Tree @gltf-multiview (Download .tar.gz)
Physially-Based GLTF Renderer
A physially-based GLTF2.0 renderer with image-based lighting.
The renderer uses the reference GLTF2.0 lighting model.
Khronos GLTF viewer | Diligent Engine |
---|---|
![]() |
![]() |
The implementation is based on GLTF sample viewer from Khronos Group and Vulkan-glTF-PBR project by Sascha Willems.
Using the renderer
To initialize the renderer, populate GLTF_PBR_Renderer::CreateInfo
structure and
create an instance of GLTF_PBR_Renderer
class:
auto BackBufferFmt = m_pSwapChain->GetDesc().ColorBufferFormat;
auto DepthBufferFmt = m_pSwapChain->GetDesc().DepthBufferFormat;
GLTF_PBR_Renderer::CreateInfo RendererCI;
RendererCI.RTVFmt = BackBufferFmt;
RendererCI.DSVFmt = DepthBufferFmt;
RendererCI.AllowDebugView = true;
RendererCI.UseIBL = true;
RendererCI.FrontCCW = true;
m_GLTFRenderer.reset(new GLTF_PBR_Renderer(m_pDevice, m_pImmediateContext, RendererCI));
Note that the front face is set to counter-clockwise because in GLTF, y axis points down and we need to invert it, which will reverse the winding order.
The renderer generates all required look-up tables at run-time. For image-based lighting, it pre-computes irradiance cube map for diffuse component and pre-filtered environment map for specular component:
RefCntAutoPtr<ITexture> EnvironmentMap;
CreateTextureFromFile("textures/papermill.ktx", TextureLoadInfo{"Environment map"}, m_pDevice, &EnvironmentMap);
m_EnvironmentMapSRV = EnvironmentMap->GetDefaultView(TEXTURE_VIEW_SHADER_RESOURCE);
m_GLTFRenderer->PrecomputeCubemaps(m_pDevice, m_pImmediateContext, m_EnvironmentMapSRV);
The renderer itself does not implement any loading functionality. Use
Asset Loader to load GLTF
models. When model is loaded, it is important to call InitializeResourceBindings()
method
to let the renderer initialize internal shader resource binding objects:
m_Model.reset(new GLTF::Model(m_pDevice, m_pImmediateContext, Path));
m_GLTFRenderer->InitializeResourceBindings(*m_Model, m_CameraAttribsCB, m_LightAttribsCB);
To render the model, prepare GLTF_PBR_Renderer::RenderInfo
structure and call
Render()
method:
m_GLTFRenderer->Render(m_pImmediateContext, *m_Model, m_RenderParams);
For more details, see GLTFViewer.cpp.
References
History of
GLTF_PBR_Renderer
@gltf-multiview
git clone https://git.s-ol.nu/forks/DiligentFX.git
- GLTF: hacky VR rendering support s-ol 2 years ago
- C API for GLTF_PBR_Renderer s-ol 2 years ago
- Fix misc. typos luz paz 2 years ago
- GLTF PBR Renderer: updated alpha mode shader paramter assiduous 2 years ago
- GLTF PBR Renderer: fixed issue with non-array views of compressed textures assiduous 2 years ago
- Updated copyright notice assiduous 2 years ago
- GLTF PBR renderer: updated default physical desc texture to define rough non-metal material assiduous 2 years ago
- GLTF PBR Renderer: optimzed render function to eliminate redundant CommitShaderResources assiduous 2 years ago
- GLTF PBR Renderer: enabled rendering objects from resource cache assiduous 2 years ago
- GLTF PBR Renderer: removed RenderNodeCallback as it makes little sense and only adds overhead assiduous 2 years ago
- GLTF PBR Renderer: few updates to GLTFNodeRenderInfo assiduous 2 years ago
- GLTF PBR Renderer: moved SRB managing out of the renderer assiduous 2 years ago
- Reworked joints buffer to be dynamic constant buffer assiduous 2 years ago
- GLTF PBR renderer: moved joint transforms into a separate buffer assiduous 2 years ago
- GLTF PBR Renderer: switched to using texture arrays assiduous 2 years ago
- GLTF PBR renderer: updated material shader attribs handling assiduous 2 years ago
- GLTFResourceManager: made allocations ref-counted objects assiduous 2 years ago
- GLTF PBR renderer: using FirstIndexLocation and BaseVertex from GLTF model assiduous 2 years ago
- GLTF PBR renderer: enabled using vertex/index buffers from cache assiduous 2 years ago
- GLTF PBR renderer: updates to match refactored material textures handling assiduous 2 years ago
- GLTF PBR Renderer: added option to use texture atlas assiduous 2 years ago
- GLTF PBR Renderer: made SRB cache thread-safe assiduous 2 years ago
- Renamed USAGE_STATIC to USAGE_IMMUTABLE (API240077) assiduous 2 years ago
- Some updates to match API240076 assiduous 2 years ago
- GLTF_PBR_Renderer: some cosmetic changes assiduous 2 years ago
- Fixed compilation after PSO refactoring azhirnov 2 years ago
- Few updates to match API 240068 assiduous 3 years ago
- Removed no longer needed CommitShaderResources(nullptr) assiduous 3 years ago
- GLTF PBR Renderer: merged mterial info and render params constant buffers assiduous 3 years ago
- GLTF PBR Renderer: added SRB type id to differentiate SRBs (e.g. shadow vs color) assiduous 3 years ago