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

Black lines flickering on mesh surface during movement #25303

Open
anantn opened this issue Jan 25, 2019 · 16 comments
Open

Black lines flickering on mesh surface during movement #25303

anantn opened this issue Jan 25, 2019 · 16 comments

Comments

@anantn
Copy link

anantn commented Jan 25, 2019

Godot version:

3.0.5

OS/device including version:

Mac OS X 10.14.2
Radeon Pro Vega 20 4080 MB

Issue description:

When composing a scene in GDScript by placing meshes aligned with each other, black lines appear on the surface of these meshes when under a DirectionalLight. These lines always appear on the surface of the mesh that faces the directional light, and are always horizontal (x-axis, never on the y or z axes).

Here are some screenshots of the lines:

image
image
image

Link to video with the problem

Steps to reproduce:

Open minimal reproduction project and play to reproduce.

Or in your own project, place simple cube meshes through GDScript, a DirectionalLight facing the top, and move a camera affixed to a KinematicBody on the surface.

Minimal reproduction project:
flicker.zip

@anantn
Copy link
Author

anantn commented Jan 25, 2019

FWIW: this does not occur when using the built-in meshes in Godot, only when importing a cube mesh from Blender. I've tried all formats (.dae, .glx, .obj) which all give the same flickering effect. Unfortunately, can't use the built-in mesh for this project since it does not have 6 surfaces to paint material on.

@anantn
Copy link
Author

anantn commented Jan 30, 2019

Thanks to Alastor001 on Reddit, I tried this sample project in the master build of Godot and can confirm that the issue does not occur on v3.1.beta.

@bojidar-bg
Copy link
Contributor

Closing as fixed then. If someone manages to reproduce the original issue, this issue might be reopened.

@anantn
Copy link
Author

anantn commented Feb 5, 2019

I spoke too soon, the issue is still prevalant on 3.1beta3 or master builds, just appearing at the different positions and offsets :( @bojidar-bg Repro is the same as before, can we re-open?

@bojidar-bg
Copy link
Contributor

Reopening as per the comment above.

@bojidar-bg bojidar-bg reopened this Feb 5, 2019
@kaadmy
Copy link
Contributor

kaadmy commented Feb 25, 2019

This seems to be due to floating point inaccuracies from the imported mesh, try disabling compression in the mesh import options.

You can also snap the mesh to grid in Blender after selecting the entire mesh and zooming in so the grid is the level you want to snap to:

  • Shift+S -> selection to grid
  • Space -> type "selection to grid"

@Calinou
Copy link
Member

Calinou commented Feb 21, 2020

@anantn Does following @kaadmy's advice solve the issue?

@anantn
Copy link
Author

anantn commented Mar 7, 2020

@kaadmy @Calinou Thanks for the tip! Unfortunately, it doesn't seem to help. I am using "OBJ As Mesh" in the Import As dialog and there is no disable compression option, am I missing something?

I also tried snapping the mesh to grid but the line artifacts still appear. This continues to happen on the latest version (3.1.2.stable)

@anantn
Copy link
Author

anantn commented Mar 8, 2020

It seems this occurs even when not using an import from Blender. I tried using a simple cube ArrayMesh with the same results.

@clutteroth
Copy link

clutteroth commented Mar 15, 2021

Hi there! I am experiencing the same issue in Godot 3.2.3.stable.mono.official running on a 64-bit Win10 Home PC with NVidia GeForce RTX 2080Ti. Lines flicker in a tiled mesh surface, see light grey horizontal lines on the road in the attached screenshot. As anantn reports, this happens only when using a directional light.
flickering_lines

@Calinou
Copy link
Member

Calinou commented Mar 15, 2021

As anantn reports, this happens only when using a directional light.

Does the DirectionalLight have shadows enabled? Does rotating the DirectionalLight improve the situation?

Also, I wonder if this is due to linear shadow filtering being used in GLES3. If you can't reproduce this when using the GLES2 renderer, then that must be the cause of the issue. Also, this issue is also unrelated to OP's, which is caused by a different problem.

@clutteroth
Copy link

clutteroth commented Mar 16, 2021

The DirectionalLight has shadows disabled. Enabling shadows does not fix it. I have tried a few different rotations but that doesn't fix it, either. Also, after switching from GLES3 to GLES2 the problem still persists.

Would posting a test scene demonstrating the problem help?

@Calinou
Copy link
Member

Calinou commented Mar 16, 2021

Would posting a test scene demonstrating the problem help?

Yes, as always 🙂

@clutteroth
Copy link

Ok, here a test project illustrating the problem. It looks as if a grey vertical line appears not only with a DirectionalLight but also with an OmniLight -- see Test scene.
glitch.zip

@mamadreflex
Copy link

mamadreflex commented Apr 17, 2021

hello. same problem here in godot 3.2.3 mono.

I have this problem with gridmap and kenny pack. doesn't show any flicker in editor but in game when moving gray lines happen some times. i test different ways (light,shadow,GLES2, etc) but seems its imported mesh problem they don't stick together well. when i test it with built-in mesh there isn't problem.

i test gridmap and normal mesh both act same. again seems imported obj problem. seems they width is float 0.9999 for example.

@starwolfy
Copy link

I have experienced this issue too.
I have resolved this by slightly rotating my meshes in Blender by a few fractions of degrees and re-exporting them to Godot.
It takes a lot of decimal tweaking, re-exporting, and checking if the black lines are (almost) gone.

However, the graphical glitches are still visible in my game after having applied this solution, but they are no longer noticeable to the untrained eye.

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

8 participants