bevyengine / bevyengine/bevy

Provides a slot in bevy_render to grabing screen texture for achieve blend mode or glass effect in bevy_sprite.

Open
#16,107 3 comments 0 reactions 0 assignees View on GitHub
A-Rendering C-Feature S-Ready-For-Implementation
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

### What problem does this solve or what need does it fill?

As i me mentioned in discussions [Does bevy provide an API similar to unity's GrabPass?](https://github.com/bevyengine/bevy/discussions/16008), i need bevy to expose a slot in RenderCommand which can perform an additional operation before draw PhaseItem, in this way, I can grab the screen and achieve the blend mode effect in shader.

### What solution would you like?
I have initially implemented this slot and applied it to my own project, and it works fine.
The main changes are in [https://github.com/Ahuang0107/bevy/blob/elase/release-0.14.2/crates/bevy_render/src/render_phase/mod.rs line 770.](https://github.com/Ahuang0107/bevy/blob/9ab3f2a1232e7df743d02da587c6fd511096bab5/crates/bevy_render/src/render_phase/mod.rs#L770)

### Additional context

The reason why I am obsessed with implementing blend mode is because I need blend mode to express the glass effect, reflective effect, shadow effect and night and day effect. Unity has these functions but I prefer to use bevy to complete my game. The following is a comparison of my implementation in unity and bevy, blend mode can bring good effect to glass in 2d game.

![Image](https://github.com/user-attachments/assets/da6c3834-b279-49b7-a649-93c00cd021e4)

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.