> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/godotengine/godot/llms.txt
> Use this file to discover all available pages before exploring further.

# Shader

# Shader

**Inherits:** Resource \< RefCounted \< Object

## Description

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

## Properties

<ResponseField name="code" type="String" default="">
  Returns the shader's code as the user has written it.
</ResponseField>

## Methods

### get\_mode

```gdscript theme={null}
Mode get_mode()
```

Returns the shader mode for the shader.

### get\_shader\_uniform\_list

```gdscript theme={null}
Array get_shader_uniform_list(get_groups: bool = false)
```

Returns the list of shader uniforms that can be assigned to a ShaderMaterial.

### set\_default\_texture\_parameter

```gdscript theme={null}
void set_default_texture_parameter(name: StringName, texture: Texture, index: int = 0)
```

Sets the default texture to be used with a texture uniform.

## Constants

* **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
* **MODE\_SKY** = `3` - Mode used for drawing skies
* **MODE\_FOG** = `4` - Mode used for volumetric fog effect

## Example Usage

<Tabs>
  <Tab title="GDScript">
    ```gdscript theme={null}
    var shader = Shader.new()
    shader.code = """
    shader_type spatial;

    void fragment() {
        ALBEDO = vec3(1.0, 0.0, 0.0);
    }
    """

    var material = ShaderMaterial.new()
    material.shader = shader
    ```
  </Tab>

  <Tab title="C#">
    ```csharp theme={null}
    var shader = new Shader();
    shader.Code = @"
    shader_type spatial;

    void fragment() {
        ALBEDO = vec3(1.0, 0.0, 0.0);
    }
    ";
    ```
  </Tab>
</Tabs>
