# ShaderDesc

Interface · category: Other

Source: https://github.com/playcanvas/engine/blob/f059dc005842f76e052cdf44d8370c8c7ec475ac/src/scene/materials/shader-material.js#L12

Defines the vertex and fragment shader source for
[ShaderMaterial](https://api.playcanvas.com/engine/classes/ShaderMaterial.md), supporting both GLSL and WGSL formats. WebGL always uses the GLSL code.
WebGPU prefers the WGSL code if available, otherwise it automatically transpiles the provided
GLSL code at runtime.

## Properties

### attributes

```ts
attributes?: {}
```

Object detailing the mapping of vertex shader
attribute names to semantics SEMANTIC_*. This enables the engine to match vertex buffer data as
inputs to the shader. Defaults to undefined, which generates the default attributes.

### fragmentGLSL

```ts
fragmentGLSL?: string
```

The fragment shader code in GLSL.

### fragmentOutputTypes

```ts
fragmentOutputTypes?: string | string[]
```

Fragment shader output types, which default to
vec4. Passing a string will set the output type for all color attachments. Passing an array will
set the output type for each color attachment.

### fragmentWGSL

```ts
fragmentWGSL?: string
```

The fragment shader code in WGSL.

### uniqueName

```ts
uniqueName: string
```

Unique name for the shader. If a shader with this name already
exists, it will be returned instead of a new shader instance.

### vertexGLSL

```ts
vertexGLSL?: string
```

The vertex shader code in GLSL.

### vertexWGSL

```ts
vertexWGSL?: string
```

The vertex shader code in WGSL.
