bevyengine / bevyengine/bevy

Runtime generation of simple environment maps

Open
#17,468 2 comments 1 reaction 0 assignees View on GitHub
A-Rendering C-Feature D-Modest S-Ready-For-Implementation X-Blessed
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?

This proposes to kill several birds with one stone:
* Simplifying shaders by removing ambient lights and replacing them with simple 1x1 environment maps.
* Implementing hemispherical lights.

Creating environment maps for Bevy is a difficult process, particularly on Mac where you have to compile multiple C++ packages to get the tooling needed to do the conversion. Other game frameworks such as three.js provide a means to generate environment maps from an image at runtime.

Ambient lights can be emulated by a 1x1 environment map, which would mean that we could remove the shader code for ambient lights, thereby reducing the lines of code for our standard shaders.

## What solution would you like?

From [the discord](https://discord.com/channels/691052431525675048/743663924229963868/1331105565195112551):

```rust
foo.insert(EnvironmentMapLight::solid_color(SLATE_BLUE.into()))
foo.insert(EnvironmentMapLight::hemispherical_gradient(BLUE.into(), BROWN.into()))
```

The idea is to provide methods for generating simple environment maps from a set of parameters.

We should also offer a means to generate an environment map from an equirectangular image, but that is a more advanced project, and should probably be a separate issue.

For backwards compatibility, the `AmbientLight` can be transformed into an environment map light, either via the constructor or perhaps by a hook of some kind.

## What alternative(s) have you considered?

What I have done in the past is posted an image on Discord and had someone convert it to an environment map for me.

## Additional context

Supersedes: #12027

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.