bevy/crates/bevy_pbr/src/render
robtfm 73bf730da9
fix shadow batching (#11645)
# Objective

`RenderMeshInstance::material_bind_group_id` is only set from
`queue_material_meshes::<M>`. this field is used (only) for determining
batch groups, so some items may be batched incorrectly if they have
never been in the camera's view or if they don't use the Material
abstraction.

in particular, shadow views render more meshes than the main camera, and
currently batch some meshes where the object has never entered the
camera view together. this is quite hard to trigger, but should occur in
a scene with out-of-view alpha-mask materials (so that the material
instance actually affects the shadow) in the path of a light.

this is also a footgun for custom pipelines: failing to set the
material_bind_group_id will result in all meshes being batched together
and all using the closest/furthest material to the camera (depending on
sort order).

## Solution

- queue_shadows now sets the material_bind_group_id correctly
- `MeshPipeline` doesn't attempt to batch meshes if the
material_bind_group_id has not been set. custom pipelines still need to
set this field to take advantage of batching, but will at least render
correctly if it is not set
2024-02-14 00:31:45 +00:00
..
clustered_forward.wgsl update shader imports (#10180) 2023-10-21 11:51:58 +00:00
fog.rs Fix fog color being inaccurate (#10226) 2023-10-23 12:45:18 +00:00
fog.wgsl update shader imports (#10180) 2023-10-21 11:51:58 +00:00
forward_io.wgsl Implement lightmaps. (#10231) 2024-01-02 20:38:47 +00:00
light.rs fix shadow batching (#11645) 2024-02-14 00:31:45 +00:00
mesh_bindings.rs Implement lightmaps. (#10231) 2024-01-02 20:38:47 +00:00
mesh_bindings.wgsl Swap material and mesh bind groups (#10485) 2023-11-28 22:26:22 +00:00
mesh_functions.wgsl Update to wgpu 0.19 and raw-window-handle 0.6 (#11280) 2024-01-26 18:14:21 +00:00
mesh_types.wgsl Implement lightmaps. (#10231) 2024-01-02 20:38:47 +00:00
mesh_view_bindings.rs Implement irradiance volumes. (#10268) 2024-02-06 23:23:20 +00:00
mesh_view_bindings.wgsl Implement irradiance volumes. (#10268) 2024-02-06 23:23:20 +00:00
mesh_view_types.wgsl Implement irradiance volumes. (#10268) 2024-02-06 23:23:20 +00:00
mesh.rs fix shadow batching (#11645) 2024-02-14 00:31:45 +00:00
mesh.wgsl Update to wgpu 0.19 and raw-window-handle 0.6 (#11280) 2024-01-26 18:14:21 +00:00
mod.rs Variable MeshPipeline View Bind Group Layout (#10156) 2023-10-21 11:19:44 +00:00
morph.rs Move EntityHash related types into bevy_ecs (#11498) 2024-02-12 15:02:24 +00:00
morph.wgsl Swap material and mesh bind groups (#10485) 2023-11-28 22:26:22 +00:00
parallax_mapping.wgsl update shader imports (#10180) 2023-10-21 11:51:58 +00:00
pbr_ambient.wgsl Use “specular occlusion” term to consistently extinguish fresnel on Ambient and Environment Map lights (#10182) 2023-10-23 03:26:20 +00:00
pbr_bindings.wgsl Swap material and mesh bind groups (#10485) 2023-11-28 22:26:22 +00:00
pbr_fragment.wgsl Gate diffuse and specular transmission behind shader defs (#11627) 2024-02-02 15:01:56 +00:00
pbr_functions.wgsl Implement irradiance volumes. (#10268) 2024-02-06 23:23:20 +00:00
pbr_lighting.wgsl update shader imports (#10180) 2023-10-21 11:51:58 +00:00
pbr_prepass_functions.wgsl update shader imports (#10180) 2023-10-21 11:51:58 +00:00
pbr_prepass.wgsl Gate diffuse and specular transmission behind shader defs (#11627) 2024-02-02 15:01:56 +00:00
pbr_transmission.wgsl Exposure settings (adopted) (#11347) 2024-01-16 14:53:21 +00:00
pbr_types.wgsl Fix specular envmap in deferred (#11534) 2024-01-29 16:39:49 +00:00
pbr.wgsl update shader imports (#10180) 2023-10-21 11:51:58 +00:00
rgb9e5.wgsl Deferred Renderer (#9258) 2023-10-12 22:10:38 +00:00
shadow_sampling.wgsl StandardMaterial Light Transmission (#8015) 2023-10-31 20:59:02 +00:00
shadows.wgsl update shader imports (#10180) 2023-10-21 11:51:58 +00:00
skin.rs Move EntityHash related types into bevy_ecs (#11498) 2024-02-12 15:02:24 +00:00
skinning.wgsl Swap material and mesh bind groups (#10485) 2023-11-28 22:26:22 +00:00
utils.wgsl Update to wgpu 0.18 (#10266) 2023-12-14 02:45:47 +00:00
view_transformations.wgsl View Transformations (#9726) 2023-10-24 21:26:19 +00:00
wireframe.wgsl Swap material and mesh bind groups (#10485) 2023-11-28 22:26:22 +00:00