TSL : PositionLocal

Channel:
Subscribers:
24,900
Published on ● Video Link: https://www.youtube.com/watch?v=VaW28X1cEpw



Duration: 0:00
38 views
4


Channel Membership :
Playlist :    • Three Shader Language (TSL)  
Documentation : https://sbcode.net/tsl/positionLocal

You will find in almost all fragment shaders, the use of some kind of positional coordinates. The positional coordinates are interpolated from left and right, up and down as each pixel colour is calculated.

In TSL, we can use `positionLocal` to get the fragment shaders current positional coordinate.

import { positionLocal } from 'three/tsl'

This value essentially comes from the `BufferGeometry.attributes.position`.

So, depending where we are on the scan, the coordinate will be a different value, and we can use that to output a different color.

On a 2D plane, the coordinates will behave like X, Y coordinates on a graph.

#three
#threejs
#tsl
#threeShaderLanguage