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


Submitted by Jonas Eschenburg, posted on February 01, 2002




Image Description, by Jonas Eschenburg



These are screenshots of a project I've been working on for over two years now. I wanted to learn 3D programming and so I wrote a little 3D engine which I used to create a simple terrain renderer.

The landscape renderer evolved over time and I stuffed it with more and more features. Only recently I began adding game elements like enemies, weapons and sound. These features are still experimental and relatively quick hacks.

The upper picture has a bit of game action in front of a nice panorama view. You can see an enemy flying towards us that has just been hit by a missile.

The lower picture displays the CLOD triangle mesh and the texture tiling.

Terrain renderer features include:
  • Continuous Level of Detail (CLOD) using a binary triangle tree (based on the technique discussed at http://www.longbowdigitalarts.com/seumas/progbintri.html)
  • complete texturing using a combination of unique texturing (one big texture for a terrain patch) and a tile-based approach.
  • recently added: ground fog (used for enhanced visual quality and also speed improvement)
  • Other features include:
  • a skybox for the clouds
  • a Wavefront .obj loader for the models
  • an enemy AI that makes the enemies look almost intelligent ... against rocks
  • a font renderer using font textures made with glfont by Brad Fish
  • The program was developed in C++ under Linux. So far this is the only platform it works on, but porting should be relatively easy since I used only portable libraries:
  • SDL for basic system access and input
  • OpenGL for hardware-accelerated 3D graphics (Direct3D support should also be possible once I have made a Windows port, since I use my own 3D engine)
  • OpenAL for hardware-accelerated 3D sound
  • SigC++ for advanced inter-object communication
  • My ultimate goal is to create a modern version of the 80's classics Carrier Command and Midwinter, featuring enhanced graphics and gameplay. Multiplayer maybe.

    The only problem is that I will never be able to do that alone so I will eventually release the game as Open Source.

    As I haven't made a Windows port until now, only Linux users will be able to try the demo at:
    http://www.student.uni-augsburg.de/~eschenjo/landscape-demo.tar.bz2

    I hope you can get it to run. It depends on OpenGL and SDL 1.2.

    Check it out! And please report any bugs you find. I know there are some.

    Oh yes, as you probably noticed, my project is still lacking a decent name (I called it "landscape" but that doesn't sound very nice...)

    Have fun,
    Jonas Eschenburg


    [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.
     
    Jerran

    February 01, 2002, 08:14 AM

    Cool looking and I specially like the fact that it's made for Linux! Keep on good work!

     
    FireFoX

    February 01, 2002, 08:32 AM

    Looks a lot like where I'm working on :)
    Keep up the good work!

     
    Christopher Dudley

    February 01, 2002, 08:51 AM

    Looks very nice, especially since it is a Linux project! Linux needs all the cool stuff it can get. :)

    I like the tesselation on the ground, the polygon edges look really crisp.

    On a side note, the fps counter reads 13fps, out of curiosity, what kind of hardware does this target? (i.e. What hardware are you running?)

    All in all a great IOTD, keep up the good work!

     
    Arne Rosenfeldt

    February 01, 2002, 08:51 AM

    Why are FPS and number of triangles so low?
    What hardware do you use (have I overlooked the homepage?)

     
    Arne Rosenfeldt

    February 01, 2002, 08:52 AM

    uups too slow a reply from me, someone else was faster

     
    krogoth

    February 01, 2002, 09:00 AM

    Looks very nice... I get a little under 60fps with Athlon 1.2GHz and GeForce 2 Pro and nVidia drivers.

     
    Brebion flavien

    February 01, 2002, 09:26 AM

    How does texturing the terrain work ? I always thought LOD and tile-based texturing didn't work very well...

    F. Brebion

     
    =[Scarab]=

    February 01, 2002, 09:27 AM

    Coohool!

     
    abnormal

    February 01, 2002, 09:40 AM

    I'm sorry, but I dont think the terran textures looks very nice. They look like 1 solid color per type. But nice engine anyway, the lod seem to work but I cant see how this will work with textures, the second pic doesn't make this very clear, doesn't look like the textures are placed correctly ..

     
    Acidtil

    February 01, 2002, 09:47 AM

    Cool something made in Linux, for Linux :) It's nice to see people developping on this platform.

    BTW, these images looks really nice. I'm going to try it when I get back home !

    Keep up the good work !

     
    Jonas Eschenburg

    February 01, 2002, 10:02 AM

    60 FPS sounds very nice to me. To be honest I thought my engine wouldn't scale very well without using some more hardware acceleration features. Multi-Texturing and the like.
    But that's a nice surprise.

    Was it hard to get the binary to run?

    Jonas

     
    Murderizer

    February 01, 2002, 10:10 AM

    I downloaded Carrier Command (PC) about two weeks ago (too slow to be fun). I absolutely loved that game on the Amiga, clean silky smooth 50fps action - delighted to hear you're working towards updating the old classic...

    Excellent work.

     
    Jonas Eschenburg

    February 01, 2002, 10:17 AM

    You're right: I also think the terrain could look better. I think I can paint much better textures, especially for the stone ground types. The texture borders aren't very satisfactory, too.

    I think I can do a lot better with better artwork.

    I will also experiment with texture tile size. Currently, if you look straight from above upon the landscape, textures appear to be very blocky and cartoonish. Like those in Warcraft or Starcraft. Not to say these games look bad, I just feel reminded of their style, which doesn't fit for my game.

    Jonas

     
    Jonas Eschenburg

    February 01, 2002, 10:46 AM

    First of all, thanks for all the nice comments and constructive criticism. And also a big thank you to the FlipCode crew for editing my message and putting it online.

    As several people have mentioned the fps:
    The upper screenshot reads 13FPS, the lower one only 9.

    The wireframe drawing eats up about 5 fps because it is totally unoptimized.

    I hope to improve the normal fps by using hardware multitexturing for the terrain. Currently each triangle gets drawn up to 6 times. Reducing that to maybe 3 passes should give a good speed improvement.
    I could also add dynamic visibility range. Near ground level it is not so important to see very far.
    Anyone have an idea how to implement occlusion culling with LoD meshes?

    The machine I develop on is a lowly Athlon 500 with a TNT2 graphics card, btw. So all you highend GeForce-powered people will get better performance than I do.

    Maybe I should also say something about the rather esoteric key bindings I currently use:

    W,S forward, backward "strafing"
    A,D left, right

    G select target in gunsight
    T select next target (you have to select a target in order
    to fight it - I known this is lame...)

    left CTRL fire machine gun
    right CTRL fire dumb missile
    space fire smart missile

    F follow mode - camera follows missiles you launch
    press again to return back to your cockpit
    F2 hack: see what your currently selected enemy sees.
    press F to get back

    Mouse buttons are not bound, joystick is not supported yet.

    Have fun,
    Jonas

     
    abnormal

    February 01, 2002, 11:13 AM

    more like warcraft ^^
    starcraft doesnt look that bad (as warcraft does, hehe), its just a bit unnatural :)

    have fun trying to make some other textures ..

     
    Jonas Eschenburg

    February 01, 2002, 11:15 AM

    Oh they do fit together, you just need a big enough hammer and hit 'em hard. *g*

    The first step is to paint a base texture on the whole terrain patch.
    Next, I draw the texture tiles above the base texture. If you look at the lower picture you will see that where the terrain is fully tesselated, it resembles a normal regular grid. This is where I draw the tiles, like in every other tile-based engine. I smoothly blend them in so the transition between base texture and tiled textures is not so annoying.
    After that, I apply light map and ground fog and that's it.

    There are various issues with this approach, but it works quite well for me.

    Jonas

     
    Jonas Eschenburg

    February 01, 2002, 12:16 PM

    Keys I forgot:

    Tab zooms map
    I disables annoying debug info next to enemies

     
    zed zeek

    February 01, 2002, 04:23 PM

    i remember carrier command on the spectrum 'i hated it :)'
    ive found on a tnt2 (even a slow one like a vanta) ive been able to get 2million+ tris a second rendering something simple like a terrain (with sdl + opengl btw, though thats not important), perhaps have a look at ditching the partically method of drawing youre using at the moment + look at rendering lots of triangles in big long strips with degenerants
    also u might need to tweak those values youre using for polygonoffset theres a bith of fighting between the lines and the terrain (not much though)
    looking quite sweet though mate

     
    Tristan

    February 01, 2002, 08:12 PM

    Are degenerants really that good idea? I mean on the performance article on nvidia's web page they specifically say not to use degenerants (if I remember right). I've always rendered strips seperately to not cause degenerates. On one LOD landscape program I developed, I found I could achieve good performance usings triangle fans and a modified quad-tree algorithm. Not many ppl uses fans these days, but they shouldn't be dismissed, as they perform just as well as triangle strips on most hardware.

     
    krogoth

    February 01, 2002, 08:35 PM

    I was half surprised that I didn't have to compile anything and to the best of my knowledge (without actually checking) I don't have libSigC++ installed. It ran fine the first time.

     
    zed zeek

    February 02, 2002, 01:59 AM

    >>Are degenerants really that good idea? I mean on the performance article on nvidia's web page they specifically say not to use degenerants (if I remember right). I've always rendered strips seperately to not cause degenerates.

     
    Arne Rosenfeldt

    February 02, 2002, 03:25 AM

    Their new version of stripe generator also generates
    degenerateds again
    Their has been a recent (2 days ago?) thread about connecting stripes here on flipcode about it

     
    Jonas Eschenburg

    February 02, 2002, 05:44 AM

    ZBuffer fighting is indeed a problem with my engine.
    But I don't really care about the wireframe view, since that's for debugging purposes solely.

    Concerning the terrain drawing method: Using a big regular grid is what I actually startet with.
    Although I used vertex buffers and triangle strips I was unhappy with the perfomance.
    OK, you get LOTS more triangles pre second, but most of them are wasted in the scene background.
    I was able to get about half the viewing distance I get now. And when I wanted to enlarge it by 50% the triangle count doubled.

    Using the CLOD mesh I can theoretically get any viewing distance that I like. It's much more scalable.

    I think it's very impressive what you can get with "brute force" drawing nowadays though.

    I don't know about "degenarants", could you please explain or give me a reference?

    Jonas

     
    Jari Komppa

    February 02, 2002, 07:27 AM

    I wrote a simple writer program which renders characters from a single big texture using strips.
    Each character is 2 triangles, so I'd end up doing a zillion renderprimitives. Instead, I built the strips using a lot of degenerates (there's almost as many degenerates as 'real' polys). The number of drawprimitives dropped dramatically, and framerate hopped up tenfold.

    I can't see any reason why degenerates would be a bad idea, but I guess there may be some reason..

     
    Lourens Veen

    February 02, 2002, 11:04 AM

    Well, despite it not being Free software yet, I couldn't resist giving it a chance. Here's my mini-review:

    Positive points:
    After unpacking it ran right away, no problems at all in that department. Also, it didn't crash.

    Negative points:
    As long as I stayed high up the framerate was quite good (15-30 fps), but lower it took several seconds to render a frame. Also, I had quite a lot of trouble finding my opponents. They kept firing at me and I never even saw them. And if you can't see them, you can't hit back :(.

    Test machine: AMD Duron 650 MHz, ATI Radeon VE video, 768MB SDRAM which was mostly full (yes I'm quite an enthusiastic multitasker). Linux 2.2.14, XFree86 4.1. I'm going to upgrade to 2.2.17 and XFree86 4.2 soon, with the new Radeon drivers in 4.2 things should be a bit better I imagine.

    Keep up the good work!

    Lourens

     
    Louis Howe

    February 02, 2002, 11:19 AM

    This looks really cool.

    I haven't run this yet, but I was wondering if you use 'geomorphing' with your terrain algorithm. If you do, could you enlighten me as to how you do it?

     
    Christopher Dudley

    February 02, 2002, 11:21 AM

    Are you certain you are getting HW acceleration?

    I don;t know how useful this will be, but until I switched over to a series 2.4 kernel, I didn't get any 3D acceleration under X.

    (Had something to do with DGA support, or some such. I didn't pay that must attention to what was wrong, just updated the kernel and that fixed it.)

     
    Christian Glodt

    February 02, 2002, 01:37 PM

    Looks pretty good... and ran like a charm on my box.

    I get about 26 fps.

    My specs: Athlon 800 MHz, 256MB RAM, GeForce 256 (SDR), kernel 2.4.17+preempt+lockbreak, XFree86 4.2.0, and the latest nvidia binary driver.

     
    Jackson Dunstan

    February 02, 2002, 02:07 PM

    15fps.

    Athon 600, TNT2 16mb, 256pc100 ram.
    Linux-Mandrake 8.2beta1 with NVIDIA drivers 1.0-2314.

    Oh, I had to make a symlink to libstdc++-libc6.1-2.so.3 because of static bindings. Source?

    Looks good. The mouse sensetivity could use a boost. Takes several full mouse movements to turn.

     
    Jonas Eschenburg

    February 02, 2002, 03:14 PM

    I don't known what I do wrong, but somehow my message appears twice. So don't be afraid, my answer isn't that long :)

    Yes I do use geomorphing. This is how it works:
    Every triangle stores a float value named "morph". It should range between 0 and 1.

    1 means the triangle has "full shape"
    0 means the triangle lies totally on its parent triangle

    When I fly towards a triangle its morph value will smoothly move from zero to one, so it will appear to grow out of its parent triangle.

    How is the morph value calculated?

    Each triangle has an associated "static" error value. This measures how far the triangle deviates from the piece of terrain it approximates.
    This static error value is used to compute the "dynamic" error:

    tri->dyn_error = tri->static_error / distance_of_triangle_from_viewer




    Depending on this dyn_error value the algorithms decides whether
    the triangle should be split or not:

    if (tri->dyn_error > MAX_DYN_ERROR) {
    split(tri);
    setup(tri->child[0]);
    setup(tri->child[1]);
    }




    You will probably know this already if you are interested in dynamic level of detail algorithms.

    Now the algorithm will setup the two child triangles. It will compute their dyn_error and, based on that, it will decide whether or not to split them and so on.

    The key is that these child triangles will get a lower dyn_error value.

    Now back to computing that morph value:

    float e = tri->child[0]->dyn_error
    tri->child[0]->morph = 1.0 - (MAX_DYN_ERROR - e) / (tri->dyn_error-e);





    Of course you have to take care of mesh continuity, this means that adacent triangles should have the same morph value, depending on which edges they share.

    This can be rather hairy :)

    If you have further questions I will gladly answer them.

    Jonas


    --------------------- repeated message begins here: --------------

     
    This thread contains 42 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.