Skip to main content
GameDev.net gamedev.net
🔒 Locked

Terragen Surface Map Renderer

Started by Lutz Jun 17, 2005 at 9:13 AM 5 replies 3.7k views
Original Post
Lutz
Lutz
Hey, I've played around with some Terragen tutorials and I'm absolutely amazed what is possible with this program - even without any image textures! Now, I'd like to include some capabilities of Terragen into my own engine. More precisely, I would like to use their surface maps for my planet renderer. I've seen they've specified the file format, so loading the .srf surface map file shouldn't be a problem. The .srf file contains only the parameters for the surface generator, not an algorithm specification. So what I need is some routine which takes the parameters and creates me some surface texture. That is, I need a routine that somehow imitates Terragen. Does anyone know whether this is available?
ApochPiQ
ApochPiQ
I haven't played with Terragen in years, so I'm not familiar with the texture system it's using these days. What sort of parameters are provided in the file? If it's like it used to be (or at least I think I'm remembering Terragen... maybe it was VistaPro) there's basically just a gradient function that maps altitudes to surface colors, which you can perturb a bit with a handful of standard noise functions.
Lutz
Lutz
No, it's more complicated. They store parameters that go somehow into noise functions like bumpiness and amount of fractal noise. They don't describe how exactly all the parameters enter the noise functions.
zppz
zppz
I tried making a utility to do this a few years back, I got it working fine for a certain surface map, only to find it didn't work half as well with another surface map... mostly my experience was a repetition of this, so I gave up trying to perfect it (although still used it for my little game).
If you like I can dig up the code for that util... at least you will have a srf file reader.
Ysaneya
Ysaneya
I also remember something i did a long... LONG time ago (back in 2001). It's not as advanced as Terragen, obviously, but gave decent results. I posted an image of the day on Flipcode, with some explanations and the small script that generated the texture. For my planet engine i'll try to implement something similar, but on the GPU with a pixel shader.



Y.
Lutz
Lutz
Quote:
Original post by Ysaneya
I also remember something i did a long... LONG time ago (back in 2001). It's not as advanced as Terragen, obviously, but gave decent results. I posted an image of the day on Flipcode, with some explanations and the small script that generated the texture. For my planet engine i'll try to implement something similar, but on the GPU with a pixel shader.
Y.


Ysaneya, that looks pretty good.
Do I understand your explanation correctly that you have three images (grass, rock, sand) and blend them together, where the blending weights are based on altitude, slope etc.?

Quote:
2. It is not using a Terragen's texture. Terrain textures are completely procedurally generated.

This sentence confused me a bit. Should "Terrain" be "Terragen"?

Terragen actually works quite similarly, except that they don't use images but constant colors.

zppz: I would be very happy if you could give me the code. I've managed to load srf files meanwhile, but it's always a good idea to see what other people did.

Does anyone understand how the lighting workd in Terragen?
What lighting equation do they use?
The only thing I've found out is that it's quite different from OpenGL's
(ambientColor + diffuseColor*cosangle(normal,light)) * textureColor
(If I use this type of lighting, results are much too dark)


Ysaneya
Ysaneya
Quote:

Ysaneya, that looks pretty good.
Do I understand your explanation correctly that you have three images (grass, rock, sand) and blend them together, where the blending weights are based on altitude, slope etc.?


Yes (except it's a set of layers - 3 in the example, but more are possible). The images are used to give a bit of color variation. Terragen uses constant colors directly, and add a bit of variation using some Perlin noise. Taking the diffuse colors from an image was just a way for me to speed up the process.

Quote:

This sentence confused me a bit. Should "Terrain" be "Terragen"?


No. I only meant that my terrain texture was procedural instead of being pre-generated by Terragen.

Y.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.