Posts In:

3D Perlin Noise

With the power of a working isosurface extraction algorithm, I decided, quite naturally, to test the capabilities of marching cubes on the 3-dimensional analogue of my favorite noise function - perlin noise.

Coding a perlin noise function to work in tandem with the marching cubes algorithm was simply a matter of transferring the 3D perlin noise function that I had already written in HLSL over to equivalent CPU instructions.

The results, though quite intriguing to look at, aren't particularly beautiful.

Unfortunately, 3D perlin noise does not seem to be feasible for real-time application. Generating one or two meshes that use 3D perlin noise may be acceptable, but making heavy use of the function simply isn't feasible if loading times are to be kept reasonable. It's slow. Really slow. Perlin noise is already a computationally-expensive function, and the fact that I'm now running a 3D analogue of it (which is, by nature, more expensive than 2D) on the CPU rather than the GPU makes the problem intractable. The CPU simply isn't capable of crunching the math fast enough.

In the long run, I'm going to look into alternatives to 3D perlin noise. The function would be a great asset for a new reality, but it's not practical for real-time application at the moment - at least on the CPU. In the future, I'll try to look into DirectX 10's stream out, as I know that it can be used to perform marching cubes on the GPU (probably in a ludicrously small fraction of the time that it takes the CPU).

Lots of Optimization

October 10, 2010 General News 0 Comments

Since I haven't had much time recently for major coding sessions (between classes and a social life), most of my work over the past few weeks has involved optimization. After downloading Intel's Parallel Studio trial, I immediately fell in love with the large suite of optimization tools it offers. Armed with such tools, I revisited my implementation of the Marching Cubes algorithm as well as my mesh simplification algorithm which, together, take up a huge amount of CPU time. Both, however, are absolutely critical to A New Reality.

After lots of tuning, I have the isosurface extraction algorithm running about 15-20 times faster and the mesh simplification algorithm running about 5 times faster. Combined, these speed increases allow for the creation of ultra-high detail meshes in almost no time.

On a side note, I also wrote my own (simple) implementation of the STL vector that runs about 5 times faster than the STL version for typical usage. Not bad! As a bonus, it shaves 2kb off of the packed executable. And here I was thinking all along that STL was made by the Gods of optimization.