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

Submitted by Tim C. Schröder, posted on May 29, 2001

Image Description, by Tim C. Schröder

This is a picture of a research project I have done in my spare time here at Crytek. I got interested in doing some Direct3D stuff, and inspired by Doom3 my work had to be about lights and shadows. This demo uses per-pixel attenuation for the lighting, thanks to Ron Frazier for is awesome tutorial. Unlike him, I do the setup for the PPA inside a vertex shader, only 9 instructions. The shadows are implemented with shadow volumes. Take a look at nVidias developer site and head for the whitepaper of Mark J. Kilgard if you want to learn more about this. The shots were taken on my slower home system, GeForce 256 DDR + Athlon 700. Still runs pretty fast with 75 - 125FPS. I hope you like it, maybe you have some suggestions for a better lighting / shadow implementation, I would love to try them out...


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.

May 30, 2001, 07:14 AM

One way to optimize is by just cheating, and not create a new shadow volume for each jittered position, but offset the volume slightly 4 times. You will get an error, but you'll also get soft-shadows.

Frans Bouma

May 30, 2001, 07:33 AM

Well, the whole point of the method I described is that you create polies at the edge of the hard edged shadow part that shade from alpha=255 at the edge of the hard edged shadow to alpha=0 at the edge of the total shadow. You won't receive that by just blending 1 quad on the scene and fill only there where the stencil buffer has a certain value. :)


May 30, 2001, 07:37 AM

Yeah, Tim is a pretty common name (Tim Sweeny...), and Schröder is very very common Germany, so putting this C. is probably a good idea ;-)

Maybe that's obvious, but I forgot to mention that everything is dynamic, so no precalulations. This is true for both, the shadows and the lighting. I guess people that don't know PPA or shadow volumes might thing I'm using lightmaps or so.

I have enough spare time for such projects, no problem. Also, doing research projects makes you a more valuable employee, you can never know enough ;-) I never had the chance to do anything advanced in D3D8, so this project was basically to get my familar with doing advanced stuff in D3D, like multitexturing, stencil buffers, vertex shaders and so on.



May 30, 2001, 08:37 AM

I doubt the level of Geometry was/is more dynamic than anything before... think Messiah. Now that game had dynamic LOD to the max! When they wrote the game engine, they couldn't even see how nice it was because hardware wouldn't allow it to run at full detail. It would conform to your hardware, pretty neat. Everything was dynamic, rooms, players, objects, even the weapons and particles, etc. I don't know if Doom3 will be more dynamic, but I doubt it.

David Olsson

May 30, 2001, 08:37 AM

It's probably faster on geforce3 too.


May 30, 2001, 08:37 AM

Just one thing to say - (GeForce + Athlon) - that's your slow system?!?


David Olsson

May 30, 2001, 08:44 AM

Is there a demo that I can download ? I'm quite interested in this.
I appologize if you have already posted a link but I haven't read all the other posts yet.


May 30, 2001, 08:46 AM

Very nice images, but some of the Shadows just don't look right. Look at the top left, middle right, and bottom right pictures at the sphere. The shadows are all jagged (obviously just missed some triangles, while it just got the ones next to it) on the self shadowing anyways, casted on the ground they look fine (although, where it would be jagged in the cast, you cannot really see). Nice work all the same though, I'm not even going to attempt real-time shadowing.


May 30, 2001, 08:47 AM

well anything we say from now on is pure speculation so rather pointless :-/


May 30, 2001, 08:58 AM

Mmmm. I agree. Can't you just resize the text down a little? Or just have it as a normal sized quote underneath your text like most people?


May 30, 2001, 09:03 AM

Nice work, Tim.

Any special tricks in the silhouette creation? Is it done on the CPU, or with one of the various vertex shader methods that Nvidia and ATI have talked about?

- Ekul


May 30, 2001, 09:14 AM

I thought you were talking about shadow-volume generation and stencil-buffering it on the scene. But you're referring to generating shadow maps then? If so, then a simple gaussian blur on there would give soft shadows. There are other more legitimate methods of going about doing proper soft shadows, one is with a convolution of the lightsource's projected geometry with the shadow blockers, although that's not quite feasible in real-time. ;)


