Custom shaders & materials
FredrikNoren opened this issue · 0 comments
FredrikNoren commented
Currently the renderer supports custom shaders on two levels; renderer_shader and material_shader. The material_shader plugs into a renderer_shader, and only affects the fragment shader. The renderer_shader can take a material_shader, but it also "owns" the entire shader so it can do pretty much anything. There is also a "material" which is just plain data + textures, exposed as a bind group, which "fits" with the material_shader.
Some examples;
- Decals are a custom renderer_shader which accepts materials; https://github.com/AmbientOrg/Ambient/blob/main/crates/decals/src/lib.rs, this means that you can feed it any type of material and it will just "project" that onto a surface.
- Water is an example of a custom material: https://github.com/AmbientOrg/Ambient/blob/main/crates/water/src/lib.rs
We'll have to figure out how to expose this on the api side.