Table of Contents

Class Shader

A shader implemented in the Godot shading language.

Inheritance
Shader
Derived

Remarks

A custom shader program implemented in the Godot shading language, saved with the .gdshader extension.

This class is used by a ShaderMaterial and allows you to write your own custom behavior for rendering visual items or updating particle information. For a detailed explanation and usage, please see the tutorials linked below.

See Also

Properties

code

Returns the shader's code as the user has written it, not the full generated code used internally.

var code : String = ""

Property Value

String

Remarks

Methods

get_default_texture_parameter(StringName, int)

Qualifiers: const

Returns the texture that is set as default for the specified parameter.

Note: name must match the name of the uniform in the code exactly.

Note: If the sampler array is used use index to access the specified texture.

Texture get_default_texture_parameter(StringName name, int index)

Parameters

name StringName
index int

get_mode

Qualifiers: const

Returns the shader mode for the shader.

int get_mode

get_shader_uniform_list(bool)

Returns the list of shader uniforms that can be assigned to a ShaderMaterial, for use with ShaderMaterial.set_shader_parameter and ShaderMaterial.get_shader_parameter. The parameters returned are contained in dictionaries in a similar format to the ones returned by get_property_list.

If argument get_groups is true, parameter grouping hints are also included in the list.

Array get_shader_uniform_list(bool get_groups)

Parameters

get_groups bool

inspect_native_shader_code

Only available when running in the editor. Opens a popup that visualizes the generated shader code, including all variants and internal shader code. See also inspect_native_shader_code.

void inspect_native_shader_code

set_default_texture_parameter(StringName, Texture, int)

Sets the default texture to be used with a texture uniform. The default is used if a texture is not set in the ShaderMaterial.

Note: name must match the name of the uniform in the code exactly.

Note: If the sampler array is used use index to access the specified texture.

void set_default_texture_parameter(StringName name, Texture texture, int index)

Parameters

name StringName
texture Texture
index int