May 30, 2001, 09:16 AM

"Also, doing research projects makes you a more valuable employee, you can never know enough"

I definitely agree with you on that one.


May 30, 2001, 09:19 AM

Ah, you mean like surface-detail polygons on top of a scene, acting as shadows? Jaap Suter did an implementation of that, a real-time one too using a beamtree to do the blocker-clipping + shadow polygon creation stuff. Doing that 1 time per frame (or per update of either lightsource or shadow blocker) is quite a daunting thing to do. Jaap pretty much optimized it all the way. Doing it 4 times or more is not something that's feasible, imho.

Anna Taker

May 30, 2001, 09:21 AM

John Carmack said something that they're now treating all surfaces the same(according lights and shadows) no hacks and tricks. He also said that they now prevent light from reaching the surface rather than taking it away. I can't remember a statement like geometry is more dynamic !?


May 30, 2001, 10:19 AM


How do you da light? Just let the HW do it or do you calculate?



May 30, 2001, 10:45 AM

Yeah, talk about bragging, i have a celeron 366.


May 30, 2001, 10:52 AM

Correct me if Im wrong here.. but didnt you just flame "Windoze" then ask for everyone else to not flame mac?

Hmm... hypocrite?


May 30, 2001, 10:58 AM

I can't remember his exact words, but at quakecon2000 he made a comment that the way they're handling geometry is more dynamic than ever before..
Whatever that's supposed to mean, i don't know

Hannu K.

May 30, 2001, 11:43 AM

Many ppl here may not know that Blade of Darkness has fully dynamic shadows (done with stencil) and the game is already out (and it rocks). Everyone here is just referring to Doom 3 :P.

Great looking picture btw.


May 30, 2001, 11:48 AM


this is my first post ever!

And I've got to say: "this are really some very cool screenshots!"
good work Tim!!

would be great to see some more stuff on your page!


May 30, 2001, 12:11 PM

While Blade of Darkness did have dynamic shadows, they were not *fully* dynamic. Only certain objects cast shadows, and only certain other objects received them. It worked well for them, but it's not as complete as doom3's is.

And even GLQuake had partially dynamic shadows...


May 30, 2001, 12:29 PM

Sorry, but this is really the slowest system I could find ;-)



May 30, 2001, 12:32 PM

Sorry, but I can 100% guarantee you that the shadows are correct. There are no missed traingles, nothing. No self-shadowing errors, really. It's a shadow volume algorithms, so it has 100% correct shadows including self-shadowing. The shadows are not soft and not depth-correct and do surely not involve radiosity / global illumination calculations, but contain no analytical or geometrical errors.



May 30, 2001, 12:34 PM

I don't use the GPU, I precalculate edge adjency for the mesh and then I find the edges that connect fron and back facing triangles.

I still have to look at this ATI paper. But I think the main bottleneck of shadow volumes is the fillrate of the volumes, not the silouhette extraction so anybody that generates the silouhette on the CPU can feel save.



May 30, 2001, 12:35 PM

I mentioned that I have the algorithm from Ron Frazier, some people posted the link. Please check out his tutorial, it's absolutely awesome. Very good explanation and pictures, including a working demo. I use his algorithm, but I moved all CPU work into a vertex shader.



May 30, 2001, 12:37 PM

Yes, I know this. But I think the dynamic shadowing in BoD has not a real big impact on the gfx. It just doesn't make such a Quake3 vs Doom3 difference ;-)



May 30, 2001, 12:37 PM

Thanks ;-)

Well, I'm pretty busy so don't many updates in the future...


Garett Bass

May 30, 2001, 12:54 PM

"GeForce 256 DDR + Athlon 700. Still runs pretty fast with 75 - 125FPS"

I'm curious what kind of polygon count this scene has. 75-125 is fast for the setup you mention if you're talking about fully texture-mapped, triangle-dense environments, but for a small room with no textures and just a few simple objects, it's not exactly encouraging. Especially considering a GF DDR/Athlon 700 is probably still about 2 years from being a reasonable consumer target, and even then I doubt it will be very common. Am I missing something here?


May 30, 2001, 12:55 PM

Ehm.. I'm not very original with this post but I don't know anything else to say.. ;)


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