bevyengine / bevyengine/bevy

Apply color to sprite according to mask

Open
#3,357 4 comments 10 reactions 0 assignees View on GitHub
A-Rendering C-Feature
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?

Selectively coloring some parts of sprites is a common trick: this is commonly used for designating teams, or doing very simple recolors.

## What solution would you like?

Add a `color_mask: Option>` field to `Sprite`, where `Mask` is some sort of geometric overlay that designates which areas to include or exclude.

## What alternative(s) have you considered?

Use two sprites, bound together using parent-child, and then rely on layering to achieve the desired effect. This is fragile, a little silly, and will likely have higher runtime costs.

Use a general-purpose decal solution.

Split the mask into its own component? This seems less ideal: it wouldn't have a meaning on its own.

Store the mask directly on the Sprite component: this is wasteful overhead in a performance sensitive area: generally this will be reused aggressively.

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.