Not logged in, Join Here! or Log In Below:  
News Articles Search    

Submitted by Cyrus Rohani, posted on February 28, 2002

Image Description, by Cyrus Rohani

Well, here it is - another terrain engine! I know there have been many lately, but I think mine is a little different and somewhat interesting (and I'm proud that I acually finished it!). The terrain you see was entirely generated with Terragen and I found the world and heightmap files at an online gallery. In retrospect, the simple hills and valley are a little plain for a demo, but it took so long to create that I don't have the patience to do it again!

The original intent of this demo was to create an engine that could display hi-res satelite imagery and 3d terrain in realtime. I could then get data of places I have been, and check them out from a different angle! Unfortunately, the only high-enough-res data that I found costs thousands of dollars (anyone know some sources?). I then fell back to using Terragen to create equivalently high-res images. Since I wanted to use satelite imagery, there are no ecosystem based effects. No detail textures. No artwork whatsoever. No flashy stuff. Nothing. Its one texture for the terrain - as raw as it gets - and that's the goal!

Actually, I lied. The entire scene is composed of two textures - the skybox and the terrain map. The terrain map is a 16384x16384 RGB file (grand total of 268M pixels!). In its uncompressed form, it consumes 768MB and after pre-computation, it is over 1GB! The landscape is modelled to be 8192x8192 meters, giving the terrain map a resolution of 4 pixels/m^2 - quite some detail! The terrain data and texture data are stored in a quadtree-like data structure that facilitates fast dynamic level-of-detail for both of them. In this demo, there are 128x128 bezier patches (sorry non-GeForce3+ users) that compose the terrain, and each is associated with "relative" texture coordinates (uv's relative to the entire terrain).

When rendering, the quadtree nodes are allocated/deallocated dynamically. For each visible patch in a node, its actual area (in this case 8192/128=64m^2) is divided by the projected screen space area and a resolution for the patch is determined. Starting at the tree root, I traverse downwards until I find a texture that covers the desired area and is at greater or equal resolution to the patch. Patches don't contain texture coordinates in their vertex data (to save memory) but a single vertex buffer with 16 texture coordinates (to match the cubic patches' 4x4 vertices) in the range [0,1] are used along with a texture matrix to compute the relative coordinates into the desired texture. Some of you may be saying "hey, this is sort of like a super-mipmapping algo." Yup, It is similar (although quite different in some respects) and it allows keeping the pixel:texel ration between 1:1 and 1:2.

The bezier patches themselves also use a level-of-detail technique. Using the screen space projected area, it is easy to determine how many segments are needed to draw the patch at a certain resolution (pixels/segment). In my case, I use 16 if it is relatively close and a geometrically precomputed lower-bound if it is relatively distant. Since tesselating patches with different control points would cause cracks in the terrain, each patch examines its neighbors before rendering. It then tesselates its East edge according to the control points of its East neighbor and does similarly with the South edge. Both North and West edges are tesselated according to the patch's determined resolution, regardless of neighboring patches.

You can see the result in the screenshots. The larger top-left and bottom-right shots show you the landscape from 1.8 meters above ground, and the larger bottom-left and top-right shots lift you by 100 meters or so. The 8 smaller shots show a zoom sequence from 7 kilometers back to a closeup!

Image of the Day Gallery


Message Center / Reader Comments: ( To Participate in the Discussion, Join the Community )
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.

February 28, 2002, 09:48 AM

Nice work!!


February 28, 2002, 09:51 AM

Another comment:

That's the most *insanely* huge "level" I have ever heard about :-)

P.S: Do you have some binaries, and a spare GeForce3 ?

Christopher Dudley

February 28, 2002, 09:57 AM

One word...Impressive!

Looks great, but I thought Terragen was no longer in development?

Matthew Harmon

February 28, 2002, 09:58 AM

Looks great. I use Terragen also and have a few questions.

- First, do you render a single image at 16384x16384, or did you create a script to render it to tiles? I use a script, but have trouble getting the tiles to line up perfectly.

- Does rendering such large textures require a special version of Terragen?

- Is there a way in Terragen to create a parallel projection during rendering, or do you just move the camera as high as possible and use the smallest zoom factor you can?

Something you may want to do is use USGS Digital Orthophoto Quadrangle data. This is a high-res composite of aerial photos. Most of the data is black and white, but some is in color. They can be downloaded directly from the USGS for a nominal cost.

You can also go grab a copy of JetFighter IV. It includes a lot of colorized phototexture of the California/Nevada area. Naturally, the product is covered by copyrights, so you can't resell the data, but it is there in a very clear form for experimentation.


February 28, 2002, 09:58 AM

Really nice work!
Do you use some kind of compression for the data?


February 28, 2002, 09:59 AM

This is f'ing AWESOME!!! Thanks for the really great explanation of the technique you use. Absolutely fabulous!!!!

R. van Wijnen

February 28, 2002, 10:22 AM

This looks absolutely magnificent.
I dislike the water though. Doesn't look realistic enough.

Keep up the good work!


February 28, 2002, 10:40 AM

Really nice, and an excellent explanation. Thanks!
I think the water looks fine, its doesnt distract from the scene, it just looks like a scene with water in it, nothing more, nothing less.
It fits :)


February 28, 2002, 10:42 AM

