FilterNormalTools
This RenderNode renders the NormalTools filter effect, which processes normal map textures for use in lighting calculations. It transforms normal vectors using a view matrix so they are correctly oriented relative to the camera, enabling accurate directional lighting on normal-mapped Game Objects.
Two optional features can be enabled via the controller: facing power, which raises the dot-product result to a given exponent to sharpen or soften the lighting falloff; and ratio output, which blends the normal contribution against a direction vector and radius to produce a ratio value used by downstream lighting passes.
This node is used internally by Phaser.Filters.NormalTools and should not need to be instantiated directly. See Phaser.Filters.NormalTools.
Constructor
new FilterNormalTools(manager)
Parameters
| name | type | optional | description |
|---|---|---|---|
| manager | Phaser.Renderer.WebGL.RenderNodes.RenderNodeManager | No | The manager that owns this RenderNode. |
Scope: static
Extends
Source: src/renderer/webgl/renderNodes/filters/FilterNormalTools.js#L12
Since: 4.0.0
Inherited Methods
From Phaser.Renderer.WebGL.RenderNodes.BaseFilterShader:
From Phaser.Renderer.WebGL.RenderNodes.RenderNode:
Public Methods
setupUniforms
<instance> setupUniforms(controller, drawingContext)
Description:
Sets the WebGL uniform values for the NormalTools shader based on the current controller settings. Always uploads the view matrix as uViewMatrix. If the controller's facingPower differs from the default value of 1, the uFacingPower uniform is also uploaded. If outputRatio is enabled on the controller, the uRatioVector (a 3-component direction vector) and uRatioRadius uniforms are uploaded as well.
Parameters:
| name | type | optional | description |
|---|---|---|---|
| controller | Phaser.Filters.NormalTools | No | The filter controller providing the uniform values. |
| drawingContext | Phaser.Renderer.WebGL.DrawingContext | No | The current drawing context. |
Overrides: Phaser.Renderer.WebGL.RenderNodes.BaseFilterShader#setupUniforms
Source: src/renderer/webgl/renderNodes/filters/FilterNormalTools.js#L86
Since: 4.0.0
updateShaderConfig
<instance> updateShaderConfig(controller, drawingContext)
Description:
Updates the shader program configuration based on the current controller settings. Resets the fragment header addition to the base VIEW_MATRIX define, then conditionally appends the FACING_POWER and OUTPUT_RATIO defines — and adjusts the addition name accordingly — so that the correct shader variant is compiled and cached for the active combination of features.
Parameters:
| name | type | optional | description |
|---|---|---|---|
| controller | Phaser.Filters.NormalTools | No | The filter controller providing the current configuration. |
| drawingContext | Phaser.Renderer.WebGL.DrawingContext | No | The current drawing context. |
Overrides: Phaser.Renderer.WebGL.RenderNodes.BaseFilterShader#updateShaderConfig
Source: src/renderer/webgl/renderNodes/filters/FilterNormalTools.js#L54
Since: 4.0.0
Inherited Members
From Phaser.Renderer.WebGL.RenderNodes.BaseFilterShader:
From Phaser.Renderer.WebGL.RenderNodes.RenderNode: