Yes, exactly. The creation of TSL (Three.js Shading Language) simplifies this process, as it resembles a conventional shader programming language:
In this way the user only needs to worry about the algorithm using JavaScript, the node system will take care about the optimization of the shader, for example, creating variables only when necessary, avoiding unnecessary bindings such as textures used in more than one input, organizes hashing with type precedence to better reuse programs, and more… In fact this is being further explored in WebGPURenderer
.
Compilation is done at render time, so you will need to add a console.log()
here for now.
You can do like this using TSL:
import { uniform, MeshBasicNodeMaterial } from "three/examples/jsm/nodes/Nodes.js";
const myUniform = uniform( 1 ); // you can put number, Vector*, Color and others
const nodeMaterial = new MeshBasicNodeMaterial();
nodeMaterial.colorNode = myUniform;
// changing
//myUniform.value = .5;
Oh, thanks for the words. I’ve already read and received a lot of emails from people asking for documentation, I think your message reflects their desire too. Thanks