Skip to content
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

Flat normals can turn smooth in the distance due to automatic mesh LOD #70603

Open
Tracked by #57416
SmartySmart702 opened this issue Dec 26, 2022 · 4 comments
Open
Tracked by #57416

Comments

@SmartySmart702
Copy link

SmartySmart702 commented Dec 26, 2022

Godot version

4.0 Beta 10

System information

GTX 1070, forward_plus, mobile, gl_compatibility

Issue description

specular reflection fickering (see video)

https://youtu.be/yaEG7Lg1Luk

Steps to reproduce

Simple scene with a point light and cubes (arranged in a grid for better visibility of the issue) with a dark material (roughness ~0.3).
Cube is default Blender cube with bevel modifier, flat shading.

Minimal reproduction project

shading_flickering.zip

@SmartySmart702
Copy link
Author

Oh I forgot to mention that this only happens for cubes with round corners but not for normal cubes.

@Calinou
Copy link
Member

Calinou commented Dec 27, 2022

I can confirm this on 4.0.beta b6e0603 (Linux, AMD Radeon RX 6900 XT with Mesa RADV).

This is a mesh LOD issue, as disabling mesh LOD generation on the glTF file in the Import dock, clicking Reimport then reassocaiating mesh resources in every MeshInstance3D node to point to the cube.res file rather than making it built-in.

Fixed MRP: shading_flickering_fixed.zip

You can also use the Debug Advanced > Disable Mesh LOD debug draw mode in the Perspective menu to preview what it looks like once it's fixed.

Normals look flat until the specular reflection changes:

image

Then, when moving past the threshold of the first LOD, normals look smooth:

image

This is expected from a performance standpoint, as smooth-shaded meshes require fewer vertices than flat-shaded meshes and are therefore faster to render. I'm not sure if we can do anything about this, other than warning in the documentation that some "corner case" meshes may require disabling LOD generation on import to look good in the distance.

@Calinou Calinou changed the title Specular light reflection flickering issue Flat normals can turn smooth in the distance due to automatic mesh LOD Dec 27, 2022
@Calinou Calinou changed the title Flat normals can turn smooth in the distance due to automatic mesh LOD Flat normals can turn smooth in the distance due to automatic mesh LOD Dec 27, 2022
@SmartySmart702
Copy link
Author

Hmm for me it looks like a normal issue (related to auto lod) but idk.
I also tried a smooth shaded cube with round corners:
ghg34gfh

@Calinou
Copy link
Member

Calinou commented Dec 27, 2022

Hmm for me it looks like a normal issue (related to auto lod) but idk.
I also tried a smooth shaded cube with round corners:

This occurs because the mesh is too simplified in the distance for normals to be accurately represented. The issue is generally not noticeable with diffuse lighting, but intense specular lighting like in your example can make it noticeable.

@clayjohn clayjohn modified the milestones: 4.0, 4.x Feb 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants