CaffeineMC / sodium

A Minecraft mod designed to improve frame rates and reduce micro-stutter
Other
4.77k stars 810 forks source link

Translucent block models that extend past 1x1x1 may not render correctly #2802

Open Altirix opened 2 weeks ago

Altirix commented 2 weeks ago

Bug Description

This is also a bug within vanilla. In one case however sodium is producing the right result.

There seem to be two categories of this bug.

Reproduction Steps

testpack.zip

Test Scene Sodium 0.6b2 Vanilla
3x3x3 translucent intersecting with water 2024-10-06_10 43 07 2024-10-06_10 44 29
3x3x3 translucent intersecting multiple 2024-10-06_10 43 57 N/A
3x3x3 translucent intersecting neigbour chunk 2024-10-06_10 45 50 2024-10-06_10 45 52 2024-10-06_10 44 48 2024-10-06_10 44 49

Log File

N/A

Crash Report

N/A

douira commented 2 weeks ago

Even regular block-sized 1x1x1 models that intersect the water surface or have internal intersections are rendered wrongly. This is because order-based translucency sorting of quads that intersect is fundamentally impossible without splitting the quads into pieces along their intersection planes. Such splitting requires a bunch of math to figure out the pieces, and then writing more quads with some interpolated vertexes. I think it's possible but requires a significant conceptualization and engineering effort. The case where geometry is wrongly sorted if it extends outside of the section would be fixed by splitting quads along the section's boundaries and rendering the quads that are then outside of the section as part of the neighboring sections. (this is another layer of complication)

btw I think one of your last screenshots got put into the wrong column.

Altirix commented 2 weeks ago

Even regular block-sized 1x1x1 models that intersect the water surface or have internal intersections are rendered wrongly. This is because order-based translucency sorting of quads that intersect is fundamentally impossible without splitting the quads into pieces along their intersection planes. Such splitting requires a bunch of math to figure out the pieces, and then writing more quads with some interpolated vertexes. I think it's possible but requires a significant conceptualization and engineering effort.

btw I think one of your last screenshots got put into the wrong column.

fixed the last screenshot, they render identical. but yeah, i wouldnt be expecting it to be fix as it doesnt sound like its worth the engineering effort especially given this is just a test model and im not sure if anyone is running into this in real resource packs.

muzikbike commented 3 days ago

Is there a vanilla report for this?

szernex commented 5 hours ago

I'm experiencing similar or potentially the same issue? I can't quite tell but this is what water looks like when looking at it at specific angles. This is in 1.20.1 with version 0.5.11 of Sodium. image image

Edit: Also happens with connected textures for transparent blocks, like ConnectedGlass. Seems to happen right at the transition of chunks: image

Altirix commented 4 hours ago

@szernex thats just #38 fixed in 0.6 betas

Is there a vanilla report for this?

have not checked