# LitShaderOptions

Class · category: Graphics

Source: https://github.com/playcanvas/engine/blob/f059dc005842f76e052cdf44d8370c8c7ec475ac/src/scene/shader-lib/programs/lit-shader-options.js#L20

The lit shader options determines how the lit-shader gets generated. It specifies a set of
parameters which triggers different fragment and vertex shader generation in the backend.

You do not create one. The engine fills a LitShaderOptions from the material and scene state
each time a [StandardMaterial](https://api.playcanvas.com/engine/classes/StandardMaterial.md) needs a shader variant, and every distinct set of values
produces a distinct compiled shader. Developers rarely need to touch it: the material properties
such as `useFog`, `useLighting` and `useSkybox` on [StandardMaterial](https://api.playcanvas.com/engine/classes/StandardMaterial.md) cover the usual
cases, and the values here mirror them together with the scene state. It is exposed for the
rare case of customizing shader generation through [StandardMaterial#onUpdateShader](https://api.playcanvas.com/engine/classes/StandardMaterial.md#onupdateshader).

## Properties

### alphaTest

```ts
alphaTest: boolean = false
```

Enable alpha testing. See [Material#alphaTest](https://api.playcanvas.com/engine/classes/Material.md#alphatest).

### alphaToCoverage

```ts
alphaToCoverage: boolean = false
```

Enable alpha to coverage. See [Material#alphaToCoverage](https://api.playcanvas.com/engine/classes/Material.md#alphatocoverage).

### ambientSH

```ts
ambientSH: boolean = false
```

If ambient spherical harmonics are used. Ambient SH replace prefiltered cubemap ambient on
certain platforms (mostly Android) for performance reasons.

### ambientSource

```ts
ambientSource: string = 'constant'
```

One of "ambientSH", "envAtlas", "constant".

### blendType

```ts
blendType: number = BLEND_NONE
```

The value of [Material#blendType](https://api.playcanvas.com/engine/classes/Material.md#blendtype).

### cubeMapProjection

```ts
cubeMapProjection: number = 0
```

The value of [StandardMaterial#cubeMapProjection](https://api.playcanvas.com/engine/classes/StandardMaterial.md#cubemapprojection).

### fog

```ts
fog: string = FOG_NONE
```

The type of fog being applied in the shader. See [Scene#fog](https://api.playcanvas.com/engine/classes/Scene.md#fog) for the list of possible
values.

### fresnelModel

```ts
fresnelModel: number = 0
```

The value of [StandardMaterial#fresnelModel](https://api.playcanvas.com/engine/classes/StandardMaterial.md#fresnelmodel).

### gamma

```ts
gamma: number = GAMMA_NONE
```

The type of gamma correction being applied in the shader. See
[CameraComponent#gammaCorrection](https://api.playcanvas.com/engine/classes/CameraComponent.md#gammacorrection) for the list of possible values.

### linearDepth

```ts
linearDepth: boolean = false
```

Make vLinearDepth available in the shader.

### occludeDirect

```ts
occludeDirect: boolean = false
```

The value of [StandardMaterial#occludeDirect](https://api.playcanvas.com/engine/classes/StandardMaterial.md#occludedirect).

### occludeSpecular

```ts
occludeSpecular: number = 0
```

The value of [StandardMaterial#occludeSpecular](https://api.playcanvas.com/engine/classes/StandardMaterial.md#occludespecular).

### occludeSpecularFloat

```ts
occludeSpecularFloat: boolean = false
```

Defines if [StandardMaterial#occludeSpecularIntensity](https://api.playcanvas.com/engine/classes/StandardMaterial.md#occludespecularintensity) constant should affect specular
occlusion.

### opacityDither

```ts
opacityDither: string = DITHER_NONE
```

Enable opacity dithering. See [StandardMaterial#opacityDither](https://api.playcanvas.com/engine/classes/StandardMaterial.md#opacitydither).

### opacityFadesSpecular

```ts
opacityFadesSpecular: boolean = false
```

Enable specular fade. See [StandardMaterial#opacityFadesSpecular](https://api.playcanvas.com/engine/classes/StandardMaterial.md#opacityfadesspecular).

### opacityShadowDither

```ts
opacityShadowDither: string = DITHER_NONE
```

Enable opacity shadow dithering. See [StandardMaterial#opacityShadowDither](https://api.playcanvas.com/engine/classes/StandardMaterial.md#opacityshadowdither).

### reflectionSource

```ts
reflectionSource: string = REFLECTIONSRC_NONE
```

One of REFLECTIONSRC_*** constants.

### shaderChunks

```ts
shaderChunks: ShaderChunks | null = null
```

Custom shader chunks that will replace default ones.

### shadowCatcher

```ts
shadowCatcher: boolean = false
```

Shader outputs the accumulated shadow value, used for shadow catcher materials.

### skyboxIntensity

```ts
skyboxIntensity: number = 1.0
```

Skybox intensity factor.

### ssao

```ts
ssao: boolean = false
```

Apply SSAO during the lighting.

### toneMap

```ts
toneMap: number = -1
```

The type of tone mapping being applied in the shader. See [CameraComponent#toneMapping](https://api.playcanvas.com/engine/classes/CameraComponent.md#tonemapping)
for the list of possible values.

### twoSidedLighting

```ts
twoSidedLighting: boolean = false
```

The value of [StandardMaterial#twoSidedLighting](https://api.playcanvas.com/engine/classes/StandardMaterial.md#twosidedlighting).

### useCubeMapRotation

```ts
useCubeMapRotation: boolean = false
```

If cube map rotation is enabled.

### useInstancing

```ts
useInstancing: boolean = false
```

If hardware instancing compatible shader should be generated. Transform is read from
per-instance [VertexBuffer](https://api.playcanvas.com/engine/classes/VertexBuffer.md) instead of shader's uniforms.

### useMetalness

```ts
useMetalness: boolean = false
```

The value of [StandardMaterial#useMetalness](https://api.playcanvas.com/engine/classes/StandardMaterial.md#usemetalness).

### useMorphNormal

```ts
useMorphNormal: boolean = false
```

If morphing code should be generated to morph normals.

### useMorphPosition

```ts
useMorphPosition: boolean = false
```

If morphing code should be generated to morph positions.

### userAttributes

```ts
userAttributes: {} = {}
```

Object containing a map of user defined vertex attributes to attached shader semantics.

### useRefraction

```ts
useRefraction: boolean = false
```

If refraction is used.

### useSceneEnv

```ts
useSceneEnv: boolean = false
```

If the environment chunks sample the scene environment, published by the renderer as
`scene_envAtlas` and `scene_skybox`, instead of the textures owned by the material
(`texture_envAtlas`, `texture_cubeMap`).

### useSpecular

```ts
useSpecular: boolean = false
```

If any specular or reflections are needed at all.
