mojira.dev
MC-38022

Order of rendering translucent block faces fails to update with camera position

The bug

Various visual artifacts appear on translucent blocks after movement, because whatever handles sorting translucency layers does not update as you move around.

How to reproduce

  1. Create a superflat world with preset:

    minecraft:bedrock,minecraft:green_stained_glass,minecraft:red_stained_glass,minecraft:blue_stained_glass;minecraft:the_void
  2. Fly up ~10 blocks (doesn't matter much)

  3. Use this command:

    /tp @p 100 ~ 100 135 45
  4. Press F3 + T (then wait for chunks to load)

  5. Use this command:

    /tp @p 0 ~ 0 -45 45

    → ❌ You will notice you cannot see the green and red glass in multiple chunks

[media]

Expected behaviour

The block faces would be sorted on each frame, so that they always render in the correct order.

Analysis

@unknown has done a good analysis in this comment.
@unknown has done a good analysis in this comment.

Related issues

MC-130195 Weird rendering of ice MC-38842 Ice turns to Water MC-39233 Shadow and Ice bugs MC-50406 Ice in large quantities renders badly from distance. MC-62421 Ice looks strange from different angles MC-81195 Slime Block Lighting Bug MC-97730 Boat Ice Viewing Glitch MC-104274 Ice rendering Glitch MC-105623 Can See Through Ice At Chunk Borders MC-115787 Large sheets of ice render strangely when flying over them MC-126055 ice blocks render glitch MC-126576 Ice on Frozen Ocean loads oddly MC-127299 Ice side texture glitch MC-127570 Weird texture bug with ice. MC-134740 Graphic glitch with ice on 1.13 (full-release) MC-137243 Frost walker boots revealing water underneath ice MC-148446 ice rendering glitch MC-149667 ice turns invisable MC-151180 glacier chunks render weird MC-153003 Ice rendering isusues MC-156238 Ice renders weirdly from a distance MC-161116 Ice Blocks Render Incorrectly MC-161241 Rarely, when Ice is viewed from a certain angle with water beneath it, it creates a gridlike pattern MC-162672 Subtle light-grey/see-through squares appearing on ice MC-179562 Stained glass and water visual glitch MC-181090 Blue glass placed one block above oceon/sea level causes it to sometimes go invisable MC-185536 Glass Blocks partially de-load when flying/moving around if the blocks are next to Water MC-236819 Ice Makes Boarders Along the Chunk Boarder MC-239011 Ice rendering issues MC-239376 Transparent Ice Blocks rendering MC-239997 Wall of stained glass with water behind it causes a visual bug/glitch MC-241794 Ice grid render bug MC-242025 Glass doesn't render properly behind other layers of glass MC-242393 渲染错误 MC-242394 Render bug MC-260342 Ice from far away renders more transparently MC-275667 Frozen river ice being wrongly rendered

Attachments

Comments

migrated
[media][media][media][media][media][media][media][media][media][media][media][media][media][media][media][media][media][media][media][media][media][media][media][media][media][media][media][media][media][media][media][media][media][media][media]
migrated

Duplicated by MC-38842

Happened to me in 14w19a with an Intel HD 4000, mipmapping or anisotropic filtering turned off.

How to reproduce

  • Create New World

  • Select "Customized" World type

  • Choose "FrozenOcean" biome

Attached crash report.

kumasasa

Reopened, not a duplicate of MC-35881

kumasasa

@@unknown: You can probably update to OX X 10.9.x for free https://itunes.apple.com/us/app/os-x-mavericks/id675248567?mt=12

migrated

Same result with another computer using an Intel HD 5000 and running OS X 10.9.2.

@Kumasasa This OS X version is too unstable on my computer 🙂

kumasasa

WTF ? Unstable software made by Apple ? Impossible.... 😉

@all: Anyone having this issue: Please force a crash by pressing F3 + C for 10 seconds while in-game and attach the crash report ([minecraft/crash-reports/crash-<DATE>-client.txt|http://hopper.minecraft.net/help/finding-minecraft-data-folder]) here.

migrated

@Kumsasa Hehe, yet I couldn't shut down it without pressing power button, or the computer turned off itself after 5 minutes, etc. 😞

migrated

Confirmed for 14w25b.

migrated

Confirmed for 14w27b, on Windows 7 64-bit with latest Java 1.8 and Nvidia GTX 670.

The graphical bug seems to occur largely independent of video settings. I have toggled all video settings and the only setting where I was unable to reproduce the bug was with a Render Distance of 2 chunks. With any Render Distance higher than 2 chunks and any other (combination of) video settings I was able to reproduce the graphical glitch.

The only way the glitch disappears is when the rendering resets (for instance when changing certain video settings) or when the player gets closer to the ice.

migrated

Confirmed for 1.8pre2 with a GTX 750 Ti

migrated

Confirmed for 1.8.1

Artimipa

Confirmed for 1.8.3, on Windows 8.1 64-bit with latest Java 1.8 and Nvidia GeForce GT 640M.

migrated

Confirmed for 15w45a

migrated

Can't reproduce in 15w46a. Is this fixed?

migrated

Was able to reproduce this in 15w46a, so this is not fixed.

migrated

Indeed, not fixed. Create a superflat world with this preset and fly around a bit: 3;minecraft:bedrock,20*minecraft:water,minecraft:ice

migrated

Confirmed for 15w47a and 15w47c

migrated

Confirmed for 15w51b

migrated

Confirmed for 1.9-pre1 and 1.9-pre2

migrated

I believe this might have to do with the block transparency.

migrated

Is this still an issue in the latest snapshot 16w44a? If so please update the affected versions.

This is an automated comment on any open or reopened issue with out-of-date affected versions.

migrated

Confirmed for 1.11

jamesmoton

Confirmed for 18w08a and is way more prevalent now.

migrated

This bug sadly ruins the new Frozen Ocean biome. Added some pics from 18w08b

migrated

Confirmed in 18w09a

migrated

Confirmed in 18w11a

muzikbike

Affects 18w15a

muzikbike

Affects 18w20c

migrated

Confirmed for 18w22c

muzikbike

Affects 1.13-pre1

_zombiehunter

1.13-pre3

muzikbike

Affects 1.13-pre4

migrated

Confirmed for 1.13-pre5 with slimeblocks

ZeNico13

Also affects 1.13-pre6

[media]

ZeNico13

Affects 1.13-pre8

[media]

[media]

ZeNico13

Affects 1.13-pre9

[media]

ZeNico13

Affects 1.13-pre10

ZeNico13

Confirmed for 1.13-release!

ZeNico13

Still in 18w30b

ZeNico13

Still in 18w31a

ZeNico13

Still in 18w32a

ZeNico13

Still in 18w33a

ZeNico13

Still in 1.13.1-pre1

migrated

this happens at chunk borders for me in 1.13

[media]
ZeNico13

Still in 1.13.1 release

ZeNico13

Still in 1.13.2-pre1

ZeNico13

Still in 1.13.2-pre2

ZeNico13

Still in 18w43b

migrated

Still in 18w50a

ZeNico13

Still in 19w06a despite the fact that the rendering engine has changed.

[media]

ZeNico13

Still in 19w07a

ZeNico13

Still in 19w08a

ZeNico13

Still in 19w09a

ZeNico13

Still in 19w11a

ZeNico13

Still in 19w11b

ZeNico13

Still in 19w12b

[Mod] Neko

Gave the report to @unknown since the original reporter is inactive.

migrated

I can't reproduce the ice glitch in 19w40a.

I think it might've been fixed by the new rendering engine.

violine1101

I don't think this can be marked as fixed just yet, the latest snapshot has major issues with mipmaps, causing a moire effect to appear on ice. This issue didn't seem to appear with mipmaps disabled in 1.14.4 either, so we can't be sure it's been fixed just yet.

ZeNico13

No, this bug is still effective despite the new rendering engine!

[media]
migrated

Confirmed in 19w45b

migrated

Confirmed in 20w06a

migrated

Confirmed in 20w07a

migrated

I just made a post about this not realizing that it was already reported here. This is such a huge graphical bug that has been present for so long and I don't know why it hasn't been fixed yet. I really hope Mojang Studios can fix this in the next version of the game. 

migrated

Confirmed in Pre-Release 2 for 1.16

migrated

this is an really old bug...I hope mojang can fix this because it last for years so it should be considered to fix in higher priority

SunCat

It already has "Important" priority. On the other hand, the fact that it's an old bug doesn't make it automatically important, the severity of the issue and how much it affects gameplay / players does

migrated

Yes, but it's had "Important" Priority since February, and the bug has existed for 7 years. That's too long for any bug to exist in this game. And I would say that it affects the severity of the gameplay greatly, seeing as literally any water build mixed with glass looks terrible when close to it. It would be 1 thing if this glitch didn't load the glass from barely out of chunk distance, but it can happen as close as 2 chunks away. 

migrated

Can confirm in 1.17-pre1.

ampolive

Can confirm in 1.17.1.

ampolive

Can confirm in 21w39a.

ampolive

Can confirm in 21w40a.

migrated

Can confirm in 21w41a.

Ceresjanin123

Can confirm in 21w42a. Also this appears to be related to chunk borders. As you can see in this screenshot these square patterns align perfectly with chunk borders

[media]
ampolive

Can confirm in 1.18 Pre-release 1.

ampolive

Can confirm in 1.18 Pre-release 4.

migrated

Confirmed in 1.18 Release Candidate 1.

Avoma

Can confirm in 1.18.

migrated

Can confirm in 1.18.1.

migrated

I can confirm in 1.18.2

(seems to be happening extremely frequently for me)

pulpetti

In 1.19 Pre-2.

Avoma

This also affects stained glass. It would probably be worth updating this ticket to mention this to potentially prevent further duplicate reports in the future.

Avoma

Can confirm in 1.19.1.

migrated

can confirm 1.19.1

migrated

Can confirm in 1.20.2

Ceresjanin123

There is a lot of issues with this issue 😉
Some are due to people confusing this bug with MC-9553. For example the "render like water" part from the title was caused in part by MC-9553 and hasn't been reproducible since it's been fixed. It's also specific to the ice + water setup, and isn't representative of the bug. The title also suggests "elevation and angle" has something to do with this but it doesn't, it happens at any angle. You can check that by pressing F3 + T and the bug will go away until you start moving again. Also the bug desc is really meagre, there's a lot more information that's missing.

I request the following be done:
1. Attachments 2015-06-09_15.51.45.png 2018-08-21_12.50.01.png Screenshot-Slime-Light-Bad.png are showing MC-9553 and not relevant and should be removed
2. Attachments crash-2014-05-13_10.54.01-client.txt crash-2014-07-02_19.22.27-client.txt 2014-05-13_11.03.30.png are not relevant and should be removed
2.5 All other attachments could be removed tbh since they're redundant. But idk your policy on that.
3. Update the title to "Order of rendering translucent block faces fails to update with camera position"
4. Update the description:

The Bug:

Various visual artifacts appear on translucent blocks after movement, because whatever handles sorting translucency layers does not update as you move around.

How to reproduce:

1. Create a superflat world with preset

minecraft:bedrock,minecraft:green_stained_glass,minecraft:red_stained_glass,minecraft:blue_stained_glass;minecraft:the_void

2. Fly up ~10 blocks (doesn't matter much)

3. Use command /tp @p 100 ~ 100 135 45
4. Press F3 + T (then wait for chunks to load)
5. Use command /tp @p 0 ~ 0 -45 45
6. You will notice you cannot see the green and red glass in multiple chunks

[media]

Analysis:

There's probably some kind of mechanism that calculates which translucent block faces are closest to the camera, and then sorts them into the correct rendering order, so that blocks render in front of each other as would be expected. However this ordering task seems to only run sporadically (once when a chunk loads, and again if you're close enough to the chunk). This obviously leads to issues where after your position changes blocks are "in front" of blocks that are now in front of them.

As of reproduction step 4 the top face of a red glass block is in front of (closer to the camera) two side faces of the blue glass block above it.
As we teleport behind it the order should switch (the top face of the red glass block is now behind those two blue faces) however the rendering thingy doesn't realize this and still thinks the top face of the red glass is in front of the two blue faces. Because of this mismatch the red glass block doesn't render properly behind those two block faces.

[media]

[media]

Note: The "two faces" I'm talking about are invisible because the block faces are culled when two of the same translucent block are next to each other. However you can see it's indeed the side faces trying to render behind the red glass, by making a hole in the glass thus making them visible.

[media]

Corroborating evidence:

What I just described with the glass world is also what's going on with the ice (the water is ordered "in front" of the two inside faces of ice, while it's actually behind them) and before the fix to MC-9553 was implemented the water would actually follow this incorrect order and render in front of the ice.

And indeed if we load up our glass world before MC-9553 was fixed and repeat the steps we'll notice the red glass blocks are actually rendering in front of the blue glass (and the green renders in front of both). This confirms my analysis I think

[media]

However after that fix, when such mismatch occurs the pixels that are incorrectly "in front" of something don't render at all which is why it looks different now. However it's still the same issue!

Expected behaviour

The block faces would be sorted on each frame, so that they always render in the correct order.

migrated

Can confirm 1.20.4, singleplayer default world, probably outside of simulation distance

[media]
ZeNico13

Many thanks to @unknown for his very detailed comment!

douira

Hi, I'd like to give an explanation for why this is happening, what possible solutions are, and why this is a hard problem in general. I just finished writing my Master's thesis about solving translucency sorting in Minecraft, with the implementation having been done in Sodium. My last year was spent trying to solve this problem efficiently, with the result being a sophisticated approach that solves it correctly and with low overhead by replacing quad distance sorting with different sorting techniques. The problem is, that if you dig into the how the geometry behaves, it quickly becomes either a graph or a spatial partitioning problem. Even accepting that sorting quads by distance does not always yield a correct result, it's not clear exactly when quad distance sorting needs to be performed.

Looking at the code, Minecraft checks if sorting needs to be performed every time the camera movement is more than 1 block away from the last time sorting was performed. Then, it iterates through all visible sections and sorts at most 15 of them per frame. It selects either any section if the camera has just crossed a chunk boundary, or specifically sections that are axis aligned with the camera ("axis-sharing"), where at least one axis of the section's coordinates is the same as the camera's section coordinates. Intuitively, this makes sense, since as you move the camera the ordering becomes wrong and needs to be re-done. As most geometry is axis aligned, performing sorting preferentially on axis-sharing sections is an okay approximation.

The bug in this report happens when the camera gets into a position where the sort order of a section is invalid but isn't updated since either the camera has not moved enough to trigger sorting or the sorting budget was prematurely exhausted. Teleporting means the camera registers a movement, but then resets the "last sort position" to the current position without having sorted all sections with invalidated sort orders. If it moves a little, unless it moves across a section border, only axis-sharing sections will be sorted, which doesn't resolve the visual glitch. Additionally, if the camera moves in a specific way near sensitive sections, the allowance of 15 sections getting sorted per frame could get repeatedly exhausted, thus starving certain sections of sorting altogether. Layered water and glass or different types of stained glass showcase the problem very easily, because the camera only needs to move a relatively small angle relative to the section before artifacts become visible. This angle depends on the geometry and the perspective on the section.

A simple fix might be to sort sections even when the camera has not moved and to prioritize which sections get sorted based on how long ago they were sorted, or based on the position the camera was at when the section was last sorted. The problem remains that sorting sections by distance is expensive, especially when it needs to happen very frequently to mitigate bugs like this one. There's a lot of optimizations and different approaches that can be applied to Minecraft's surprisingly tractable translucency sorting problem, albeit with the introduction of significant complexity as I showed in my work.

I hope this helps, I'm happy to answer any more questions about the translucency sorting problem should they arise.

migrated

@douira This is unrelated to this bug, however i need answers from you regarding a bug you mentioned you used to encounter or maybe still do, specifically bug MC155104. I am getting this consistently on 1.21. Did you ever find a fix for this? Please get back to me as soon as you can.

ZeNico13

(Unassigned)

Confirmed

Platform

Important

Rendering, Textures and models

honey_block, ice, rendering, slime_block, stripes

Minecraft 1.7.2, Minecraft 14w25b, Minecraft 14w27b, Minecraft 14w29b, Minecraft 1.8-pre2, ..., 1.20.5 Pre-Release 1, 1.20.6, 1.21, 1.21.1, 24w33a

24w36a

Retrieved