1
0
Fork
You've already forked glTF-IBL-Sampler-flake
0
"convert fancy HDR image to bevy Cubemap tool"
Nix 100%
Find a file
2024年12月07日 16:26:25 +01:00
.gitignore gitignore: result 2024年12月07日 15:43:29 +01:00
0001-nix-use-ktx-tools-from-nixpkgs.patch remove ktx-subodule via preBuild 2024年12月07日 15:31:44 +01:00
flake.lock add patch 2024年12月07日 15:26:37 +01:00
flake.nix make executable 2024年12月07日 15:42:53 +01:00
README.md document the url in nix run commands 2024年12月07日 16:26:25 +01:00

Nix flake for glTF-IBL-Sampler

or rather

Nix flake for the "make me a nice bevy cubemap skybox from a fancy hdr image"-program

The glTF-IBL-Sampler is a program meant to convert equilinear HDR images into ktx2 textures and happens to be able to render cubemaps in particular. Exactly as we need them in bevy.

I spent 24 hours to get this running and thought i'd share this flake with you, as i want no one to have to go through that patching stuff again.

This patch esentially

  • Patches some printf's that woudln't compile in the gcc in 24.11
  • Makes the package use ktx-tools from nixpkgs instead of compiling their own

And that being done it runs on nixos.

Usage

In bevy you need the specular map of an hdr:

nix run "git+https://codeberg.org/grindhold/glTF-IBL-Sampler-flake" -- -inputPath fancy_hdr_image.hdr -outCubeMap nice_bevy_cubemap_diffuse.ktx2 -distribution Lambertian -sampleCount 1024 -targetFormat R16G16B16A16_SFLOA
nix run "git+https://codeberg.org/grindhold/glTF-IBL-Sampler-flake" -- -inputPath fancy_hdr_image.hdr -outCubeMap nice_bevy_cubemap_specular.ktx2 -distribution GGX -sampleCount 1024 -targetFormat R16G16B16A16_SFLOAT

Then move your resulting nice_bevy_cubemap_specular.ktx2 and nice_bevy_cubemap_diffuse.ktx2 to your bevy application's asset folder. Add the following to your camera3d-entity:

Skybox {
 image: asset_server.load("nice_bevy_cubemap_specular.ktx2"),
 brightness: 1000.0,
}

Enjoy the view.

Upstream

The original project can be found at https://github.com/KhronosGroup/glTF-IBL-Sampler