Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

Shader

Inherits: Resource < RefCounted < Object

Inherited By: VisualShader

A shader implemented in the Godot shading language.

Description

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.

Tutorials

Properties

String

code

""

Methods

Texture2D

get_default_texture_parameter ( StringName name, int index=0 ) const

Mode

get_mode ( ) const

Array

get_shader_uniform_list ( bool get_groups=false )

void

set_default_texture_parameter ( StringName name, Texture2D texture, int index=0 )


Enumerations

enum Mode:

Mode MODE_SPATIAL = 0

Mode used to draw all 3D objects.

Mode MODE_CANVAS_ITEM = 1

Mode used to draw all 2D objects.

Mode MODE_PARTICLES = 2

Mode used to calculate particle information on a per-particle basis. Not used for drawing.

Mode MODE_SKY = 3

Mode used for drawing skies. Only works with shaders attached to Sky objects.

Mode MODE_FOG = 4

Mode used for sett