• entries
    17
  • comments
    19
  • views
    21207

Land-o-Rama with shaders and VBOs

Sign in to follow this  
jasjas

415 views

In my last journal entry about Land-o-Rama, I had a basic terrain-rendering class in place. Land-o-Rama performs LOD using a quadtree of patches containing regularly spaced vertices. It adds artificial detail to the terrain mesh at runtime so that it can render terrains as large as 32K x 32K.

In the first renderer class I made, Land-o-Rama drew the patches using basic OpenGL 1.1 code and did the vertex and normal morphing between LODs entirely in software. So by using shaders and VBOs, I figured that I could greatly speed things up.

I created a new derived renderer class to use VBOs and shaders. Instead of storing the patch pool in system RAM, it stores it in video RAM using VBOs. All patches use the same index buffer, so I only have to create the index buffer once. I also created a vertex shader that implements a subset of the OpenGL lighting and fog equations, plus vertex, normal, and color morphing between LODs.

I had no idea how much of a difference shaders and VBOs would make! The OpenGL 1.1 renderer could manage about 10-12 frames per second, but look at the frame rate now:



79 frames per second! Holy crap!

The next thing I worked on was getting rid of that horrible blue fog and replacing it with something that looked like real atmospheric scattering.
Sign in to follow this  


2 Comments


Recommended Comments

That looks pretty sweet. I can't wait to see some more interesting fog in there too. [grin]

You seem to have some odd black crosses near to the camera on the left though, any idea what's causing that?

Share this comment


Link to comment
Quote:
Original post by OrangyTang
That looks pretty sweet. I can't wait to see some more interesting fog in there too. [grin]

You seem to have some odd black crosses near to the camera on the left though, any idea what's causing that?


Hi OrangyTang,

The black crosses are there because I was using vertex-based lighting and these triangles are fairly large.

Edit: When using per-pixel bump mapping, those "cross" artifacts disappear.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now