-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
Strange lights show on ShaderMaterial in 4.2 #84089
Comments
This issue appears to be something to do with the way meshes are handled in 4.2. If I replace the imported mesh with a built in |
I can repro the visual issues on current master at 3f04595. Seems like selecting The flickering visuals seem to be caused by the Glow effect, adding a WorldEnvironment node to the scene and disabling its Glow seems to also remove (or hide) these visual issues. However, the root cause is still possibly caused by the mesh data (bad normals or tangents?), this might need some more investigation. CC @clayjohn |
Looks like an issue with UVs. I don't see how normals or tangents would change this behaviour. It could be that the UV is flooring to 0 (because it's using 16 bit precision when compressed) and that is causing issue with the call to pow(). I can take a deeper look when I am in front of a computer |
If it helps, I've attached the blend file this cylinder came from. I exported to Godot as OBJ with 'export materials' unchecked and every other setting left default. |
Okay, testing locally it looks like Changing the pow line to Looking at the generated UVs, this indeed comes from our UV compression scheme. Basically the way UV compression works is we determine the absolute range (i.e. the furthest we get away from 0) and use that to scale the UVs. In this case since the UVs are all in the 0-1 range, we get an absolute range of one. So we scale the UVs by doing UV / 2 + 0.5 (this way anything within -1 - 1 is brought within the 0-1 range). Since 16 bit unorms can't store 0.5 exactly, 0.0 ends up becoming 0.49999 which ends up as -0.0002 in the fragment shader. Taking the For now, you have two solutions:
I'll also investigate if I can improve this on the engine side. It would be nice to guarantee that positive numbers stay positive with the compression scheme. |
Godot version
v4.2.beta3.official
System information
Windows 11, Forward+, geforce 3070TI
Issue description
An imported cylinder mesh with
ShaderMaterial
applied has a strange lights show appearing above it when I move rotate the viewport in the 4.2b3. An identical project in 4.1 does not exhibit this behaviour.Here's a video showing the behaviour in 4.1 then the behaviour in an identical 4.2 project:
2023-10-28.11-02-35.mp4
Steps to reproduce
Import a cylinder OBJ and drag it into the scene. Add a surface material override
ShaderMaterial
with the following shader:Move the camera around in the editor.
Minimal reproduction project
The zip contains a 4.1 project and an identical 4.2 project.
vfx41-42.zip
The text was updated successfully, but these errors were encountered: