mirror of
https://github.com/bevyengine/bevy
synced 2024-12-11 22:02:34 +00:00
bevy_pbr2: Fix shadow logic (#3186)
# Objective - Shadow maps should only be sampled if the mesh is a shadow receiver AND shadow mapping is enabled for the light ## Solution - Fix the logic in the shader
This commit is contained in:
parent
73fd6a6f6f
commit
f3d4be316d
1 changed files with 2 additions and 2 deletions
|
@ -501,7 +501,7 @@ fn fragment(in: FragmentInput) -> [[location(0)]] vec4<f32> {
|
|||
let light = lights.point_lights[i];
|
||||
var shadow: f32;
|
||||
if ((mesh.flags & MESH_FLAGS_SHADOW_RECEIVER_BIT) != 0u
|
||||
|| (light.flags & POINT_LIGHT_FLAGS_SHADOWS_ENABLED_BIT) != 0u) {
|
||||
&& (light.flags & POINT_LIGHT_FLAGS_SHADOWS_ENABLED_BIT) != 0u) {
|
||||
shadow = fetch_point_shadow(i, in.world_position, in.world_normal);
|
||||
} else {
|
||||
shadow = 1.0;
|
||||
|
@ -513,7 +513,7 @@ fn fragment(in: FragmentInput) -> [[location(0)]] vec4<f32> {
|
|||
let light = lights.directional_lights[i];
|
||||
var shadow: f32;
|
||||
if ((mesh.flags & MESH_FLAGS_SHADOW_RECEIVER_BIT) != 0u
|
||||
|| (light.flags & DIRECTIONAL_LIGHT_FLAGS_SHADOWS_ENABLED_BIT) != 0u) {
|
||||
&& (light.flags & DIRECTIONAL_LIGHT_FLAGS_SHADOWS_ENABLED_BIT) != 0u) {
|
||||
shadow = fetch_directional_shadow(i, in.world_position, in.world_normal);
|
||||
} else {
|
||||
shadow = 1.0;
|
||||
|
|
Loading…
Reference in a new issue