sp614x / optifine

1.81k stars 416 forks source link

Normal map rotation wrong for rotated blocks #1857

Open eproxus opened 6 years ago

eproxus commented 6 years ago

I'm creating normal maps for a texture pack and I can't seem to get the rotation right. The normals look okay when the block is in a certain angle, but for other angles the normal map rotation seems wrong and shadows end up in the wrong places:

2018-10-03_12 43 29

The example has a normal map for the top of the cobblestone stairs. For the two blocks in the foreground, the rotation is correct in the further block, but for the closer block rotated 180 degrees the normal map also seems rotated 180 degrees.

This is the normal map I'm using: cobblestone_stairs_top_n

Is OptiFine supposed to rotate the normal maps or is the shader pack that has that responsibility?

Seen on 1.12.2 HD U E2 and confirmed still existing in OptiFine 1.13.1 HD U E3 pre4.

eproxus commented 6 years ago

Here's a better view of the problem:

The highlights should all be on the left side (since that's where the sun comes from, but they're rotated with the block instead).

sp614x commented 6 years ago

The normal map texture is rotated together with the main texture, this is done by OptiFine. The lighting calculations are done by the shader. Here is a simple shader pack which shows the normal map textures instead of the main textures: TestNormals.zip

eproxus commented 6 years ago

@sp614x So, let me see if I understand this correctly: The shader pack gets the normal map and the rotation of the block, and has to calculate the right angle for lighting?