ReflectionBlock

Block used to implement the reflection module of the PBR material

Hierarchy

Index

Constructors

constructor

Find examples in Playground

Properties

comments

Find examples in Playground
comments: string

Gets or sets the comments associated with this block

forceIrradianceInFragment

Find examples in Playground
forceIrradianceInFragment: boolean

Force the shader to compute irradiance in the fragment shader in order to take bump in account.

inputsAreExclusive

Find examples in Playground
inputsAreExclusive: boolean

Gets or sets a boolean indicating that only one input can be connected at a time

name

Find examples in Playground
name: string

Gets or sets the name of the block

texture

Find examples in Playground

Gets or sets the texture associated with the node

uniqueId

Find examples in Playground
uniqueId: number

Gets or sets the unique id of the node

useSphericalHarmonics

Find examples in Playground
useSphericalHarmonics: boolean

Defines if the material uses spherical harmonics vs spherical polynomials for the diffuse part of the IBL.

Accessors

buildId

Find examples in Playground
  • get buildId(): number
  • set buildId(value: number): any
  • Gets or sets the build Id

    Returns number

  • Gets or sets the build Id

    Parameters

    • value: number

    Returns any

cameraPosition

Find examples in Playground

color

Find examples in Playground

hasTexture

Find examples in Playground
  • get hasTexture(): boolean
  • Returns true if the block has a texture (either its own texture or the environment texture from the scene, if set)

    Returns boolean

inputs

Find examples in Playground

isFinalMerger

Find examples in Playground
  • get isFinalMerger(): boolean
  • Gets a boolean indicating that this block is an end block (e.g. it is generating a system value)

    Returns boolean

isInput

Find examples in Playground
  • get isInput(): boolean
  • Gets a boolean indicating that this block is an input (e.g. it sends data to the shader)

    Returns boolean

isUnique

Find examples in Playground
  • get isUnique(): boolean
  • Gets a boolean indicating that this block can only be used once per NodeMaterial

    Returns boolean

outputs

Find examples in Playground

position

Find examples in Playground

reflection

Find examples in Playground

reflectionColor

Find examples in Playground
  • get reflectionColor(): string
  • Gets the reflection color (either the name of the variable if the color input is connected, else a default value)

    Returns string

target

Find examples in Playground

view

Find examples in Playground

world

Find examples in Playground

worldNormal

Find examples in Playground

worldPosition

Find examples in Playground

Methods

_deserialize

Find examples in Playground
  • _deserialize(serializationObject: any, scene: Scene, rootUrl: string): void

autoConfigure

Find examples in Playground

bind

Find examples in Playground

build

Find examples in Playground
  • 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

clone

Find examples in Playground
  • Clone the current block to a new identical block

    Parameters

    • scene: Scene

      defines the hosting scene

    • Optional rootUrl: string

      defines the root URL to use to load textures and relative dependencies

    Returns Nullable<NodeMaterialBlock>

    a copy of the current block

connectTo

Find examples in Playground
  • Connect current block with another block

    Parameters

    • other: NodeMaterialBlock

      defines the block to connect with

    • Optional options: object

      define the various options to help pick the right connections

      • Optional input?: string
      • Optional output?: string
      • Optional outputSwizzle?: string

    Returns this | undefined

    the current block

dispose

Find examples in Playground
  • dispose(): void

getClassName

Find examples in Playground
  • getClassName(): string

getCode

Find examples in Playground
  • Gets the main code of the block (fragment side)

    Parameters

    • state: NodeMaterialBuildState

      current state of the node material building

    • normalVarName: string

      name of the existing variable corresponding to the normal

    Returns string

    the shader code

getFirstAvailableInput

Find examples in Playground

getFirstAvailableOutput

Find examples in Playground

getInputByName

Find examples in Playground

getOutputByName

Find examples in Playground

getSiblingOutput

Find examples in Playground

handleFragmentSideCodeReflectionColor

Find examples in Playground
  • handleFragmentSideCodeReflectionColor(lodVarName?: string, swizzleLookupTexture?: string): string
  • Generates the reflection color code for the fragment code path

    Parameters

    • Optional lodVarName: string

      name of the lod variable

    • Optional swizzleLookupTexture: string

      swizzle to use for the final color variable

    Returns string

    the shader code

handleFragmentSideCodeReflectionCoords

Find examples in Playground
  • handleFragmentSideCodeReflectionCoords(worldNormalVarName: string, worldPos?: string, onlyReflectionVector?: boolean): string
  • Generates the reflection coords code for the fragment code path

    Parameters

    • worldNormalVarName: string

      name of the world normal variable

    • Optional worldPos: string

      name of the world position variable. If not provided, will use the world position connected to this block

    • Optional onlyReflectionVector: boolean

      if true, generates code only for the reflection vector computation, not for the reflection coordinates

    Returns string

    the shader code

handleFragmentSideInits

Find examples in Playground

handleVertexSide

Find examples in Playground

initialize

Find examples in Playground

initializeDefines

Find examples in Playground
  • initializeDefines(mesh: AbstractMesh, nodeMaterial: NodeMaterial, defines: NodeMaterialDefines, useInstances?: boolean): void
  • Initialize defines for shader compilation

    Parameters

    • mesh: AbstractMesh

      defines the mesh to be rendered

    • nodeMaterial: NodeMaterial

      defines the node material requesting the update

    • defines: NodeMaterialDefines

      defines the material defines to update

    • Optional useInstances: boolean

      specifies that instances should be used

    Returns void

isReady

Find examples in Playground
  • isReady(): boolean

prepareDefines

Find examples in Playground

provideFallbacks

Find examples in Playground

registerInput

Find examples in Playground
  • Register 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

    • Optional isOptional: boolean

      defines a boolean indicating that this input can be omitted

    • Optional target: NodeMaterialBlockTargets

      defines the target to use to limit the connection point (will be VertexAndFragment by default)

    • Optional point: NodeMaterialConnectionPoint

      an already created connection point. If not provided, create a new one

    Returns this

    the current block

registerOutput

Find examples in Playground

replaceRepeatableContent

Find examples in Playground
  • Function called when a block is declared as repeatable content generator

    Parameters

    • vertexShaderState: NodeMaterialBuildState

      defines the current compilation state for the vertex shader

    • fragmentShaderState: NodeMaterialBuildState

      defines the current compilation state for the fragment shader

    • mesh: AbstractMesh

      defines the mesh to be rendered

    • defines: NodeMaterialDefines

      defines the material defines to update

    Returns void

serialize

Find examples in Playground
  • serialize(): any

updateUniformsAndSamples

Find examples in Playground
  • Add uniforms, samplers and uniform buffers at compilation time

    Parameters

    • state: NodeMaterialBuildState

      defines the state to update

    • nodeMaterial: NodeMaterial

      defines the node material requesting the update

    • defines: NodeMaterialDefines

      defines the material defines to update

    • uniformBuffers: string[]

      defines the list of uniform buffer names

    Returns void

writeOutputs

Find examples in Playground

Generated using TypeDoc