Game Programming Journey Monthly – October 2019

Progress

Zooid Engine

  • Added separate draw list for rendering depth shadow map. There was some issue with shadow rendering on the engine before, which used the same draw list for drawing the actual scene. This implementation caused some problems where shadows will not be rendered in the place should be in shadow since the occluder is not part of the scene draw list. To fix this, I implemented a separate draw list for each light in the scene. The draw list is generated based on the light type.
    • Directional light will use Cascaded Shadows Map (CSM) – uses four shadow maps, and to generate draw list, it will use four orthographic frustums for each shadow map.
    • Point light uses four frustums to generate the draw list in all four directions.
    • Spotlight uses a perspective frustum to generate the draw list.
  • Updated the ZooidUI code to use the latest one, along with the new update from this month. This update will include a bunch of UI components, like vector input, slider, text input box, panel, and some update on code simplicity (see ZooidUI update).
  • Added support for Anisotropic filtering, also added support for OpenGL Renderer. If you see the previous update, you will notice that the texture on the floor looks blurry. Because the camera looked at the floor at the steep angle, causing the texture filtering failed (it was using trilinear filtering, I believe). I added support for enabling Anisotropic filtering on the texture object in GPU.
  • Implement Depth Pre-Pass. I did read some graphics studies in the last couple of months and found out that most of them using Depth Pre-Pass (another name: Z pre-pass). This pass will help to reduce the number of fragment/pixel shader calculations in the next render pass – GBuffer pass for deferred rendering or rendering the actual scene in forward rendering. In the Depth Pre-pass, there are two passes. In the first pass, it will take only the scene to depth buffer for the first pass. In the second pass, the renderer will use the first pass’ depth buffer to render the scene and only render each pixel if the pixel passes the depth test (with compare function: less and equal than). The depth map result can also be used for GPU queries for the next pass, for example, filtering the scene draw list before sending it to the GPU (Query of drawing simple mesh – most likely box – before drawing the actual complex mesh).
  • Fixed some rendering bugs:
    • Fixed frustum calculation from View Matrix;
    • Fixed bounding sphere and box for mesh that used for frustum culling;
    • Fixed frustum generation for CSM (Cascaded Shadow Map) for directional light. This fix will make the shadow frustums to fit each partition of the view frustum and improve the quality of the resulted shadow maps.
Sponza Crytek scene. The result for this month. I took at the (almost) same angle as the prev month screenshot. The obvious ones are the Anisotropic filtering, light, and cascade shadow working on this scene.
The GPU events break down per pass.

Note: If you noticed that in the screenshot, there is some FPS drop. That was caused by the draw thread got some threading lock that causes the thread to wait. I don’t know why that was happening. I probably did something wrong with the threading implementation.

Zooid UI

  • Refactored the code and changed the way to create UI in code:
    • Added support for Automatic ID. Previously, I provide id every time creating the UI component. The id will be generated based on the parameter when calling a function creating the UI component, for example, the id from creating a text input will be generated by the pointer to text buffer (not the content of the buffer). I use CRC32 of the pointer or string as an ID but it can be changed later on. I got the CRC32 implementation from here. Later, I found out that Dear ImgUI already uses the same method.
    • Added new Panel system. The old panel system needs me to provide position, size, and also keep the reference of the position if the panel changed. It also not populated automatically the component under the old panel; I needed to layout the components manually. As for the new panel system, the position and the size of the panel will be managed in the UI engine. Also, all the components under the panel will be layout automatically by the engine.
Before refactored. I needed to provide the id and location of the panel and its children.
After refactored. It has more compact code, no need to provide the id or position for the panel and its component

Learning/Tutorial

  • (Book) Real-Time Rendering Third Edition: Chapter 9 – Global Illumination, subchapter: Ambient Occlusion.
  • (Tutorial) DirectX 11 from Rastertek.com: Light Map and Alpha Map.
  • (Tutorial) DirectX 11 from Rastertek.com: Bump Map (Normal map).

Leave a Reply

Your email address will not be published. Required fields are marked *