#[non_exhaustive]pub enum UniformSource {
Show 98 variants
CameraProjectionMatrix,
CameraViewMatrix,
CameraIndex,
CameraWorldMatrix,
CameraPosition,
ModelWorldMatrix,
ModelNormalMatrix,
CameraProjectionMatrixInverse,
ModelWorldMatrixInverse,
MaterialColor,
MaterialOpacity,
MaterialAlphaTest,
MaterialReflectivity,
MaterialEnvIntensity,
MaterialRotation,
MaterialShininess,
MaterialSpecular,
MaterialEmissive,
MaterialEmissiveIntensity,
MaterialAnisotropyVector,
MaterialClearcoat,
MaterialClearcoatRoughness,
MaterialClearcoatNormalScale,
MaterialTransmission,
MaterialThickness,
MaterialAttenuationDistance,
MaterialAttenuationColor,
EnvRotationMatrix,
BackgroundRotation,
BackgroundBlurriness,
BackgroundIntensity,
FogColor,
FogNear,
FogFar,
FogDensity,
Time,
DeltaTime,
FrameId,
ViewportSize,
Viewport,
ScreenDpr,
CameraNear,
CameraFar,
LightColorIntensity(usize),
LightCutoffDistance(usize),
LightDecay(usize),
LightViewPosition(usize),
MorphBase,
LightWorldPosition(usize),
LightTargetPosition(usize),
LightGroundColor(usize),
LightConeCos(usize),
LightPenumbraCos(usize),
ShadowMatrix(usize),
ShadowCameraNear(usize),
ShadowCameraFar(usize),
ShadowBias(usize),
ShadowNormalBias(usize),
ShadowRadius(usize),
ShadowBlurSamples(usize),
ShadowMapSize(usize),
ShadowIntensity(usize),
MaterialLineWidth,
MaterialMetalness,
MaterialRoughness,
MaterialBumpScale,
MaterialIor,
MaterialSpecularIntensity,
MaterialSpecularColor,
MaterialSheen,
MaterialSheenColor,
MaterialSheenRoughness,
MaterialDiffuseRoughness,
MaterialIridescence,
MaterialIridescenceIor,
MaterialIridescenceThicknessMax,
MaterialIridescenceThicknessMin,
MaterialNormalScale,
MaterialAoMapIntensity,
MaterialLightMapIntensity,
MaterialPointSize,
ToneMappingExposure,
BindMatrix,
BindMatrixInverse,
ObjectCenter,
PreviousModelWorldMatrix,
VelocityProjectionMatrix,
PreviousProjectionMatrix,
PreviousCameraViewMatrix,
Value(Vec<f64>),
Settable(SettableValue),
ObjectUpdate(ObjectUpdate),
Live(LiveValue),
CameraNormalMatrix,
MaterialRefractionRatio,
HighpModelViewMatrix,
HighpModelNormalViewMatrix,
Object3D {
scope: Object3DScope,
object: Option<LiveValue>,
},
}Expand description
Where a uniform’s bytes come from. The renderer owns the values; the node
graph only names them. This is the whole of NodeUpdateType /
UniformNode.update() for the ladder so far.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
CameraProjectionMatrix
cameraProjectionMatrix — camera.projectionMatrix.
CameraViewMatrix
cameraViewMatrix — camera.matrixWorldInverse.
CameraIndex
cameraIndex — uniform( 0, 'uint' ).setName( 'u_cameraIndex' ), the
sub-camera an ArrayCamera draw is for. The backend binds one group
per sub-camera rather than rewriting it, so the value written here is
never read; see Draw::sub_cameras in the renderer.
CameraWorldMatrix
cameraWorldMatrix — camera.matrixWorld.
CameraPosition
cameraPosition — camera.matrixWorld’s translation, which
getIBLVolumeRefraction takes the world-space view vector from.
ModelWorldMatrix
modelWorldMatrix — object.matrixWorld.
ModelNormalMatrix
modelNormalMatrix — object.normalMatrix.
CameraProjectionMatrixInverse
cameraProjectionMatrixInverse — camera.projectionMatrixInverse.
Line2NodeMaterial.setupPosition() needs it to push a clip-space
position back through the camera.
ModelWorldMatrixInverse
modelWorldMatrixInverse — uniform( new Matrix4() ).onObjectUpdate( ( { object }, self ) => self.value.copy( object.matrixWorld ).invert() ).
MaterialColor
materialColor — MeshBasicMaterial.color in the working space.
MaterialOpacity
materialOpacity — Material.opacity.
MaterialAlphaTest
materialAlphaTest — Material.alphaTest.
MaterialReflectivity
materialReflectivity — MeshLambertMaterial.reflectivity and
friends.
MaterialEnvIntensity
materialEnvIntensity — MeshStandardMaterial.envMapIntensity, the
scale EnvironmentNode puts on both IBL terms.
MaterialRotation
materialRotation — SpriteMaterial.rotation.
MaterialShininess
MeshPhongMaterial.shininess / .specular / .emissive /
.emissiveIntensity.
MaterialSpecular
MeshPhongMaterial.specular.
MaterialEmissive
MeshPhongMaterial.emissive / MeshStandardMaterial.emissive.
MaterialEmissiveIntensity
emissiveIntensity — the scale on UniformSource::MaterialEmissive.
MaterialAnisotropyVector
materialAnisotropyVector — MeshPhysicalMaterial.anisotropy and
.anisotropyRotation as one vec2( a * cos( r ), a * sin( r ) ).
MaterialClearcoat
MeshPhysicalMaterial.clearcoat / .clearcoatRoughness /
.clearcoatNormalScale.
MaterialClearcoatRoughness
MeshPhysicalMaterial.clearcoatRoughness.
MaterialClearcoatNormalScale
MeshPhysicalMaterial.clearcoatNormalScale.
MaterialTransmission
MeshPhysicalMaterial.transmission / .thickness /
.attenuationDistance / .attenuationColor — KHR_materials_transmission
and KHR_materials_volume.
MaterialThickness
MeshPhysicalMaterial.thickness.
MaterialAttenuationDistance
MeshPhysicalMaterial.attenuationDistance.
MaterialAttenuationColor
MeshPhysicalMaterial.attenuationColor, in the working space.
EnvRotationMatrix
materialEnvRotation — the env map’s rotation matrix.
BackgroundRotation
backgroundRotation — scene.backgroundRotation.
BackgroundBlurriness
backgroundBlurriness — scene.backgroundBlurriness.
BackgroundIntensity
backgroundIntensity — scene.backgroundIntensity.
FogColor
reference( 'color' | 'near' | 'far' | 'density', …, scene.fog ) .setGroup( renderGroup ) — the classic scene.fog’s parameters, which
NodeManager.updateFog() binds as render-group uniforms so that a fog
whose values change never rebuilds a program. The colour is in the
working space.
FogNear
scene.fog.near — Fog’s linear near distance.
FogFar
scene.fog.far — Fog’s linear far distance.
FogDensity
scene.fog.density — FogExp2’s density.
Time
time — TimerNode.GLOBAL, seconds since the renderer started.
DeltaTime
deltaTime — TimerNode.DELTA, frame.deltaTime: the seconds since
the previous NodeFrame.update().
FrameId
frameId — TimerNode.FRAME, uniform( 0, 'uint' ) updated from
frame.frameId: the count of NodeFrame.update() calls.
ViewportSize
viewportSize — the render target’s pixel dimensions.
Viewport
viewport — ScreenNode.VIEWPORT, the whole rectangle as
( x, y, width, height ) in physical pixels. ScreenNode.update()
takes it from the bound render target, or from
renderer.getViewport() times the pixel ratio.
ScreenDpr
screenDPR — uniform( 1 ).onRenderUpdate( ( { renderer } ) => renderer.getPixelRatio() ).
CameraNear
cameraNear — uniform( 'float' ).setName( 'cameraNear' ) .setGroup( renderGroup ).onRenderUpdate( ( { camera } ) => camera.near ).
CameraFar
cameraFar — as UniformSource::CameraNear, from camera.far.
LightColorIntensity(usize)
LightsNode’s per-light members, by index into the renderer’s light
list for the pass. The dumps put all four in the render group:
light.color * light.intensity (linear), the cutoff distance, the decay
exponent, and the light’s position through the camera view matrix.
LightCutoffDistance(usize)
The cutoff distance — see UniformSource::LightColorIntensity.
LightDecay(usize)
The decay exponent — see UniformSource::LightColorIntensity.
LightViewPosition(usize)
The light’s position through the camera view matrix — see
UniformSource::LightColorIntensity.
MorphBase
Morph.js’ base = uniform( 1 ), updated per object to
1 - Σ morphTargetInfluences (or 1 when the targets are relative).
LightWorldPosition(usize)
lightPosition( light ) / lightTargetPosition( light ) — the world
positions lightTargetDirection differences.
LightTargetPosition(usize)
lightTargetPosition( light ) — see UniformSource::LightWorldPosition.
LightGroundColor(usize)
HemisphereLightNode: light.groundColor * light.intensity (linear).
LightConeCos(usize)
SpotLightNode’s coneCosNode / penumbraCosNode.
LightPenumbraCos(usize)
SpotLightNode.penumbraCosNode — see UniformSource::LightConeCos.
ShadowMatrix(usize)
ShadowNode’s per-shadow references: lightShadowMatrix( light ), the
shadow camera’s near and far planes (PointShadowNode) and
reference( …, shadow ) for the five scalars.
ShadowCameraNear(usize)
The shadow camera’s near plane — see UniformSource::ShadowMatrix.
ShadowCameraFar(usize)
The shadow camera’s far plane — see UniformSource::ShadowMatrix.
ShadowBias(usize)
reference( 'bias', 'float', shadow ).
ShadowNormalBias(usize)
reference( 'normalBias', 'float', shadow ).
ShadowRadius(usize)
reference( 'radius', 'float', shadow ) — the blur radius.
ShadowBlurSamples(usize)
reference( 'blurSamples', 'float', shadow ) — the VSM blur passes’
tap count.
ShadowMapSize(usize)
reference( 'mapSize', 'vec2', shadow ) — the shadow map’s resolution.
ShadowIntensity(usize)
reference( 'intensity', 'float', shadow ).
MaterialLineWidth
materialLineWidth — MaterialNode.LINE_WIDTH, i.e.
material.linewidth. Only a fat-line material reads it; a hairline
Line ignores it, as WebGL and WebGPU both do.
MaterialMetalness
materialMetalness / materialRoughness / materialBumpScale.
MaterialRoughness
MeshStandardMaterial.roughness.
MaterialBumpScale
MeshStandardMaterial.bumpScale.
MaterialIor
MeshPhysicalMaterial’s ior / specularIntensity / specularColor,
and MeshStandardMaterial.normalScale.
MaterialSpecularIntensity
MeshPhysicalMaterial.specularIntensity.
MaterialSpecularColor
MeshPhysicalMaterial.specularColor, in the working space.
MaterialSheen
MeshPhysicalMaterial.sheen / .sheenColor / .sheenRoughness.
MaterialSheenColor
MeshPhysicalMaterial.sheenColor, in the working space.
MaterialSheenRoughness
MeshPhysicalMaterial.sheenRoughness.
MaterialDiffuseRoughness
MeshPhysicalMaterial.diffuseRoughness.
MaterialIridescence
MeshPhysicalMaterial.iridescence — KHR_materials_iridescence.
MaterialIridescenceIor
MeshPhysicalMaterial.iridescenceIOR.
MaterialIridescenceThicknessMax
iridescenceThicknessRange[ 1 ] — three reaches the range through
reference( '1', 'float', material.iridescenceThicknessRange ) and
reference( '0', … ), two separate float uniforms, the maximum built
first.
MaterialIridescenceThicknessMin
iridescenceThicknessRange[ 0 ].
MaterialNormalScale
MeshStandardMaterial.normalScale.
MaterialAoMapIntensity
MeshStandardMaterial.aoMapIntensity — the scale in materialAO’s
tex.r.sub( 1 ).mul( aoMapIntensity ).add( 1 ).
MaterialLightMapIntensity
material.lightMapIntensity (MeshBasicMaterial, MeshLambertMaterial,
MeshPhongMaterial, MeshStandardMaterial, MeshToonMaterial) — the
scale in materialLightMap’s tex.rgb.mul( lightMapIntensity ).
MaterialPointSize
PointsMaterial.size — materialPointSize.
ToneMappingExposure
toneMappingExposure — renderer.toneMappingExposure.
BindMatrix
reference( 'bindMatrix', 'mat4' ) / reference( 'bindMatrixInverse', 'mat4' ) — SkinnedMesh’s two bind matrices, in the object group.
BindMatrixInverse
bindMatrixInverse — see UniformSource::BindMatrix.
ObjectCenter
reference( 'center', 'vec2', object ) — Sprite.center, read by
SpriteNodeMaterial.setupPositionView(), in the object group.
PreviousModelWorldMatrix
VelocityNode.previousModelWorldMatrix — the object’s matrixWorld
as the last velocity draw of it left it (getPreviousMatrix( object )), in the object group. See crate::nodes::velocity.
VelocityProjectionMatrix
VelocityNode.currentProjectionMatrix — the camera’s projection, or
the unjittered one setProjectionMatrix() handed the node, in the
render group.
PreviousProjectionMatrix
VelocityNode.previousProjectionMatrix — last frame’s
currentProjectionMatrix for this camera.
PreviousCameraViewMatrix
VelocityNode.previousCameraViewMatrix — last frame’s
camera.matrixWorldInverse for this camera.
Value(Vec<f64>)
A plain uniform( value ) the example supplies.
Settable(SettableValue)
uniform( value ) whose .value is written between draws — three.js’
UniformNode is always this; UniformSource::Value is the special
case of one that never moves. SSAAPassNode.sampleWeight is the port’s
first: one node, one program, eight different values across the eight
accumulation draws of a frame.
ObjectUpdate(ObjectUpdate)
A uniform() inside a node whose updateType is
NodeUpdateType.OBJECT: three calls node.update( frame ) with
frame.object set to the render object about to be drawn, and the
callback writes uniformNode.value before that object’s bindings are
built. webgpu_instance_uniform’s InstanceUniformNode is the ladder’s
first — twelve meshes share one material, one program and one pipeline,
and differ only in the three floats this uniform resolves to.
The port has no place to hang a mesh.color the way the page does, so
the callback receives the object itself and answers from whatever the
application keyed to it. See docs/nodes.md §18.
Live(LiveValue)
A uniform that holds a reference to an application object and reads
it when the buffer is written: three’s uniform( skinnedMesh.bindMatrix ) (the Matrix4 itself, not a copy of its elements) and
objectWorldMatrix( object3d ) (Object3DNode with an explicit object,
whose OBJECT update reads object3d.matrixWorld). Unlike
UniformSource::ObjectUpdate it does not need a render object, so a
compute kernel can read it: computeSkinning() and
webgpu_skinning_points are the first. See docs/nodes.md §44.
CameraNormalMatrix
cameraNormalMatrix — uniform( camera.normalMatrix ). Nothing in
WebGPURenderer ever writes a camera’s normalMatrix (only
WebGLRenderer updates it, and only for the objects it draws), so
three uploads the identity it was constructed with, and so does this.
MaterialRefractionRatio
materialRefractionRatio — uniform( 0 ).onObjectUpdate( ( { material } ) => material.refractionRatio ).
HighpModelViewMatrix
highpModelViewMatrix — uniform( 'mat4' ).onObjectUpdate( … ):
camera.matrixWorldInverse * object.matrixWorld, multiplied on the CPU
in double precision.
HighpModelNormalViewMatrix
highpModelNormalViewMatrix — the normal matrix of
UniformSource::HighpModelViewMatrix’s product, per object.
Object3D
Object3DNode’s vector and scalar scopes: Object3DScope of the
object drawn (ModelNode, object None) or of an explicit one
(objectPosition( object3d ) and friends), whose matrixWorld the
LiveValue reads when the buffer is written.
Fields
scope: Object3DScopeWhich value of the object.
object: Option<LiveValue>The explicit object’s matrixWorld, or None for the object the
draw is for. For Object3DScope::Direction it is instead the
world direction itself, three components, since
getWorldDirection() refreshes the object’s world matrix and
negates for a camera, which only the object can tell.