Cant access sky properties

Godot Version
Godot 4.4

Question

I know im gonna seem dumb but just leaving this here in case i dont figure it out.

When making a script for the world environment, im trying to find a way to access the offset of the noise2dmap that have to give a feeling of the clouds moving. But no matter what path i try to take, it just doesnt ever accept the offset as a property I can change.

I looked through a bunch of documentation and couldnt find offset as a listed property of the world environment or the sky within it. I tried making a script off of the sky itself, extending it off of both the sky itself and another for the texture when that failed, yet offset never came up.

I just dont understand why these properties are so elusive and other properties for other nodes are so easy to access. What simple thing am i missing here?

This is just me trying to experiment and get a hold of the engine but I cant find any tutorials that do any scripting with the world environment and im just too tured and frustrated to continue messing with it for the night.

Thank you to anyone who takes the time to help me!

It depends on which Sky.sky_material you are using. I don’t see any noise2dmap in any of the built-in materials: PanoramaSkyMaterial, PhysicalSkyMaterial or ProceduralSkyMaterial so my guess is that you are using a custom ShaderMaterial. In that case you’ll need to access its properties using ShaderMaterial.get_shader_parameter() and ShaderMaterial.set_shader_parameter()

Assuming that the noise2dmap is a NoiseTexture2D and that you want to change the FastNoiseLite.offset property of it then it would be something like:

extends Node


func _ready() -> void:
    var sky_material = $WorldEnviroment.environment.sky.sky_material as ShaderMaterial
    var noise2dmap = sky_material.get_shader_parameter("noise2dmap") as NoiseTexture2D
    var noise = noise2dmap.noise as FastNoiseLite
    noise.offset = Vector3(10, 10, -10)
    sky_material.set_shader_parameter("noise2dmap", noise2dmap)
1 Like

Thank you so much! the problem ended up being I was trying to access the environment with an upper case instead of the environment property and thus couldn’t get the right properties I wanted to tinker with. Looking at your solution really helped, and I used it to tinker around with some other things.

Thanks for the help and quick reply!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.