Game Programming Journey – May & June 2020

Two months, I finally added the specular term of PBR implementation (hence, a complete calculation of PBR) in my home engine, so I can start implementing more graphics features. But I found a couple of bugs on the engine I need to fix and reducing some memory usage on GPU. Plus, I got really annoyed by the fact that I need to rerun the engine every time I changed a simple value for testing. I decided to make a simple tool editor for the engine so I can change some settings during runtime – I’m still on the early stage on this.

Progress

Zooid Engine

  • Added the specular/reflection term of PBR: Creating the specular cube map from a skybox (Image-Based Lighting). The current calculation/implementation is based on Epic Games’ split some approximation here.
Two metal balls. The reflection is coming from the specular environment map.
  • Started creating simple scene Editor: Listing all objects in the scene, and selecting an object in the scene. To support some input, I also implement ZooidUI integration to support Mouse Scroll and Text input.
Simple Scene Editor: List of all objects and an ability to select them – no action implemented yet.
  • Added Visual Studio NatVis file for better debugging for String, Array, and HashMap. The NatVis file is really helpful for me to debug the custom data structures I created. NatVis is a xml file defining what to show when this type is shown in the VS watch window in visual studio. Here is a HashMap xml definition, and the example how the variable being shown in the VS watch window.
  <!-- HashKeyValue in HashMap.h -->
  <Type Name="ZE::HashKeyValue<*,*>">
    <DisplayString Condition="m_occupied==1">{{ key={m_key}, value={m_value} }}</DisplayString>
    <DisplayString Condition="m_occupied==0">{{ empty }}</DisplayString>
    <Expand>
      <Item Name="[key]"> m_key </Item>
      <Item Name="[value]"> m_value </Item>
      <Item Name="[hash]">m_hashKey</Item>
    </Expand>
  </Type>
  
  <!-- HashMap.h -->
  <Type Name="ZE::HashMap<*,*,*>">
    <DisplayString>{{ length={m_length}, capacity={m_capacity} }}</DisplayString>
    <Expand>
      <Item Name="[size]"> m_length </Item>
      <Item Name="[capacity]"> m_capacity </Item>
      <ArrayItems>
        <Size>m_capacity</Size>
        <ValuePointer>m_debugPointer</ValuePointer>
      </ArrayItems>
    </Expand>
  </Type>

A variable of HashMap type shown in the VS watch window
  • I also implemented a better platform Interface for the engine to reduce the engine conde dependencies with platform-specific code/features. In order to do that what I did is create an internal key enum for the engine (based on Windows Virtual-key codes), handle input in the platform application class, and map the incoming input from the current platform into the engine internal input type. I also implemented the GLFW Windows platform interface, since the current Windows implementation is using GLFW for OpenGL.

Zooid UI

  • Implemented a new look of the UI. I was testing how easy to change the style of the UI and decided to go with more dark style UI. Well, the UI still looks like a “programmer” art.
  • Implemented Selection List view. In order to have the ability to select an object in the Zooid Engine scene (see in Zooid Engine progress part), I need to implement a selection list. The usage of the new selection list is very straightforward. Here is an example:
if (ZE::UI::DoSelectionListView("ListTest",
    ZE::UIRect(ZE::UIVector2(0.0f, 0.0f), ZE::UIVector2(250.0f, 70.0f)),
    listItems, selectionIndex, 5
))
{
    std::cout << "Selection Changed to " << selectionIndex << std::endl;
}
The new Zooid UI look.

Learning

  • (Book) Finished Real-Time Rendering the rest Chapter 10 – Image-Based Effects: Depth of Field, Motion Blur, Fog, and Volume Rendering.
  • (Video/Slide) SIGGRAPH 2019 Geometric Algebra. It’s an excellent video introducing Geometric Algebra, especially if you’re familiar with 3D or 2D vector math, and you’re a programmer 🙂
  • (Tutorial) Ray Marching and Signed Distance Functions. A good tutorial for starting making a 3D scene using fragment shader only using ray marching and 3D signed distance functions, especially if planning to do it in Shadertoy. I accidentally made such a cool effect while creating my 3D scene.

Leave a Reply

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