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

Tim


[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.
 
TThirion

May 29, 2001, 07:36 PM

Marvelous work. It's pics like this that keep me driven.
Keep up the good work!

Tim

 
DragonWorx

May 29, 2001, 07:48 PM

Your shots look great! Maybe you do a swinging light demo? My first reaction was to see a light swinging back and forth from the roof, casting different shadows and lighting as it moves.

Speaking of Doom3, has anyone decided to invest in Apple G4/Geforce3 MacOSX programming? There is the potential for a new generation of game development to take place on Apples new hardware, and i know i'd rather program for OSX, than Windoze. (please, no Apple/Windows flaming...it's so tiresome).

 
DragonWorx

May 29, 2001, 07:49 PM

Your shots look great! Maybe you do a swinging light demo? My first reaction was to see a light swinging back and forth from the roof, casting different shadows and lighting as it moves.

Speaking of Doom3, has anyone decided to invest in Apple G4/Geforce3 MacOSX programming? There is the potential for a new generation of game development to take place on Apples new hardware, and i know i'd rather program for OSX, than Windoze. (please, no Apple/Windows flaming...it's so tiresome).

 
dan ogles

May 29, 2001, 08:27 PM

Great pic! I'm going to be working on the same thing on my new engine soon. I was also inspired by the Doom3 movie. :)

Could you please post the link to the PPA tutorial?

Cheers,
Dan

 
Joseph Crevier

May 29, 2001, 09:10 PM

I assume you are generating silloette for your shadow casters? Does it get slow when shadowing complex objects? Thats what amazes me about the Doom3 mpeg - how they generates those silloette edge so quickly for those high polygon environments. I mean you could LOD the character but some of those shadow casters in the environment were extremely complex.

 
Jeff Quesnelle

May 29, 2001, 09:50 PM

Whoa, that's some pretty nice stuff!

 
DirtyPunk

May 29, 2001, 10:43 PM

You are assuming they do :) Its more likely some straight render to texture thing - eg Shadow maps :)

 
Hiro Protagonist

May 29, 2001, 11:10 PM

Then why in the hell did you start it off?

 
ecko_53

May 29, 2001, 11:50 PM

This looks great! the shadows look very realistic

 
dan ogles

May 30, 2001, 12:16 AM

It looked to me like they were using shadow volumes in Doom3 due to the non-jagged edges, although the video was relatively low-res. It definitely looked like they used a much lower LOD for the characters when doing the silhouette, because (for instance) the marine in the video had a light above him yet his nose didn't cast a shadow on his face. Look closely and you'll see what I mean.

In regards to silhouette generation, I believe there was a pretty good discussion within the (excellent) SurRender Umbra manual. Specifically, they talk about how to cache and lookup silhouettes very quickly. You can get it at www.hybrid.fi/umbra.

Cheers,
Dan

 
FUEL

May 30, 2001, 01:58 AM

Hey, great work. I've been working on shadows a lot lately for work and have implemented shadow volumes. They seem fairly slow however for complex models and use a lot of CPU work. Let me know if you have any info on fast silhouette generation, or some way of generating it in hardware. Currently I am implementing shadow mapping, which is, fairly fast and can be done GPU side, but has some resolution problems so it doesn't look as nice as shadow volumes. Anyway nice work!

Btw the Ron Frazier PPA tutorial go to
http://www.nvidia.com/Marketing/Developer/DevRel.nsf/pages/A29998E29896BE8E8825695C0004D163

- Greg

 
Not

May 30, 2001, 03:01 AM

Carmack said at quakecon 2000 that he used the stencil-buffer shadow volume technique.
he also said that he tried to use shadow maps but that the results where unsatisfactory

 
QRock

May 30, 2001, 03:32 AM

Nice work my friend, now tell us all what we want to know.

How did you make X-Isle go so fast?

 
disc

May 30, 2001, 03:57 AM

ouch
that there signature was massive :)
i'm kinda interested in the g4, not necessarily mac os x though

 
Frans Bouma

May 30, 2001, 04:06 AM

Looks great!

What you could add is softshadow edges using gouraudshading in the alpha fragment. You seem to create an edgemap of the objects already, so you can create 4 of them instead of 1: give the light a size, and generate the edgemaps from the top of hte light, the bottom, the left and the right side. Then, combine the edges you found for the 4 sides of the light and the inner area of the edgemap you get when you've combined the edgemaps is the hard shadow part. The edges around that hard shadow part are soft, you should fade these towards alpha=0 at the very outside edge.

This will give you real time softshadows without overdrawing the whole scene over and over again and you don't have to use a stencilbuffer either.

 
tcs

May 30, 2001, 04:19 AM

