-
-
Notifications
You must be signed in to change notification settings - Fork 21k
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
shadow_mesh
on ArrayMesh
replaces the original mesh
#72071
Comments
Does this happen on all the renderers? |
It seems to be exclusive to the |
Oh, I know whats going on. The mesh isn't rendering at all. The depth prepass uses the shadow mesh, but the opaque pass only draws meshes where the depth is the same as the depth from the depth prepass. Since you are using a completely different mesh, it means the object isn't getting drawn at all. But since it was drawn to the depth prepass, there is a hole where nothing has been drawn. This is another edge case where #70214 breaks down. We need to add some logic to avoid this issue when a shadow mesh is used |
Ah, I see. I can confirm that it renders normally if the shadow mesh is the same as the main mesh. However, there is an use case where shadow mesh is simpler version of the actual mesh, so this should be eventually fixed. |
Shadow meshes are generated by default for imported 3D scenes, so this would make the optimization useless in most cases 🙁 |
I'm not expert on this area, but if solving this requires removing optimization from more frequent cases, it isn't worth it. In that case we should document this behaviour. I'm currently writing description for |
Altough if making custom shadow meshes is not supported, exposing |
Not really, the optimization is only really for alpha hash and alpha scissor materials. For regular opaque materials it doesn't make much of a difference |
In the end I think documenting the requirement for positions to be the same is the way to go. We discussed this at the rendering meeting yesterday and realized that any attempt to create the behaviour sought by the OP will hurt performance in a way that we don't want to support. Further, using a different mesh for shadows than the one used for rendering will always result in uncontrollable shadow artifacts (i.e. very bad shadow acne). |
Godot version
v4.0.beta.custom_build [fab9926]
System information
Windows 10
Issue description
AddingIfshadow_mesh
toArrayMesh
causes the mesh itself not to render, only shadow mesh gets rendered.shadow_mesh
has different vertex positions than the main mesh, rendering the main mesh fails on Forward+ renderer.Check this image explanation:
Steps to reproduce
Make an
ArrayMesh
and addshadow_mesh
to it. I used following code (it rotates and offsets the shadow mesh to make the problem more visible):Minimal reproduction project
ShadowMeshBug.zip
The text was updated successfully, but these errors were encountered: