bevyengine / bevyengine/bevy

Screen texture prevents shadow sampling

Open
#11,295 0 comments 0 reactions 0 assignees View on GitHub
A-Rendering C-Bug
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## Bevy version

0.12.1

## System information

AdapterInfo { name: "AMD Radeon(TM) Graphics", vendor: 4098, device: 5686, device_type: IntegratedGpu, driver: "AMD proprietary driver", driver_info: "21.3.1", backend: Vulkan }

## What you did

I used bevy example of post-fx shader with shadow map sampling .
Sampling is similar to bevy source.

## What went wrong
```
ERROR bevy_render::render_resource::pipeline_cache: failed to process shader:
error: failed to build a valid final module: Entry point fragment at Fragment is invalid
┌─ shaders/PostProcess.wgsl:35:23

35 │ @group(0) @binding(1) var texture_sampler: sampler;
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ naga::GlobalVariable [6]

= Bindings for [6] conflict with other resource
```

Error is happens when ever code is trying to access light data.
```
let light = &view_bindings::lights.directional_lights[light_id];
//error
let cascade_index = get_cascade_index(light_id, view_z);

//error
if (cascade_index >= (*light).num_cascades) {
return 1.0;
}

//error
var shadow = sample_cascade(light_id, cascade_index, frag_position);
```

## Additional information

Theories about what might be going wrong

Discord user suggested:
"you might be trying to run your shader on the shadow views if you're conflicting on shadow maps. try limiting your node to only run on views with a component that you add?"
So I added PostProcessSettings to ViewQuery inside impl ViewNode for PostProcessNode. **But no results.**

Both rust and wgsl code works as expected (without errors), **until** i try to sample shadow maps.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.