Soul Engine Devlog #March 2019

It has been two months since my last devlog in January. I didn’t do any devlog in February due to laziness so there is not much to show on that month. I try to figure out what makes me feel lazy to continue this project, and I figure out that it is tough to debug and test the feature that I implemented. I always know that I need a better editor to do testing and debugging but unwilling to invest some time on it because it doesn’t contribute anything to the visual. Something that I learned is that debugging facility is an essential part of the development even though you might throw it away and it is not part of the end product. After I implement the editor, doing this project start to feel enjoyable again.

So here is the list of things that I want to talk in this devlog:
– Editor Improvement
– Point Light and Spotlight
– Glow Postprocess
– Area Light / Emissive Material

Editor Improvement

With the help of Dear ImGUI, it is really easy to develop a quick yet decent editor. The first thing I notice that I really need is being able to load model other than the Sponza Atrium. I decided that I will implement a GLTF loader. The reason is there is a plethora of model in sketchfab that can be downloaded as GLTF model. My rendering engine doesn’t fully support all GLTF model yet, but I have tested it with a lot of GLTF model from sketchfab.

Another thing I implement is a basic entity tree and manipulator for moving the entity in the editor (I use ImGuizmo for the manipulator). I used to change the position of the model in the code and recompile the code. Being able to drag and drop the entity in my editor feels really refreshing.

Spotlight and Point Light

Spotlight and point light in Soul is pretty standard. Similar to directional light, spotlight, and point light will allocate some texture regions from the shadow atlas to do shadow mapping. Spotlight will allocate one texture region and point light will allocate six texture regions, one for each face. You can think of point light as six spotlights with a 90-degree angle facing each axis. This implementation of point light proves to be problematic.

Notice the white line in the shadow area.

As you can see in the image above. There are visible white seams in the shadow area. This happened when a point light samples the shadow in the edge of each cube or at the border of each texture region. When we do PCF filtering, we need to sample the neighboring pixel. Because we allocate each faces of the cube randomly in shadow atlas, we need to be careful. One pixel left on a cube face is not the same as one pixel left in the shadow atlas, specifically at the edge of a cube face. I expect this to happen when implementing the point light. Implementing the correct solution is quite hairy, so I kinda skip it. This is definitely future work for me to make point light cast the correct shadow.

Glow Postprocess

Glow in soul engine follow similar technique that is employed in Godot. It is an effect that happened when a pixel is too bright that it bleeds to its surrounding pixels. First we extract all pixels on the screen that have brightness more than a certain value that is set by the user. Then, we do gaussian blur multiple times. Each time to half of the resolution of the original image. Then the user can choose which level of blur contributes to the final image.

Original Image
Extract bright area

Above is the image of Gaussian blur of different levels

Final result: Original Image + Blurred image

This is something that is quite easy to implement, yet it gives a lot of wow effect.

Area Light / Emissive Material

Personally, I think this is the most exciting feature that I implemented recently. One thing that is nice with Voxel GI is that it is easy to implement area light, albeit not accurate. Area light in soul engine is just an emissive material, so it can be any arbitrary shapes and volumes. Adding area light is as simple as adding the emissive value into the voxel during ‘voxel light injection’ pass.


Area Light
Arcade machine (Source) and Neon (Source)
Pont Light and Spotlight

By now, I am sure you can guess how much I like glow. Okay Thanks for reading.


  • Distance and angle attenuation function for point light and spot light follow google’s filament and frostbite course note
  • Voxel cone tracing for area light. I get inspiration from here.

Leave a Reply