Shader

Inherits: Resource < Reference < Object

Inherited By: VisualShader

A custom shader program.

Description

This class allows you to define a custom shader program that can be used by a ShaderMaterial. Shaders allow you to write your own custom behavior for rendering objects or updating particle information. For a detailed explanation and usage, please see the tutorials linked below.

Properties

Stringcode""

Methods

Textureget_default_texture_param ( String param ) const
Modeget_mode ( ) const
boolhas_param ( String name ) const
voidset_default_texture_param ( String param, Texture texture )

Enumerations

enum Mode:

  • MODE_SPATIAL = 0 — Mode used to draw all 3D objects.
  • MODE_CANVAS_ITEM = 1 — Mode used to draw all 2D objects.
  • MODE_PARTICLES = 2 — Mode used to calculate particle information on a per-particle basis. Not used for drawing.

Property Descriptions

Default""
Setterset_code(value)
Getterget_code()

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

Method Descriptions

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

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


  • Mode get_mode ( ) const

Returns the shader mode for the shader, either MODE_CANVAS_ITEM, MODE_SPATIAL or MODE_PARTICLES.


Returns true if the shader has this param defined as a uniform in its code.

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


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: param must match the name of the uniform in the code exactly.

Doc ID missing

Disclaimer: This page has been automaticaly and directly extracted from the official Godot Docs website, the 1970-01-01 at 00:00:00. It’s the English Stable version because it’s what most Godot users should use. The Copyright owners are Juan Linietsky, Ariel Manzur and the Godot community. CC-BY 3.0. Thanks for your patience and generosity.