MaterialBuilder
MaterialBuilder compiles Filament material source code into binary packages.
MaterialBuilder takes high-level material definitions and generates optimized shaders for multiple backends (OpenGL, Vulkan, Metal, WebGPU). The resulting MaterialPackage can be loaded by Filament's Material system.
Initialization: Call Filamat.init() before using MaterialBuilder. Call shutdown() when finished.
Compilation: Configure material properties using methods like name(), shading(), blendingMode(), etc., then call build() to generate the package.
See also
MaterialBuilder compiles Filament material source code into binary packages.
MaterialBuilder takes high-level material definitions and generates optimized shaders for multiple backends (OpenGL, Vulkan, Metal, WebGPU). The resulting MaterialPackage can be loaded by Filament's Material system.
Initialization: Call Filamat.init() before using MaterialBuilder. Call shutdown() when finished.
Compilation: Configure material properties using methods like name(), shading(), blendingMode(), etc., then call build() to generate the package.
See also
MaterialBuilder compiles Filament material source code into binary packages.
MaterialBuilder takes high-level material definitions and generates optimized shaders for multiple backends (OpenGL, Vulkan, Metal, WebGPU). The resulting MaterialPackage can be loaded by Filament's Material system.
Initialization: Call Filamat.init() before using MaterialBuilder. Call shutdown() when finished.
Compilation: Configure material properties using methods like name(), shading(), blendingMode(), etc., then call build() to generate the package.
See also
MaterialBuilder compiles Filament material source code into binary packages.
MaterialBuilder takes high-level material definitions and generates optimized shaders for multiple backends (OpenGL, Vulkan, Metal, WebGPU). The resulting MaterialPackage can be loaded by Filament's Material system.
Initialization: Call Filamat.init() before using MaterialBuilder. Call shutdown() when finished.
Compilation: Configure material properties using methods like name(), shading(), blendingMode(), etc., then call build() to generate the package.
See also
MaterialBuilder compiles Filament material source code into binary packages.
MaterialBuilder takes high-level material definitions and generates optimized shaders for multiple backends (OpenGL, Vulkan, Metal, WebGPU). The resulting MaterialPackage can be loaded by Filament's Material system.
Initialization: Call Filamat.init() before using MaterialBuilder. Call shutdown() when finished.
Compilation: Configure material properties using methods like name(), shading(), blendingMode(), etc., then call build() to generate the package.
See also
Constructors
Types
Blending modes determine how material color combines with background color.
Blending modes determine how material color combines with background color.
Blending modes determine how material color combines with background color.
Blending modes determine how material color combines with background color.
Blending modes determine how material color combines with background color.
Which triangle faces are culled before rasterization.
Which triangle faces are culled before rasterization.
Which triangle faces are culled before rasterization.
Which triangle faces are culled before rasterization.
Which triangle faces are culled before rasterization.
Vertex attribute interpolation in the fragment shader.
Vertex attribute interpolation in the fragment shader.
Vertex attribute interpolation in the fragment shader.
Vertex attribute interpolation in the fragment shader.
Vertex attribute interpolation in the fragment shader.
Which pipeline stage the material targets.
Which pipeline stage the material targets.
Which pipeline stage the material targets.
Which pipeline stage the material targets.
Which pipeline stage the material targets.
Shader optimization level applied at compile time.
Shader optimization level applied at compile time.
Shader optimization level applied at compile time.
Shader optimization level applied at compile time.
Shader optimization level applied at compile time.
Precision level for numeric parameters.
Precision level for numeric parameters.
Precision level for numeric parameters.
Precision level for numeric parameters.
Precision level for numeric parameters.
Platform class to generate shaders for.
Platform class to generate shaders for.
Platform class to generate shaders for.
Platform class to generate shaders for.
Platform class to generate shaders for.
Source of reflections for the material.
Source of reflections for the material.
Source of reflections for the material.
Source of reflections for the material.
Source of reflections for the material.
Source of refracted light for refractive materials.
Source of refracted light for refractive materials.
Source of refracted light for refractive materials.
Source of refracted light for refractive materials.
Source of refracted light for refractive materials.
Geometry model used to compute refraction.
Geometry model used to compute refraction.
Geometry model used to compute refraction.
Geometry model used to compute refraction.
Geometry model used to compute refraction.
Data format for sampler parameters.
Data format for sampler parameters.
Data format for sampler parameters.
Data format for sampler parameters.
Data format for sampler parameters.
Sampler types for texture parameters.
Sampler types for texture parameters.
Sampler types for texture parameters.
Sampler types for texture parameters.
Sampler types for texture parameters.
Shading model determines how light interacts with the material surface.
Shading model determines how light interacts with the material surface.
Shading model determines how light interacts with the material surface.
Shading model determines how light interacts with the material surface.
Shading model determines how light interacts with the material surface.
How ambient occlusion is applied to specular indirect lighting.
How ambient occlusion is applied to specular indirect lighting.
How ambient occlusion is applied to specular indirect lighting.
How ambient occlusion is applied to specular indirect lighting.
How ambient occlusion is applied to specular indirect lighting.
Graphics API(s) to generate shaders for.
Graphics API(s) to generate shaders for.
Graphics API(s) to generate shaders for.
Graphics API(s) to generate shaders for.
Graphics API(s) to generate shaders for.
How transparent objects are rendered (BlendingMode.TRANSPARENT/BlendingMode.FADE only).
How transparent objects are rendered (BlendingMode.TRANSPARENT/BlendingMode.FADE only).
How transparent objects are rendered (BlendingMode.TRANSPARENT/BlendingMode.FADE only).
How transparent objects are rendered (BlendingMode.TRANSPARENT/BlendingMode.FADE only).
How transparent objects are rendered (BlendingMode.TRANSPARENT/BlendingMode.FADE only).
Uniform variable types in material parameters.
Uniform variable types in material parameters.
Uniform variable types in material parameters.
Uniform variable types in material parameters.
Uniform variable types in material parameters.
Custom vertex attribute variable slots.
Custom vertex attribute variable slots.
Custom vertex attribute variable slots.
Custom vertex attribute variable slots.
Custom vertex attribute variable slots.
Coordinate space the vertex shader's material() output is expressed in.
Coordinate space the vertex shader's material() output is expressed in.
Coordinate space the vertex shader's material() output is expressed in.
Coordinate space the vertex shader's material() output is expressed in.
Coordinate space the vertex shader's material() output is expressed in.
Functions
Converts fragment alpha to MSAA coverage; smoother BlendingMode.MASKED edges under MSAA.
Converts fragment alpha to MSAA coverage; smoother BlendingMode.MASKED edges under MSAA.
Converts fragment alpha to MSAA coverage; smoother BlendingMode.MASKED edges under MSAA.
Converts fragment alpha to MSAA coverage; smoother BlendingMode.MASKED edges under MSAA.
Converts fragment alpha to MSAA coverage; smoother BlendingMode.MASKED edges under MSAA.
Sets how the material blends with the render target (BlendingMode.OPAQUE by default).
Sets how the material blends with the render target (BlendingMode.OPAQUE by default).
Sets how the material blends with the render target (BlendingMode.OPAQUE by default).
Sets how the material blends with the render target (BlendingMode.OPAQUE by default).
Sets how the material blends with the render target (BlendingMode.OPAQUE by default).
Compiles the material and returns the resulting package (check isValid before use).
Compiles the material and returns the resulting package (check isValid before use).
Compiles the material and returns the resulting package (check isValid before use).
Compiles the material and returns the resulting package (check isValid before use).
Compiles the material and returns the resulting package (check isValid before use).
Makes the clear coat layer's IOR affect the base layer (physically correct; default: true).
Makes the clear coat layer's IOR affect the base layer (physically correct; default: true).
Makes the clear coat layer's IOR affect the base layer (physically correct; default: true).
Makes the clear coat layer's IOR affect the base layer (physically correct; default: true).
Makes the clear coat layer's IOR affect the base layer (physically correct; default: true).
Enables colored shadow penumbras for this material's transparent shadows.
Enables colored shadow penumbras for this material's transparent shadows.
Enables colored shadow penumbras for this material's transparent shadows.
Enables colored shadow penumbras for this material's transparent shadows.
Enables colored shadow penumbras for this material's transparent shadows.
Enables/disables writes to the color buffer (default: true).
Enables/disables writes to the color buffer (default: true).
Enables/disables writes to the color buffer (default: true).
Enables/disables writes to the color buffer (default: true).
Enables/disables writes to the color buffer (default: true).
Sets face culling (CullingMode.BACK by default).
Sets face culling (CullingMode.BACK by default).
Sets face culling (CullingMode.BACK by default).
Sets face culling (CullingMode.BACK by default).
Sets face culling (CullingMode.BACK by default).
Enables custom surface shading: the material provides its own surfaceShading() function.
Enables custom surface shading: the material provides its own surfaceShading() function.
Enables custom surface shading: the material provides its own surfaceShading() function.
Enables custom surface shading: the material provides its own surfaceShading() function.
Enables custom surface shading: the material provides its own surfaceShading() function.
Enables/disables depth testing (default: true).
Enables/disables depth testing (default: true).
Enables/disables depth testing (default: true).
Enables/disables depth testing (default: true).
Enables/disables depth testing (default: true).
Enables/disables writes to the depth buffer (default: true, except for blended modes).
Enables/disables writes to the depth buffer (default: true, except for blended modes).
Enables/disables writes to the depth buffer (default: true, except for blended modes).
Enables/disables writes to the depth buffer (default: true, except for blended modes).
Enables/disables writes to the depth buffer (default: true, except for blended modes).
Renders both faces and flips the normal on back faces; implies CullingMode.NONE.
Renders both faces and flips the normal on back faces; implies CullingMode.NONE.
Renders both faces and flips the normal on back faces; implies CullingMode.NONE.
Renders both faces and flips the normal on back faces; implies CullingMode.NONE.
Renders both faces and flips the normal on back faces; implies CullingMode.NONE.
Flips the V texture coordinate at compile time (default: true, matching Filament's convention).
Flips the V texture coordinate at compile time (default: true, matching Filament's convention).
Flips the V texture coordinate at compile time (default: true, matching Filament's convention).
Flips the V texture coordinate at compile time (default: true, matching Filament's convention).
Flips the V texture coordinate at compile time (default: true, matching Filament's convention).
Sets the interpolation quality of the shading normal (default: SMOOTH).
Sets the interpolation quality of the shading normal (default: SMOOTH).
Sets the interpolation quality of the shading normal (default: SMOOTH).
Sets the interpolation quality of the shading normal (default: SMOOTH).
Sets the interpolation quality of the shading normal (default: SMOOTH).
Sets the alpha cutoff for BlendingMode.MASKED (default: 0.4).
Sets the alpha cutoff for BlendingMode.MASKED (default: 0.4).
Sets the alpha cutoff for BlendingMode.MASKED (default: 0.4).
Sets the alpha cutoff for BlendingMode.MASKED (default: 0.4).
Sets the alpha cutoff for BlendingMode.MASKED (default: 0.4).
Sets the fragment-stage material code: a GLSL void material(inout MaterialInputs) body.
Sets the fragment-stage material code: a GLSL void material(inout MaterialInputs) body.
Sets the fragment-stage material code: a GLSL void material(inout MaterialInputs) body.
Sets the fragment-stage material code: a GLSL void material(inout MaterialInputs) body.
Sets the fragment-stage material code: a GLSL void material(inout MaterialInputs) body.
Sets the material domain (MaterialDomain.SURFACE by default).
Sets the material domain (MaterialDomain.SURFACE by default).
Sets the material domain (MaterialDomain.SURFACE by default).
Sets the material domain (MaterialDomain.SURFACE by default).
Sets the material domain (MaterialDomain.SURFACE by default).
Sets the vertex-stage material code: a GLSL void materialVertex(inout MaterialVertexInputs) body.
Sets the vertex-stage material code: a GLSL void materialVertex(inout MaterialVertexInputs) body.
Sets the vertex-stage material code: a GLSL void materialVertex(inout MaterialVertexInputs) body.
Sets the vertex-stage material code: a GLSL void materialVertex(inout MaterialVertexInputs) body.
Sets the vertex-stage material code: a GLSL void materialVertex(inout MaterialVertexInputs) body.
Simulates extra light bounces in occluded areas to reduce over-darkening from AO.
Simulates extra light bounces in occluded areas to reduce over-darkening from AO.
Simulates extra light bounces in occluded areas to reduce over-darkening from AO.
Simulates extra light bounces in occluded areas to reduce over-darkening from AO.
Simulates extra light bounces in occluded areas to reduce over-darkening from AO.
Sets the material's name (shown in tooling and debug output).
Sets the material's name (shown in tooling and debug output).
Sets the material's name (shown in tooling and debug output).
Sets the material's name (shown in tooling and debug output).
Sets the material's name (shown in tooling and debug output).
Sets the shader optimization level (Optimization.PERFORMANCE by default).
Sets the shader optimization level (Optimization.PERFORMANCE by default).
Sets the shader optimization level (Optimization.PERFORMANCE by default).
Sets the shader optimization level (Optimization.PERFORMANCE by default).
Sets the shader optimization level (Optimization.PERFORMANCE by default).
Selects the platform class to generate shaders for (Platform.ALL to cover everything).
Selects the platform class to generate shaders for (Platform.ALL to cover everything).
Selects the platform class to generate shaders for (Platform.ALL to cover everything).
Selects the platform class to generate shaders for (Platform.ALL to cover everything).
Selects the platform class to generate shaders for (Platform.ALL to cover everything).
Sets how the post-lighting color blends with the lit result.
Sets how the post-lighting color blends with the lit result.
Sets how the post-lighting color blends with the lit result.
Sets how the post-lighting color blends with the lit result.
Sets how the post-lighting color blends with the lit result.
Sets where reflections are sampled from (ReflectionMode.DEFAULT by default).
Sets where reflections are sampled from (ReflectionMode.DEFAULT by default).
Sets where reflections are sampled from (ReflectionMode.DEFAULT by default).
Sets where reflections are sampled from (ReflectionMode.DEFAULT by default).
Sets where reflections are sampled from (ReflectionMode.DEFAULT by default).
Sets where refracted light is sampled from (RefractionMode.NONE by default).
Sets where refracted light is sampled from (RefractionMode.NONE by default).
Sets where refracted light is sampled from (RefractionMode.NONE by default).
Sets where refracted light is sampled from (RefractionMode.NONE by default).
Sets where refracted light is sampled from (RefractionMode.NONE by default).
Sets the refraction geometry model (RefractionType.SOLID by default).
Sets the refraction geometry model (RefractionType.SOLID by default).
Sets the refraction geometry model (RefractionType.SOLID by default).
Sets the refraction geometry model (RefractionType.SOLID by default).
Sets the refraction geometry model (RefractionType.SOLID by default).
Requires the given vertex attribute to be present in rendered geometry (e.g. UV1, COLOR).
Requires the given vertex attribute to be present in rendered geometry (e.g. UV1, COLOR).
Requires the given vertex attribute to be present in rendered geometry (e.g. UV1, COLOR).
Requires the given vertex attribute to be present in rendered geometry (e.g. UV1, COLOR).
Requires the given vertex attribute to be present in rendered geometry (e.g. UV1, COLOR).
Declares a texture sampler parameter, settable via MaterialInstance.setParameter.
Declares a texture sampler parameter, settable via MaterialInstance.setParameter.
Declares a texture sampler parameter, settable via MaterialInstance.setParameter.
Declares a texture sampler parameter, settable via MaterialInstance.setParameter.
Declares a texture sampler parameter, settable via MaterialInstance.setParameter.
Sets the shading model (LIT, UNLIT, SUBSURFACE, CLOTH, SPECULAR_GLOSSINESS).
Sets the shading model (LIT, UNLIT, SUBSURFACE, CLOTH, SPECULAR_GLOSSINESS).
Sets the shading model (LIT, UNLIT, SUBSURFACE, CLOTH, SPECULAR_GLOSSINESS).
Sets the shading model (LIT, UNLIT, SUBSURFACE, CLOTH, SPECULAR_GLOSSINESS).
Sets the shading model (LIT, UNLIT, SUBSURFACE, CLOTH, SPECULAR_GLOSSINESS).
UNLIT only: multiplies the final color by the shadowing factor, for shadow-receiver planes.
UNLIT only: multiplies the final color by the shadowing factor, for shadow-receiver planes.
UNLIT only: multiplies the final color by the shadowing factor, for shadow-receiver planes.
UNLIT only: multiplies the final color by the shadowing factor, for shadow-receiver planes.
UNLIT only: multiplies the final color by the shadowing factor, for shadow-receiver planes.
Sets how AO is applied to specular lighting (SpecularAmbientOcclusion.NONE by default).
Sets how AO is applied to specular lighting (SpecularAmbientOcclusion.NONE by default).
Sets how AO is applied to specular lighting (SpecularAmbientOcclusion.NONE by default).
Sets how AO is applied to specular lighting (SpecularAmbientOcclusion.NONE by default).
Sets how AO is applied to specular lighting (SpecularAmbientOcclusion.NONE by default).
Reduces specular shimmering/aliasing on curved geometry (LIT models only).
Reduces specular shimmering/aliasing on curved geometry (LIT models only).
Reduces specular shimmering/aliasing on curved geometry (LIT models only).
Reduces specular shimmering/aliasing on curved geometry (LIT models only).
Reduces specular shimmering/aliasing on curved geometry (LIT models only).
Clamping threshold of the specular AA roughness increase, in [0, 1] (default: 0.2).
Clamping threshold of the specular AA roughness increase, in [0, 1] (default: 0.2).
Clamping threshold of the specular AA roughness increase, in [0, 1] (default: 0.2).
Clamping threshold of the specular AA roughness increase, in [0, 1] (default: 0.2).
Clamping threshold of the specular AA roughness increase, in [0, 1] (default: 0.2).
Screen-space variance of the specular AA filter kernel, in [0, 1] (default: 0.15).
Screen-space variance of the specular AA filter kernel, in [0, 1] (default: 0.15).
Screen-space variance of the specular AA filter kernel, in [0, 1] (default: 0.15).
Screen-space variance of the specular AA filter kernel, in [0, 1] (default: 0.15).
Screen-space variance of the specular AA filter kernel, in [0, 1] (default: 0.15).
Selects the graphics API(s) to generate shaders for; fewer APIs → smaller package.
Selects the graphics API(s) to generate shaders for; fewer APIs → smaller package.
Selects the graphics API(s) to generate shaders for; fewer APIs → smaller package.
Selects the graphics API(s) to generate shaders for; fewer APIs → smaller package.
Selects the graphics API(s) to generate shaders for; fewer APIs → smaller package.
Sets the transparency rendering strategy (TransparencyMode.DEFAULT by default).
Sets the transparency rendering strategy (TransparencyMode.DEFAULT by default).
Sets the transparency rendering strategy (TransparencyMode.DEFAULT by default).
Sets the transparency rendering strategy (TransparencyMode.DEFAULT by default).
Sets the transparency rendering strategy (TransparencyMode.DEFAULT by default).
Makes this transparent material cast (dithered) transparent shadows.
Makes this transparent material cast (dithered) transparent shadows.
Makes this transparent material cast (dithered) transparent shadows.
Makes this transparent material cast (dithered) transparent shadows.
Makes this transparent material cast (dithered) transparent shadows.
Declares a uniform parameter with an explicit shader precision.
Declares a uniform parameter with an explicit shader precision.
Declares a uniform parameter with an explicit shader precision.
Declares a uniform parameter with an explicit shader precision.
Declares a uniform parameter with an explicit shader precision.
Declares a uniform array parameter of size elements.
Declares a uniform array parameter with an explicit shader precision.
Declares a uniform array parameter of size elements.
Declares a uniform array parameter with an explicit shader precision.
Declares a uniform array parameter of size elements.
Declares a uniform array parameter with an explicit shader precision.
Declares a uniform array parameter of size elements.
Declares a uniform array parameter with an explicit shader precision.
Declares a uniform array parameter of size elements.
Declares a uniform array parameter with an explicit shader precision.
Uses the legacy (non-CPU-skinning-aware) morph target implementation.
Uses the legacy (non-CPU-skinning-aware) morph target implementation.
Uses the legacy (non-CPU-skinning-aware) morph target implementation.
Uses the legacy (non-CPU-skinning-aware) morph target implementation.
Uses the legacy (non-CPU-skinning-aware) morph target implementation.
Names a custom interpolant (Variable slot) passed from the vertex to the fragment stage.
Names a custom interpolant (Variable slot) passed from the vertex to the fragment stage.
Names a custom interpolant (Variable slot) passed from the vertex to the fragment stage.
Names a custom interpolant (Variable slot) passed from the vertex to the fragment stage.
Names a custom interpolant (Variable slot) passed from the vertex to the fragment stage.
Bitmask of shader variants to exclude from compilation, shrinking the package.
Bitmask of shader variants to exclude from compilation, shrinking the package.
Bitmask of shader variants to exclude from compilation, shrinking the package.
Bitmask of shader variants to exclude from compilation, shrinking the package.
Bitmask of shader variants to exclude from compilation, shrinking the package.
Sets the coordinate space of the vertex output (VertexDomain.OBJECT by default).
Sets the coordinate space of the vertex output (VertexDomain.OBJECT by default).
Sets the coordinate space of the vertex output (VertexDomain.OBJECT by default).
Sets the coordinate space of the vertex output (VertexDomain.OBJECT by default).
Sets the coordinate space of the vertex output (VertexDomain.OBJECT by default).