Uniforms
Creating uniforms
import { uniformFloat, float, sin, translateY } from "@hology/core/shader-nodes"
const uniformTime = uniformFloat("time")
const material = new NodeShaderMaterial({
color: rgba(0x00ff00, sin(uniformTime).multiply(float(0.5)).add(float(0.5)),
transform: translateY(sin(uniformTime.multiply(float(5)))),
uniforms: {
time: { value: 0 }
}
})material.uniforms.time.value = clock.getElapsedTime()uniformBool(name: string, value?: boolean): BoolNode
uniformFloat(name: string, value?: number): FloatNode
uniformVec2(name: string, value?: Vector2): Vec2Node
uniformVec3(name: string, value?: Vector3): Vec3Node
uniformVec4(name: string, value?: Vector4): Vec4Node
uniformMat2(name: string, value?: Matrix2): Mat2Node
uniformMat3(name: string, value?: Matrix3): Mat3Node
uniformMat4(name: string, value?: Matrix4): Mat4Node
uniformSampler2d(name: string): Sampler2dNodeUniform arrays
Predefined
Camera and model
Time
Particles
Depth
Lights and shadows
Last updated