Class PbrShadingModel.Builder
- All Implemented Interfaces:
AutoCloseable
- Enclosing class:
PbrShadingModel
Builder for a PbrShadingModel.- Since:
- 2026.1
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the PBR shading model.voidclose()directionalLighting(boolean directional) Sets whether the map's configured light contributes direct lighting to PBR materials.protected voidfinalize()ignoreUnlitProperty(boolean ignoreUnlitProperty) Sets whether a material's unlit property is ignored so that PBR shading is still applied to it.imageBasedLighting(boolean imageBasedLighting) Sets whether PBR materials are lit by image-based lighting (IBL) from the map's environment map.lightIntensity(double lightIntensity) Sets the light intensity used for the PBR lighting, a linear multiplier on the resulting shading.metallic(double factor) Sets the metallic factor and offset applied to PBR materials.metallic(double factor, double offset) Sets the metallic factor and offset applied to PBR materials.roughness(double factor) Sets the roughness factor and offset applied to PBR materials.roughness(double factor, double offset) Sets the roughness factor and offset applied to PBR materials.
-
Constructor Details
-
Builder
Copy constructor.- Parameters:
other- the builder to copy.
-
-
Method Details
-
finalize
protected void finalize() -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
directionalLighting
Sets whether the map's configured light contributes direct lighting to PBR materials.This is optional. The default value is
true.- Parameters:
directional- whether the map's configured light contributes direct lighting to PBR materials.- Returns:
- this builder.
-
imageBasedLighting
Sets whether PBR materials are lit by image-based lighting (IBL) from the map's environment map.This is optional. The default value is
true. IBL only contributes when a reflection map is configured on the map (seeEnvironmentMapEffect). Set this tofalseto get the raw direct-only look.- Parameters:
imageBasedLighting- whether PBR materials are lit by image-based lighting.- Returns:
- this builder.
-
lightIntensity
@NotNull public PbrShadingModel.Builder lightIntensity(double lightIntensity) throws IllegalArgumentException Sets the light intensity used for the PBR lighting, a linear multiplier on the resulting shading.This is optional. The default value is
1, which leaves the shading unchanged. Values above1brighten the shading and values below1darken it:2is twice as bright and0.5is half as bright. A value of0removes the PBR light contribution entirely.- Parameters:
lightIntensity- the light intensity multiplier applied to PBR-shaded surfaces. Must not be negative.- Returns:
- this builder.
- Throws:
IllegalArgumentException- when the light intensity is negative.
-
metallic
Sets the metallic factor and offset applied to PBR materials.metallic = clamp(assetMetallic * factor + offset, 0, 1)
assetMetallicis the asset's own metallic: its material factor times any metallic-roughness texture. Setting the metallic is optional. Without it the factor is1and the offset is0, which leave the asset's own metallic unchanged.- Parameters:
factor- the factor by which the asset's metallic is multiplied.offset- the offset added after scaling by the factor. Defaults to0.- Returns:
- this builder.
-
metallic
Sets the metallic factor and offset applied to PBR materials.metallic = clamp(assetMetallic * factor + offset, 0, 1)
assetMetallicis the asset's own metallic: its material factor times any metallic-roughness texture. Setting the metallic is optional. Without it the factor is1and the offset is0, which leave the asset's own metallic unchanged.- Parameters:
factor- the factor by which the asset's metallic is multiplied.- Returns:
- this builder.
-
roughness
Sets the roughness factor and offset applied to PBR materials.roughness = clamp(assetRoughness * factor + offset, 0, 1)
assetRoughnessis the asset's own roughness: its material factor times any metallic-roughness texture. Setting the roughness is optional. Without it the factor is1and the offset is0, which leave the asset's own roughness unchanged.- Parameters:
factor- the factor by which the asset's roughness is multiplied.offset- the offset added after scaling by the factor. Defaults to0.- Returns:
- this builder.
-
roughness
Sets the roughness factor and offset applied to PBR materials.roughness = clamp(assetRoughness * factor + offset, 0, 1)
assetRoughnessis the asset's own roughness: its material factor times any metallic-roughness texture. Setting the roughness is optional. Without it the factor is1and the offset is0, which leave the asset's own roughness unchanged.- Parameters:
factor- the factor by which the asset's roughness is multiplied.- Returns:
- this builder.
-
ignoreUnlitProperty
Sets whether a material's unlit property is ignored so that PBR shading is still applied to it.This is optional. The default value is
false: a glTF material that carries theKHR_materials_unlitextension is left unshaded, showing only its base color regardless of the map's light. Set this totrueto ignore that extension and shade the material like any other PBR material, for example when the unlit property in the source data is not wanted.- Parameters:
ignoreUnlitProperty- whether a material's unlit property is ignored so that PBR shading is still applied to it.- Returns:
- this builder.
-
build
Builds the PBR shading model.- Returns:
- the built PBR shading model.
- Throws:
IllegalStateException- if both directional lighting and image-based lighting are disabled, as PBR shading then contributes nothing. UseSimpleShadingModel, or pass no shading model, to shade without either.
-