godot icon indicating copy to clipboard operation
godot copied to clipboard

Vulkan Clustered: Mesh wireframes are showing on material surfaces on AMD GPUs, especially on darker surfaces

Open CarlosRios opened this issue 3 years ago • 22 comments

Godot version

4 Alpha 10

System information

MacOS 12.3 Intel

Issue description

Screen Shot 2022-06-15 at 11 09 00 AM Screen Shot 2022-06-15 at 11 09 32 AM

I noticed this in 4 Alpha 9 but now in Alpha 10 it seems to be showing more. In Alpha 9 it was related to metallic surfaces and roughness, now it just seems to show in shadowed areas.

Steps to reproduce

  • Create a MeshInstance3d and give it a basic material or
  • Import a model with a metallic surface

Minimal reproduction project

No response

CarlosRios avatar Jun 15 '22 16:06 CarlosRios

The issue arises on Vulkan Clustered and not Vulkan Mobile

CarlosRios avatar Jun 15 '22 17:06 CarlosRios

I've noticed this happening in pretty much all prior alphas on the clusters that have Decals in them. That's worth looking into further.

RandomCatDude avatar Jun 16 '22 19:06 RandomCatDude

I've noticed this happening in pretty much all prior alphas on the clusters that have Decals in them. That's worth looking into further.

Which operating system and graphics card model are you using?

Calinou avatar Jun 16 '22 21:06 Calinou

I'm on MacOS 12.3

GPUs AMD Radeon Pro 555X 4GB Intel UHD Graphics 630 1536 (Integrated graphics for the Intel i7)

CarlosRios avatar Jun 16 '22 21:06 CarlosRios

Which operating system and graphics card model are you using?

Windows 7, and AMD RX 570

RandomCatDude avatar Jul 01 '22 16:07 RandomCatDude

This also happens for me on my laptop (AMD GPU), it does not happen om my pc (Nvidia gpu). Both run windows 11 so this isn't a platform specific issue. It may have something to do with the amd drivers. This only happens when using decals on or near the mesh. The car material is just metal = 0 and roughtness = 0 image

WrobotGames avatar Jul 27 '22 18:07 WrobotGames

My guess is that this is due to AMD defaulting to using coarse derivatives.

Right now Godot uses the following code to calculate derivatives: https://github.com/godotengine/godot/blob/0dcf679bdc9bde359d8fd5e486eeefc56f754ec8/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl#L850-L851

This allows the GPU driver to select whether to use coarse or fine derivatives. My guess is explicitly asking for fine derivatives would fix the issue it would be great if someone who can reproduce the problem could replace the above code with the following and test:

	vec3 vertex_ddx = dFdxFine(vertex);
	vec3 vertex_ddy = dFdyFine(vertex);

clayjohn avatar Jul 27 '22 20:07 clayjohn

Just want to add that this issue still exists in 4.0.beta3 on macOS 12.6.1 with an AMD Radeon Pro 560 graphics card when using the new forward+ renderer. Switching to the mobile renderer the polygon edge lines disappear.

Screen Shot 2022-11-04 at 10 37 45

I was planning to try and build godot with the change suggested by @clayjohn above, but I'm not familiar with the build system and after closing the repository it seems there have been other changes to the scene_forward_clustered.glsl file seems to have been moved and altered by other changes. So I would be grateful if someone more experienced tried making and building with this change. I'd be happy to test the build and see if the rendering issues are still there.

lostminds avatar Nov 04 '22 10:11 lostminds

Good news! Just tried it on the new 4.0.beta4 and the issues seems to be resolved here.

lostminds avatar Nov 04 '22 18:11 lostminds

Beta 4 looks like it fixed the issue for me as well. It does run a lot slower now however 😆

CarlosRios avatar Nov 04 '22 18:11 CarlosRios

Can anyone else please confirm that you're no longer viewing the mesh?

CarlosRios avatar Nov 04 '22 18:11 CarlosRios

It does run a lot slower now however :laughing:

If you can compile the engine from source, you could look into bisecting the regression to greatly speed up troubleshooting.

Calinou avatar Nov 04 '22 19:11 Calinou

Can anyone else please confirm that you're no longer viewing the mesh?

Its still there on my windows 11 laptop with AMD gpu (no problem on pc with nvidea). My issue is slightly different, the wireframe only shows when a decal is being projected on that mesh.

The same issue as in godot 4 alpha: https://github.com/godotengine/godot/issues/62073#issuecomment-1197225300

WrobotGames avatar Nov 04 '22 22:11 WrobotGames

