TSL: Question regarding the concept of "property"

I’m a newbie to TSL, and currently learning it now, and I’m confused about the concept of “property”.

In Three.js Shading Language, it describes the property function shown below, but provides no explanation of the concept of “property”.

property( type, name = null ) Declares an property but does not assign an initial value.

In PropertyNode, it says:

This class represents a shader property. It can be used
to explicitly define a property and assign a value to it.

const threshold = property( 'float', 'threshold' ).assign( THRESHOLD );

`PropertyNode` is used by the engine to predefined common material properties
for TSL code.

It also doesn’t explain the concept of “shader property”, it only says “It can be used to explicitly define a property and assign a value to it”.

It says “PropertyNode is used by the engine to predefined common material properties for TSL code.”, but in the VolumetricLightingModel,

const startPos = property( 'vec3' );
const endPos = property( 'vec3' );

and I don’t understand why it uses properties instead of variables.

My questions are:

  • How does the PropertyNode behave differently compared to the VarNode?

  • What is the benefit of using the PropertyNode?

1 Like