|
||||||||||||||||||
Add Forum to Favorites | Send Topic To a Friend | View Forum FAQ | Track this topic Page: 1 2 3 »» |
Last Thread Next Thread ![]() |
| Creating detailed terrain under severe limitations? |
|
![]() Mephs Member since: 5/4/2000 From: Nottingham, United Kingdom |
||||
|
|
||||
| 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 GDNet+ Member since: 4/1/2002 From: Psionic Ward |
||||
|
|
||||
| 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. |
||||
|
||||
![]() Mephs Member since: 5/4/2000 From: Nottingham, United Kingdom |
||||
|
|
||||
| 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 Moderator Member since: 2/6/2002 From: Breizh |
||||
|
|
||||
quote: 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 GDNet+ Member since: 4/1/2002 From: Psionic Ward |
||||
|
|
||||
| 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. |
||||
|
||||
![]() ProgramMax Member since: 3/26/2000 From: Ohio, USA |
||||
|
|
||||
| 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 Moderator Member since: 2/6/2002 From: Breizh |
||||
|
|
||||
| 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 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: lol [edited by - Yann L on March 14, 2003 8:44:56 PM] |
||||
|
||||
![]() ProgramMax Member since: 3/26/2000 From: Ohio, USA |
||||
|
|
||||
| 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 Member since: 12/10/2001 From: Earth |
||||
|
|
||||
| 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 Member since: 5/4/2000 From: Nottingham, United Kingdom |
||||
|
|
||||
| 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 Member since: 7/4/2001 From: CA, USA |
||||
|
|
||||
quote: 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. |
||||
|
||||
![]() mittens Moderator Member since: 11/26/2000 From: Austin, TX, United States |
||||
|
|
||||
| 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 Member since: 10/9/2000 From: Nottingham, United Kingdom |
||||
|
|
||||
| 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 |
||||
|
||||
![]() Yann L Moderator Member since: 2/6/2002 From: Breizh |
||||
|
|
||||
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 |
||||
|
||||
![]() Mephs Member since: 5/4/2000 From: Nottingham, United Kingdom |
||||
|
|
||||
| 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 Member since: 5/4/2000 From: Nottingham, United Kingdom |
||||
|
|
||||
quote: 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 Moderator Member since: 2/6/2002 From: Breizh |
||||
|
|
||||
quote: That's correct. Just make sure, that the sum of the weights is always 1. quote: No, slope/altitude/etc only affects the texture type assigned to a face. The whole interpolation and weight distribution is independent of it. |
||||
|
||||
![]() Mephs Member since: 5/4/2000 From: Nottingham, United Kingdom |
||||
|
|
||||
| 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 Member since: 5/4/2000 From: Nottingham, United Kingdom |
||||
|
|
||||
| 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] |
||||
|
||||
![]() OrangyTang Member since: 3/19/2002 From: London, United Kingdom |
||||
|
|
||||
quote: Oo, go on, I'd like to see what Glide code actually looks like.. Rumour has it it was a nice API, but thats about all i know |
||||
|
||||
![]() Yann L Moderator Member since: 2/6/2002 From: Breizh |
||||
|
|
||||
quote: On current 3D hardware (GeForce or Radeon type class), you have more iterators. On a GF4, for example, you can weight the 4 units by C(primary)RGB, C(primary)Alpha, C(secondary)RGB, C(secondary)Alpha. With pixelshaders (eg. Radeon 9x00, GFfx), it's even easier, you could even use individual colour channels for that (although the Radeon has issues with per-pixel swizzeling, has the 9800' corrected that problem ?). Now the bad news: on a Voodoo, you must do each pass separately, but you can do the detail blend in a single pass. Simply, because the way the Voodoo arranges the colour and texture combiners. You cannot use vertex alpha to weight between two textures, as the interpolator values aren't available at that point of the pipeline. You can only use texture-alpha to blend between both, but that's not very useful here. But you can actually use a LOD detail factor to blend between both maps. That can be used for detail mapping. So essentially, you have to reverse the concept for your Voodoo: on modern cards, you would render the individual texture layers by multiple units, and the detail maps as separate pass. On the Voodoo, it's the opposite. [Edit: note that I have no idea, if that LOD-blend functionality is exposed under D3D. It was under Glide. If it's not, then you're stuck doing all passes separatley, incl. detail blends] quote: It was very close to OpenGL. Here is a small snippet from the terrain renderer (it won't help very much, I needed to post much more code for that, but you get the idea of what Glide feels like
// Set combine mode ci * (t0 + t1)
grColorCombine(GR_COMBINE_FUNCTION_SCALE_OTHER, GR_COMBINE_FACTOR_LOCAL, GR_COMBINE_LOCAL_ITERATED, GR_COMBINE_OTHER_TEXTURE, FXFALSE);
grAlphaCombine(GR_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_NONE, GR_COMBINE_LOCAL_ITERATED, GR_COMBINE_OTHER_NONE, FXFALSE);
grTexCombine(GR_TMU1, GR_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_NONE, GR_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_NONE, FXFALSE, FXFALSE);
grTexCombine(GR_TMU0, RGBFunction, RGBFactor, AlphaFunction, AlphaFactor, FXFALSE, FXFALSE);
// blend pass 1, render base blend classes
for( a=0; a < TxListCnts.BlendTx_G; a++ )
rspfx_RenderBlendClass(TxLists->BlendTxList[a].swap, 0, 0);
grChromakeyMode(GR_CHROMAKEY_DISABLE);
// render all additive blend passes, layers 3-7 (and for Glide also layer 2)
grDepthBufferFunction(GR_CMP_LEQUAL);
grAlphaBlendFunction(GR_BLEND_ONE, GR_BLEND_ONE, GR_BLEND_ONE, GR_BLEND_ZERO);
// Glide only: render second blend pass over base set (nodes are still sorted from above)
for( a=0; a < TxListCnts.BlendTx_G; a++ )
rspfx_RenderBlendClass(TxLists->BlendTxList[a].swap, 1, 0);
for( a=0; a < TxListCnts.BlendTx_R; a++ )
rspfx_RenderBlendClass(TxLists->BlendTxList[a].noswap, 1, 0);
// additional passes go here:
for( a=0; a < TxListCnts.SecBlendTx_G; a++ ) {
rspfx_RenderBlendClass(TxLists->SecBlendTxList[a], 0, 1);
if( !(TxLists->SecBlendTxList[a] & 0x0F) ) rspfx_RenderBlendClass(TxLists->SecBlendTxList[a], 1, 1);
SecBlendTexLayers[TxLists->SecBlendTxList[a]] = NULL;
}
grDepthBufferFunction(GR_CMP_LESS);
grAlphaBlendFunction(GR_BLEND_ONE, GR_BLEND_ZERO, GR_BLEND_ONE, GR_BLEND_ZERO);
[edited by - Yann L on March 17, 2003 9:52:37 AM] |
||||
|
||||
![]() Ysaneya GDNet+ Member since: 1/7/2000 From: Brussels, Belgium |
||||
|
|
||||
| Yann, i've been working on a similar technic since some time now (with the minor difference that i use a "material map" to encode the weights into RGB components instead of per-vertex). I'm still having problems with the material-map (or, for you, the blending weights) contributions. I have a set of parameters like the slope at the given vertex, sun exposure, height, etc.. With some heightmaps it looks decent, like here: http://www.fl-tw.com/Luvalon/luv1.jpg But i can't get ride of these ugly artifacts: http://www.fl-tw.com/Luvalon/luv2.jpg The previous screenshot shows the lightmap (encoded in the alpha of the material map), which is only dependant on the slope at the texel. I also have that pixelated look everywhere. I'm not really sure how to fix that.. I think it might come from a loss of precision in my heightmaps (heights are encoded on 8 bits only), do you have any idea to fix that? Y. |
||||
|
||||
![]() Yann L Moderator Member since: 2/6/2002 From: Breizh |
||||
|
|
||||
| Ysaneya: 8bit dynamic range problem. Guaranteed. I had exactly the same issue when experimenting with 8bit DEMs. 8bit will only give you 256 different height levels, and that's just not enough to represent a smooth slope. Using 16bit data, or even better floating point, will remove those artifacts. Nice terrain, BTW. |
||||
|
||||
![]() JimH Member since: 11/15/2001 From: USA |
||||
|
|
||||
quote: How about using the 8 bits to store the delta from one height to the next? It would prevent you from making very steep slopes, but it would save storage space. |
||||
|
||||
![]() _DarkWIng_ Member since: 1/11/2001 From: Duplje, Slovenia |
||||
|
|
||||
quote: Since when secondary color has alpha? This is from ARB_vertex_program spec : >>> (43) What do we say about the alpha component of the secondary color? RESOLVED: The alpha component of the secondary color has generally been treated as zero. This extension specifies that only the R, G, and B components are added in the color sum operation, making the alpha component of the secondary color irrelevant. Other downstream extensions may allow applications to make use of this component. <<< Any other way to use tir. I would realy like to know since I would realy need it in some cases.... |
||||
|
||||
|
Page: 1 2 3 »» All times are ET (US) ![]() |
Last Thread Next Thread ![]() |
|