Define the material parameters of a LitMesh.

interface LitMeshMaterialParams {
    toneMapping?: ToneMappings;
    additionalVaryings?: { type: string; name: string }[];
    environmentMap?: EnvironmentMap;
    colorSpace?: ColorSpace;
    color?: Vec3;
    opacity?: number;
    alphaCutoff?: number;
    metallic?: number;
    roughness?: number;
    normalScale?: Vec2;
    occlusionIntensity?: number;
    emissiveIntensity?: number;
    emissiveColor?: Vec3;
    specularIntensity?: number;
    specularColor?: Vec3;
    shininess?: number;
    transmission?: number;
    ior?: number;
    dispersion?: number;
    thickness?: number;
    attenuationDistance?: number;
    attenuationColor?: Vec3;
    baseColorTexture?: ShaderTextureDescriptor;
    normalTexture?: ShaderTextureDescriptor;
    emissiveTexture?: ShaderTextureDescriptor;
    occlusionTexture?: ShaderTextureDescriptor;
    metallicRoughnessTexture?: ShaderTextureDescriptor;
    specularTexture?: ShaderTextureDescriptor;
    specularFactorTexture?: ShaderTextureDescriptor;
    specularColorTexture?: ShaderTextureDescriptor;
    transmissionTexture?: ShaderTextureDescriptor;
    thicknessTexture?: ShaderTextureDescriptor;
    shading?: ShadingModels;
    vertexChunks?: AdditionalChunks;
    fragmentChunks?: AdditionalChunks;
}

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'.

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.

environmentMap?: EnvironmentMap

EnvironmentMap to use for IBL shading.

colorSpace?: ColorSpace

ColorSpace to use for material uniform colors. All lighting calculations must be done in linear space. Default to srgb (which means the uniform colors are converted to linear space), but glTF internally use linear.

color?: Vec3

Base color of the LitMesh as a Vec3. Default to new Vec3(1).

opacity?: number

Opacity of the LitMesh. If different than 1, consider setting the transparent parameter to true. Default to 1.

alphaCutoff?: number

Alpha cutoff threshold value of the LitMesh. Default to 0.5.

metallic?: number

The metallic factor of the LitMesh. Default to 1.

roughness?: number

The roughness factor of the LitMesh. Default to 1.

normalScale?: Vec2

How much the normal map affects the material normal texture if any. Typical ranges are [0-1]. Default to new Vec2(1).

occlusionIntensity?: number

A scalar multiplier controlling the amount of occlusion applied to the occlusion texture if any. Default to 1.

emissiveIntensity?: number

Emissive intensity to apply to the emissive color of the LitMesh. Default to 1.

emissiveColor?: Vec3

Emissive color of the LitMesh as a Vec3. Default to new Vec3(0) (no emissive color).

specularIntensity?: number

The strength of the specular reflections applied to the LitMesh (not applicable to Lambert shading). Default to 1.

specularColor?: Vec3

Specular color to use for the specular reflections of the LitMesh as a Vec3 (not applicable to Lambert shading). Default to new Vec3(1).

shininess?: number

Shininess of the LitMesh when using Phong shading. Default to 30.

transmission?: number

The base percentage of light that is transmitted through the surface of the LitMesh. Only applicable to PBR shading if transmissive parameter is set to true. Default to 0.

ior?: number

The index of refraction of the LitMesh. Default to 1.5.

dispersion?: number

The strength of the dispersion effect, specified as 20/Abbe number. Only applicable to PBR shading if transmissive parameter is set to true. Default to 0.

thickness?: number

The thickness of the volume beneath the surface. The value is given in the coordinate space of the mesh. If the value is 0 the material is thin-walled. Only applicable to PBR shading if transmissive parameter is set to true. Default to 0.

attenuationDistance?: number

Density of the medium given as the average distance that light travels in the medium before interacting with a particle. The value is given in world space. Only applicable to PBR shading if transmissive parameter is set to true. Default to Infinity.

attenuationColor?: Vec3

The color as a Vec3 that white light turns into due to absorption when reaching the attenuation distance. Only applicable to PBR shading if transmissive parameter is set to true. Default to new Vec3(1).

baseColorTexture?: ShaderTextureDescriptor
normalTexture?: ShaderTextureDescriptor
emissiveTexture?: ShaderTextureDescriptor
occlusionTexture?: 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
shading?: ShadingModels

ShadingModels to use for lighting. Default to PBR.

vertexChunks?: AdditionalChunks

Additional WGSL chunks to add to the vertex shaders.

fragmentChunks?: AdditionalChunks

Additional WGSL chunks to add to the fragment shaders.