bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
35.15k stars 3.46k forks source link

Allow using Material2D with TextureAtlasSprite #7131

Open zaycev opened 1 year ago

zaycev commented 1 year ago

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

An easy way to add a custom shader to the current 2d sprite pipeline.

What solution would you like?

As of 0.9.x, as far as I know, there is no easy way to use Material2D with sprites. From the user's point of view, it would be great if you can add a Material2D component to a sprite and have a built-in function to sample sprite texture or textures (like diffuse, normals, displacement, etc) by id inside of a shader.

What alternative(s) have you considered?

The current workaround is to split an atlas into multiple textures and bind them into Material2D components as textures rather than sprites.

zaycev commented 1 year ago

Example of a plugin where this would be useful for shading different types of objects (sprites): https://github.com/zaycev/bevy-magic-light-2d

ElliotB256 commented 12 months ago

Merge with https://github.com/bevyengine/bevy/issues/1738 ?

Aqaao commented 1 month ago

+1,atlas-animation with shader should work right out of the box.