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.
    Dennis Meffert

    April 22, 2002, 01:08 AM

    Sounds interesting, thanks for the link.


    April 22, 2002, 01:15 AM

    Well I've had my GF2GTS for almost 2 years now, so you've got no excuse for still having a TNT2 ;). Then again... on older systems fancy accelerators are overkill. A GF or GF2 would probably help squeeze some last life from an older box, anything more up to date would be pointless.


    April 22, 2002, 02:21 AM

    How very nice of id to donate those textures :)


    April 22, 2002, 02:24 AM

    The demo ran completely ok on my Win XP - GeForce2 MX machine. I didn't experience any of the problems that others did. The demo felt a little lifeless though, but I'm thinking that its purpose might not be to provide an experience that appeals to all one's senses :)

    Good work dude.

    Dennis Meffert

    April 22, 2002, 05:17 AM

    I know what you mean, I've been stuck with a TNT2 for a long time too. The lighting model doesn't work on a TNT2 since it doesn't support DOT3, and even if it did, the shadows and all the render passes for the lights would probably make it way too slow :)


    April 22, 2002, 06:17 AM

    Oh, so seeing as he didnt make the models, he also didnt program it?
    I really want to see something you had made.
    and also, it says he hasnt done any work on visibility determination IN THE FUCKING TEXT THAT GOES WITH THE PICTURE YOU THICK FUCK!


    April 22, 2002, 06:33 AM

    It ran fine on my WinXP / GeForce 3 ti500 combo. I noticed a wee bit of flickering at corners (ie where the walls meet) in the outdoot "courtyard" scene. Otherwise I noticed no artifacts. The shadows looked a bit odd in the hallway scene (the one with moving light).

    Cool motion blur effect. Thumbs up.


    April 22, 2002, 06:52 AM

    Good work!
    Importing from MAP files means you do all CSG by yourself, right?
    Is there any CSG-ed geometry or this is plain brushes what we see on screenshots?..
    Can you tell something more about world data structures you use, in few words - I mean, you do not have visibility determination and this is the thing (often) which the data structures depends on. So, you'll change everything, on build something hacky on top of current code? Or it is mighty flexible? :)
    I'm just curious - currently my engine can just find the brushes, but with my current design there is no problem to use 3DS MAX to import geometry and to reuse 80% of processing pipeline. However my design is far from good, it is only flexible and it is interesting to hear what other ppl have done!
    Here on that forum this is exacly the last thing to talk about :(


    April 22, 2002, 06:57 AM

    I have a suggestion - when you write down a reply, simply delete the last sentence (you can even automate that by macros!). It is pitty to spoil your (not so unconstructive) comments by the crap you write sometimes...


    April 22, 2002, 08:15 AM

    You're describing the technique exactly as described by Lee Markosian, et all in the paper "Real-Time Nonphotorealistic Rendering". You can find the paper at this URL:



    April 22, 2002, 08:53 AM

    Better idea, just have a macro delete anything he/it writes.


    April 22, 2002, 09:33 AM

    Well, hell yeah. But my old ASUS mainboard has some compatibility issues with everything gforce and in addition, my old power supply lacks the juice to power newer graphic cards.


    April 22, 2002, 09:41 AM

    Extremely nice! I'm downloading the demo now...


    April 22, 2002, 09:52 AM

    Another question about the converter. Does it actually strip away
    those faces that'll never be seen, as in Q3map, or are you just
    dropping faces with a specific texture?

    Dennis Meffert

    April 22, 2002, 10:06 AM

    The map files in the demo are just the brushes without any CSG-ing, but I have some CSG code from a previous project I could add.

    When I'm going to add visible surface determination I will probably have to modify some parts, but no really big changes I guess.

    Dennis Meffert

    April 22, 2002, 10:09 AM

    Just removing polygons with a specific texture. If I'm going to use BSP/PVS for visible surface determination again it could be done with a simple floodfill I guess, but I don't know what I want to do yet.


    April 22, 2002, 10:32 AM

    Morgan, Dodger, vil

    Thanks for the references.

    About the edge algorithm from Buchanan et al. Apparently I'm doing something similiar to what they propose. I also assume only two faces sharing a single edge. But for large scenes I am looking for some ways to intelligently cull the faces you have to look through to get a silhouette.

    Very true that the probobalistic idea came from the NPR paper, it was suggested for a class project by one of its authors. I am still willing to give it a try implementing it, even though it doesn't give complete silhouettes. Long and thus important silhouette ridges have the highest chance of being discovered, while small bumps that don't add much to visual realism can be skipped. Combined with temporal coherence to minimize sudden dissapearance of silhouettes, this might a nice optimization for distant meshes.

    Along the same lines. Wouldn't it be possible to sort faces in order of their curvature, and do your silhouette edge checking in this order? This will allow you to stop before you check the entire mesh, but after you got silhouette edges within some error threshold of importance. Curvature can be measures as the greatest angle to any adjecent face maybe.

    A similiar idea I'm sure a lot of people tried, is to use a lower detail mesh to generate shadows. But that seems to have a lot of problems with silhouettes edges not exactly on the original mesh, and artifacts from trying to do shadows with that.

    Anybody try this yet with good results? Just thinking out loud here.



    April 22, 2002, 11:00 AM

    Maybe it is just me, but why PVS?? Isn't it odd technique for todays processors? Why one should wait for level compilation 30 minutes? And then fill up the memory with huge PVS data. Just to offload the CPU in realtime by offline processing that took ages? There is nothing great about that, except maybe some neat geometry and optimization in PVS calculation, I think it is worthless even from a 'learning' point of view... Concave regions with portals can replace that quite nicely IMHO, for indoor environment of course...
    That BSP/PVS thing is kinda curse for every 3d newbie - he/she tries to go just the way Carmack did (or write STUPID octrees)...
    Sorry for the rant, can't resist it :)


    April 22, 2002, 11:09 AM

    Yes, this is slick... The images looked so cool I decided to download the entire whopping 6Mb of the thing despite my impossibly slow connection and having to work around the Great Firewall of China.
    Unfortunately, I am one of the people suffering from the white-shadows bug. Dang, it would have been so cool otherwise. Is it possible that's a video memory problem? Looking at these messages, it seems like a problem on older cards, but only half of the GeForce 2's... I have a Geforce 2 Go, 16Mb, 128Mb RAM, 850MHz.
    It looks like what's happening is the shadow volumes are getting rendered as white junk at full depth (over the skybox, as mentioned earlier) but the shadows themselves appear to actually be there, as un-shadowed areas. They're just not visible on the first scene because the whole scene is full-bright. Weird bug.
    The poly-seem problems aren't so bad. I noticed the same thing on some levels of Return to Castle Wolfenstein, actually. Just make sure the background color is black instead of white and it won't stand out.
    But really, what I say, is write the culling code first, so you can render some big levels and be able to use this engine for something real, and not just demos!
    Oh yeah, and how come the motion blur has a higher frame-rate than anything else?

    Dennis Meffert

    April 22, 2002, 11:37 AM

    I totally agree with you, but the reason I might go for BSP/PVS is that I already have a working implementation of this from a previous project, so it will save me a lot of time if I decide to use it again.

    Dennis Meffert

    April 22, 2002, 11:40 AM

    Yeah, the visible surface determination is the first thing I'll write after trying to fix the bugs. The motion blur has a higher framerate because it renders the scene to a 256x256 texture instead of the backbuffer :)


    April 25, 2002, 10:37 PM

    Can you give me the source code of your engine,i want to know how to write such a nice work

    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.