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


Submitted by Dion, posted on October 22, 2000




Image Description, by Dion



Here is an image from the Terrain System that I currently am working on. Some features/bugs are:
  • 1. No detail texturing yet. That will be next.
  • 2. Textures are blending at run-time (ala Black&White)
  • 3. Quad-tree culling of data
  • 4. Not really at all optimized yet.
  • 5. Number of base textures used for texture blending is unlimited.
  • 6. Texture caching to get some frame to frame coherence of texture generation.
  • 7. Simple LOD that has a bit of popping. (Crappy)
  • 8. Skybox sky
  • 9. Uses Direct3D
  • Right now it's running around 30-40 fps on a PII-350 with a Voodoo3 3000 with 16MB of RAM at 640x480x16bpp. I will get around to optimizing it soon enough. Right now there are too many texture state changes as well as the fact that I'm not batching my primitives into a vertex buffer.

    If anyone is interested I can always post a demo for download somewhere. I can't guarantee that it will work on many video cards though. I wish Nvidia or 3Dfx or ATI would send me new generation cards. That would be sweet.

    Later.
    -Dion Picco
    aka: Draigan
    dionpicco@hotmail.com


    [prev]
    Image of the Day Gallery
    www.flipcode.com

    [next]

     
    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.
     
    VgP

    October 22, 2000, 04:13 PM

    Looks very cool :)

    Which sorting method do you use ?

     
    The Wolf

    October 22, 2000, 05:12 PM

    looking good, keep on it

     
    ref_cracker

    October 22, 2000, 05:58 PM

    Very respectable! :)
    Nice work.
    Post a link for downloading please! I'd love to check out the real thing

     
    morgan

    October 22, 2000, 06:14 PM

    Nice job, Draigan. That water texture is a particularly good choice.

    -nm

     
    Vander Nunes

    October 22, 2000, 06:32 PM

    sweet! would like to hear a bit more about your texture caching... is it being fast enough or do you see blending pops / cracks? what is the grid (mesh/texture) size?

    nice, keep going.

     
    DarkMage139

    October 22, 2000, 06:42 PM

    That's totally cool. I'm impressed.

     
    Jon Creighton

    October 22, 2000, 09:03 PM

    The shots look great Dion, I really like the texture blending.

    A quick tip on improving the performance of the quadtree terrain: use the distance and/or direction to the child nodes to determine your recursion order so that the terrain is draw from front to back.

    Direct3D performs the Z-buffer test before calculating any lighting or texturing, so it's better to draw the closest polygons first. In my landscape renderer I used a really simple test to order the recursion and it improved performance by 12%.

     
    civax

    October 22, 2000, 10:12 PM

    Images looks wonderful.
    The water specially. Are they moving?

     
    Nathan Hoobler

    October 22, 2000, 10:21 PM

    Out of curiousity, how ARE you doing the texturing? I ask, as this has become a (surprisingly) major issue in my own terrain engine (IOTD-To-Be). Do you generate the whole map as one texture? Do you set up a series of pre-generated and aligned tiles? I really am rather curious as to your solution, as it looks rather nice in the screenshots.

    Also, about the water -- is it just a normal part of the terrain set to be "flat" and use a water texture, or do you have some kind of value on the height/texture map?

    Any response or advice would be appriciated.

     
    Dion Picco

    October 22, 2000, 10:44 PM

    Thanks everyone for all the wonderful comments. I really appreciate them.

    Since I posted the IOTD I started rewriting much of the wrapper code. Originally I had planned to wrap Direct3D and OpenGL together using an abstracted class that encapsulated both using inheritance so that I could use either very easily. Since then I've found that managing both api's for every call is a pain in the butt so I've gone back to the metal so to speak with Direct3D (which is now quick a nice API when you consider that OpenGL has progressed into nothing but extensions). The problem is that almost everything relied on my old class. Right now I'm in the process of converting everything to my new ultra-thin Direct3D wrapper. As soon as I get it done I can send a demo to anyone who wants one. Just e-mail me you address and when I get it completed I'll send it along. My address is:

    dionpicco@hotmail.com


    To Vgp: Right now I'm just using a z-buffer and I'm not sorting the polygons back to front or front to back.

    To Vander Nunes: The texture cache is working pretty good. Since I blend my textures together in software, it certainly helps me save the trouble of rendering all the terrain textures each frame. The texture cache brought me from about 2fps (redrawing every texture) to 75fps (redrawing no textures). Of course it slows a little when generating textures. But it helps a lot. I switch texture LOD at a pretty far distance so that pops of texture LOD aren't bad at all. The mesh/texture size close up is 16x16 grid for a 256x256 texture.

    To Jon Creighton: 12% is quite good! Thanks for the tip.

    To civax: The water is just having it's texture coordinates adjusted each frame. Nothing serious yet. :)

    To Nathan Hoobler: The texture blending is done in software. This is because I can have up to 4 textures influence each block of 16x16 pixels in the texture (for a 256x256 texture). It would be too costly (I guess) to switch textures and try to do this in hardware. This can be optimized using MMX quite nicely as well though I haven't gotten around to it yet. I also have another software method that allows me to have up to 8 texture influence each 16x16 pixel block at once. However, it's much much slower. It looks like Black&White and Halo both can only do 4 textures per landscape grid unit. I generate the textures using software on the fly as I need them. Like I said before, I use a texture cache so that I don't have to redraw the textures every frame. The cache is basically a LRU scheme although it has some quirks to it. Each leaf of my quad-tree has it's own texture and I generate it as the leaf becomes visible and cache it. I have a series of base textures from which I blend from. I use vertex blending weights to determine the textures to blend. These can be based on height, slope, amount of sunlight, rainfall, wind, etc... The key however is the cache. That's where the speed comes from. The water is just a flat plane that I draw at sea-level. It's not included in the landscape information.

    Hope I haven't missed anyone or anything.
    Take care all.

    -Dion (Draigan)

     
    cem

    October 23, 2000, 12:57 AM

    To Jon Creighton: Actually, the only thing you save by sorting front to back is a frame-buffer/z-buffer write, so you'll only see performance improvement if your app/video card is bound by framebuffer memory bandwidth (as is the case with many modern video cards at high res/color depth).
    Remember, by the time a z-buffer check occurs, the pixel has probably already been "generated" inside the graphics card, so the only potential for savings is in memory access.

    -Cem


     
    NeoIcarus

    October 23, 2000, 01:10 AM

    Wow, nice shots.

    After seeing all of these nice terrain engines, I have gotten quite interested in terrain. I have read many papers on terrain LODs, but I have not seen many on terrain texturing. Can anyone point me to any good papers on texturing terrains? Thanks.

     
    Mace

    October 23, 2000, 02:54 AM

    Beautiful landscape. The textures fit like a glove on that.

     
    Jon Creighton

    October 23, 2000, 04:36 AM

    That's odd because I read about the tweak in an MSDN article, and it really did work; on my Celeron 400 system with a 16MB TNT2 card I got a noticable improvement in the framerate, up to 12% in some cases.

    I'll have to have a closer look at it later.

     
    Phil Carlisle

    October 23, 2000, 05:55 AM

    Certainly looks good so far.

    One question though.. why generate the textures on the fly?, it saves space, but you dont really gain anything.

    Phil.

     
    NinjaCross

    October 23, 2000, 07:56 AM

    Really cool !
    Where did you find the textures for the terrain ?

     
    richard

    October 23, 2000, 09:53 AM

    #$@!, why does this landscape looks MUCH better than the one I just created????? :-D

     
    Phil Carlisle

    October 23, 2000, 11:27 AM

    Another small suggestion:

    When you blend the textures together, add some noise to the alpha, so that the blend isnt a straight transition. From the shots it looks like your doing a height based alpha, which is fair enough, but Ive found that adding noise in the alpha makes the transition area more convincing (make sure that the noise is only slighly altering the alpha enough to "fray" the edges of where textures transition.

    Another thing is to adust the alpha based on slope (i.e. favour alpha of rock face if slope is harsh).

    One question: do you render the lighting into the texture at runtime too?

    Phil.

     
    Dion Picco

    October 23, 2000, 12:00 PM

    Geez, the comments keep piling up. I love it!!! Again, thanks for all the comments.

    To NeoIcarus: Mostly I get the ideas from trying stuff out. Message boards like the one on Lionhead's site and Longbow Digital Arts are good. I try to read everything on landscapes, including all voxel references since anything could contain something that could spark an idea. And trying code, rather than just thinking about it, is a huge help.

    To NinjaCross: Textures came from Graphtallica and the WadFather. And the water texture came from VTP, the virtual terrain project.

    To Phil Carlisle: Creating the textures on the fly is great because I don't have to pre-draw then and I don't have to create just one BIG texture. I believe that it's a good idea for large scale worlds to generate textures on the fly rather than just paste base textures onto the land. It's less repetitive and requires hardly any storage space. I could just generate loads of textures and store them and swap them in as needed I suppose. But with this method, I can add dynamic details and have it re-rendered quickly (explosion blasts, etc...) Right now, the textures are generated based on altitude and slope. You can see from the images that there are patches of grass high up where the slope in minimal. What kind of noise alpha function do you use? A modified Perlin? It has to be a sort of constant noise in that, it should always choose the same noise value for a given vertex or pixel. I guess a Perlin solution would fit this nicely. Thanks for the idea.
    And yes, I build the shading directly into the texture. This way I don't get those gouraud vertex pops in shading colors as the mesh resolution decreases during LOD calculations.

    Thanks everyone. And to anyone that e-mailed me, I will get back to you ASAP (after work ends today).

    -Dion (Draigan)

     
    This thread contains 19 messages.
     
     
    Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.