Class PBRMetallicRoughnessBlock
Hierarchy (View Summary)
- NodeMaterialBlock
- PBRMetallicRoughnessBlock
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
-
Create a new ReflectionBlock
Parameters
- name: string
defines the block name
Returns PBRMetallicRoughnessBlock
- name: string
Properties
alpha Test Cutoff
Defines the alpha limits in alpha test mode.
base Diffuse Model
Base Diffuse Model
comments
Gets or sets the comments associated with this block
debug Factor
As the default viewing range might not be enough (if the ambient is really small for instance) You can use the factor to better multiply the final value.
debug Limit
Specify from where on screen the debug mode should start. The value goes from -1 (full screen) to 1 (not visible) It helps with side by side comparison against the final render This defaults to 0
debug Mode
Defines the material debug mode. It helps seeing only some components of the material while troubleshooting.
direct Intensity
Intensity of the direct lights e.g. the four lights available in your scene. This impacts both the direct diffuse and specular highlights.
enable Specular Anti Aliasing
Enables specular anti aliasing in the PBR shader. It will both interacts on the Geometry for analytical and IBL lighting. It also prefilter the roughness map based on the bump values.
environment Intensity
Intensity of the environment e.g. how much the environment will light the object either through harmonics for rough material or through the reflection for shiny ones.
force Normal Forward
Force normal to face away from face.
generate Only Fragment Code
Indicates that no code should be generated in the vertex shader. Can be useful in some specific circumstances (like when doing ray marching for eg)
inputs Are Exclusive
Gets or sets a boolean indicating that only one input can be connected at a time
light
Gets or sets the light associated with this block
light Falloff
Defines the falloff type used in this material. It by default is Physical.
on Code Is Ready Observable
Observable raised when the block code is ready (if the code loading is async)
real Time Filtering
Enables realtime filtering on the texture.
real Time Filtering Quality
Quality switch for realtime filtering
specular Intensity
This is a special control allowing the reduction of the specular highlights coming from the four lights of the scene. Those highlights may not be needed in full environment lighting.
unique Id
Gets or sets the unique id of the node
unlit
If set to true, no lighting calculations will be applied.
use Alpha Blending
Specifies that alpha blending should be used
use Alpha Test
Specifies that alpha test should be used
use Energy Conservation
Defines if the material uses energy conservation.
use Horizon Occlusion
This parameters will enable/disable Horizon occlusion to prevent normal maps to look shiny when the normal makes the reflect vector face the model (under horizon).
use Radiance Occlusion
This parameters will enable/disable radiance occlusion by preventing the radiance to lit too much the area relying on ambient texture to define their ambient occlusion.
use Radiance Over Alpha
Specifies that the material will keeps the reflection highlights over a transparent surface (only the most luminous ones). A car glass is a good example of that. When the street lights reflects on it you can not see what is behind.
use Specular Over Alpha
Specifies that the material will keeps the specular highlights over a transparent surface (only the most luminous ones). A car glass is a good example of that. When sun reflects on it you can not see what is behind.
visible In Inspector
Gets or sets a boolean indicating that this input can be edited in the Inspector (false by default)
visible On Frame
Gets or sets a boolean indicating that this input can be edited from a collapsed frame
Accessors
alpha
-
Gets the alpha output component
Returns NodeMaterialConnectionPoint
ambient Clr
-
Gets the ambient output component
Returns NodeMaterialConnectionPoint
ambient Color
-
Gets the ambient color input component
Returns NodeMaterialConnectionPoint
ambient Occ
-
Gets the ambient occlusion input component
Returns NodeMaterialConnectionPoint
anisotropy
-
Gets the anisotropy object parameters
Returns NodeMaterialConnectionPoint
base Color
-
Gets the base color input component
Returns NodeMaterialConnectionPoint
build Id
-
get buildId(): number
Gets or sets the build Id
Returns number
-
set buildId(value: number): void
Parameters
- value: number
Returns void
camera Position
-
Gets the camera position input component
Returns NodeMaterialConnectionPoint
clearcoat
-
Gets the clear coat object parameters
Returns NodeMaterialConnectionPoint
clearcoat Dir
-
Gets the clear coat output component
Returns NodeMaterialConnectionPoint
clearcoat Ind
-
Gets the indirect clear coat output component
Returns NodeMaterialConnectionPoint
code Is Ready
-
get codeIsReady(): boolean
Gets a boolean indicating that this block has is code ready to be used
Returns boolean
diffuse Dir
-
Gets the diffuse output component
Returns NodeMaterialConnectionPoint
diffuse Ind
-
Gets the indirect diffuse output component
Returns NodeMaterialConnectionPoint
index Of Refraction
-
Gets the index of refraction input component
Returns NodeMaterialConnectionPoint
inputs
-
Gets the list of input points
Returns NodeMaterialConnectionPoint[]
iridescence
-
Gets the iridescence object parameters
Returns NodeMaterialConnectionPoint
is Final Merger
-
get isFinalMerger(): boolean
Gets a boolean indicating that this block is an end block (e.g. it is generating a system value)
Returns boolean
is Input
-
get isInput(): boolean
Gets a boolean indicating that this block is an input (e.g. it sends data to the shader)
Returns boolean
is Loop
-
get isLoop(): boolean
Gets a boolean indicating if this block is a loop
Returns boolean
is Teleport In
-
get isTeleportIn(): boolean
Gets a boolean indicating if this block is a teleport in
Returns boolean
is Teleport Out
-
get isTeleportOut(): boolean
Gets a boolean indicating if this block is a teleport out
Returns boolean
is Unique
-
get isUnique(): boolean
Gets a boolean indicating that this block can only be used once per NodeMaterial
Returns boolean
lighting
-
Gets the global lighting output component
Returns NodeMaterialConnectionPoint
metallic
-
Gets the metallic input component
Returns NodeMaterialConnectionPoint
name
-
get name(): string
Gets the name of the block
Returns string
-
set name(newName: string): void
Sets the name of the block. Will check if the name is valid.
Parameters
- newName: string
Returns void
opacity
-
Gets the opacity input component
Returns NodeMaterialConnectionPoint
outputs
-
Gets the list of output points
Returns NodeMaterialConnectionPoint[]
perturbed Normal
-
Gets the perturbed normal input component
Returns NodeMaterialConnectionPoint
reflection
-
Gets the reflection object parameters
Returns NodeMaterialConnectionPoint
refraction
-
Gets the refraction output component
Returns NodeMaterialConnectionPoint
roughness
-
Gets the roughness input component
Returns NodeMaterialConnectionPoint
shadow
-
Gets the shadow output component
Returns NodeMaterialConnectionPoint
sheen
-
Gets the sheen object parameters
Returns NodeMaterialConnectionPoint
sheen Dir
-
Gets the sheen output component
Returns NodeMaterialConnectionPoint
sheen Ind
-
Gets the indirect sheen output component
Returns NodeMaterialConnectionPoint
specular Dir
-
Gets the specular output component
Returns NodeMaterialConnectionPoint
specular Ind
-
Gets the indirect specular output component
Returns NodeMaterialConnectionPoint
subsurface
-
Gets the sub surface object parameters
Returns NodeMaterialConnectionPoint
target
-
Gets or sets the target of the block
Returns NodeMaterialBlockTargets
-
Parameters
- value: NodeMaterialBlockTargets
Returns void
view
-
Gets the view matrix parameter
Returns NodeMaterialConnectionPoint
will Be Generated Into Vertex Shader From Fragment Shader
-
get willBeGeneratedIntoVertexShaderFromFragmentShader(): boolean
Gets a boolean indicating that the code of this block will be promoted to vertex shader even if connected to fragment output
Returns boolean
world Normal
-
Gets the world normal input component
Returns NodeMaterialConnectionPoint
world Position
-
Gets the world position input component
Returns NodeMaterialConnectionPoint
Methods
_ deserialize
-
Deserializes the block
Parameters
- serializationObject: any
the object to deserialize from
- scene: Scene
the scene to deserialize in
- rootUrl: string
the root URL for assets
Returns void
- serializationObject: any
auto Configure
-
autoConfigure(
material: NodeMaterial,
additionalFilteringInfo?: (node: NodeMaterialBlock) => boolean,
): voidAuto configure the block based on the material
Parameters
- material: NodeMaterial
the node material
- additionalFilteringInfo: (node: NodeMaterialBlock) => boolean = ...
additional filtering info
Returns void
- material: NodeMaterial
bind
-
Bind data to effect
Parameters
- effect: Effect
the effect to bind data to
- nodeMaterial: NodeMaterial
the node material
Optionalmesh: Meshthe mesh to bind data for
Returns void
- effect: Effect
build
-
Compile the current node and generate the shader code
Parameters
- state: NodeMaterialBuildState
defines the current compilation state (uniforms, samplers, current string)
- activeBlocks: NodeMaterialBlock[]
defines the list of active blocks (i.e. blocks to compile)
Returns boolean
true if already built
- state: NodeMaterialBuildState
clone
-
Clone the current block to a new identical block
Parameters
- scene: Scene
defines the hosting scene
- rootUrl: string = ""
defines the root URL to use to load textures and relative dependencies
Returns NodeMaterialBlock | null
a copy of the current block
- scene: Scene
connect To
-
connectTo(
other: NodeMaterialBlock,
options?: { input?: string; output?: string; outputSwizzle?: string },
): PBRMetallicRoughnessBlock | undefinedConnect current block with another block
Parameters
- other: NodeMaterialBlock
defines the block to connect with
Optionaloptions: { input?: string; output?: string; outputSwizzle?: string }define the various options to help pick the right connections
Returns PBRMetallicRoughnessBlock | undefined
the current block
- other: NodeMaterialBlock
dispose
-
Release resources
Returns void
get Class Name
-
Gets the current class name
Returns string
the class name
get First Available Input
-
getFirstAvailableInput(
forOutput?: Nullable<NodeMaterialConnectionPoint>,
): NodeMaterialConnectionPoint | nullWill return the first available input e.g. the first one which is not an uniform or an attribute
Parameters
- forOutput: Nullable<NodeMaterialConnectionPoint> = null
defines an optional connection point to check compatibility with
Returns NodeMaterialConnectionPoint | null
the first available input or null
- forOutput: Nullable<NodeMaterialConnectionPoint> = null
get First Available Output
-
getFirstAvailableOutput(
forBlock?: Nullable<NodeMaterialBlock>,
): NodeMaterialConnectionPoint | nullWill return the first available output e.g. the first one which is not yet connected and not a varying
Parameters
- forBlock: Nullable<NodeMaterialBlock> = null
defines an optional block to check compatibility with
Returns NodeMaterialConnectionPoint | null
the first available input or null
- forBlock: Nullable<NodeMaterialBlock> = null
get Input By Name
-
Find an input by its name
Parameters
- name: string
defines the name of the input to look for
Returns NodeMaterialConnectionPoint | null
the input or null if not found
- name: string
get Output By Name
-
Find an output by its name
Parameters
- name: string
defines the name of the output to look for
Returns NodeMaterialConnectionPoint | null
the output or null if not found
- name: string
get Sibling Output
-
Gets the sibling of the given output
Parameters
- current: NodeMaterialConnectionPoint
defines the current output
Returns NodeMaterialConnectionPoint | null
the next output in the list or null
- current: NodeMaterialConnectionPoint
initialize
-
Initialize the block and prepare the context for build
Parameters
- state: NodeMaterialBuildState
defines the state that will be used for the build
Returns void
- state: NodeMaterialBuildState
initialize Defines
-
Initialize defines for shader compilation
Parameters
- defines: NodeMaterialDefines
defines the material defines to update
Returns void
- defines: NodeMaterialDefines
is An Ancestor Of
-
Checks if the current block is an ancestor of a given block
Parameters
- block: NodeMaterialBlock
defines the potential descendant block to check
Returns boolean
true if block is a descendant
- block: NodeMaterialBlock
is Connected In Fragment Shader
-
Gets a boolean indicating that this connection will be used in the fragment shader
Returns boolean
true if connected in fragment shader
is Ready
-
Checks if the block is ready
Parameters
- mesh: AbstractMesh
the mesh to check
- nodeMaterial: NodeMaterial
the node material
- defines: NodeMaterialDefines
the list of defines
Returns boolean
true if ready
- mesh: AbstractMesh
prepare Defines
-
prepareDefines(
defines: NodeMaterialDefines,
nodeMaterial: NodeMaterial,
mesh?: AbstractMesh,
): voidPrepare the list of defines
Parameters
- defines: NodeMaterialDefines
the list of defines to update
- nodeMaterial: NodeMaterial
the node material
Optionalmesh: AbstractMeshthe mesh to prepare defines for
Returns void
- defines: NodeMaterialDefines
provide Fallbacks
-
Add potential fallbacks if shader compilation fails
Parameters
- fallbacks: EffectFallbacks
defines the current prioritized list of fallbacks
Optionalmesh: AbstractMeshdefines the mesh to be rendered
Returns void
- fallbacks: EffectFallbacks
register Input
-
registerInput(
name: string,
type: NodeMaterialBlockConnectionPointTypes,
isOptional?: boolean,
target?: NodeMaterialBlockTargets,
point?: NodeMaterialConnectionPoint,
): PBRMetallicRoughnessBlockRegister a new input. Must be called inside a block constructor
Parameters
- name: string
defines the connection point name
- type: NodeMaterialBlockConnectionPointTypes
defines the connection point type
- isOptional: boolean = false
defines a boolean indicating that this input can be omitted
Optionaltarget: NodeMaterialBlockTargetsdefines the target to use to limit the connection point (will be VertexAndFragment by default)
Optionalpoint: NodeMaterialConnectionPointan already created connection point. If not provided, create a new one
Returns PBRMetallicRoughnessBlock
the current block
- name: string
register Output
-
registerOutput(
name: string,
type: NodeMaterialBlockConnectionPointTypes,
target?: NodeMaterialBlockTargets,
point?: NodeMaterialConnectionPoint,
): PBRMetallicRoughnessBlockRegister a new output. Must be called inside a block constructor
Parameters
- name: string
defines the connection point name
- type: NodeMaterialBlockConnectionPointTypes
defines the connection point type
Optionaltarget: NodeMaterialBlockTargetsdefines the target to use to limit the connection point (will be VertexAndFragment by default)
Optionalpoint: NodeMaterialConnectionPointan already created connection point. If not provided, create a new one
Returns PBRMetallicRoughnessBlock
the current block
- name: string
replace Repeatable Content
-
replaceRepeatableContent(
vertexShaderState: NodeMaterialBuildState,
defines: NodeMaterialDefines,
mesh?: AbstractMesh,
): voidFunction called when a block is declared as repeatable content generator
Parameters
- vertexShaderState: NodeMaterialBuildState
defines the current compilation state for the vertex shader
- defines: NodeMaterialDefines
defines the material defines to update
Optionalmesh: AbstractMeshdefines the mesh to be rendered
Returns void
- vertexShaderState: NodeMaterialBuildState
serialize
-
Serializes the block
Returns any
the serialized object
update Uniforms And Samples
-
updateUniformsAndSamples(
state: NodeMaterialBuildState,
nodeMaterial: NodeMaterial,
defines: NodeMaterialDefines,
uniformBuffers: string[],
): voidUpdate the uniforms and samples
Parameters
- state: NodeMaterialBuildState
the build state
- nodeMaterial: NodeMaterial
the node material
- defines: NodeMaterialDefines
the list of defines
- uniformBuffers: string[]
the uniform buffers
Returns void
- state: NodeMaterialBuildState
validate Block Name
-
Validates the new name for the block node.
Parameters
- newName: string
the new name to be given to the node.
Returns boolean
false if the name is a reserve word, else true.
- newName: string
Block used to implement the PBR metallic/roughness model
See
https://playground.babylonjs.com/#D8AK3Z#80