godotengine / godot

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

ReflectionProbe Reflection Masks have no effect on Mobile renderer #93173

Open RaineVixen opened 3 weeks ago

RaineVixen commented 3 weeks ago

Tested versions

System information

Fedora Linux 40.20240613.0 (Silverblue) - Wayland - Vulkan (Mobile) - dedicated AMD Radeon RX 5700 (RADV NAVI10) () - Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz (8 Threads)

Issue description

Reflection Masks can be used to exclude meshes from being affected by a ReflectionProbe. In the Forward+ and Compatibility backends this works correctly, but not so on the Mobile backend. Meshes are always affected by a ReflectionProbe in Forward Mobile, even when excluded by the Reflection Mask.

I've also tested ReflectionProbe Cull Masks to see if it had similar issues, but it works just fine in the Mobile renderer.

Forward Plus (Working correctly): gd4MRP-MRPM-Screenshot_ForwardPlus

Forward Mobile (With issues): gd4MRP-MRPM-Screenshot_Mobile

Compatibility (Working correctly): gd4MRP-MRPM-Screenshot_Compatibility

Steps to reproduce

  1. Create two MeshInstance3Ds and set one of them to Layer 2.
  2. Create a ReflectionProbe and in the Reflection Mask, exclude Layer 2.
  3. Set the Ambient Color in the ReflectionProbe to Constant Color and use a bright color to help exaggerate the differences between the two Meshes.
  4. Switch between the Forward+ and Mobile backends to see the difference.

Minimal reproduction project (MRP)

gd4MRP-MobileReflectionProbeMasks.zip

Calinou commented 3 weeks ago

I can confirm this when running the project with the Mobile rendering method, both on 4.2.2 and 4.3.beta 71699e08c (Linux, GeForce RTX 4090 with NVIDIA 550.78).

I also checked 4.1.2 and 4.0 and the issue is still present on those versions.

image

The code that handles reflection probe cull masks is here in Forward+:

https://github.com/godotengine/godot/blob/71699e08c9df78b7203fa4ef9cede28e995d6ace/servers/rendering/renderer_rd/shaders/forward_clustered/scene_forward_clustered.glsl#L1670-L1685

And for Mobile:

https://github.com/godotengine/godot/blob/71699e08c9df78b7203fa4ef9cede28e995d6ace/servers/rendering/renderer_rd/shaders/forward_mobile/scene_forward_mobile.glsl#L1248-L1261