godotengine / godotengine/godot
Unable to set light energy via RenderingServer (light.get_base() returns RID(0))
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
Godot v4.6.dev3
Godot v4.5.1.stable
### System information
Windows 11 (build 26100) - Multi-window, 1 monitor - Vulkan (Forward+) - integrated Intel(R) Iris(R) Xe Graphics (Intel Corporation; 32.0.101.7076) - 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz (8 threads) - 15.80 GiB memory
### Issue description
I'm implementing a light flicker as a tool script.
`Light3D.set_param(param, value)` works, but it changes the base light energy in the Inspector.
So I'm trying to change the light energy using `RenderingServer.light_set_param(light.get_instance(), param, value)`
However, it returns an error saying the light is null:
`ERROR: servers/rendering/renderer_rd/storage_rd/light_storage.cpp:190 - Parameter "light" is null.`
Reading the RenderingServer docs:
So, from what I understand:
- `VisualInstance3D.get_instance()` returns an instance (the Light3D?)
- `VisualInstance3D.get_base()` returns a base (the actual light type?)
However, calling `RenderingServer.light_set_param(light.get_base(), param, value)`
still results in:
`ERROR: servers/rendering/renderer_rd/storage_rd/light_storage.cpp:190 - Parameter "light" is null.`
`light.get_base()` returns `RID(0)`
### Steps to reproduce
`RenderingServer.light_set_param(light.get_instance(), RenderingServer.LIGHT_PARAM_ENERGY, 1.0)`
or
`RenderingServer.light_set_param(light.get_base(), RenderingServer.LIGHT_PARAM_ENERGY, 1.0)`
### Minimal reproduction project (MRP)
[light-set-param-mrp.zip](https://github.com/user-attachments/files/23445184/light-set-param-mrp.zip)
Contributor guide
Research direction
Start with the linked light-set-param-mrp.zip and reproduce both RenderingServer.light_set_param calls using Light3D.get_instance() and get_base(). Read the Light3D, VisualInstance3D, and RenderingServer API documentation, then trace the null RID reported at servers/rendering/renderer_rd/storage_rd/light_storage.cpp:190. Done means identifying the valid RID or correcting the API behavior so light energy can be changed without the null-light error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100