bevy/crates/bevy_pbr/src
robtfm 979c4094d4
pbr shader cleanup (#10105)
# Objective

cleanup some pbr shader code. improve shader stage io consistency and
make pbr.wgsl (probably many people's first foray into bevy shader code)
a little more human-readable. also fix a couple of small issues with
deferred rendering.

## Solution

mesh_vertex_output: 
- rename to forward_io (to align with prepass_io)
- rename `MeshVertexOutput` to `VertexOutput` (to align with prepass_io)
- move `Vertex` from mesh.wgsl into here (to align with prepass_io)

prepass_io: 
- remove `FragmentInput`, use `VertexOutput` directly (to align with
forward_io)
- rename `VertexOutput::clip_position` to `position` (to align with
forward_io)

pbr.wgsl:
- restructure so we don't need `#ifdefs` on the actual entrypoint, use
VertexOutput and FragmentOutput in all cases and use #ifdefs to import
the right struct definitions.
- rearrange to make the flow clearer
- move alpha_discard up from `pbr_functions::pbr` to avoid needing to
call it on some branches and not others
- add a bunch of comments

deferred_lighting:
- move ssao into the `!unlit` block to reflect forward behaviour
correctly
- fix compile error with deferred + premultiply_alpha

## Migration Guide

in custom material shaders:
- `pbr_functions::pbr` no longer calls to
`pbr_functions::alpha_discard`. if you were using the `pbr` function in
a custom shader with alpha mask mode you now also need to call
alpha_discard manually
- rename imports of `bevy_pbr::mesh_vertex_output` to
`bevy_pbr::forward_io`
- rename instances of `MeshVertexOutput` to `VertexOutput`

in custom material prepass shaders:
- rename instances of `VertexOutput::clip_position` to
`VertexOutput::position`
2023-10-13 19:12:40 +00:00
..
deferred pbr shader cleanup (#10105) 2023-10-13 19:12:40 +00:00
environment_map Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
prepass pbr shader cleanup (#10105) 2023-10-13 19:12:40 +00:00
render pbr shader cleanup (#10105) 2023-10-13 19:12:40 +00:00
ssao Deferred Renderer (#9258) 2023-10-12 22:10:38 +00:00
alpha.rs bevy_reflect: FromReflect Ergonomics Implementation (#6056) 2023-06-29 01:31:34 +00:00
bundle.rs Fix a typo in DirectionalLightBundle (#9861) 2023-09-20 04:44:56 +00:00
fog.rs bevy_reflect: FromReflect Ergonomics Implementation (#6056) 2023-06-29 01:31:34 +00:00
lib.rs Deferred Renderer (#9258) 2023-10-12 22:10:38 +00:00
light.rs fix orthographic cluster aabb for spotlight culling (#9614) 2023-10-08 22:53:09 +00:00
material.rs chore: Renamed RenderInstance trait to ExtractInstance (#10065) 2023-10-13 17:06:53 +00:00
parallax.rs bevy_reflect: FromReflect Ergonomics Implementation (#6056) 2023-06-29 01:31:34 +00:00
pbr_material.rs Deferred Renderer (#9258) 2023-10-12 22:10:38 +00:00
wireframe.rs Configurable colors for wireframe (#5303) 2023-10-13 00:06:24 +00:00