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

    April 16, 2002, 11:36 PM

    Really nice :o)

    I got to the top of the tower and jumped on all the balls! Most fun ITOD I've seen for a while!

    good work, keep it up!

     
    Tristan

    April 16, 2002, 11:41 PM

    if you use one of the ramps and then hold down backspace in mid-air you can fly over the tower and everything :o)

     
    Timothy Barnes

    April 16, 2002, 11:46 PM

    Your shading effects are 1-3-3-7.

     
    StiNKy

    April 16, 2002, 11:48 PM

    this is by _FAR_ one of the best demos I've tried in a LONG time! EXCELLENT stuff!

     
    Si Brown

    April 16, 2002, 11:51 PM

    You'll need to download, include and link ODE into the project. Visit http://www.q12.org/ode/ for more details.

    Sorry I maybe should have made this more clear in the IOTD description. :)

     
    Sebastian Sylvan

    April 17, 2002, 01:00 AM

    How do you model the vehicle?

    Chassi and four wheels (5 objects)?

    And how do you join the wheels with the chassi? A hinge-2 joint or what? How do you propell the vehicle forwards, by simply applying a force in the direction of the wheels, or by using motors on each individual wheel?

    Thanks.

     
    El Wolf

    April 17, 2002, 01:04 AM

    !!!_INCREDIBLE_!!!

    how easy is ODE to integrate?

     
    Garett Bass

    April 17, 2002, 01:34 AM

    The sourcecode is available, have at it ;)

     
    Ron Bakker

    April 17, 2002, 02:19 AM

    Real nice. I also smell a stunt-car game in here. You're not far off.
    Thanx for the source, that's real nice.
    Could you put up the link to ODE?

    - Ron

     
    Psyclonist

    April 17, 2002, 02:49 AM

    Quite easy ;)

    I found ODE about two weeks ago while looking for a nice physics engine.
    It took me only a few minutes to compile and get some test code running in my engine. After half an hour I had a monster truck driving around on a plane.

    Creating the config.h for the first time (just had to call 'make' ;) and updating the paths in my project were probably the hardest parts.

    ODE ships with several examples, and there are more on the web that should get you started quickly.

    psyclonist

     
    John Mcroberts

    April 17, 2002, 03:08 AM

    Sweet Nectar this is cool. =)

     
    Herr_O

    April 17, 2002, 03:25 AM

    I managed to jump from the jump-thing to the top of the tower.. :D cool demo GJ

     
    Dr.Mosh

    April 17, 2002, 03:43 AM

    "(Plus the implementation I did was written quickly using the stl, and as such has room for some heavy optimisation)"

    I did noticed you were using stl::vector.push_back() in the quickhull code, arguably not the best operator to be using at runtime :)

     
    Si Brown

    April 17, 2002, 04:15 AM

    Check the CreateBuggy() function in the source, but you're pretty much correct already - 4 hinge2 joints, and all the steering and acceleration is done using angular motors on the axes of the joints.

    There are no external forces other than gravity and a small amount of air resistance. :)

    Ta,
    Si

     
    Endurion

    April 17, 2002, 04:57 AM

    I had the same problem,
    it seems, the demo only works with 24 or 32 bit depth mode
    on your desktop in windowed mode.

     
    Peter Mackay

    April 17, 2002, 05:04 AM

    Well I played with this for a bit last night, and I have to say this is probably the best iotd of all time :-)

    Good work.

     
    DWORD

    April 17, 2002, 05:16 AM

    Very kewl demo indeed!!! I really like it. But I find the car a bit diffucult to navigate though - primarily because of the camera's position.

     
    sagacity

    April 17, 2002, 05:55 AM

    Correct. If I do that, I do get a tiny set of controls in the top of my screen, so it IS a fullscreen instance of IE, for some reason.

     
    AndyM

    April 17, 2002, 06:01 AM

    cool, but compile us a non-stencil-buffer version to look at the physics on a basic card please!!
    Also, just what is the point of .NET for a non-internet project - I don't know much about it?
    A

     
    Mikademus

    April 17, 2002, 06:24 AM

    Try setting your FTP-client to PASV ("passive") mode. That's usually the culprit for issues like yours...

     
    dEViNiTY

    April 17, 2002, 06:39 AM

    yah, cruise around and up the tower. Well, as long as there's gaz and coffee.

     
    Mikademus

    April 17, 2002, 06:44 AM

    I am so very, VERY impressed!

    The absolute thouroughness of the implementation is staggering - just for kicks, I used the backspace (which makes the buggy rear up, if running) to hump the beachballs and ended up on my back with the ball on top of me: when I accelerated, the spinning of the wheels made the ball spin physically correct in response...!

    Brilliant work!

     
    shortarse

    April 17, 2002, 06:53 AM

    the demo is excellent, however there is one small thing, the buggy appears to be Rear wheel drive, but four wheel steering - this makes it very, shall we say, twitchy..

    keep up the great work.

    K

     
    Axel

    April 17, 2002, 07:09 AM

    replace .NET with 7.0 and you know ;-)

     
    the_only_lorddaha

    April 17, 2002, 07:10 AM

    You can use (as in this demo) Visual Studio.Net for native C++ projects, without using the .Net framework.

     
    Matt D

    April 17, 2002, 07:29 AM


    how to recreate a small glitch

    1) break the balls up so one rests on the edge of the map
    2) accelerate at ball at a slight off axis when compared to the perpendicular of the edge of the map the ball is resting against
    3) hit ball hard and jam it between you and the edge of the map

    the ball consistently reacts by going straight up very fast... until it lands about 3-4 seconds later a short distance 'into' the map

    otherwise very very nice.. makes me realise how bad my poor gf2mx is!
    *sob*

    dms0

     
    Ready4Dis

    April 17, 2002, 07:47 AM

    For anyone having problems running the demo windowed or fullscreen with a Geforce based card. Make sure your desktop is set to 32-bit color depth if you're doing windowed, or if going full-screen, choose a resolution that is 32-bits. Geforce based cards only have/use a stencil buffer while in 32-bit color depth, and not in a 16-bit color depth, which is why you're getting the error. Set it to 32-bits, and you should be fine BOTH ways. I don't know about other cards, but I'm sure they probably have similar issues.

    Billy - BillyB@mrsnj.com

     
    Ready4Dis

    April 17, 2002, 07:51 AM

    Make sure you run in 32-bit mode, a lot of graphics cards support a stencil buffer ONLY while in 32-bit color depths (like the Geforce 1/2/3/4)

    Billy - BillyB@mrsnj.com

     
    Ready4Dis

    April 17, 2002, 07:56 AM

    Odd.. seems to be locking at 49/50 fps for everyone. I can run it windowed, full screen, 800x600, 320x200, disable v-sync, enable it... still runs the same speed. DOPE!!! I just realised something... I disabled v-sync by defualt in OpenGL.. not D3D :D... son of a... lol, back to the testing board after work. By the way, this is one of the most interesting IOTD i've ever played!

    Athlon XP1600
    Geforce2MX (original)
    WindowsXP Pro

    Billy - BillyB@mrsnj.com

     
    SirKnight

    April 17, 2002, 08:21 AM

    haha cool. I'll have to try that later. :)

     
    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.