-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Lighting issue on last face of ArrayMesh #52399
Comments
This is likely a regression from octahedral compression or the vertex attribute split. |
Tested it on Windows myself now - same issue there. So this might be driver or graphics card related, which is weird because it does work in 3.3. Let's see if others get the same issue. |
I can reproduce the issue on Linux with both Intel HD 630 and AMD Radeon RX Vega M, both using Mesa 21.2.2. The bug is a bit weird when checking different versions though: |
@akien-mga The first minimal project I posted should be more accurate, as the other might contain differences in the way array meshes are imported/exported. I experienced the same issues with the other minimal project as you. |
Thanks, I can indeed reproduce the issue too with this project. Note: It's easiest to see by making the generation script I confirm that the bug is caused by octahedral compression added in #46800, CC @The-O-King @clayjohn. I worked it around with those flags: var path := MeshInstance.new()
path.mesh = st.commit(null, Mesh.ARRAY_COMPRESS_DEFAULT & ~Mesh.ARRAY_FLAG_USE_OCTAHEDRAL_COMPRESSION)
add_child(path) |
I'm afraid I won't be of much help, I can't reproduce on any of my devices. For interested contributors, the first step will be to run this scene through a frame debugging program like RenderDoc. Then you should inspect the drawcall that draws the mesh and then navigate to "Pipeline State" and finally "Vertex Input" from here you can inspect the values that are sent for each vertex and get an idea if the issue is related to the value going in to the draw call or if the issue is in the shader itself. |
I will try to investigate this on the devices that I have and see if I can reproduce it and find out what exactly is causing this from the octahedral compression side In the meantime I have updated #48625 which provides the option to enable/disable octahedral compression (among other compression options) at import time, which should allow you to get around this issue as @akien-mga has noted |
Ok so I was able to reproduce this on one of my computers and was able to get a fix in! I tested it locally and things seem to work, if others want to give it a go to confirm that would be great :) #54768 The issue stemmed from the way I was binding vertex attributes from the buffer to the shader - I was always specifying the vertex attribute as a vec4 and using offsets to specify where in the vertex buffer the data would come from, regardless of whether we actually had 4 components of data (this is specific to octahedral normal/tangents) But now we specify 2 or 4 components depending on what data is present in the buffer |
Fixed by #54768. |
Godot version
3.4.beta4.official
System information
Linux Mint 20.1 Cinnamon, GLES3, GLES2, NVIDIA GeForce GTX1060 6GB (470.63.01-0ubuntu0.20.04.1)
Issue description
In the attached project, I generated a mesh along a Curve3D. On the last surface (as seen on the screenshot below) the lighting seems to be slightly glitched. Removing the affected inner wall section will result in the glitch being present on the top surface instead, which is why I believe that this affects the last surface of the mesh.
Same Project in Godot 3.3.stable.official:
Steps to reproduce
Run the project, it has a controllable camera with controls as seen in Blender. (Middle Mouse Button to rotate around the camera origin, Shift + Middle Mouse Button to move the cameras origin)
On the last surface, as seen on the screenshots, the lighting issue should be visible.
Minimal reproduction project
issue.zip
Edit: The project below contains just the ArrayMesh exported from the generated one above with a camera facing the affected face directly.
LightIssue.zip
The text was updated successfully, but these errors were encountered: