Skip to main content
gamedev.net
🔒 Locked

Creating detailed terrain under severe limitations?

Started by Mephs 63 replies 31.8k views
Original Post
Mephs
Mephs
I''m just posting here in the hopes that someone might have some suggestions as to how to improve the quality of my terrain. I have included a sample image of my terrain as it currently stands. My problem is that I face severe graphics card limitations. I have a voodoo 3 2000, it supports a maximum texture size of 256x256 (OUCH!!), 3 multitexture layers, no pixel shaders, no vertex shaders, only power of two textures, 16 megs video RAM limit. I''m finding it incredibly difficult to make my terrain look any better than it currently does. My main problem is the texture limitations. The base texture for my heightmap is a 256x256 texture stretched over a 64x64 mesh, created by blending 3 layers of textures dependant upon vertex height. Even when I apply a detail texture over the base texture... it doesn''t really look that great. The 256x256 texture size limit is the major problem, I could tile several 256x256 textures over the heightmap and gain a bit more detail I suppose, but even then I don''t think I would really be happy. I want smoothe looking terrain such as: or: It seems in the case of the first image, that there is no stretched base texture at all, everything is textured at a high res. In the second case, it does appear that there is a base texture, but it is managed in such a way that the snow does not have the same detail texture as the muddy area. I''ve experimented with my editor, allowing the user to select an area to overlay something similar to a decal, I think what I''ve done there is perhaps similar to how the train track in the dungeon siege picture is achieved. The problem is though, it only helps add an extra bit of localised detail, it doesn''t improve the general terrain quality. So, if anyone has any suggestions for various methods to increase detail even further, bearing in mind my limitations, I''d really appreciate the help! Alternatively if you just have any general hints for good looking terrain, I''d appreciate that also, because the minute I have saved up a couple of hundred pounds I swear I''m going out and buying the best new graphics card I can afford!! cheers, Steve aka Mephs PS for reference, I''m using Direct3D
Extrarius
Extrarius
The way dungeon siege works is that it uses 3d tiles with attach points. Each little section of terrain(like a small cliff piece, ramp, etc) is modeled and textured in gmax and then in the map editor the tiles are placed and if you use the right pieces next to eachother, they form a seamless ground. Since each tile has its own texture (or there might be a small list of textures and they use the parts of each they need, like grass, trail, etc) a very high level of detail can be achieved.
"Walk not the trodden path, for it has borne it's burden." -John, Flying Monk
Mephs
Mephs
Yeah, I suspected it did something like that, I saw a couple of the editor screenshots and saw pictures of the tiles you mention. It does make me wonder if perhaps I should be looking to follow a similar route rather than using a heightmap. I''m not sure, I just think that currently my heightmap looks too ugly, too low resolution. It might suffice for my game project with a bit of lighting thrown in, and perhaps a larger base map once I get a new gfx card, but until I get the power of the features the newer cards introduce, I''m stuck with the functional but ugly thing I have at the moment. So, I''d still appreciate any further advice, or examples of how people have gone about dealing with making a nice looking landscape for their own projects perhaps? I''m not fussed about super photrealistic terrain, I just want it to look reasonably smoothe and decent res, with perhaps the odd splash of high detail like my decal-style technique, failing that, perhaps I need to rethink my idea of using a heightmap and consider other methods like this dungeon siege method.... not sure, not sure!! hmm.....

*wanders off in confusion*...
Yann L
Yann L
quote:

Alternatively if you just have any general hints for good looking terrain, I''d appreciate that also, because the minute I have saved up a couple of hundred pounds I swear I''m going out and buying the best new graphics card I can afford!!


Don''t run out just yet. Your hardware is not as limited as you might think, and you can do pretty nice looking terrain with it.

Look at those screenshots, for example. They are really old shots from our very first terrain engine prototype, years ago. It run on a Voodoo-2 if I recall correctly, using Glide, under DOS

Terrain 1
Terrain 2

If you''re interested in technical details, let me know.
Extrarius
Extrarius
YannL: I''d love the technical details - it looks VERY NICE =-) It sounds about the tech level I''m aiming for too - I don''t plan on using any shaders etc like you have in your newest engine.

It looks like a heightmap, with either multi-texturing or multi-pass rendering, which is exactly the kind of thing I''m going to make for my game, but I''m not sure how to make the textures blend so nicely from one to another like you''ve done.
"Walk not the trodden path, for it has borne it's burden." -John, Flying Monk
ProgramMax
ProgramMax
Why does Yann L own so much? Is there some magic "ownz0r" pill that I can take?