Can anyone else please confirm that you're no longer viewing the mesh?

Its still there on my windows 11 laptop with AMD gpu (no problem on pc with nvidea). My issue is slightly different, the wireframe only shows when a decal is being projected on that mesh.

The same issue as in godot 4 alpha: #62073 (comment)

Can you try it with the code change I have suggested above? https://github.com/godotengine/godot/issues/62073#issuecomment-1197352018

clayjohn avatar Nov 05 '22 01:11 clayjohn

Can you try it with the code change I have suggested above?

I've tried that change and it didn't solve the issue. (The glsl file was in the /servers/rendering/renderer_rd/shaders/forward_clustered folder instead of the shaders folder. I replaced line 929 and 930)

Built from commit: https://github.com/godotengine/godot/commit/e6751549cf7247965d1744b8c464f5e901006f21 (Beta 4)

WrobotGames avatar Nov 05 '22 15:11 WrobotGames

I'm noticing a similar issue in the current stable version of 4.0. Instead of seeing my materials at all though, I see just the wireframe and the material is applied to the wireframe. This is with AMD graphics (RX 5700) on EndeavourOS (Arch-based). This is only in the editor though. At runtime, I see the meshes and their materials just fine.

DesertFroggo avatar Mar 06 '23 04:03 DesertFroggo

I'm noticing a similar issue in the current stable version of 4.0. Instead of seeing my materials at all though, I see just the wireframe and the material is applied to the wireframe. This is with AMD graphics (RX 5700) on EndeavourOS (Arch-based). This is only in the editor though. At runtime, I see the meshes and their materials just fine.

It sounds like you have wireframe debug drawing enabled. To turn it off select the "[perspective]" button in the top left corner of the 3D viewport editor and then select "debug draw normal"

clayjohn avatar Mar 06 '23 06:03 clayjohn

It sounds like you have wireframe debug drawing enabled. To turn it off select the "[perspective]" button in the top left corner of the 3D viewport editor and then select "debug draw normal"

Yeah, that was it. I was looking for something like that in the Editor Settings window but didn't think to look in the viewport. Thanks.

DesertFroggo avatar Mar 07 '23 04:03 DesertFroggo

Looks like this issue has been resolved and can be closed, or are you still seeing this @WrobotGames? Or perhaps your issue was something else related to decals?

lostminds avatar Jun 17 '23 20:06 lostminds

Looks like this issue has been resolved and can be closed, or are you still seeing this @WrobotGames? Or perhaps your issue was something else related to decals?

The issue still persists in 4.1 Beta 2. Its the same problem as I had experienced months ago (Described in the comment with the car picture). afbeelding The sphere on the left is Metallic=1, Roughness=0. The sphere on the right in this image is the default material, which also shows a bit of the wireframe.

WrobotGames avatar Jun 17 '23 21:06 WrobotGames

Hey, this still happens in Godot 4.2.1 (also happens in 4.3.dev5)

I just tested it on my steamdeck, it works there perfectly, so I assume it works on also desktop linux with an AMD gpu.

This only happens in game on both editor build or export build.

image This seems also to happen when roughness is not 0 but near it.

image

I'm using windows 11 with an AMD Ryzen 5800u APU.

Here is the GPU Driver Data

  • APU - AMD Radeon(TM) Graphics - Primary/Integrated
  • VRAM - 512 MB - LPDDR4 1333 MHz
  • Driver Version - 23.19.12-240220a-400376C-AMD-Software-Adrenalin-Edition
  • AMD Windows Driver Version - 31.0.21912.14
  • Direct3D API Version - 12.1
  • Vulkan™ API Version - 1.3.260
  • OpenCL™ API Version - 2.0
  • OpenGL® API Version - 4.6
  • Direct3D® Driver Version - 9.14.10.01526
  • Vulkan™ Driver Version - 2.0.279
  • OpenCL® Driver Version - 31.0.21912.14
  • OpenGL® Driver Version - 24.02.230729_569461f
  • 2D Driver Version - 8.1.1.1634
  • 2D Driver File Path - /REGISTRY/MACHINE/SYSTEM/CurrentControlSet/Control/Class/{4d36e968-e325-11ce-bfc1-08002be10318}/0000
  • UI Version - 2024.0220.1122.1996
  • AMD Audio Driver Version - 10.0.1.30
  • Driver Provider - Advanced Micro Devices, Inc.
  • Windows Edition - Windows 11 Core (64 bit)
  • Windows Version - 23H2

TaraSophieDev avatar Apr 08 '24 11:04 TaraSophieDev