Saturday, March 31, 2012

3/31 Progress

I ought to get in the habit of posting to this blog regularly.

Since my last post I've been working on coding a cloud generator using a voxel buffer based on chapter 2 of Game Engine Gems 2. I've decided that, rather than modifying my existing volumetric renderer code, I will just code a new C++ project from scratch. I think the final product will differ too much from my old volumetric renderer to make it worth modiying pre-existing code.

I also need to do more reading on 3D textures. I've decided that, in the long run, learning more about GLSL will be better than attempting to code the renderer in CUDA. I enjoy coding in GLSL more and, as much as it pains me to admit it, I am not adept at writing efficient CUDA code. As such, I will be rendering the clouds I generate via 3D textures and raymarching in GLSL.

For Monday I expect to have offline rendering of my cloud generation.

Wednesday, March 14, 2012

Description / Proposal


I propose to extend my volumetric renderer from CIS 560 by adding a more realistic cloud generator, rendering the cloud(s) with the GPU, and altering the cloud lighting formula. I will be basing my work on Frank Kane’s chapter of Game Engine Gems 2, which describes techniques for modeling, lighting, and rendering clouds in real time. The cloud generator Kane describes stores three different bits of data (vapor, phase transition, and cloud) in each cell of a voxel grid in order to procedurally generate a cloud within the grid. The grid is initially randomly seeded with vapor bits. When the cloud generation algorithm is run, during each iteration the three different cell attributes are looked at and the cells are updated based on their data and the data of nearby cells. When a cell contains a vapor bit and a cell next to or below (but not above) it has a transition bit, that cell also gains a transition bit and loses the vapor bit. When a cell has a phase transition bit, it gains the cloud bit. Additionally, a small probability is coded to make cells lose or gain certain bits, in order to represent cloud particles evaporating or more water condensing. This random function is necessary for the formulation of a cloud since the initial cloud grid contains only vapor cells; phase transitions must be randomly created during iterations of the algorithm.
Once the algorithm has generated cloud data for the grid, the cloud can be rendered. Kane describes three different methods of doing this: volumetric splatting, volumetric slicing, and ray marching. At the moment I plan on implementing just ray marching (I think it would look the most realistic). Before the actual rendering can begin, though, the cells’ lighting must be calculated. By using a multiple forward scattering technique to simulate the way light is dispersed through a cloud, the lighting of each voxel can be computed before the raymarch. After computing the lighting of a single voxel, one can use its light value to then compute the lighting of neighboring voxels, since light scattering is not contained to just one small section of the cloud.
The volumetric renderer will, in addition to the main cloud generator and renderer, support various types of lights: point lights, directional lights, spot lights, and area lights. After all, a cloud will look less realistic if there is nothing with which to light it. Multiple lights in one scene will also be supported.
As for why there is a need for my project: real-time rendering and generation of volumetric clouds is useful for games. It makes the game look more realistic.