bevyengine / bevyengine/bevy

Allow using shaders (through Material2D or similar) with DirectionalLightTexture

Open
#21,343 1 comment 2 reactions 0 assignees View on GitHub
A-Rendering C-Feature M-Release-Note S-Needs-Design
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?

Using a shader for directional light textures can be used for various artistic effects beyond a static texture. See Chris Biscardis video for example: https://youtu.be/H4ysDezt8Vo

## What solution would you like?

Some way to use AsBindGroup would be ideal, perhaps through Material2D.

## What alternative(s) have you considered?

As shown in Chris' video (linked above), its already possible to use a Material2d on a plane in a separate render layer with its render target set to the image which is passed to the MaterialLightTexture. This sadly requires quite a bit of boilerplate to set up, which is why a more convenient option would be great.

## Additional context

Related, but far beyond the scope of this feature request: It would be great to have a way to use a shader to render a image anywhere a Handle can be used. Perhaps a way to create a shader-defined Image asset which does essentially what the whole "material2d + plane + camera + render target image" setup does, but in a single step, maybe even without using up a render layer. A solution like this would allow far more flexibility anywhere a Image handle is used on the GPU - but I don't know rendering enough to know if this is unreasonable.

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.