godotengine / godotengine/godot
Visibility ranges ignored when casting shadows under Omni/Spot lights
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
4.3 stable, 4.4dev4
### System information
Linux
### Issue description
Using Visibility Range Begin and End to hide an Object always creates a shadow for OmniLight3D, even if the camera is far away and the Object becomes hidden by the set Visibility Range. DirectionalLight3D only creates a shadow for the object if it was not hidden by Visibility Range.
Use case:
This is an issue for me because I would like to keep using Visibility Range to hide a 3D objects Mesh so it only creates a shadow but is not visible to the user. There is no LightOccluder3D Node in Godot and setting the Mesh transparency = 1.0 has been a performance drain (I use many light blocker mesh instances)
### Steps to reproduce
Set a MeshInstance3D Visibility Range between 1.0 and 2.0 and zoom in and out with the camera and take note of the shadow on the floor (OmniLight3D = always shadow, DirectionalLight3D = shadow only if mesh is visible). The behavior is present in the editor and when running the project.
### Minimal reproduction project (MRP)
[lightingtest.zip](https://github.com/user-attachments/files/17688518/lightingtest.zip)
Contributor guide
Research direction
Start with the linked lightingtest.zip minimal reproduction project and compare MeshInstance3D Visibility Range behavior for OmniLight3D, SpotLight3D, and DirectionalLight3D in the editor and at runtime. Trace the shadow-generation path for visibility-range changes; done means hidden meshes no longer cast shadows inconsistently under Omni or Spot lights.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100