ShaderFlag

Edit

Built-in shader flags. Shaders can use both user-created specialization constants (or simply "flags") alongside the following built-in ones.

ValueDescription
pointSize The point size when drawing points with e.g. Pass:points, in pixels.
passColor Multiply the pass color (Pass:setColor) into the Color variable sent to the fragment shader.
materialColor Multiply the material color (Pass:setMaterial) into the Color variable sent to the fragment shader.
vertexColors Multiply the vertex color (from the VertexColor attribute) into the Color variable sent to the fragment shader.
uvTransform Apply the UV transform from the material to the VertexUV attribute.
alphaCutoff Enable alpha cutoff. When enabled, pixels will be discarded if their alpha is less than the alphaCutoff value of the material.
glow Enable glow. When enabled, the Material's glowTexture and glow property will get added to the color of the pixel returned by lovrmain. This is also called an "emissive" texture and is used for parts of an object that give off light, like an LED screen or the headlights on a car.
normalMap Use the normal map texture in the material to affect the normal direction of surfaces. This only affects the normal variable in the Surface struct.
vertexTangents Use the vertex tangents of the model for normal mapping. When this is false, tangents will be computed in the fragment shader from the vertex positions, UVs, and normal vector.
colorTexture Use the color texture of the material. If this is false, the color will only be derived from the Color variable (pass color, material color, vertex color), and the color texture will be ignored.
glowTexture Sample the glowTexture of the material when applying glow. Note that glow is only active when the glow flag is also enabled. If this is false, then materials will give off a constant glow using their glow property, and the glow texture is ignored.
metalnessTexture Sample the blue channel of the material's metalness texture when computing the metalness value of a Surface. When false, the surface will have a constant metalness based on the material's metalness property, instead of using a texture.
roughnessTexture Sample the green channel of the material's roughness texture when computing the roughness value of a Surface. When false, the surface will have a constant roughness based on the material's roughness property, instead of using a texture.
ambientOcclusion Sample the red channel of the occlusionTexture of the material to compute the occlusion property of a Surface. When false, the occlusion will be 1.0 (no occlusion).
clearcoatTexture Sample the red channel of the material's clearcoatTexture to compute the clearcoat property of a Surface. When false, only the clearcoat property of the material will be used, and the texture will be ignored.
tonemap Apply ACES tonemapping to the final color output. This will compress color channel values down to the 0-1 range while attempting to preserve detail in highlights and shadows.

Notes

The types and default values for the flags are:

Flag Type Default
pointSize float 1.0
passColor boolean true
materialColor boolean true
vertexColors boolean true
uvTransform boolean true
alphaCutoff boolean false
glow boolean false
normalMap boolean false
vertexTangents boolean true
colorTexture boolean true
glowTexture boolean true
metalnessTexture boolean true
roughnessTexture boolean true
ambientOcclusion boolean true
clearcoatTexture boolean false
tonemap boolean false

See also