Parameters used to build a lit fragment shader.

interface FragmentShaderInputParams {
    toneMapping?: ToneMappings;
    outputColorSpace?: ColorSpace;
    additionalVaryings?: { type: string; name: string }[];
    fragmentOutput?: FragmentOutput;
    chunks?: AdditionalChunks;
    geometry: Geometry;
    materialUniform?: BufferBindingBaseParams;
    materialUniformName?: string;
    receiveShadows?: boolean;
    extensionsUsed?: GLTFExtensionsUsed;
    environmentMap?: EnvironmentMap;
    shadingModel?: ShadingModels;
    baseColorTexture?: ShaderTextureDescriptor;
    emissiveTexture?: ShaderTextureDescriptor;
    occlusionTexture?: ShaderTextureDescriptor;
    normalTexture?: ShaderTextureDescriptor;
    metallicRoughnessTexture?: ShaderTextureDescriptor;
    specularTexture?: ShaderTextureDescriptor;
    specularFactorTexture?: ShaderTextureDescriptor;
    specularColorTexture?: ShaderTextureDescriptor;
    transmissionTexture?: ShaderTextureDescriptor;
    thicknessTexture?: ShaderTextureDescriptor;
    transmissionBackgroundTexture?: ShaderTextureDescriptor;
    sheenTexture?: ShaderTextureDescriptor;
    sheenColorTexture?: ShaderTextureDescriptor;
    sheenRoughnessTexture?: ShaderTextureDescriptor;
    anisotropyTexture?: ShaderTextureDescriptor;
    clearcoatTexture?: ShaderTextureDescriptor;
    clearcoatRoughnessTexture?: ShaderTextureDescriptor;
    clearcoatNormalTexture?: ShaderTextureDescriptor;
    iridescenceTexture?: ShaderTextureDescriptor;
    iridescenceFactorTexture?: ShaderTextureDescriptor;
    iridescenceThicknessTexture?: ShaderTextureDescriptor;
}

Hierarchy (View Summary)

Properties

toneMapping?: ToneMappings

Whether the shading function should apply tone mapping to the resulting color and if so, which one. Default to 'Khronos'.

outputColorSpace?: ColorSpace

In which ColorSpace the output should be done. srgb should be used most of the time, except for some post processing effects that need input colors in linear space (such as bloom). Default to srgb.

additionalVaryings?: { type: string; name: string }[]

Optional additional varyings to pass from the vertex shader to the fragment shader.

Type declaration

  • type: string

    type of the varying.

  • name: string

    name of the varying.

fragmentOutput?: FragmentOutput

Custom fragment shader output structure members and returned values to use if needed. Useful when rendering to a Multiple Render Target for example.

Additional WGSL chunks to add to the shaders.

geometry: Geometry

Geometry used to create the fragment shader. Can use the vertexBuffers properties for vertex colors or tangent/bitangent computations.

materialUniform?: BufferBindingBaseParams

The BufferBindingBaseParams holding the material uniform values. Will use default values if not provided.

materialUniformName?: string

The BufferBindingBaseParams name to use for variables declarations. Default to 'material'.

receiveShadows?: boolean

Whether the shading function should account for current shadows. Default to false.

extensionsUsed?: GLTFExtensionsUsed

The glTF extensions used to generate this fragment shader.

environmentMap?: EnvironmentMap

EnvironmentMap to use for IBL shading.

shadingModel?: ShadingModels

Shading model to use. Default to 'PBR'.

baseColorTexture?: ShaderTextureDescriptor
emissiveTexture?: ShaderTextureDescriptor
occlusionTexture?: ShaderTextureDescriptor
normalTexture?: ShaderTextureDescriptor
metallicRoughnessTexture?: ShaderTextureDescriptor
specularTexture?: ShaderTextureDescriptor

Specular texture descriptor (mixing both specular color in the RGB channels and specular intensity in the A channel) to use if any.

specularFactorTexture?: ShaderTextureDescriptor

Specular intensity texture descriptor (using the A channel) to use if any.

specularColorTexture?: ShaderTextureDescriptor

Specular color texture descriptor (using the RGB channels) to use if any.

transmissionTexture?: ShaderTextureDescriptor
thicknessTexture?: ShaderTextureDescriptor
transmissionBackgroundTexture?: ShaderTextureDescriptor

Sheen texture descriptor (mixing both sheen color in the RGB channels and roughness in the A channel) to use if any.

sheenColorTexture?: ShaderTextureDescriptor

Sheen color texture descriptor (using the RGB channels) to use if any.

sheenRoughnessTexture?: ShaderTextureDescriptor

Sheen roughness texture descriptor (using the A channel) to use if any.

anisotropyTexture?: ShaderTextureDescriptor
clearcoatTexture?: ShaderTextureDescriptor

Clearcoat texture descriptor (using the R channel) to use if any.

clearcoatRoughnessTexture?: ShaderTextureDescriptor

Clearcoat roughness texture descriptor (using the G channel) to use if any.

clearcoatNormalTexture?: ShaderTextureDescriptor
iridescenceTexture?: ShaderTextureDescriptor

Iridescence texture descriptor (using the R channel for intensity and G channel for thickness) to use if any.

iridescenceFactorTexture?: ShaderTextureDescriptor

Iridescence texture descriptor (using the R channel) to use if any.

iridescenceThicknessTexture?: ShaderTextureDescriptor

Iridescence thickness texture descriptor (using the G channel) to use if any.