I research and contact hardware manufacturers and ask questions. Even after I think I have done as much as I can and have put in a lot of hard effort, Yann L still finds a way to make my jaw drop.

Yann L - Do you think you might give some small speeches or something to help others move from "I don''t suck anymore" to "I own now"? Thanks!
Yann L
Yann L
I didn't do it, a friend of mine did (he is now our game's project manager). I only did the sky on this one Heh, the good old memories...

Anyway, the technique is actually very simple. It's basically multitexturing with really good textures. The textures are from photographic sources, sepcifically from Marlin Studios. They make excellent professional quality textures, we use a lot of their material in our scenes.

The layers are blended together by using vertex-alpha, which is a precalculated coverage value, based on various surface texture distribution params: altitude, slope, etc, and also a user-defined surface map (eg. to draw roads, paths, etc, into the terrain).

For more details, I'll have to check out the old sources (somewhere on a dusty CD in the archive...) If you want, I can post some source (although it is in Glide).

quote:

Yann L - Do you think you might give some small speeches or something to help others move from "I don't suck anymore" to "I own now"? Thanks!


lol Actually Trent (mittens here on the forums) asked me if I was interested in giving an IRC lecture about some graphics topic. I'm not so sure, I don't really like IRC very much, but would some people here be intersted in something like this ?


[edited by - Yann L on March 14, 2003 8:44:56 PM]
ProgramMax
ProgramMax
I kinda noticed that you are on the gamedev.net forums a lot more than in #gamedev. If that''s your thing, I would be just as happy (infact probably more happy) to have a special column where you write on various topics of your choice. If you did that, we could reference it at any time. Even more, you could perhaps attach a thread to each column so people can post comments and questions about that particular column.

Anyway, I would be very interested to learn anything I can from you. I have waded through these forums and seen enough of your examples that I would basically hang on your every word. Even if you were teaching something very simple, I have this hunch that I would pick up something that I either skipped over or didn''t realize at the time.

*crosses fingers* Well, I gotta go pick up my GF. Thanks and Cya L8er!
GekkoCube
GekkoCube
Hi.

After taking a look at those two really nice screenshots of your old terrain, i almost nearly cried. Im working slowly on my 2nd generation of landscape rendering...learning as i go.

i can tile my textures or stretch them.
but i cant make it look anything like what your posted.

im using directx 8.1 now, and i need a tutorial on blending textures together AND doing that vertex alpha stuff for smooth transitions.

and speaking of texture transitions, is the mountain texture a different one from the valley texture? If so, i need a tutorial on that kind of texturing technique as well since mine only supports one texture over the entire mesh.
Mephs
Mephs
Yes Gekko, you have hit the nail on the head of what I''m interested in learning, or part of at least. Firstly I''m interested in the detail level in general, but I''m also interested in how to have more than one detail texture, like the mountain/valley situation. At the moment, for my detail texture, I purely tile it over every quad in my heightmap and multitexture it over my base texture, thats obviously not what is going on in the screenshots though, something a little more advanced is being used.... anyone care to explain?
masterg
masterg
quote:
Original post by Yann L
Actually Trent (mittens here on the forums) asked me if I was interested in giving an IRC lecture about some graphics topic. I''m not so sure, I don''t really like IRC very much, but would some people here be intersted in something like this ?



Quite; I love mr. polack and even his last lecture. (#Lecture, afternet) Thus, judging from this and your character, I would indeed enjoy any sort of lecture given by you.

masterghttp:/masterg.andyc.org
mittens
mittens
As for terrain stuff, I''ve written a book on the matter (mwuahahaha), which you can get a link to in my signature below. But I''ve also given an IRC lecture on the topic (similar to the one YannL was talking about). You can see the entire lecture on the ''net at http://www.andyc.org/lecture/viewlog.php?log=Future%20of%20Terrain%20Programming.

If you have any questions or anything, feel free to e-mail me... Once again, the link is in the sig.

YannL: Terrain = *drool*... And still think about that lecture, we need a speaker.

Trent Polack
trent.codershq.com
trent@codershq.com
Author of Focus on 3D Terrain Programming
mrbastard
mrbastard
Mephs:
Charles Bloom has a good article on his site about blending between different layers of terrain texture. Maybe that''ll give you ideas. I haven''t tried it yet myself - it looks hard to do at a decent speed (at least with my very basic culling).

YannL and Mittens:
I''d be very interested in a lecture on pretty much anything graphics related YannL decided to talk about ;¬)

That said, theres not much info around on the stuff Mephs is asking about - theres a lot out there on basic heightmapped terrain, basic culling and basic lod, but not a lot (the link above being an exeption) on texturing terrain. Very few people seem to make the leap between streching overall and detail textures over the terrain, to something detailed. Allowing artists control over this stuff via tools is another consideration..

So a lecture or article on this stuff would be very cool if Yann is interested in talking about it.

Or maybe a lecture on the applications of noise for outside environments?

Dan
[size="1"]
Yann L
Yann L

OK, so here the technical detail of the terrain renderer.

The terrain itself is not a heightmap, but a progressive mesh. Although it looked pretty good, we trashed that concept and replaced it by fully parametric surfaces in the current engine. Progressive meshes need face-level operations on the CPU, and that''s not good with modern 3D hardware (although it was no problem with a Voodoo). The terrain texturing technique, however, is also applicable to heightmaps, or pretty much any other representation you choose.

So, the texturing is divided into two distinct parts: the base composite layer, and the detail composite layer. The base layer is used over the entire range, the detail layer is only blended on the geometry near the camera. The blending starts at approx. 20 meters, and raises exponentially, until at around 5 meters it has completely replaced the base layer. The shots from the old engine only used those two layers, which is not always enough (notice the still blurry looking grass near the camera, in the first shot). My current engine uses the base layer, and 3 additional detail layers, which allows for extremely detailed textures, even when the camera is really near. You can use any amount of layers you want, the overhead is minimal, since the additional layers are only rendered on a very small part of the overall geometry.

Each composite layer itself is a blend between several small base textures. Here are the 6 base textures used in the terrain shown above:


As you can see, we have two grass textures, two bare ground, and two rock surfaces. All textures have 256*256 resolution (although the new engine uses 1024², the Voodoo wasn''t able to do more than 256). The 6 different textures are blended together using weighting factors, stored as per-vertex. On a 2 unit system such as the Voodoo, this can take up to 3 passes, on a modern Radeon, it can be done in a single pass. Note that most faces will not have all 6 textures applied at once, a typical number is around 2 to 3.

To get the alpha weighting factors, do the following steps:

* for each face, classify into a topographic class, depending on altitude, slope, and various other factors (experiment a little !). Classes include: grassy ground, baren ground, slightly rocky, very rocky, etc. You can add much more, you can even make it dependent of the vegetation over the ground (eg. introduce a needle-covered-ground class, if you have a pine forest over it).

* Have a configuration structure, where you assign a certain texture to a certain topographic class. Eg. class "grassy-ground" = GRASS.PNG, "snow-surface" = NICE_SNOW.JPG, etc.

* now you can use the texture - class attribution structure to assign a single texture to each face, depending on the topographic class computed in step 1.

* This point is very important now: compute how many faces connect to it, and create a weighting factor for each texture connected to the vertex. You now have a list of textures, and their respective weighting factors, per vertex.

* For each face, you can finally create a list of texture blends, by processing the texture weighting lists of each vertex the face connects to.

At this point, you are left with two structures: for each face, you have a list of textures that need to be blended on the respective face, and for each vertex, you have a list of weighting factors for the textures. That''s all we need to render the base composite layer. Create UV texcoordinates over the entire terrain. You can simply use standard planar (2D) mapping, or something more sophisticated, the exact algorithm doesn''t really matter for the concept to work. All textures that are blended together in the base composite layer will share the same set of texcoords. That saves memory.

To adjust the tiling factor, make a visual check: position the camera at a position where you have a long range view over the terrain. Adjust your tiling, in order to get maximum visual quality in the long and medium distance. The near-range might be very blurry, but don''t worry about that now. Once you have all that adjusted, you can add the detail composite layer(s).

Now this is very important: A detail layer is nothing but the original base layer, but shifted to a higher octave. Just like Perlin noise, but without the amplitude modulation: only frequency is changed. So in fact, the detail textures are exactly the same as the base textures, but with a (much) higher tiling.

A little math:

Base_layer = tex1(base_tile) * weight1 + tex2(base_tile) * weight2 + ... + tex_n(base_tile) * weight_n

Detail_layer = tex1(detail_tile) * weight1 + tex2(detail_tile) * weight2 + ... + tex_n(detail_tile) * weight_n

detail_tile = base_tile * detail_factor

For each successive detail layer, the detail factor is increased by one or more octaves.

The detail layer is alpha blended over the base layer, based on distance, if the geometry is near the camera:

For distance > 20 meters: Final = Base_layer
For distance < 5 meters: Final = Detail_layer
For distance between 5 and 20 meters: Final = blend(Base_layer, Detail_layer, exp(distance))

The ranges are experimental, and depend highly on your terrain range and the type of texture used. Just play around until it looks good.


BTW, Trent, I just realized I still didn''t answer your mail. I''m getting a little much, lately I''ll reply tonight, I still have a few questions about that IRC thing.
Mephs
Mephs
Cool thanks a lot Yan,
I think I may need to read through that a couple more times to be sure I''m clear on everything, but it makes a lot more sense now, and the explanation had just about the right level of detail that I think I could go off now and achieve a similar effect, I''ll give it a go and post back if/when I get some results. One thing I realised aswell is that my approach was subtly wrong, I was trying to implement splatting techniques directly into the base texture rather than using vertex alpha values, and I can see now exactly why the method I currently use is never going to produce the best results without some drastic changes. Vertex alpha will blend a texture over a polygon smoothly, while using an alpha map, as I had, will only blend a texture per texel of the base texture, and because the base texture is stretched over the entire terrain, it could never get that detailed. Another Gamedev poster (d0000hg, appologies if I missed any letters there!!) recently suggested to me the idea of using different scale of textures aswell, but I couldn''t quite see how it would be implemented or see it making that much difference, but having seen it in effect now I''m very impressed.

cheers!

Steve
Mephs
Mephs
quote:
This point is very important now: compute how many faces connect to it, and create a weighting factor for each texture connected to the vertex. You now have a list of textures, and their respective weighting factors, per vertex.


After looking over what you''ve written quite a few times now, Ive realised that I may have failed to grasp one detail, in the section quoted above, you say you create a weighting factor for each texture connected to the vertex. How is this weighting determined? I would hazard a guess that it is dependant upon the surrounding textures, for instance, in applying the technique to my heightmap, in general, 99% of the vertices will be surrounded by 6 faces. If my understanding of your technique is correct, then if 3 of the surrounding textures were rocky, 2 were grassy and 1 was sandy, then the weightings for the texture at that vertex would be

rock texture : 0.5
grass texture: 0.3 recurring
sand texture : 0.16 recurring

is that correct in that the height/slope etc only affects what land type a face is classified as, or is this particular set of vertex weightings also influenced even further by height/slope etc?

Hope I''m making sense!

cheers,

Steve
Yann L
Yann L
quote:

If my understanding of your technique is correct, then if 3 of the surrounding textures were rocky, 2 were grassy and 1 was sandy, then the weightings for the texture at that vertex would be

rock texture : 0.5
grass texture: 0.3 recurring
sand texture : 0.16 recurring


That''s correct. Just make sure, that the sum of the weights is always 1.

quote:

is that correct in that the height/slope etc only affects what land type a face is classified as, or is this particular set of vertex weightings also influenced even further by height/slope etc?


No, slope/altitude/etc only affects the texture type assigned to a face. The whole interpolation and weight distribution is independent of it.
Mephs
Mephs
Awesome, I think I understand everything now =) I''m gonna aim to attempt to recreate the effect within the next week and hopefully my game characters will have some nice terrain to walk over :D
Mephs
Mephs
Okay,
I'm still having trouble with Yanns method. I've emailed him to discuss the specifics, but if anyone can explain it to me before Yann gets back to me then you'd be saving Yann from going to the trouble.

What I don't get is the end multipass multitexturing. Say for example, a face has (in a worst case scenario) 6 textures in it's list to be blended. For our first pass we will use texture0 and texture1. texture0's weighting at the first vertex of the face is 0.333333, texture 1's weighting at the same vertex is 0.166666. Therein lies the problem, our vertices can only hold one alpha value at a given pass. I can work out the overall end of pass alpha by adding the two weights, ie this pass will have a result alpha value of roughly 0.49 (for blending with future passes). Problem is the blending of the two textures in this pass. The two textures could not be blended by their respective alpha values, because our vertices can only hold one weight(alpha value) per pass, and blending them equally would not take into account their respective alpha values, ie texture0 would be equally as visible as texture1, where it should be more dominant.

Does this mean I have to perform a single pass for every texture, changing the vertex alpha values for each pass to the weights of the texture currently being rendered, which performance-wise could be very costly, or is there some method to account for both weightings in the same pass?

Thanks in advance for any help anyone can offer (and I'm sure Yann would be greatful too ),

cheers,

Steve


[edited by - Mephs on March 17, 2003 8:45:28 AM]

Topic Locked

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

Sign in to reply to this topic.