Iris Shaders

Iris Shaders

38M Downloads

Incorrect vertex normal for terrain

GeForceLegend opened this issue ยท 0 comments

commented

What happened?

Iris is using unsigned normalized octahedron decoding for vertex normal. To get exact vertex normal for common surfaces, it needs the input be 0.0 and 0.5. But in vertex attributes, Iris is using RGBA8_SNORM and even throw values between [-1.0, 0.0) away, and 0.5 will be about 0.496 in vertex attribute. This will create obvious artifact in some situation, like this image using ComplementaryReimagined_r5.2.2, because of the incorrect normal, left part is reflecting things under water:

Image

As Iris is using RGBA8_SNORM as vertex attribute format, why not just using the full [-1.0, 1.0] range, and removing * 2.0 + 1.0 in the beginning of octahedron decoding code? RGBA8_SNORM can get 0.0 correctly (works same as 0.5 in current solution), which means we will get exact normal data on common surfaces.

Screenshots

No response

Log output

No response

Minecraft Version

Minecraft 1.21.3

Iris Version

iris-fabric-1.8.1+mc1.21.3.jar

Operating System

Windows 10

What is your GPU?

NVIDIA GeForce RTX 4070

Additional context

No response