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

Submitted by Dennis Meffert, posted on April 21, 2002

Image Description, by Dennis Meffert

These are 2 screenshots of a 3D engine I've been working on in some spare hours since a few weeks. It is programmed in C++ and uses DirectX 8.1. It's not very fast yet, but there is still a lot of optimization to be done so it will probably get faster in the future. I'm still searching for some fast ways of extracting silhouettes.

  • Per Pixel Attenuation
  • DOT3 Bumpmapping
  • Stencil Shadow Volumes
  • Scripted Shaders
  • Map Converter for Q3Radiant maps
  • Motion Blur
  • Simple Particle System
  • Quake 2 Models
  • The lighting/shadows can be dynamic, but static lights are handled in a different way so they are faster. In the future I hope to add more features like curved surfaces, volumetric fog, spotlights and most important: visibility culling (probably a portal based approach). Also, a GeForce3 implementation could make it much faster because of the vertex/pixel shaders and extra texture units.

    More screenshots and a demo can be found at my webpage: or a direct link to the demo: (6.14 MB).

    The demo requires a GeForce or highter and DirectX 8.1. There are still some problems with z-buffer precision so you might see some cracks, and there is a small bug in the bumpmapping wich makes it look wrong in some cases, but I think I will be able to resolve this pretty soon.

    Finally, thanks to the guys in #flipcode on EnterTheGame for helping me.

    Dennis Meffert

    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 21, 2002, 01:53 PM

    Looks nice! :)


    April 21, 2002, 01:55 PM

    hey I like shadows ;)


    April 21, 2002, 02:06 PM

    Hmm, nothing seems to work with my GeForce. All the polygons flicker, and it seems like the vertices would be made of integers.

    The fire-particles and the blurry "rush" effects are cool, but the camera points at the robotic chickens too long...


    April 21, 2002, 02:10 PM

    Shadows were pretty damn good. I liked the blurred-zoom-fly effect too =] (Anyone have a link about how thats done?).

    About shadow extrapolation: Huges Hoppe ( ) has a great document about building outlines of predefined objects. Then you could easily use these outlines to create volumes. Just a suggestion and I have no idea how fast/slow it would be.

    Oh yea, and those birds were crazy looking. ;)


    April 21, 2002, 02:32 PM

    "I liked the blurred-zoom-fly effect too =] (Anyone have a link about how thats done?)."

    Render to texture.

    Matthew Baranowski

    April 21, 2002, 02:57 PM

    the problem with hughe's hoppe approach is that it takes a _huge_ amount of memory.
    i attempted to implement something like it, but for a game engine i wouldn't
    recommend it in practice.

    so i'm looking for better methods. i would love to hear if anyone has good ideas on this.
    just some observations:

    so for a mesh with n edges, the number of silouette edges should be propotional to

    for a convex mesh. the silhouette is always a closed loop, so you need to search
    only adjecent edges to grow your silhouette loop.

    for general meshes that are smooth enough you have silhouette ridges of several edges.
    one could probobly exploit temporal coherence and smooth movement of light and object
    with respect to each other.

    so my ideas currently are that you could try a probabilitic search. pick edges at random
    from a mesh, if you find one that is on a silhouette, search for more edges adjecent to it,
    to discover an entire ridge. after trying about sqrt(n) edges it is likely that you found
    most of the silhouettes.

    or one could try to decompose the mesh into convex submeshes. but that seems very

    any other ideas?



    April 21, 2002, 03:23 PM

    Looks fantastic!

    Refreshing to see geometry other than terrain and heightmaps. Is the
    Radiant map converter availible any place? It'd be a great help for
    those of us stuck with rotating MilkShape models : )


    April 21, 2002, 03:29 PM

    Nice work beffert!


    April 21, 2002, 03:59 PM

    It ran ok on my 1 gig athlon/geforce2, speed-wise.

    OTOH there were alot of white triangles, looking like where you expect shadows to be?

    Other shadows were not white, or black, but often a lighter color than surroundings?

    I also saw a number of white sparkles in some areas where polys touched, non-matching or overlapping vertices?

    I also saw virtually no lighting effects? No diffuse/specular components? Alot of scenes looked pretty flat.

    Nice motion blur!



    April 21, 2002, 04:19 PM

    I get the same problem, shadows are perfect white, and areas that
    should be shaded appear fully bright. In some parts it looked as
    though the shadows were being drawn behind everything, except the
    skybox? GeForce 2 MX, Direct-X 8.1.

    The fire and the motion blur were amazing anyway!


    April 21, 2002, 05:03 PM

    Matthew Baranowski:

    The randomized silhouette method you described was first discovered by Markosian et al for NPR work. It doesn't work for shadow volumes because it isn't guaranteed to actually find all silhouette edges, which leads to incorrect shadowing.


    Si Brown

    April 21, 2002, 05:14 PM

    Nice work Dennis.


    April 21, 2002, 05:24 PM

    one idea for the ones with bugs:
    run in 32bit color, looks like buggy stencil support.. ill try it out myself soon.. (with gf2, too)


    April 21, 2002, 05:28 PM

    That looks really good. You know, it kinda reminds me of the game Serious Sam. You said the static lights are handled a little different so they would be faster, what are you doing different, like radiosity or something?


    April 21, 2002, 05:36 PM

    possibly he precalcs the shadowvolumes..

    Headless Chicken

    April 21, 2002, 05:36 PM

    Runs smoothly and properly on my GeForce2 MX with WinXP.
    Keep up the good work


    April 21, 2002, 05:46 PM

    Ran great on my Geforce3 Ti under Xp. Really liked the funky looking chickens! Good work.


    April 21, 2002, 05:48 PM

    What editor is used... which method is used for visibility determination ?

    Haven't tested the demo yet, but it looks nice


    April 21, 2002, 05:50 PM

    Works fine on my GF2 MX-400 on Win2K Pro.


    April 21, 2002, 06:05 PM

    Ups, doesn't work at all on my TNT2 PIII450Mhz Win2k System. Seems like mine's a little outdated compared to the systems of all the other posters.
    Nvidia just throws out so many graphic chips in so little time, how's one supposed to keep up with that (especially if one's a student)? *sigh*


    April 21, 2002, 07:02 PM

    It worked fine on my GF2 GTS (64 MB), until it got to the robot chickens. The ground texture seemed to sometimes be tiled and sometimes be wrapped, and the screen frequently blacked out and there were weird white lines and polygons drawn there. After that it was fine again, though.


    April 21, 2002, 07:24 PM

    I have the answers from webpage but that's pitty u have used all available tools so your program is simply nothing.
    Quake textures, quake models, lighting, etc...
    Total lameness


    April 21, 2002, 07:43 PM

    For silhouette finding you might be interested in this paper by John W. Buchanan and Mario C. Sousa:

    Their method - which is a very simple idea - recomputes an exact silhouette each frame with very little overhead. Basically every edge has a 'silhouette' flag associated with it, initially set to 0. For each triangle you process when you do your backface culling you XOR a 1 into the silhouette flag for each of its three edges if the triangle is front-facing. When you've finished, every edge that has a 1 in its flag is a silhouette edge. Easy. How useful this is when you're trying to offload as much work onto the graphics card as possible, I don't know...


    April 21, 2002, 09:08 PM

    My GeForce2 GTS didn't like this at all, especially the indoor area... Lots of polygon flicker, so disgusting I had to leave before I went into a seizure. I dunno, but it seems like a common problem :P

    Too bad, cuz it was looking cool even despite the bugs. I look forward to trying it again when it's in better working condition.

    Jeff Quesnelle

    April 21, 2002, 09:45 PM

    Ran without errors on a GeForce2 MX-200. The last couple of scenes (the ones after the chickens) probably were only 8 FPS, but it looked pretty nice, and I didn't encounter any of the irregularites others seemed to have. Is that motion blur real-rime? It's pretty sweet.


    April 21, 2002, 10:29 PM

    The image blur is nice but the textures are flat.. the engine ran slowly on my system (GF2, 1,3ghz athlon, 256mb ddr)..

    But it is good.. Much.. much ... much... much better that I could ever put together with my meager knowledge :

    Adam Byram

    April 21, 2002, 11:12 PM

    I had that same problem. Everything looked really good until the chicken scene and then it would keep blacking out and getting all kinda of poly garbage all over the screen. Then it was all back to normal. (733 PIII, GeForce, 384MB, latest nVidia Drivers)


    Dennis Meffert

    April 22, 2002, 12:55 AM

    Thanks for all the replies.
    It seems there is a LOT to be done to get it working on all cards, too bad I don't have more different cards myself to try it out. I don't know what the problem could be, but I had similar problems on my own videocard in the beginning when I used DirectX 8 instead of 8.1. This is because the lighting passes are accumulated in the alpha buffer, and DirectX 8 doesn't support destination alpha when you use D3DSWAPEFFECT_DISCARD. This makes it look very flat without any lighting. Anyway, I'll try to fix it as soon as possible :)

    Dennis Meffert

    April 22, 2002, 12:58 AM

    Yes, for static lights the shadow volumes are precalculated, like davepermen said.

    Dennis Meffert

    April 22, 2002, 01:06 AM

    The .map format is very easy actually, and there are lots of tutorials about them available. But maybe I'll put up the source code, after I cleaned it up a bit :)

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