-
-
Notifications
You must be signed in to change notification settings - Fork 21k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flip H and Flip V normalmap problem on sprite with nvidia flicker workaround #40905
Comments
Related to #39851. I'll have to see if I can work out why it even works at all with the uniform draw path in GLES3. If you flip the normal map, although the texels get flipped to match the color, the normal directions don't get flipped. So the right side of a sphere when flipped to the left will still point to the right (which is the 'erroneous' behaviour). It needs an intervention to also flip the normal orientations, which is a more tricky problem:
Edit: Yes it looks like the shader is setting |
It turns out this is a pretty pervasive problem. It will affect the nvidia workaround on GLES2 as well, as well as having implications for normal mapping with batching. The Given that we are moving over towards batching as primary method and the flipping is incompatible with nvidia_workarounds, I'm now tending to think we should add an extra 2 Vector2s into the vertex format in cases of normal mapping in order to transfer the normal map rotation necessary for lighting. Actually we may be able to do this in a compact form. Strictly speaking we only need an angle for an UP vector (which can derived by sin and cos) and a polarity for the horizontal flipping (which could be the sign of this angle, except in the case of zero, but that is workaroundable). I'll have to discuss this with @clayjohn. EDIT - I now have a tentative solution to this adding a new LIGHT_ANGLE vertex attribute, a bit more work before I make a WIP PR. I'll maybe fix this first for GLES3 then GLES2 nvidia workaround and the batching. 👍 |
This is probably not so relevant anymore now that 2D batching is implemented? |
Yes the normal mapping uses LIGHT_ANGLES to work correctly with batching. The problem probably still exists with the legacy renderer with nvidia workaround, but not many people are using that now I expect. |
I think we can close as no longer an issue. |
Godot version:
v3.2.2.stable.official
OS/device including version:
OpenGL ES 3.0
Renderer: GeForce RTX 2080/PCIe/SSE2
Driver Version: 446.14
Issue description:
When using the option 2d/use_nvidia_rect_flicker_workaround in the "Quality" project settings, the normal maps of a sprite will not render correctly when using flip_h or flip_v - the normal map is flipped with the sprite.
Here is a short gif illustrating the issue
Steps to reproduce:
Minimal reproduction project:
nvidia-flicker-normalmap-flip_h-problem.zip
The text was updated successfully, but these errors were encountered: