godot
godot copied to clipboard
Fix billboarding of GPU particles in double precision builds
Resolves #76388 by applying the particle transformation matrix to the modelview matrix prior to the material's vertex shader code where billboarding is performed. Double precision emulation is still done for the translation component of the transformation. This also changes to use the main camera's inverse view transformation in the particle billboarding to correct the lighting as in review #72638.
The issue was caused by matrix
being manually applied for is_multimesh
objects after the material's vertex shader. In the case of billboarded particles, this resulted in a model rotational component not being accounted for when facing the object towards the main camera.
The matrix
can be baked into the modelview matrix in both double and single precision cases. This removes the need for some preprocessor macros since now the model_matrix
will be used in both configurations. For double precision, the translation component of matrix
is removed to be used in the high precision calculations after the material's vertex shader.
I tested the following configurations in the minimal reproduction projects from #76388 and #89020:
- rendering backend: Mobile & Forward+
- precision: single & double
- billboarding: disabled & particle billboard