PBR extension: anisotropy - #32
Open
alemuntoni wants to merge 29 commits into
Open
Conversation
…o pbr-ext-anisotropy
Member
Author
|
test: ANISOTROPY_ROTATION_TEST in 950-pbr |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds initial support for the glTF KHR_materials_anisotropy extension across the asset pipeline (glTF import → material/uniform plumbing → PBR shader evaluation) and provides new sample assets to validate anisotropy strength/rotation/texture behavior.
Changes:
- Implement anisotropic GGX specular + reflection “bent normal” path in the PBR shader, and plumb anisotropy strength/rotation + anisotropy texture through uniforms.
- Extend material/texture typing to include an anisotropy texture and serialize/deserialize anisotropy parameters.
- Update texture-stage/sampler layout and add new glTF examples/assets for anisotropy testing.
Reviewed changes
Copilot reviewed 12 out of 23 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| vclib/render/shaders/vclib/bgfx/pbr_common.sh | Adds anisotropic GGX functions and threads anisotropy parameters into pbrColorLights; also changes default light settings. |
| vclib/render/shaders/vclib/bgfx/drawable/uniforms/material_uniforms.sh | Adds u_anisotropyPack uniform macros for strength/rotation. |
| vclib/render/shaders/vclib/bgfx/drawable/uniforms/drawable_mesh_texture_uniforms.sh | Adds anisotropy texture sampling helpers and shifts BRDF LUT to stage position 6. |
| vclib/render/shaders/vclib/bgfx/drawable/drawable_mesh/surface/fs_surface_uber_pbr.sc | Computes anisotropy tangent frame + reflection bending; passes anisotropy data into pbrColorLights. |
| vclib/render/include/vclib/bgfx/drawable/uniforms/material_uniforms.h | Adds/binds the anisotropy uniform pack on the C++ side. |
| vclib/render/include/vclib/bgfx/drawable/uniforms/drawable_mesh_uniforms.h | Adds ANISOTROPY texture type to the packed-stage enum. |
| vclib/render/include/vclib/bgfx/drawable/drawable_environment.h | Changes BRDF LUT sampler uniform from s_tex5 → s_tex6. |
| vclib/core/include/vclib/space/core/material.h | Adds anisotropy parameters and anisotropy texture type + serialization support. |
| vclib/core/include/vclib/io/mesh/gltf/detail/load_mesh.h | Loads KHR_materials_anisotropy extension values/texture into Material. |
| examples/render/950-pbr/main.cpp | Adds anisotropy-related sample selections and prints anisotropy material info. |
| assets/example_meshes/gltf/CarbonFibre/CarbonFibre_occlusion.png | New sample texture (CarbonFibre). |
| assets/example_meshes/gltf/CarbonFibre/CarbonFibre_anisotropy.png | New sample anisotropy texture (CarbonFibre). |
| assets/example_meshes/gltf/CarbonFibre/CarbonFibre.gltf | New CarbonFibre glTF sample using KHR_materials_anisotropy. |
| assets/example_meshes/gltf/AnisotropyRotationTest/Heights_1d_Normals_v2.png | New anisotropy rotation test texture. |
| assets/example_meshes/gltf/AnisotropyRotationTest/GridWithMarkers.png | New anisotropy rotation test texture. |
| assets/example_meshes/gltf/AnisotropyRotationTest/AnisotropyRotationTest.gltf | New anisotropy rotation test scene using KHR_materials_anisotropy. |
| assets/example_meshes/gltf/AnisotropyRotationTest/AnisoRotation30_Linear.png | New anisotropy rotation test texture. |
| assets/example_meshes/gltf/AnisotropyRotationTest/AnisoRotation10_Linear.png | New anisotropy rotation test texture. |
| assets/example_meshes/gltf/AnisotropyRotationTest/AnisoDonutLabels.png | New anisotropy rotation test texture. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
# Conflicts: # vclib/render/shaders/vclib/bgfx/drawable/uniforms/drawable_mesh_texture_uniforms.sh # vclib/render/shaders/vclib/bgfx/drawable/uniforms/material_uniforms.sh
malomo
reviewed
Apr 28, 2026
Member
Author
|
Fixed mipmap downsampling for normal maps (commit 6c2f4ce): Normal Map Downsampling Fixes
|
# Conflicts: # vclib/render/include/vclib/bgfx/drawable/uniforms/material_uniforms.h # vclib/render/shaders/vclib/bgfx/drawable/drawable_mesh/material_uniforms.sh # vclib/render/shaders/vclib/bgfx/drawable/drawable_mesh/surface_pbr/fs_surface_pbr.sc # vclib/render/shaders/vclib/bgfx/drawable/drawable_mesh/texture_uniforms.sh # vclib/render/shaders/vclib/bgfx/pbr_common.sh
# Conflicts: # tests/render/006-mesh-pbr-headless/main.cpp # vclib/render/include/vclib/bgfx/drawable/uniforms/material_uniforms.h
# Conflicts: # vclib/render/include/vclib/bgfx/drawable/mesh/mesh_render_buffers.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TODO:
use floats instead of uint8 per channel, trough bimg functions