Depth information and screen space ambient occlusion

The voxel rendering algorithm already collected depth information. A while ago I added some code that collects this information and stores it in a depth buffer. Hence it can be used in post-processing steps, such as the screen space ambient occlusion (SSAO) lighting technique. I implemented the SSAO filter using this tutorial. However, my rendering algorithm does not produce normal information, so I had to change it slightly.

I also added some code to allow super sampling anti aliasing (SSAA), which basically renders the image at a much higher resolution and then downscales this to the output resolution. This a prohibitively expensive anti-aliasing technique, but still, my renderer takes only 2-4 seconds to render a 7680×4320 image and downscale it to 1920×1080, which results in 16x SSAA. Combined with the SSAO this resulted in the pictures attached below. To emphasize the effect of SSAO, I exaggerated the resulting shadows.


7 thoughts on “Depth information and screen space ambient occlusion

  1. Hi, I tried to compile your engine on xubuntu 32bit 14.04 LTS. It almost successfully, but when I try launch some builded windowed app – got an error: undefined instruction. I think this because your engine uses some of SIMD instructions and my machine (amd athlon TL60) not support them šŸ˜¦ Can be voxel engine launched with more simplified version of computation, without tricky SIMD’s instructions?

    • Yes, about half the engine is written using SIMD instructions. It is odd though that the program compiles and crashes. GCC should notice that your computer does not support the instruction and either replace it with simpler instructions, or not compile at all.

      Can you make a debug build, run it in GDB and point out which instruction/line of code is problematic? Maybe I can replace it with a different instruction.

    • I suspect that _mm_blend_ps is the problematic instruction, as it requires SSE4.1. It is used in blend_epi32 in octree_draw.cpp. I just implemented a fall back implementation that should be used automatically, assuming your compiler does not #define __SSE4_1__. Note however that using the fall back is about 10% slower.

    • Yeah, I got it works. Tricky instructions are:
      Instead last three I just written “dummy” implementations that works somehow.
      Finally, I got ~1 FPS with 1024×768 mode. I also try to switch resolution down
      SCREEN_WIDTH = 1024 / 4
      SCREEN_HEIGHT = 768 / 4 in art.h
      but it’s gives “damaged” picture.

      • I’ve added fall back implementations for the other 3 instructions as well. On my PC the fall back implementations end up being about 50% slower, giving ~6.5 FPS.

        The “damaged” picture is caused by an integer overflow in the computation of the bounds array in octree_draw. This can be fixed by reducing quadtree::dim in quadtree.h. I’ve reduced it from 13 to 10, so after you pull from git it should already work properly.

  2. I have few questions about renderer:
    – why cubemap go to discard in each frame?
    why not keep rendered results until position of camera the same?
    – how algorithm produces really looked cubes instead of squares?

    • why cubemap go to discard in each frame?
      The cubemap mentioned in my draft-paper has been removed. I noticed that with some changes to the algorithm I could render directly to the screen. I’ve implemented this updated version of the algorithm, but have not yet taken the effort to update the draft-paper.

      how algorithm produces really looked cubes instead of squares?
      The algorithm interprets leaf nodes as if they have all their 8 children pointing to itself. Thereby it represents an infinite (sub-)octree that represents a single solid cube. The algorithm renders pixels, not squares or rectangles. Hence it must traverse this octree until the node is the size of a single pixel.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s