Friday, November 16, 2012

Better Scene Management

Improved scene bounding volume hierarchy. This scene contains 2,500 instanced Imrod Models.

480x360 @ 25-30 fps

There is still much I want to do in the way of optimizations. My goal is still at least 30 fps at a resolution of 1280x720 (720p).

Once I get closer to this goal, I will be implementing soft shadows, depth of field, and glossy reflection capabilities. The soft shadows will actually make it faster as secondary rays will not be traversing as deeply into the octrees, and the sampling will be interpolated for smoothness. The same goes for depth of field and glossy reflections. Hopefully I will also benefit from utilizing texture memory rather than global memory for the voxel data.

My next blog entry will hopefully show models with color rather than being textured white.

Imrod Model by Dmitry Parkin

Thursday, August 30, 2012

Instance Test

Just a quick test of the instancing capabilities. In this test there are 1,323 Imrod Models SVODepth(11). Only one copy of the octree resides in GPU memory taking 75 MB; the rest are instanced but have there own lighting.

480x400 ~ 4-25 fps  -  (~2.2 billion) Visible Voxels
2x GTX 680

It runs slow as I have yet to optimize the scene octree and there are a few other bottlenecks I am working on.

Here is a 1280x720 render at 20+ fps of a single model:

Tuesday, August 21, 2012

Instancing and Shadows

800x600 ~30 fps - SVODepth(11/8) ~ 50 Million visible voxels
2x GTX 680

This is a low resolution render of a scene that utilizes instancing of only two octree models. I am now in the process of developing an octree based scene graph data structure. This scene graph octree will reduce overall overdraw and speed up rendering substantially.

Wednesday, August 8, 2012

Better Shading

Fixed the shading and added spherical environment mapped specular reflections.

800x600 ~50 fps - SVODepth(11) ~ 2 Million visible voxels
1x GTX 680

My next goal is to implement some sort of contour mapping per voxel, so that even at a lower subdivision level it will still look as detailed as this example.

Friday, July 20, 2012

Rendering Imrod

I was compelled to try and render the Imrod model that Jon Olick (worked for ID Software at one point) rendered with voxels. Below is a video of Jon's render, and below that is mine. Jon's is better...

800x600 ~60 fps - SVODepth(10) ~ 2 Million visible voxels
1x GTX 680

I have been optimizing all that I can without the ability to even debug my parallel code, as the Nvidia Cuda Development site has been down from a malicious attack for the past week. I have been in dire need of the Nvidia Parallel Nsight 2.2 debugging app.

I plan to implement voxel contours so that the voxels no longer have the cubical shape when viewed up close, but rather have a smoother surface that better represents the high poly source model.

Disclaimer: This model is the intellectual property of Dmitry Parkin -

Wednesday, July 11, 2012

Optimization Underway

I have been slaving away at this thing for a while now in an effort to optimize the heck out of it. I am making some progress.

640x480 - ~50 fps - SVO Depth(9)
1x GTX 580

OBJ polygon count: 6,615,041
SVO voxel count: 1,484,810 (22% the detail of OBJ)
OBJ file size: ~500 MB
SVO file size: ~88 MB (17% the size of OBJ) 
5% relative size difference over OBJ

My goal is to get the SVO files compressed down much further. Due to the hierarchical nature of sparse voxel octrees, much of the data I am currently saving to the file can actually be rebuilt at load time. I believe I can cut out at least 16 MB of data from the above example.

Sunday, July 8, 2012

Octree Depth Visualization and Dynamic LOD

Here is something to help you wrap your head around how a Sparse Voxel Octree (SVO) is organized.

I rendered the model with each empty octant somewhat visible as a transparent shade of gray. As each primary raycast traverses into a deeper subdivision level within the octree, the rendered pixel gets brighter. If the ray intersects a terminal voxel (visible part of model), it returns the color to draw that pixel. I also show what reducing the maximum subdivision level rendered looks like (Inherent LOD).

First Real Voxel Model

This will probably be the first post anyone will see, as I don't think anyone would be impressed by the first two. This one has a little bit more eye candy. Not as boring as looking at meaningless cubes...

600x480 - ~60 fps - SVO Depth (7)
1x GTX 580

I wrote a Wavefront .obj file converter for getting polygonal models into a voxel format. All the converter does right now is it places a single leaf node (visible voxel) in the center of each quad polygon. The .obj file was exported from ZBrush with no UV map or textures; only polypaint was used to color it. ZBrush exports polypaint color information within the .obj file in a rather large mess of hex color codes. I am rendering this particular model with Blinn-Phong style lighting from within the Cuda kernel. 

I will be focusing on optimising what I have right now for the next week or so. I should be able to increase the detail and frame rate quite a bit.

Wednesday, July 4, 2012

Renderer ported to CUDA

Here is the same setup running in CUDA. I am using a recursive traversal algorithm.

1024x768 - 180 fps - SVO Depth (20)
1x GTX 580
A little more interesting this time.

The smallest Subdivision level shown above is only one millionth the size of the whole octree. A 1km x 1km x 1km scene subdivided 20 times would result in voxels of size 1mm x 1mm x 1mm.

Getting the Directx 11 / Cuda interoperability working was fairly straight forward. I also optimized the traversal algorithm so that it would traverse the voxel hierarchy in order from front to back.

My next goal is to write a converter that will take a high polygon count (~5 million) .obj exported from ZBrush with vertex color information, and compile a sparse voxel octree from this data. From there, I will attempt to load this data into my renderer to see how it performs rendering a single ~5 million voxel model.

Monday, June 18, 2012

Basic Sparse Voxel Octree Renderer

I began this project by creating a single-threaded sparse voxel octree raycast renderer that runs on the CPU. Here is a screenshot of what I have so far.

320x240 - 30fps - SVO Depth (2)
Not too much to look at right now. The octree being rendered is very simple.

My next task will be to setup a Cuda implementation of the renderer. This will require that I setup a DirectX 11 texture for rendering to and the interoperability between Cuda and DirectX. I won't be worrying about streaming of data to the video card until later.

The ultimate goal of this project, is to produce a system that renders sparse voxel octree formatted models with a path traced lighting algorithm. I believe that there is great potential with this combination.