#want to edit values of shader in script

36 messages · Page 1 of 1 (latest)

last bridge
#

did you try set_shader_param("radius", ...

stuck wagon
#

this also doesnt work @last bridge

last bridge
#

let me see how I did it

#

just a sec

stuck wagon
#

ye sure, thanks

last bridge
#

yeah, it was just like I said

#

I am not sure what is going on

stuck wagon
#

yups, same

last bridge
#

to which node is the material attached to?

#

are you referencing the material in the project folder?

stuck wagon
#

to a MeshInstance3d called range

#

the script is attached to this MeshInstance3D and then im using 'self' to override the material

last bridge
#

try doing directly on the material on the mesh

stuck wagon
#

so now I have a MeshInstance3D with an PlaneMesh an added to the PlaneMesh I have the shader, I dont really understand what you want me to try

stuck wagon
white sleet
#

the line_color uniform is not defined as a source_color. so you can't set it with color

#

but that of cource only counts for that one parameter

stuck wagon
#

ye I added it, thanks

#

but still doesnt fix the main issue

white sleet
#

oh i see now. you don't have to write "shader_param/radius", only "radius"

stuck wagon
#

still doesnt fix it

white sleet
#

ah my bad, didn't realize that you already tried that

stuck wagon
#

Now I have the range_indicator shown, but from the moment I start my scene, I dont getanything

white sleet
#

could be a problem with z-fighting

stuck wagon
#

and also the standard color is red, but in the script I gave it a greay color, so the script is not overriding the standard values of the shader

#

so I dont think its a z thing

white sleet
#

try putting the mesh a bit higher

#

just because the changing of the parameters doesn'T work doesn't mean that the mesh should be invisible

last bridge
stuck wagon
#

if I do it like this, I get a null error

Attempt to call function 'set_shader_parameter' in base 'null instance' on a null instance.

white sleet
#

you also have to directly put the shader material as the material_override inside the inspector.

stuck wagon
#

Ow okay, will try that, need to go now, so will try it tomorrow. Already thanks for all the help.

last bridge
#

and you don´t really need self., you can call material_override directly

stuck wagon
#

okay, guys after applying the things you gave me and some testing I fixed it

#

I think my shader was not 100%, where it didnt aplly the changes of the params

#

but now it works