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

Vulkan: Decal 'Normal Fade' feature appears incorrect on scaled meshes #56590

Open
Tracked by #57284
RandomCatDude opened this issue Jan 7, 2022 · 3 comments · May be fixed by #58153
Open
Tracked by #57284

Vulkan: Decal 'Normal Fade' feature appears incorrect on scaled meshes #56590

RandomCatDude opened this issue Jan 7, 2022 · 3 comments · May be fixed by #58153

Comments

@RandomCatDude
Copy link
Contributor

Godot version

v4.0.dev.20211210.official [21b8199]

System information

Windows 7, Vulkan Clustered, RX 570 (21.5.1)

Issue description

When a mesh is scaled either with its own Scale transform or the Scale of any parent nodes, the Normal Fade feature of Decals applied to it will misbehave.

The Decal's normal fading appears inconsistent and buggy.
When the mesh node's scale is even (all fields have the same value), there is a visible pattern: When the mesh is scaled up, the Decal appears too opaque. And vice versa for meshes that are scaled down, the Decal appears too transparent. Otherwise, there isn't any pattern I can discern.

The Decal's place in the scene tree does not matter, including its own scale.

image
Three unshaded SphereMeshes, identical aside from their Scale. All of these Decals have their Normal Fade set to 0.5. Their Vertical Fade was also lowered to 0, to not interfere with the test.

I expect that all the Decals appear just like the middle one, fading the exact same amount based on the normal.

Steps to reproduce

  1. Create a MeshInstance3D, preferably with a SphereMesh Mesh
  2. Create a Decal, give it any Albedo texture. Set the Normal Fade to a value above 0. I also recommend setting both Vertical Fade properties to 0, so that they do not cause confusion.
  3. Move the Decal so that it's applied to the mesh. Make it a child of the mesh node so that it's in the same position on the mesh, and covers the same area on it.
  4. Scale the mesh node. Observe the decal's transparency changing. Drag the Decal's Normal Fade property around, to clearly see how it's been affected.

Minimal reproduction project

DecalFadeTest.zip

@Chaosus Chaosus added this to the 4.0 milestone Jan 7, 2022
@Calinou Calinou changed the title Decal 'Normal Fade' feature appears incorrect on scaled meshes Vulkan: Decal 'Normal Fade' feature appears incorrect on scaled meshes Jan 7, 2022
@Calinou
Copy link
Member

Calinou commented Jan 7, 2022

I can confirm this on commit 8f6cba3.

MRP with some changes: DecalFadeTest_1.zip

I've placed all spheres on the same height, adjusted decals' extents to be very tall (100 units each) and adjusted decal sizes to look visually identical:

image

If you reduce decals' Y extents to be short (0.5 local units each), they will end at different distances since they're being scaled by their transform:

image

If you reduce decals' Y extents to be short (0.5 global units each), they will end at the same distance, but you can clearly see Normal Fade acting differently:

image

@RandomCatDude
Copy link
Contributor Author

Thanks for improving the minimal reproduction project, wasn't sure mine was very good. That illustrates the problem much better.

@Calinou
Copy link
Member

Calinou commented Feb 13, 2023

The original issue is still reproducible as of 4.0.rc 493e932. Screenshot taken with decal extents' Y increased to 100 to emphasize the issue:

image

Updated MRP: DecalFadeTest_2.zip

@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

Successfully merging a pull request may close this issue.

4 participants