Skip to content

Commit ba7a795

Browse files
authored
Update 2_gbuffers.mdx
1 parent 34227d9 commit ba7a795

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/content/docs/current/Guides/Your First Shader/2_gbuffers.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ In the previous tutorial, we had a variable called `texcoord`, which gave us the
5454
Minecraft calculates two values that represent how lit a block is: the exposure to emissive blocks (torches, lava, glowstone, etc.) and the exposure to the sky. These values are stored in `gl_MultiTexCoord1` as "lightmap coordinates", where the x channel encodes block exposure and the y channel sky exposure. The actual range of these values varies between Minecraft versions, but by multiplying it by `gl_TextureMatrix[1]` we instead get it in the approximate range [0.033, 0.97]. This still isn't very useful but we can fix this ourselves. Let's add a new line below the one assigning `lmcoord`.
5555

5656
```glsl
57-
lmcoord = (lmcoord * 33.05 / 32.0) - (1.05 / 32.0);
57+
lmcoord / (30.0 / 32.0) - (1.0 / 32.0);
5858
```
5959

6060
This now gets us the correct light level. You will notice now that if you reload the shader, lighting is now broken. We will fix this later on.

0 commit comments

Comments
 (0)