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


Submitted by Si Brown, posted on April 16, 2002




Image Description, by Si Brown



These screenshots are taken from a small project I undertook about a month ago to integrate ODE, DirectX and stencil shadowing into a single demo.

ODE is the Open Dynamics Engine - an open source rigid-body physics simulator, written by Russ Smith. This demo uses version 0.03. The stencil shadowing is performed using the standard "Carmack's reverse" method on convex bodies. The basic algorithm for each light is:
  • Project the body onto the plane normal to the light direction
  • Compute the convex hull on the plane
  • Extrude this hull into a shadow volume, being careful to cap before the far clip plane
  • Using the shadow volumes, additively render the scene into the frame buffer
This works fine for the directional lights used in the demo, and could easily be extended to more useful point and spotlights.

The end result is what I hope is a fun demo. The player controls a buggy in a simple world containing plenty of dynamic objects to smash into and ramps to drive off. Many thanks to the population of #flipcode on ETG for their invaluable comments, suggestions and artwork. :) The demo uses vertex shaders for geometry processing, so unless you own a card with hardware shaders (e.g. GeForce3) you will need at least a 800MHz CPU to get a decent framerate. The demo requires Windows 2000/XP with DirectX 8.1 installed.

The demo binaries (which include the textures) and the full project source code are avaiable here:
  • iotd-04-16-2002-buggydemo-binary.zip (389k)
  • iotd-04-16-2002-buggydemo-source.zip (50k)
  • The source is all C++ (with a bit of vertex shader assembler) in a Visual Studio .NET project.

    Si Brown


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

    April 17, 2002, 08:31 AM

    Very cool demo, very addictive. Hopefully this will get some people to look into physics engines a bit more.
    So who's going to be the first to recompile it with a more realistic car model ?

     
    Si Brown

    April 17, 2002, 08:43 AM

    Nope it is 4-wheel drive in addition to 4-wheel steering. I agree though that it's very, er, responsive. :)

    Si

     
    ejTed

    April 17, 2002, 09:31 AM

    DX and ODE __BEAUTIFUL___

     
    ThomW

    April 17, 2002, 09:33 AM

    I love this demo! Great work Si!

     
    Punchey

    April 17, 2002, 09:45 AM

    Didn't you read the name of the demo? It's supposed to be a "buggy" demo! That's what it says on the file! :-)

     
    Si Brown

    April 17, 2002, 09:57 AM

    The demo implements a framerate limiter at 50fps, sorry.

    This is because this lazy developer does physics in the same loop as the rendering, and 50Hz is easily enough for realistic physical responses. Besides, it gives that CPU a break to carry on playing your mp3s for some background music. :)

     
    J-S Perrier

    April 17, 2002, 10:02 AM

    Seems to make my Radeon 8500 freezes at the first frame. I was running with hardware shaders and windowed mode. Here are the specs of my system: Dual P3 1Ghz 512 MB, W2k. Radeons have a lot of driver issue, I'll try it without hardware shaders to see if it still freezes...

     
    Punchey

    April 17, 2002, 10:15 AM

    Si, I regret to inform you that my attourey's will be getting in touch with you... I am sueing for compensatory damages for loss of sleep due to your latest demo.

    This is friggin' AWESOME!

    Who's the Man?
    Si's the MAN!

     
    J-S Perrier

    April 17, 2002, 10:16 AM

    Me again, ok, it works with software shaders... I got a stange back face culling problem with somes of the spheres. I guess that's another "ATI driver issue".

    Very nice demo by the way!! I did something similar a while back. If I may suggest adding more lateral friction to the tires of the buggy so that it doesn't slide so much. It makes the driving difficult.

    Great work!

     
    BigCarlito

    April 17, 2002, 10:27 AM

    FYI, it works fine on my Radeon 8500 - P3 600, 384 MB, W2K.

     
    BigCarlito

    April 17, 2002, 10:33 AM

    I have always wanted to try out ODE, but I can't get the 'make' command to work. If someone who's done this would give me some simple steps for compiling on Windows and VS6, that would be awesome! Really, I'm not an idiot ;-)

    P.S. I love IOTD's that are actually playable!

     
    BigCarlito

    April 17, 2002, 10:43 AM

    ...And 10 minutes later, it works. You need to run VCVars32.bat first in VC98/Bin directory first! Please disregard.

     
    A'r-Ci-O'oh

    April 17, 2002, 10:47 AM

    But, IMHO, I think you also have to install the .NET Framework, don't you?

    - Rolando

     
    jeff weber

    April 17, 2002, 12:38 PM

    thanks!

    A related (kinda) question. How much experience to you have using .Net and Cpp? I'm trying to figure out what effort it'd take to make the ode engine accessible from managed .net code (c# for instance.) If you have any insight on what that might take or if it's even possible i'd be interested hearing it.
    Could the ode be ported to managed Cpp?? I think it'd then be accessible from c#. Guess i'll need to dig into this!!

     
    DarkWIng

    April 17, 2002, 01:07 PM

    OT : are "software shaders" possible in OpenGL too?

     
    davepermen

    April 17, 2002, 03:51 PM

    yes vertexprograms run on nvidia hardware even without hardware support.. (like geforce1 and two)

     
    Si Brown

    April 17, 2002, 04:33 PM

    No, they are run in software on your CPU. The CPU-transformed vertices are then rasterised in hardware on the card.

    Only the GeForce3 class and above (in the case of nVidia) can run vertex shader assembler on the GPU.

     
    davepermen

    April 17, 2002, 05:44 PM

    thats what i said.. on EVERY nvidia hardware you can use the vertexprograms emulated, even if its not supported in hardware.. read what i said

    DarkWing asked for "software shaders"

     
    Kenneth Kolano

    April 17, 2002, 06:46 PM

    Wonderful demo...drooling for more.

    My ultimate acheivement was to use the ramp to jump to the top of the tower. :) (Secret-Use backspace to lift you during flight. Landing is still the hard part.)


     
    magpulse

    April 18, 2002, 01:00 PM

    Now I'm pretty sure I've been playing this too long.. but if you jump off a ramp and hold up and backspace you can fly :-) I can even get over the tower using this method, which is both air control and the flipping mechanism.

     
    magpulse

    April 18, 2002, 01:02 PM

    Oops, Kolano beat me to it.

     
    KieranIsOK

    April 19, 2002, 05:42 AM

    si brown - "and could easily be extended to more useful point and spotlights"

    Easy for point lights, yes - but spotlights are going to be a little more complex, clipping the volumes to the spot cone etc.

     
    Def

    April 19, 2002, 11:28 AM

    If you're talking about the odd site here and there, the site is probably controlling it through JavaScript or something...

     
    FXO

    April 19, 2002, 08:08 PM

    Crashes with oGraphics:CreateFromLoader(); CreateDevice failed
    on my GF2MX, installed the latest nvidia drivers, but it didn't help

     
    Jerry

    April 22, 2002, 12:31 AM

    There is nothing wrong with using push_back() if you pre-allocate space with reserve() ahead of time. Otherwise on the vector there's a memory allocation for first few elements then as you push_back more elements the vector resizes 2x the size. Ie. you push 100 elements then run out of room the code will resize to 200 elements on 101 push_back. Look into stl headers for more info.

     
    Mucki

    April 22, 2002, 04:36 PM

    First: very cool App. The shadows look brilliant. At first I thought I haven't turned them on, but then I realized that they looked so realistic that I didn't notice them :)

    Second: It has been said some times already: PLEASE make a small game out of it :) If you add a small track or two, some timing and networking code this would be the perfect little game for lanparties while you wait for allthe others to install the game you want to play, get their comuter to connect or just for a quick break in between all the fragging :)

    Mucki

     
    Ready4Dis

    April 22, 2002, 07:36 PM

    Would be interesting to see what it maxed out at :D (hint, hint).

    Billy - BillyB@mrsnj.com

     
    Si Brown

    April 24, 2002, 10:39 AM

    Sorry for the late reply: you don't need to clip the shadow volumes to the spot cone. Just cull volumes that don't intersect it, then render lit by the spotlight as per usual.

     
    Si Brown

    April 24, 2002, 10:43 AM

    I'd love to make a game if I had the time, but I have a non-game-related day job and also try to have a life outside of coding. :)

    On the plus side, I am looking into methods for networked interactive physics, so if I come up with a decent architecture I'll port the demo into it. Don't expect any results for a while though. :)

     
    shady el mously

    April 28, 2002, 07:38 PM

    what a great demo u made
    well..
    i am working in a similar project and i was having problems writing my own physics code
    your demo made me know about ode...
    i downloaded and tried to use it
    but i failed....

    can you please tell me step by step how can i compile and link it
    (and what enviroenment variables have to be set)
    also..i downloaded a version of make.exe (which was refered to in the documantation of ODE).....i am using windows and msvc6.0

    so please tell me what do to step by step

    thanks:)

     
    This thread contains 120 messages.
    First Previous ( To view more messages, select a page: 0 1 2 3 ... out of 3) Next Last
     
     
    Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.