{"id":27940615,"url":"https://github.com/khronosgroup/gltf-ibl-sampler","last_synced_at":"2025-05-07T10:19:00.130Z","repository":{"id":39916634,"uuid":"211086194","full_name":"KhronosGroup/glTF-IBL-Sampler","owner":"KhronosGroup","description":"Sampler to create the glTF sample environments","archived":false,"fork":false,"pushed_at":"2024-02-01T16:18:01.000Z","size":363,"stargazers_count":144,"open_issues_count":13,"forks_count":21,"subscribers_count":24,"default_branch":"main","last_synced_at":"2025-05-07T10:18:48.992Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KhronosGroup.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-26T12:42:23.000Z","updated_at":"2025-05-05T09:42:16.000Z","dependencies_parsed_at":"2023-01-17T18:45:51.196Z","dependency_job_id":null,"html_url":"https://github.com/KhronosGroup/glTF-IBL-Sampler","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KhronosGroup%2FglTF-IBL-Sampler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KhronosGroup%2FglTF-IBL-Sampler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KhronosGroup%2FglTF-IBL-Sampler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KhronosGroup%2FglTF-IBL-Sampler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KhronosGroup","download_url":"https://codeload.github.com/KhronosGroup/glTF-IBL-Sampler/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252856570,"owners_count":21814858,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-07T10:18:59.472Z","updated_at":"2025-05-07T10:19:00.107Z","avatar_url":"https://github.com/KhronosGroup.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# glTF IBL Sampler\n\n## Introduction\n\nThis project pre-filters an environment High Dynamic Range (HDR) panorama image and stores diffuse and specular parts in cube maps respectively. Considering different material characteristics, the specular part consists of several mip-map levels corresponding to different roughness values of the modeled material. The final basis compression into a [KTX2](https://github.com/KhronosGroup/KTX-Software/tree/ktx2) file ensures small file sizes while maintaining reasonable image quality.\n\nAlgorithm references:\n\n* [Real Shading in Unreal Engine 4](https://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_notes_v2.pdf)\n* [GPU-Based Importance Sampling](https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch20.html)\n* [Runtime Environment Map Filtering for Image Based Lighting](https://placeholderart.wordpress.com/2015/07/28/implementation-notes-runtime-environment-map-filtering-for-image-based-lighting/)\n* [Filtering shader](lib/source/shaders/filter.frag)\n\n\u003c!--\nThe official Khronos [glTF Sample Viewer](https://github.com/KhronosGroup/glTF-Sample-Viewer) is used to clarify, how e.g. a physically-based material has to be lit and rendered. In the [glTF 2.0 reference](https://www.khronos.org/files/gltf20-reference-guide.pdf), the default material model is the Metallic-Roughness-Model. \n--\u003e\n\n## Workflow\n\nThe individual transformations can be executed separately in the library, enabling the use of a cube map as input in future releases.  \n\n* Environment HDR image \u0026rightarrow; Cube Map  \n* Cube Map \u0026rightarrow; Filtered Cube Map  \n* Filtered Cube Map \u0026rightarrow; KTX2 Output File  \n\nThis separation of shader passes ensures both, flexibility and extensibility.\nThe pre-filtering will use the algorithms noted in the [glTF Sample Environments](https://github.com/ux3d/glTF-Sample-Environments) repository.\n\n![Workflow](doc/filterpipeline.png)\n\n## Building\n\nThe project provides a cmake file to generate respective build files.\n\nThird Party Requirements:\n\n* [Vulkan SDK](https://vulkan.lunarg.com)\n* Glslang (included in the Vulkan SDK)\n* [STB](https://github.com/nothings/stb) image library (git submodule, no need to install)\n* [KTX-Software](https://github.com/KhronosGroup/KTX-Software/releases) (you might need to manually install KTX-Software with the [pull request that fixes cmake find_package](https://github.com/KhronosGroup/KTX-Software/pull/325))\n\nCMake option ```IBLSAMPLER_EXPORT_SHADERS``` can be used to automatically copy the shader folder to the executable folder when generating the project files. By default, shaders will be loaded from their source location in lib/shaders.\n\nThe glTF-IBL-Sampler consists of two projects: lib (shared library) and cli (executable). \n\n## Usage\n\nThe CLI takes an environment HDR image as input. The filtered specular and diffuse cube maps can be stored as KTX1 or KTX2 (with basis compression).\n\n* ```-inputPath```: path to panorama image (default) or cube map (if inputIsCubeMap flag ist set)\n* ```-outCubeMap```: output path for filtered cube map (default=outputCubeMap.ktx2)\n* ```-outLUT```: output path for BRDF LUT (default=outputLUT.png)\n* ```-distribution```: NDF to sample (Lambertian, GGX, Charlie)\n* ```-sampleCount```: number of samples used for filtering (default = 1024)\n* ```-mipLevelCount```: number of mip levels of specular cube map. If omitted, an optimal mipmap level is chosen, based on the input panorama's resolution.\n* ```-cubeMapResolution```: resolution of output cube map.  If omitted, an optimal resolution is chosen based on the input panorama's resolution.\n* ```-targetFormat```: specify output texture format (R8G8B8A8_UNORM, R16G16B16A16_SFLOAT, R32G32B32A32_SFLOAT)\n* ```-lodBias```: level of detail bias applied to filtering (default = 0)\n\n## Example\n\n```\n.\\cli.exe -inputPath ..\\cubemap_in.hdr -outCubeMap ..\\..\\specular_out.ktx2 -distribution GGX -sampleCount 1024 -targetFormat R16G16B16A16_SFLOAT\n.\\cli.exe -inputPath ..\\cubemap_in.hdr -outCubeMap ..\\diffuse_out.ktx2 -distribution Lambertian -sampleCount 1024 -targetFormat R16G16B16A16_SFLOAT\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhronosgroup%2Fgltf-ibl-sampler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkhronosgroup%2Fgltf-ibl-sampler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhronosgroup%2Fgltf-ibl-sampler/lists"}