Using a .blend import with .png texture, is there a way to use a shader on the node?

Godot Version

4.2.2

Question

Hey guys, bit new here please bear me,

I am importing my 3d model and texture using the blender import, so I end up with a .blend and .png file. I want to be able to shift the colour of the texture, is there a way for me to attach a shader to this node?

I have tried creating a .gdshader file and in the node script importing it and using self.material_override, but no luck so far, I get Invalid set index 'material_override' (on base: 'Node3D (landing_pad.gd)') with value of type 'Shader'.

Cheer :slight_smile:

1 Like

Could you do this from the editor? you can set the model to “editable children” from right clicking it in the scene tree.

The shader needs to be attached to a ShaderMaterial

var new_mat := ShaderMaterial.new()
new_mat.shader = load("myshader.gdshader")
self.material_override = new_mat
1 Like

Thanks for the response, :grin:

The first part I was doing wrong what bringing these items into the scene incorrectly, seems to work much better creating a new inherited instance from them. I then found I don’t need a shader in this scenario as I can just edit the color under the Albedo tab of the texture :slight_smile:

The editable children tip will be very helpful, as I wanted multiple colored versions of this asset in the scene.

Thanks again for the help, will keep this in mind if I need to use a shader in the future.

1 Like

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