Skip to content

Add a method to force a ReflectionProbe to update #13466

@Varrox

Description

@Varrox

Describe the project you are working on

A 3D liminal space game with real time lighting and reflection probes, where lights can be turned off and on.

(please note: this is my first time writing an issue on github, let me know if I have messed up on something)

Describe the problem or limitation you are having in your project

My game needs reflection probes to have the ability to update when I need them to (turning on, or off a light, and etc) so lighting isn't weird, but currently, updating reflection probes manually at the moment isn't that great, as you have to change their transform in order to update their cubemap.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Instead of changing a reflection probes update_mode set to UPDATE_ONCE, and changing it's transform, hoping that it actually updates it's cubemap, add a function that updates a reflection probe cubemap directly

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

There could be a new function called update() that will update the cubemap.

Light switch example:

extends ReflectionProbe

@export var switch:LightSwitch

func _ready():
   switch.switched.connect(refresh) # signal switched(on:bool)

func refresh(on:bool): 
   update() # Update reflection probe cubemap

Level editor example:

class_name LevelEditor extends Node3D

@export reflection_probe:ReflectionProbe

signal level_changed

func _ready():
   level_changed.connect(reflection_probe.update)

If this enhancement will not be used often, can it be worked around with a few lines of script?

It can, but at the moment it is very counter intuitive to do, and seems like it would be better to just update a probe manually than to change it's transform, also unrelated to the actual proposal since this is a bug, but I would like to still mention it since it relates to this issue, in some cases changing the transform doesn't even work like seen here:

Image Image Image

This is the code that changes the transform in the second image, which is also what is needed to update a reflection probe.

extends ReflectionProbe

var original_pos:Vector3

func _ready() -> void:
	original_pos = global_position

func update_reflection_probe(): # To be called by signal
	global_transform.origin.y = original_pos.y + randf_range(-0.05,0.05)

Is there a reason why this should be core and not an add-on in the asset library?

It requires changes to the RenderingServer and also the reflection probe node class.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions