ViewportDepthNode

Last modified: Jun 30, 2024

This node offers a collection of features in context of the depth logic in the fragment shader. Depending on ViewportDepthNode#scope, it can be used to define a depth value for the current fragment or for depth evaluation purposes.

Constructor

new ViewportDepthNode(scope, valueNode?)
ParameterTypeDefault Value
scope"depth" | "depthBase" | "linearDepth"
valueNode?null | Nodenull

Constructs a new viewport depth node.

AccessorType

Properties

PropertyTypeDefault Value
scope"depth" | "depthBase" | "linearDepth"
valueNodenull | Node
isViewportDepthNodeboolean
MethodType

Extends

Node

viewZToOrthographicDepth

TSL function for converting a viewZ value to an orthographic depth value.

ParameterTypeDefault Value
viewZNode<float>
nearNode<float>
farNode<float>

Returns

Node<float>
N E W

viewZToReversedOrthographicDepth

TSL function for converting a viewZ value to a reversed orthographic depth value.

ParameterTypeDefault Value
viewZNode<float>
nearNode<float>
farNode<float>

Returns

Node<float>

orthographicDepthToViewZ

TSL function for converting an orthographic depth value to a viewZ value.

ParameterTypeDefault Value
depthNode<float>
nearNode<float>
farNode<float>

Returns

Node<float>

viewZToPerspectiveDepth

TSL function for converting a viewZ value to a perspective depth value.

Note: {link https://twitter.com/gonnavis/status/1377183786949959682}.

ParameterTypeDefault Value
viewZNode<float>
nearNode<float>
farNode<float>

Returns

Node<float>
N E W

viewZToReversedPerspectiveDepth

TSL function for converting a viewZ value to a reversed perspective depth value.

ParameterTypeDefault Value
viewZNode<float>
nearNode<float>
farNode<float>

Returns

Node<float>

perspectiveDepthToViewZ

TSL function for converting a perspective depth value to a viewZ value.

ParameterTypeDefault Value
depthNode<float>
nearNode<float>
farNode<float>

Returns

Node<float>

viewZToLogarithmicDepth

TSL function for converting a viewZ value to a logarithmic depth value.

ParameterTypeDefault Value
viewZNode<float>
nearNode<float>
farNode<float>

Returns

Node<float>

logarithmicDepthToViewZ

TSL function for converting a logarithmic depth value to a viewZ value.

ParameterTypeDefault Value
depthNode<float>
nearNode<float>
farNode<float>

Returns

Node<float>

depth

TSL object that represents the depth value for the current fragment.

Type

ViewportDepthNode

linearDepth

TSL function for converting a perspective depth value to linear depth.

ParameterTypeDefault Value
value?Node<float>

Returns

ViewportDepthNode<float>

viewportLinearDepth

TSL object that represents the linear (orthographic) depth value of the current fragment

Type

ViewportDepthNode