A slight boost of the specular reflection on the water and a few daisy's in the fields and I'm packing my bag and movin' to Rohani's world ! ;)

Nice work dude !

PS. What's the best texture generation method using terragen: camera straight from above or using some sort of script and if so, where do I find such script ??


February 28, 2002, 10:56 AM

it looks good, but please don`t make stuff that is restricted to high end cards !!!!!
Not eveyone can run out and buy a GF3.


February 28, 2002, 10:57 AM

Hm, don't you get lost on such a large landscape like that? :)

And you're saying 'sorry non-Geforce3+ users' but where are the binaries? ;)
(yes, I've got a GeForce3 Ti 200)

El Wolf

February 28, 2002, 11:02 AM

Very Nice work!


February 28, 2002, 11:13 AM

Yep, do something about the water and this will be awesome.


February 28, 2002, 11:26 AM

AWESOME JOB! This is excelent!

I would also be VERY interested if anyone could shed light on how to get high-res texture data out of Terragen using whatever technique available. As it stands now, I'm only able to get about 512x512 textures (okay, 640x640 is possible but that size won't work in OGL so I have to down-sample it to 512x512). If I lower the altitude to get any larger than that, then it ceases to be ortho/parallel. Anybody got some good tips?


February 28, 2002, 11:50 AM

It's kind of barren. Needs some trees, buildings, etc.

Dennis Carlstrom

February 28, 2002, 12:02 PM

I've been looking into landscape visualization (surprise, surprise) and you might want to check out the Virtual Terrain Project at for links to good sources of terrain data.

Btw, very nice pics!

Jonathan Fischer

February 28, 2002, 12:29 PM

Wow, did you guys asking for binaries read though it all. The data file(s) for it are over 1 gig! That's just a tad bit big to post for download, doncha think? :)

My question is, even with lod and a GeForce 3, how the hell do you manage that much data and still pull of 24 fps? That's nuts



February 28, 2002, 01:06 PM

Wow, that is definately awesome... one quick question. Is the lighting realtime, or a lightmap?


February 28, 2002, 01:33 PM

N I C E W O R K ! ! !

I can see I have much to do before I post my "Terrain" Engine....

low-cost real-place heightmaps?... let me see, USGS 10 meter DEMs..

low-cos real-place textures?... If your talking about Portugal I can point out

This wasn´t a big help!... what good is it Mesquite, Texas heightmap with a sea-shore texture from Algarve...? :-)


February 28, 2002, 01:59 PM

yeah, nice pics! i just wonder how do u make the world heightmaps and terrain textures using terragen?
plz explain :)


February 28, 2002, 04:34 PM

Great i need somthing like that for a game i'm going to make:)))


February 28, 2002, 05:48 PM

Looks very nice indeed, but I think something similar could have been acheived with another type of texturing (a more dynamically based kind, or blended tiles of terrain textures...)

But how do you manage to send the texture data to Opengl (each frame??) ? I guess no one here has 1 Gb of video card memory :)

As for the water it doesn't seem to be real water, just a water texture generated with Terragen I presume, which is part of the one big texture map.

Great work though, I wish I had a GeForce 3 myself :


February 28, 2002, 06:47 PM

I run out of memory (512MB) when trying to do 16384x16384. I did 16384x4096 four times and wrote an app to stitch the images together. BTW I can attest that Photoshop 6 can handle 16384x16384x24bit - although it is quite sluggish!

Yes, you need a registered copy of Terragen to get that size output.

I don't know of a way to do parallel projections in terragen. That's what I wanted to do. As you guessed, I took the shots from as high as possible with the lowest FOV possible.


February 28, 2002, 06:50 PM

Yup, I load my textures as DXT5 - I'm using DirectX8.


February 28, 2002, 06:57 PM

This is not for everyone. Its for me! Furthermore, I encourage anyone who has great hardware to use it and show us the results. Aren't you interested in what can be done on the latest hardware?


February 28, 2002, 06:59 PM

If you want, I'll send you the 1GB of data along with the binary! :)


February 28, 2002, 07:18 PM

Word. Read the description before commenting! :)

This is a big question. Clearly the killer is texture size, and I achieve 24 fps mainly by minimizing texture bandwidth requirements. I use a quadtree like structure where each node has a unique ID corresponding to an image on disk. Each node has a fixed texture size (128x128 in this example) and is a representation of an area at a resolution proportional to the quadtree level. Thus, nodes that are far from the camera get rendered closer to the tree root, where the images cover larger areas at lower resolution. By knowing the terrain patch size, you can calculate what resolution is necessary to get at least 1:1 pixel:texel ratio. Then you recurse the quadtree searching for particular areas at a desired minimum resolution. Once found, that texture is cached and using texture generation, I scale and offset my UVs into the right portion of that texture and render.

The geometry is bezier patches that are cached and tesselated on the card, so even with 100,000+ polys, performance is good.


February 28, 2002, 07:30 PM

Its lighting effects from Terragen, burnt into the base texture.


February 28, 2002, 07:35 PM

Download Terragen ( and give it a try. Its very easy to create heightmaps and textures to go with it. However, I downloaded the terragen files from an online gallery (I'm no artist) and made small changes.


February 28, 2002, 07:38 PM

Read the intro blurb.

This thread contains 37 messages.
First Previous ( To view more messages, select a page: 0 1 ... out of 1) Next Last
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.