工具介绍
一个基于 Vulkan 的实时 PBR 渲染器实现
Laugh Engine
A Vulkan implementation of real-time PBR renderer.
Results
glTF Support
- glTF, also called the GL Transmission Format, it is a runtime asset dilivery format for GL-based applications. It supports common functionalities of 3D applications such as geometry, texture, skin, and animation. It also allows extension, for example, I used the FRAUNHOFER_materials_pbr extension to load PBR textures.
- It aims to form a standard/common format for runtime asset dilivery/exchange. In my opinion, it has better documentation than FBX and possess some abilities that some other file formats don't (e.g. scene hierarchy, skin, animation). I believe, if it gets popular, it will be a great convenience to both application developers and artists because less effort will be required to perform application-specific conversion on file formats.
- In order to show my support, I added glTF support to Laugh Egine. It is now able to load geometry and material data from glTF files.
- Below are some screen shots of 3D models loaded from glTF files. Thanks to Sketchfab for providing these glTF assets and Gary Hsu for the glTF 2.0 test models.
| Microphone (glTF 1.0) |
Helmet (glTF 1.0) |
|
|
| Boom Box (glTF 2.0) |
Lantern (glTF 2.0) |
|
|
Updates (3/26/2017)
Shadow
- Implemented Cascaded Shadow Map (CSM) for directional lights. The lesson I learned is that having shadow is easy but making it presentable is not. Most of my time was spent in fixing shadow mapping artifacts such as perspective aliasing (multiple pixels mapped to the same shadow map texel), projection aliasing (enlongated, pointy shadow on surfaces that are almost parallel to the light direction), shadow acne, and shadow edge shimmering.
- Tighter orthographic frustum, slope based depth bias, non-uniform frustum split, and PCF are used to mitigate shadow acne and perspective/projective aliasing. To fix the shadow edge flickering problem, I followed the moving light in texel-sized increments idea from DX11 CSM sample. The reason why shadow edge shimmers is that an area of the scene (e.g. a small patch on a floor) is covered by shadow pixels of different sizes/shapes/orientations due to the fact that the orthographic cascade frustums are updated each frame in reponse to camera movement. Therefore, to combact this artifact, we need to fix the sizes and orientations of the orthographic cascade frustums and move them in texel-sized increments. So a patch in the scene is always covered by a shadow map texel of the same size/shape/orientation.
- I render the shadow map for each cascade using different subpasses without inter-dependency in the hope that they will be executed in parallel. However, according the to timeline of RenderDoc capture, it seems that the subpasses are executed sequentially. So I may switch to the geometry shader layered rendering approach in the future. Performance comparison is needed.
| Test Scene Cascades |
Drone Cascades |
|
|
Optimizations
Overview
Performance Analysis
Build Instruction
- Install LunarG Vulkan SDK
- If you have Visual Studio 2015, the solution should build out of the box
- To run the program, you will need to copy the .dlls to executable path or system paths
- Builds on other platforms are not supported yet
Third-Party Credits
References:
Libraries
Assets