nodeProxyIntent
Creates a proxy function like nodeProxy but marks the node as “intent” and calls toVarIntent so the result is materialized as a local or varying variable, reducing recomputation and producing cleaner GLSL.
Core Advantages
Forces important intermediates to be cached as variables. When the same node instance is reused, duplicate work is reduced and readability improves. Still supports scope, factor, parameter limits, and naming.
Common Uses
Wrap costly nodes (noise, texture sampling, complex expressions) with an intent proxy
Build mix-like ops with a fixed factor and cache the result
Explicitly generate locals or varyings for values reused across stages
How to adjust
Signature: nodeProxyIntent(NodeClass, scope?, factor?, settings?). The factor is appended as the last constructor arg. settings is Object.assign-ed onto the node; when settings.intent===true (set by this helper) it triggers toVarIntent(). Chain helpers: setParameterLength(min[, max]) to enforce min/max params; missing params are zero-padded and extra ones are truncated (see verifyParamsLimit). setName(name) controls the display name for errors and logs. Use it on expensive or widely reused nodes to avoid duplicated work.
Code Examples
1<Canvas>
2 <mesh>
3 <sphereGeometry args={[0.5, 128, 128]} />
4 <meshStandardNodeMaterial
5 colorNode={
6 // Wrap noise as an “intent variable”; compiler materializes it once for reuse in larger expressions
7 vec3( nodeProxyIntent( NoiseNode )( uv() ) )
8 .mix( vec3(0.2, 0.6, 1.0), 0.6 )
9 }
10 />
11 </mesh>
12</Canvas>