Phaser 4 examples

Shaders

  • 15 examples

Examples 15

Basic Texture ShaderDemonstrates how to create a custom shader that accepts an image texture as a uniform and applies it using texture coordinates.Change Shader TextureDemonstrates how to dynamically swap textures used by a shader at runtime using the setTextures method.Load ShaderLearn how to load an external GLSL fragment shader file and display it in your scene using a Shader Game Object.Render Shader to TextureDemonstrates how to render a fragment shader directly to a texture, which can then be used by standard Game Objects like Images and Sprites throughout your scene.Setting Shader UniformsDemonstrates how to define custom uniform variables within a BaseShader and update their values at runtime using the setUniform method.Shader Arcade PhysicsThis example demonstrates how to apply Arcade Physics to Shader Game Objects, including dynamic bodies with velocity and bounce, as well as static body collisions.Shader as a MaskDemonstrates how to use a custom GLSL shader as a dynamic mask for an image. It shows how to create a shader object and apply it to a Game Object through the filters system to create animated masking effects.Shader Feedback BuffersDemonstrates how to create a shader feedback loop by rendering multiple shaders to textures and using the output of one as the input for another.Shader Render to TextureDemonstrates how to render a GLSL shader to a texture and then use that texture across multiple Game Objects simultaneously.Shader Render-to-Texture FeedbackDemonstrates how to create a feedback loop between multiple shaders by rendering each to a texture and passing those textures as sampler inputs to one another.Shader SandboxDemonstrates layering multiple shaders with standard images and animating shader uniforms using the Tween Manager.Shader TransformsLearn how to manipulate a Shader Game Object using standard properties such as scale, rotation, and position, including how to apply tweens to them.Shader Using an Updating Dynamic TextureThis example demonstrates how to use a Dynamic Texture as a sampler input for a fragment shader, allowing you to feed live-rendered graphics directly into a shader effect.Shader with Dynamic Texture InputThis example demonstrates how to create a Dynamic Texture, draw images onto it, and then use that texture as a sampler input for a fragment shader.Using a Shader as a BufferDemonstrates how to render a shader's output directly to a texture and use that texture as a sampler input for another shader.