Shader Texture
Updated
One image a shader material reads through a texture uniform.
- Type
comp-shader-texture- Script class
ShaderTextureComponent- Per entity
- Several
- Version
- 1.0.0
Read about it in Shaders: what it does, how to use it from a script, and examples.
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
Live example
Feed an image to a shaderA custom Shader Material declares a Texture uniform, and a Shader Texture on the same entity feeds it an image: the print scrolls around an amber drum, and the script swaps the image every few seconds without rebuilding the shader.
Watch the print scroll around the drum and change image every three seconds. Drag to orbit the camera, scroll to zoom.
From a script
Section titled “From a script”#pragma lifecycle(startup)
function startup() { const component = self.parent.getComponent(ShaderTextureComponent); if (component) log(component.props);}