Does anyone know how I could create a brightness setting for 3d?

Godot Version

4.5

Question

Does anybody know how to create a brightness setting for a 3d game? I looked all over the place and only found an outdated 2D tutorial and other such videos. I might have missed something, though. I thought that having my world environments all in a group and then changing the brightness with code would work, but no luck.

func _on_brightness_slider_value_changed(value: float) -> void:
	get_tree().set_group("environments", "adjustment_brightness", value)

if anyone has any ideas on how to do this I would really appreaciate it.

WorldEnvironment does not have an “adjustment_brightness” property. It’s on the Environment resource. I think you will need to use call_group() instead, or a for loop.

1 Like

there are many ways and it depends on the style.

for most cases, in WorldEnvironment:Environment, you change the tonemap. each tonemap has different settings.
the most common is exposure, which can make the scene brighter.

you also have exposure in a camera setting. you can add this to a camera or to the worldenvironment node, and it can be flat exposure or automatic, in which case it will adjust to the scene.

the way to change this from settings is to obtain a reference to the worldenvironment node and change it.
if you want to automate it, a way would be to use an autoload to store the value of exposure, then add a script to worldenvironment, and change the value based on whats on the autoload. you can also connect a signal from the autoload to change the values on the worldenvironment.

autoload options.gd

signal exposure_changed(value : float)
var exposure : float = 1.0

worldenvironment.gd


func _ready() -> void:
	change_exposure(Options.exposure)
	Options.exposure_changed.connect(change_exposure)

func change_exposure(value : float) -> void:
	environment.tonemap_exposure = value
1 Like

Thanks, I’ll try that! :slight_smile:

Thanks for the in depth explanation!