Shader examples
The engine's shader examples: what each one shows, whether it runs in a browser and the command that runs it.
On this page
Custom materials, shader defs, post-processing passes, compute shaders and lower-level render code. There are 31 examples on this page. For the concepts behind them, see Custom materials and shaders.
Run any of them from the engine core's workspace (the folder of the engine source that holds the neo crate's Cargo.toml); see Run an example.
Shaders#
| Example | What it shows | Web | Run |
|---|---|---|---|
| Animated | A shader that uses dynamic data like the time since startup | Yes | cargo run --example animate_shader |
| Array Texture | A shader that shows how to reuse the core neo PBR shading functionality in a custom material that obtains the base color from an array texture. | Yes | cargo run --example array_texture |
| Compute - Game of Life | A compute shader that simulates Conway's Game of Life | No | cargo run --example compute_shader_game_of_life |
| Compute Shader Mesh | A compute shader that generates a mesh that is controlled by a Handle | No | cargo run --example compute_mesh |
| Custom phase item | Demonstrates how to enqueue custom draw commands in a render phase | Yes | cargo run --example custom_phase_item |
| Custom Render Phase | Shows how to make a complete render phase | Yes | cargo run --example custom_render_phase |
| Custom Vertex Attribute | A shader that reads a mesh's custom vertex attribute | Yes | cargo run --example custom_vertex_attribute |
| Extended Bindless Material | Demonstrates bindless ExtendedMaterial | No | cargo run --example extended_material_bindless |
| Extended Material | A custom shader that builds on the standard material | Yes | cargo run --example extended_material |
| GPU Component Array Buffer | Shows how to expose per-mesh-instance data to the GPU | Yes | cargo run --example gpu_component_array_buffer |
| GPU readback | A very simple compute shader that writes to a buffer that is read by the cpu | No | cargo run --example gpu_readback |
| Instancing | Shows that multiple instances of a cube are automatically instanced in one draw call | Yes | cargo run --example automatic_instancing |
| Instancing | A shader that renders a mesh multiple times in one draw call using low level rendering api | Yes | cargo run --example custom_shader_instancing |
| Material | A shader and a material that uses it | Yes | cargo run --example shader_material |
| Material | A shader and a material that uses it on a 2d mesh | Yes | cargo run --example shader_material_2d |
| Material - 2D Bindless | Demonstrates bindless materials in 2D | No | cargo run --example shader_material_2d_bindless |
| Material - Bindless | Demonstrates how to make materials that use bindless textures | Yes | cargo run --example shader_material_bindless |
| Material - Screenspace Texture | A shader that samples a texture with view-independent UV coordinates | Yes | cargo run --example shader_material_screenspace_texture |
| Material Prepass | A shader that uses the various textures generated by the prepass | No | cargo run --example shader_prepass |
| Pipeline Constants | Demonstrates pipeline-overridable constants (WGSL override) by compiling the same shader into multiple variants with different posterization levels | Yes | cargo run --example pipeline_constants |
| Post Processing - Custom Render Pass | A custom post processing effect, using a custom render pass that runs after the main pass | Yes | cargo run --example custom_post_processing |
| Render Depth to Texture | Demonstrates how to use depth-only cameras | Yes | cargo run --example render_depth_to_texture |
| Shader Defs | A shader that uses "shaders defs" (a neo tool to selectively toggle parts of a shader) | Yes | cargo run --example shader_defs |
| Specialized Mesh Pipeline | Demonstrates how to write a specialized mesh pipeline | Yes | cargo run --example specialized_mesh_pipeline |
| Sprite Material | A custom shader for sprites | Yes | cargo run --example sprite_material |
| Storage Buffer | A shader that shows how to bind a storage buffer using a custom material. | Yes | cargo run --example storage_buffer |
| Texture Binding Array (Bindless Textures) | A shader that shows how to bind and sample multiple textures as a binding array (a.k.a. bindless textures). | No | cargo run --example texture_binding_array |
Advanced shaders#
| Example | What it shows | Web | Run |
|---|---|---|---|
| Deferred Gbuffer Raymarching | Writes a raymarched SDF into the deferred gbuffer so it is lit by the standard PBR deferred lighting pass | Yes | cargo run --example deferred_raymarch --features free_camera |
| Fullscreen Material | Demonstrates how to write a fullscreen material | Yes | cargo run --example fullscreen_material |
| Manual Material Implementation | Demonstrates how to implement a material manually using the mid-level render APIs | Yes | cargo run --example manual_material |
| Mesh Shader Introduction | Demonstrates how to use Task/Amplification/Mesh Shaders | No | cargo run --example mesh_shader_intro |