CaffeineMC / sodium

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

Terrain vertex attribute "a_LightAndData.xy" would be set to 8 instead of 0 when light level is 0. #2761

Closed Tahnass closed 1 month ago

Tahnass commented 1 month ago

Bug Description

Terrain vertex attribute "a_LightAndData.xy" would be set to 8 instead of 0 when light level is 0. This problem started to appear in version 0.6.0 beta.1 (not tested with alpha versions). It has no effect on vanilla rendering, but may cause some shaders to calculate block lighting incorrectly. 2024-09-17_12 53 36

Reproduction Steps

Launch Minecraft 1.21.1 with sodium-fabric-0.6.0-beta.2 only. Capture a frame with RenderDoc. And randomly select a triangle with no lighting. 0 1 image

Log File

No useful infromation.

Crash Report

No useful infromation.

MCRcortex commented 1 month ago

resource pack terrain shaders are not supported

jellysquid3 commented 1 month ago

Sodium clamps the light map coordinates between (0.5, 0.5) and (15.5, 15.5) in the vertex data rather than in the shader code to avoid some additional instructions. So these values are to be expected for the minimum and maximum brightness levels.

jellysquid3 commented 1 month ago

If you are authoring a shader pack with Iris and this behavior causes compatibility issues, then you should open a bug report with them. They are copying the clamping behavior, but it probably doesn't make sense for OptiFine-style shaders that expect it to work identically to Minecraft.