#bevy #graphics #gamedev #skybox

bevy_skybox

A skybox from an image for bevyengine.org

6 releases (breaking)

new 0.6.0 Feb 16, 2025
0.5.0 Jul 21, 2021
0.4.0 Apr 12, 2021
0.3.0 Jan 14, 2021
0.1.0 Jan 5, 2021

#312 in Game dev

MIT/Apache

37KB
291 lines

Bevy Skybox

Bevy now provides a Skybox component that can be attached to cameras to provide a background in all directions: see examples/3d/skybox.rs. What this crate provides is a simple bit of image processing to turn the sort of skybox "net" image that you find on the internet into one suitable for the Bevy Skybox. It is therefore designed primarily for fast prototyping.

This crate assumes that the input image is of the same format as the examples given in the assets folder: a PNG image of a net of six squares in the same shape as these examples. It also assumes that you only need one skybox at any given time.

Usage

The usage is documented in the module comment at the top of src/lib.rs.

To demonstrate this, examples\board_flyover.rs puts a skybox around a flat "board". Key/mouse camera movement is provided by bevy_flycam.

Board Flyover example

Skybox images come from the following sources.

Image processing

Many skybox are available as net images. bevy_skybox assumes that the image is a specific net of a cube.

The assumptions about the image are listed in src/image.rs, but the image is measured like this.

Measuring the cube net

It assumes the net is exactly aligned with the image rectangle and filling most of its width and height.

Only PNG images are supported currently.

Build

Build using stable or nightly toolchain, e.g.

cargo run --release --example board_flyover

Compatibility

Currently compatible with Bevy 0.15.

Raise an issue or PR if you need support for other versions of Bevy.

Dependencies

~24–35MB
~578K SLoC