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:
  • (389k)
  • (50k)
  • The source is all C++ (with a bit of vertex shader assembler) in a Visual Studio .NET project.

    Si Brown

    Image of the Day Gallery


    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.

    April 16, 2002, 03:31 PM

    Wow, great job! I'm lovin' the demo.


    April 16, 2002, 03:34 PM

    Looks great. How hard has it been getting DirectX and .Net going together? Been thinking about upgrading but have feared problems migrating from VC6 to .Net.


    April 16, 2002, 03:36 PM

    Wow that's fun! Friction seems a bit low.. but maybe that's just me. Is there a homepage for ODE?


    April 16, 2002, 03:45 PM

    yahoo ... physics is my loved thing
    I hope source will be useful... physics in games is always important



    April 16, 2002, 03:46 PM

    Excellent work!

    Edwin Jakobs

    April 16, 2002, 03:49 PM

    Not hard at all


    April 16, 2002, 04:01 PM

    Tried this a while back, must say it's both impressive and addicting. Very good work!

    As a side note, does anybody know how to set IEs font sizes smaller? This and the rest of FC uses HUGE fonts ever since my reformat...

    Kurt Miller

    April 16, 2002, 04:04 PM

    "As a side note, does anybody know how to set IEs font sizes smaller?"

    In IE, try going to the View menu -> Text Size -> Medium

    IE occasionally changes that setting to smaller or larger font sizes for reasons beyond me.


    April 16, 2002, 04:07 PM

    Thank you Kurt! :)

    I also just figured out that you can use Right Control + Scrollwheel as a shortcut to that :D


    April 16, 2002, 04:08 PM

    Actually it is you holding the ctrl key and using the mouse wheel at the same time ;)

    Clint Brewer

    April 16, 2002, 04:09 PM

    very nice! you should have a prize for getting to the top of that tower though :)

    Hiro Protagonist

    April 16, 2002, 04:11 PM

    "This is the best demo submitted to any page on the web ever!"
    - Nina Schumacher, Grandmother and gardening hobbyist

    "I would pay for this kind of entertainment!"
    - Gene Salsbury, Law Enforcement Officer, Detroit Michigan

    "* * * * * !"
    - General Schwarzkopf, US Army retired

    "I laughed I cried, I jumped into a pile of beachballs."
    - Ali Muzhalla, 7-11 atendant

    "Sweet ass wheels!"
    Hiro Protagonist, Flipcode community forum poster


    April 16, 2002, 04:12 PM

    While we're on that subject (nice IOTD by the way), my Internet Explorer goes fullscreen for no reason in a seperate window. For...well, no reason really. Any ideas? :)


    April 16, 2002, 04:12 PM

    Just wanted to add this:
    Your demo seems really buggy because createfromloader():createdevice failed
    But i hope physiscs works good


    April 16, 2002, 04:15 PM

    great fun! one thing though, sliding would be cool (as in the buggy should start to move backwards on the ramp)


    April 16, 2002, 04:15 PM

    Ctrl-mousewheel does the trick for the font size thing

    Robert Pasquin

    April 16, 2002, 04:21 PM

    I have the same problem :[


    April 16, 2002, 04:27 PM

    It might not be a bug, it's just that your card isn't compatible. If you look at the source you can see that he's being fairly strict on what is considered a compatible device. It seems to work fine on GeForce cards, but not on any card that doesn't support stencil buffer.


    April 16, 2002, 04:28 PM

    sweet as pie.


    April 16, 2002, 04:31 PM

    hum i get great flickerings of non-drawn faces or whatever.. but anyways, its cool to play, really


    April 16, 2002, 04:32 PM

    ODE webpage.

    Hey Si, would you have enough time to write a good tutorial on Volume Shadow capping? I'm having major trouble with that.


    April 16, 2002, 04:33 PM

    I had this problem also.
    Unzip with directories. It needs the graphics files in the media directory.


    April 16, 2002, 04:37 PM

    Is anyone else having troubles downloading the files? It's not liking me at all.


    April 16, 2002, 04:42 PM

    I can never get at any files from the flipcode ftp at home. Works at work for me for some reason tho..

    Si Brown

    April 16, 2002, 04:43 PM

    Thanks for all the comments so far.

    MC BAXTON: you need DirectX 8.1 and a card with a stencil buffer. (e.g. GeForce2 or above) If it still doesn't work, you have the source. :)

    PlayfulPuppy: 'fraid I don't have the time to do that. But here is the method I used:
    - I only compute the volumes for convex bodies.
    - I compute the 2D convex hull on the plane normal to the light direction.
    - I render the edges of the shadow volume using a single triangle strip around the 2d convex hull.
    - I completely cap the volume by using a fan at each end that goes around the 2d convex hull, centred at the body centre.


    PS No HTML in messages any more??

    Kurt Miller

    April 16, 2002, 04:49 PM

    ">>I can never get at any files from the flipcode ftp at home. Works at work for me for some reason tho.."

    No clue why that might be the case. Can you access other ftp sites (on port 21)? Could be your firewall at work. I stuck a copy of the files in a web dir in case it'll help...

    Matt Newport

    April 16, 2002, 04:49 PM

    Are you Si Brown as in Mike's friend from Cambridge?

    Matt. (also Mike's friend from Cambridge :-)

    P.S. Nice screenshot. Going to download the demo and try it out now.

    Si Brown

    April 16, 2002, 04:55 PM

    Hey Matt,

    Yeah I am. I've seen you here before too, but I've not been very active on these forums for a bit. :)

    I must email Mike actually, I'm just the laziest bastard when it comes to this sort of thing. We must meet up again soon, in fact sod it I'm going to email now...


    Kurt Miller

    April 16, 2002, 04:55 PM

    ">>No HTML in messages any more??"

    No, it was being abused yesterday so I took out. The forums currently in the works have a ubb-like set of formatting tags and an auto-linkify feature for URLs in posts.


    April 16, 2002, 04:58 PM

    I have the same problem if I try to run windowed on my GF2. Use fullscreen.

    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.