Custom Procedural Textures
Create custom procedural textures with shaders:
// Create a custom procedural texture with a fragment shader
const customProceduralTexture = new BABYLON.ProceduralTexture(
"customTex",
512, // Size
"customShader", // Shader name
scene,
null,
true, // Generate mipmaps
true // Is fragment only
);
// Set shader parameters
customProceduralTexture.setFloat("time", 0);
customProceduralTexture.setVector2("resolution", new BABYLON.Vector2(512, 512));
// Update time in the render loop
scene.onBeforeRenderObservable.add(() => {
customProceduralTexture.setFloat("time", performance.now() / 1000);
});