18 lines
527 B
GDScript
18 lines
527 B
GDScript
extends Node
|
|
|
|
## Fixes the tonemapping being applied twice when looking through a portal.
|
|
##
|
|
## It copies the original environment (sky and stuff) and just puts in a noop
|
|
## tonemapping (linear with exposure 1).
|
|
|
|
@export var base: WorldEnvironment
|
|
@export var portals: Array[Portal] = []
|
|
|
|
func _ready() -> void:
|
|
var adapted_env: Environment = base.environment.duplicate(false)
|
|
adapted_env.tonemap_mode = Environment.TONE_MAPPER_LINEAR
|
|
adapted_env.tonemap_exposure = 1
|
|
|
|
for p in portals:
|
|
p.exit_environment = adapted_env
|