0

in Godot 4.4.1 I'm trying to access shader variables in code to do some math for my game. However, Even though I have set these shader parameters in global/shaders in project settings they don't show. So I tried adding it manually before trying to get them, but it still doesn't fetch any global parameters. Is there something I'm doing wrong or is this a bug?

        RenderingServer.global_shader_parameter_add("spotlight_inner_radius",RenderingServer.GLOBAL_VAR_TYPE_FLOAT, 0.25)
        print("BOPP")
        print(RenderingServer.global_shader_parameter_get_list())
        var inner_radius_px = RenderingServer.global_shader_parameter_get("spotlight_inner_radius") * screen_width
        var outer_radius_px = RenderingServer.global_shader_parameter_get("spotlight_radius") * screen_width
        print('here')
 

this prints out BOPP [] before erroring out when it tries to multiply null and an integer

The shaders are using these variables with no issue and seem to be able to find them just fine. here is an exerpt from the gdshader code

global uniform float spotlight_radius; // The radius of the effect in pixels
global uniform float spotlight_inner_radius;

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.