Sure, OSX rox. I just see one problem, the drivers !
My friend has a G4 and a GF2 GTS, and the drivers are sooooo bad. They just expose 10 extensions or so, nothing compared to the 50+ on a Win32 system.

At the moment, the GF2 drivers on OSX have NO vertex programs and NO register combiners. So, so shaders, no DOT3, no good multitexture etc.

Why not developing on Win32 and porting the compatible OpenGL code to Mac when they have their drivers ready ? Should be easy, never had problems.

Tim

 
tcs

May 30, 2001, 04:21 AM

Agreed. My guess is that they calculate projected shadows for all static light + static object shadows. SO they have something that looks like lightmaps but can cast shadows on moving objects, like in the new Nocturne engine. Anything that moves uses shadow volumes.

I guess they have the silhouette anyway, because they might use silouhette clipping, see the whitepaper...

Tim

 
tcs

May 30, 2001, 04:24 AM

Thanks for posting the link, I lost it. Basically I'm using his method, but with the texture setup in a vertex shader and different bleding / combining functionality because of D3D8.

I beleive ATI has a whitepaper on how to calculate shadow volumes in a vertex shader. Neverwinter Nights also seem to use shadow volumes for their pretty complex objects, and it's also damn fast. Maybe because of the far camera...

Tim

 
tcs

May 30, 2001, 04:25 AM

To say it with the words of Shaggy: "It wasn't me !"

Tim

 
tcs

May 30, 2001, 04:27 AM

Sounds damn interesting ;-) I'm not 100% understanding it right now, but I'll take a deep look at it.,

Tim

 
Not

May 30, 2001, 04:38 AM

Well i wouldn't be too suprised if all the lighting is dynamic
John Carmack made a few comments about -no- preprocessing and made a mysterious comment that the level geometry was more dynamic than anything before..

 
Not

May 30, 2001, 04:40 AM

no wait, that is not entirely true
i vaguely remember a comment about precalculated edge information being stored in the .map files...

 
MK42

May 30, 2001, 04:49 AM

Hi!

I think, he wants you to generate several sets of silhouette edges with a jittered light position. Then, you can 'merge' those sets in two ways. First you generate the 'union' of all the areas. This is the 'outer' part of the shadow. Then you generate the 'intersection' of all the areas giving you the 'inner' part of the shadow. The inner part is the umbra (full shadow), the outer part the penumbra (partial shadow).

Hmm ... looks very interesting,

MK42

 
MK42

May 30, 2001, 04:52 AM

Oh ... one more thing. He 'might' talk about generating shadow maps, not shadow volumes, since he talks about not having to use the stencil buffer. Please correct me if I'm wrong.

- MK42

 
Isaack Rasmussen

May 30, 2001, 04:59 AM

I read somewhere, that Apple is the fault of lacking extension. They are restricting Nvidia for releasing new extensions for reasons, I just can't understand.
But it seems quite typical of them.

Anyway, nice pic Tim!

And I have some links that you might find interesting.
Here's Ron Frazier's page,
Click

Cass Everritt has some nice things here,
Click

Nvidia has made a perpixel lighting demo, but unlike Ron's, they use TextureMatrix for doing the per-vertex calculation. So for those without native VertexPrograms, it's easier to HW accellerate.

Click

 
tcs

May 30, 2001, 05:07 AM

Yep, I know it can be done with the texture matrix. But I 100% agree with Carmacks plan, multitexture setups for multiple passes with multiple textures and those texture matrix stuff are nearly unredable. I understood a shit while looking at this demo. vertex programs are soooo cool because you can make everything HW accelerated and don't have to worry about how to hack your equations into some weird fixed-function transform capabilities.

But of course, texture matrix is HW accelerated and so probably faster an GF1/2 cards...

Tim

 
D.P.

May 30, 2001, 05:08 AM

Nice clean shadowing, soon I will enter the realm of lighting and shadowing; per-vertex -> simple lightmap -> complex lightmap with proper shadowing -> per-pixel pixel shader light mapping with dynamic lights and scenery. First got to make a good octree class. That was a good tutorial (on octrees) on your site by the way. I am the third Tim to reply, just shows what a great name it is.

Tim S. ( no c in the middle :( )

 
Willem

May 30, 2001, 05:57 AM

Nice looking pic you've got there. One thing that surprised me though is the "spare time at Crytek". I mean, spare time whilst working at a game company? :)

 
Frans Bouma

May 30, 2001, 06:29 AM

What I ment was: generate a set of triangles that you render blended on top of the geometry, and without texturing. The set of triangles is composed from the edge sets you get when you use the jittered lightpositions as you explained indeed.

With complex objects this can be a little slow perhaps, allthough you can optimize a lot.

 
kewldude

May 30, 2001, 06:56 AM

What the hell is wrong with you? I had to scroll three screens to go past your double posting with that enormous signature.

 
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.