Capítulo 509 de 859

Chapter 509: VelocityNode

Core Idea

A node for representing motion or velocity vectors. Foundation for advanced post processing effects like motion blur or TRAA.

The node keeps track of the model, view and projection matrices of the previous frame and uses them to compute offsets in NDC space. These offsets represent the final velocity.

Key Concepts

  • previousCameraViewMatrix : UniformNode.<mat4>: Uniform node representing the previous view matrix.
  • previousModelWorldMatrix : UniformNode.<mat4>: Uniform node representing the previous model matrix in world space.
  • previousProjectionMatrix : UniformNode.<mat4>: Uniform node representing the previous projection matrix.
  • projectionMatrix : Matrix4: The current projection matrix.
  • updateAfterType : string: Overwritten since velocity nodes save data after the update.
  • updateType : string: Overwritten since velocity nodes are updated per object.

Reference Tables

Constructor

Signature
new VelocityNode()

Properties

PropertyDescription
.previousCameraViewMatrix : UniformNode.<mat4>Uniform node representing the previous view matrix.
.previousModelWorldMatrix : UniformNode.<mat4>Uniform node representing the previous model matrix in world space.
.previousProjectionMatrix : UniformNode.<mat4>Uniform node representing the previous projection matrix.
.projectionMatrix : Matrix4The current projection matrix.
.updateAfterType : stringOverwritten since velocity nodes save data after the update.
.updateType : stringOverwritten since velocity nodes are updated per object.

Methods

MethodDescription
.setProjectionMatrix( projectionMatrix : Matrix4 )Sets the given projection matrix.
.setup( builder : NodeBuilder ) : Node.<vec2>Implements the velocity computation based on the previous and current vertex data.
.update( frame : NodeFrame )Updates velocity specific uniforms.
.updateAfter( frame : NodeFrame )Overwritten to updated velocity specific uniforms.

Key Takeaways

  1. VelocityNode extends: EventDispatcher → Node → TempNode
  2. Most relevant properties: previousCameraViewMatrix, previousModelWorldMatrix, previousProjectionMatrix, projectionMatrix.
  3. Key methods: setProjectionMatrix, setup, update, updateAfter.

Connects To