bevy/assets/shaders
Robert Swain 84991d34f3 Array texture example (#5077)
# Objective

- Make the reusable PBR shading functionality a little more reusable
  - Add constructor functions for `StandardMaterial` and `PbrInput` structs to populate them with default values
  - Document unclear `PbrInput` members
- Demonstrate how to reuse the bevy PBR shading functionality
- The final important piece from #3969 as the initial shot at making the PBR shader code reusable in custom materials

## Solution

- Add back and rework the 'old' `array_texture` example from pre-0.6.
- Create a custom shader material
  - Use a single array texture binding and sampler for the material bind group
  - Use a shader that calls `pbr()` from the `bevy_pbr::pbr_functions` import
- Spawn a row of cubes using the custom material
- In the shader, select the array texture layer to sample by using the world position x coordinate modulo the number of array texture layers

<img width="1392" alt="Screenshot 2022-06-23 at 12 28 05" src="https://user-images.githubusercontent.com/302146/175278593-2296f519-f577-4ece-81c0-d842283784a1.png">

Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2022-06-28 00:58:50 +00:00
..
animate_shader.wgsl Add reusable shader functions for transforming position/normal/tangent (#4901) 2022-06-14 00:32:33 +00:00
array_texture.wgsl Array texture example (#5077) 2022-06-28 00:58:50 +00:00
custom_material.frag add some more pipelined-rendering shader examples (#3041) 2022-01-05 19:43:11 +00:00
custom_material.vert Fixing confusing near and far fields in Camera (#4457) 2022-05-16 16:37:33 +00:00
custom_material.wgsl Update wgpu to 0.12 and naga to 0.8 (#3375) 2021-12-19 03:03:06 +00:00
custom_material_chromatic_aberration.wgsl add a post-processing example (#4797) 2022-06-06 00:06:49 +00:00
custom_material_screenspace_texture.wgsl Split mesh shader files (#4867) 2022-05-31 23:23:25 +00:00
custom_vertex_attribute.wgsl Add reusable shader functions for transforming position/normal/tangent (#4901) 2022-06-14 00:32:33 +00:00
game_of_life.wgsl add some more pipelined-rendering shader examples (#3041) 2022-01-05 19:43:11 +00:00
instancing.wgsl Add reusable shader functions for transforming position/normal/tangent (#4901) 2022-06-14 00:32:33 +00:00
shader_defs.wgsl Add reusable shader functions for transforming position/normal/tangent (#4901) 2022-06-14 00:32:33 +00:00