Pages

Showing posts with label Terrain. Show all posts
Showing posts with label Terrain. Show all posts

Friday, June 20, 2008

Terrain and Atmospheric Scattering Source



I figured I would release my source for the terrain rendering demo. There aren't that many terrain and atmospheric scattering examples on the net, so I figured I might as well post mine for anyone that would like to see it.
It's still a work in progress (that I paused about a year ago), so it's kind of immature. But it is the same code that produced the images I posted awhile back. You'll probably need at least a 6 series Nvidia graphics card (or ATi equivalent). For the terrain, the demo uses a simple quad tree with frustum culling, so it's not the greatest performer for anything above 512x512 heigtmaps. Also, it is in Managed DirectX, but it shouldn't be too hard to port to XNA.



Anyway, enough of that. If you didn't know, the Creature Creator for Spore has been released, and it's an absolute blast to mess around with. The possibilities on what you can create are pretty much endless. Here's a couple that I made:
CRE_spider-0685c592_sml
CRE_Graptilosaurus-0685c593_sml

Thursday, March 20, 2008

Terrain Rendering and Atmospheric Scattering

Terrain has always been an interest of mine, ever since I loaded my first 8-bit raw heightmap. And last summer I decided to dive into Atmospheric Scattering after reading Ysaneya's developer journal over on gamedev for quite some time.

So I read ATi's paper and looked at their demo and set out to work. Now, I'm not math genious (having only taken calculus and linear algebra), but implementing atmospheric scattering is not for the faint of heart. However, after about a month I had a pretty good working implementation based on the Hoffman and Preetham paper.

Then I started on the water rendering component. There were two articles in Shader X3/4 that were of great help when it came to getting the color just right.

After a couple of months I had a pretty good looking demo. The terrain wasn't anything special, it was just broken down into a quadtree, so I was only able to render 2048x2048 terrain. In order to do this I made the water be at half the height of the terrain and culled the non-visible areas when i was above/below the water, so I was effectively only rendering half of the terrain when I was above/below the water line.

Anyways, on to the pictures:
Scene details:
  • 1024x1024 terrain with multi-texturing and aerial perspective
  • Sky dome with sun and skylight scattering
  • 2048x2048 water plane(size not number of vertices)
  • Bloom post processing
  • Written in c# and managed directx









And a video of it in action:



The water has realistic coastal coloring, soft edges when it intersects the terrain, under water fogging, and depth fogging.

This summer I plan to rewrite the whole application in c++. I also want to extend the terrain rendering with geomipmapping, fix the huge sun, and add volumetric clouds. I had tried implementing volumetric clouds using mega particles, but didn't turn out too well in a dense cloud field. Worked really well for volcanic or nuclear plumes though. More on this in a later post.