godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.71k stars 21.12k forks source link

3D Particle shading is reversed when particle trails are turned on in Material #95054

Open derkork opened 2 months ago

derkork commented 2 months ago

Tested versions

v4.2.2.stable.mono.official [15073afe3]

System information

Godot v4.2.2.stable.mono - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4080 (NVIDIA; 32.0.15.5599) - AMD Ryzen 9 7950X3D 16-Core Processor (32 Threads)

Issue description

I have set up a 3D GPU particle system which has trails enabled. The particle system uses a ribbon trail mesh. In the material on the trail mesh cull mode is set to "disable" so all sides of the ribbon render no matter from which direction the camera looks at it. I also have a directional light in my scene.

Now for trails to work properly, I need to enable "Use particle trails" in the material. This makes the trails render correctly. However now the particle shading is reversed, e.g. sides that face towards the directional light are now dark while sides that face away from it are now lit.

https://github.com/user-attachments/assets/ef57c6eb-b0e6-4816-9b77-fb521850e52e

Steps to reproduce

In the attached sample project open light_trails_test.tscn. Then go to the material attached to the ribbon trail mesh and enable/disable Transform -> Use particle trails.

Minimal reproduction project (MRP)

particle_reproducer.zip

Calinou commented 2 months ago

I wonder if this is because trail mode flips the mesh rendering by using a negative scale. This probably went unnoticed since trails are generally unshaded.