Files
storyteller-bevy/studio/assets/skyboxes
Danny McGee 155272a5ba Upgrade to Bevy v0.12 (#12)
* Migrate `System::pipe(...)` calls to `System::map(...)`
* Migrate `EventReader::iter()` and `EventReader::into_iter()` calls to
  `EventReader::read()`
* Migrate asset handling
* Generate `*.meta` files for assets
* Migrate a shader import
* Fix emissive materials double-applying their emissive strength
* Fix non-normalized bone weights resulting in incorrect vertex positions
* Set shadow filtering to `Hardware2x2` to mitigate increase in shader
  compilation times
2023-11-22 23:05:42 -05:00
..
2023-11-22 23:05:42 -05:00
2023-10-03 17:08:21 -04:00
2023-11-22 23:05:42 -05:00

Generating Skybox and Image-Based Lighting Assets

HDRI images like those available at Poly Haven or HDRI Haven must be preprocessed before they can be used for skyboxes and image-based lighting in Bevy Engine. Ultimately, three files are required:

  • An *.hdr cubemap texture for the skybox
  • A *.ktx2 prefiltered diffuse irradiance cubemap for IBL
  • A *.ktx2 prefiltered specular cubemap for IBL

The HDR cubemap texture currently must be generated using Blender. A helper asset with instructions is available here for Blender 3.6.

The prefiltered IBL cubemaps are generated with two CLI tools:

  1. glTF IBL Sampler

    • Git clone with --recursive and build using CMake
    • Diffuse:
    ./path/to/build-output/cli \
    	-inputPath <input>.hdr \
    	-outCubeMap <output>_diffuse.ktx2 \
    	-distribution Lambertian \
    	-cubeMapResolution 32
    
    • Specular:
    ./path/to/build-output/cli \
    	-inputPath <input>.hdr \
    	-outCubeMap <output>_specular.ktx2 \
    	-distribution GGX \
    	-cubeMapResolution 512
    
  2. bevy_mod_environment_map_tools

    • You can run this directly with cargo on the files generated by the previous step:
    cargo run --release -- \
    	--inputs <input>_diffuse.ktx2,<input>_specular.ktx2 \
    	--outputs <output>_diffuse.zstd.ktx2,<output>_specular.zstd.ktx2
    

The Bevy app expects the filenames to exactly match the patterns given in the examples above:

  • {name}.hdr
  • {name}_diffuse.zstd.ktx2
  • {name}_specular.zstd.ktx2

Once the files are in place, the application's skybox module can load all of the associated files for a skybox by passing its name to a helper function.