Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Linguica

Carmack On Shadows

Recommended Posts

Lead id programmer John Carmack updated his .plan yesterday with a small blurb about a new NVidia white paper on the subject of shadow volume rendering, which is of course one of the cornerstones of the Doom 3 engine. Also on the site is a small document, dating from May 2000, detailing previously unpublished correspondence with Carmack where he talks about his forays into shadow volume rendering. Here's a little blurb to make your head hurt:

The next iteration involved attempting to "preload" the standard stencil shadow algorithm by the number of clipped away planes. I first drew the shadow volumes with depth test disabled, incrementing for back sides and decrementing for front sides. This finishes with a positive value in the stencil buffer for each plane that is clipped away at the view plane. The normal depth tested shadow volume is drawn next, with the change polarity reversed, decrementing for back sides and incrementing for front sides. The areas not equal to the initial clear value are in shadow.

Ow, I need to go lie down.

Share this post


Link to post

Typical Coder's way to develop new stuff. First they toy with the idea, then they add stuff until it works in all cases, and then realize how redundant is the code and proceed to write it all over again in a minimalistic way.

Who says coding's not an art? Afterall it's all about inspiration.

Share this post


Link to post

Really, a couple of years ago when I was working in a game with several of my real-life friends I noticed this trend (4 years and minimal progress, school sucks).

I remember we were working on a isometric engine like the one in Ultima VII or LBA. While I was drawing some wall and doors templates, this coder friend was trying to develop a fast way to sort the sprites and render them correctly depth-wise. He went for 20 minutes, working with the math in a piece of paper. That's when he started laughing and banging his head against the wall. I take a look at the piece of paper and realize the first draft of the algorythm contained a couple of arc sin and arc cos, while the final form was just :

X + Y

Damn I miss those times.

Share this post


Link to post

Originally posted by Zaldron
Really, a couple of years ago when I was working in a game with several of my real-life friends I noticed this trend (4 years and minimal progress, school sucks).

I remember we were working on a isometric engine like the one in Ultima VII or LBA. While I was drawing some wall and doors templates, this coder friend was trying to develop a fast way to sort the sprites and render them correctly depth-wise. He went for 20 minutes, working with the math in a piece of paper. That's when he started laughing and banging his head against the wall. I take a look at the piece of paper and realize the first draft of the algorythm contained a couple of arc sin and arc cos, while the final form was just :

X + Y

Damn I miss those times.


My long life dream is to create a game.

Share this post


Link to post

Yeah that one. Anyway the game was going to be a RPG following the lines of Ultima VII and Serpent Isle. Just at 800x600@24 :)

Share this post


Link to post

Originally posted by Zaldron
I remember we were working on a isometric engine like the one in Ultima VII or LBA. While I was drawing some wall and doors templates, this coder friend was trying to develop a fast way to sort the sprites and render them correctly depth-wise. He went for 20 minutes, working with the math in a piece of paper. That's when he started laughing and banging his head against the wall. I take a look at the piece of paper and realize the first draft of the algorythm contained a couple of arc sin and arc cos, while the final form was just :

X + Y

Damn I miss those times.

Roflmao!

I wish that was possible at all times :)

Share this post


Link to post

Originally posted by Zaldron
Typical Coder's way to develop new stuff. First they toy with the idea, then they add stuff until it works in all cases, and then realize how redundant is the code and proceed to write it all over again in a minimalistic way.

Who says coding's not an art? Afterall it's all about inspiration.

Yup,this is often the creative path and not just in gaming. Simplicity is often the desired result but 'simple' should never be confused with 'easy' as it often is.You usually have to work through the 'guff' to get to the core.

Share this post


Link to post

The cloest thing to me making a game was when we had to make one for an assignment at school.

I totally botched up the code and the game had millions of bugs and errors. You flew around in a plane shooting the answers to maths problems...but I still got a C+ for it so I was happy.

Share this post


Link to post

When will id software find the five minutes to program a game that goes with all these graphical effects?

Share this post


Link to post

I once made a game in Turing that involved blasting away Pikachu into gibs... it had animated gibs and shotgun sounds and everything.

Heh

Share this post


Link to post

I've made a game where you shoot my face. It's available on the Internet - see if you can find it.

Share this post


Link to post

I think what Carmack is trying to say is that he's programming a flying plane that will spread ammo clips over the city in the game, and that he's in a dark area of the room he's working in, hence the shadows...

Share this post


Link to post

Originally posted by Fredrik
I've made a game where you shoot my face. It's available on the Internet - see if you can find it.


!!!I bet a lot of people would LOVE to get their hands on that :)

Share this post


Link to post

Originally posted by Maonth


!!!I bet a lot of people would LOVE to get their hands on that :)

Heh haven't you played it already?

Share this post


Link to post

Do you hate fredrik that much?

Share this post


Link to post

Originally posted by dsm
Do you hate fredrik that much?


No. I love fredrik in a non-gay, brotherly fashion.

Share this post


Link to post

Clearly what Carwank is trying to say is that the next iteration involved attempting to "preload" the standard stencil shadow algorithm by the number of clipped away planes. So first he drew the shadow volumes with depth test disabled, incrementing for back sides and decrementing for front sides. This finished with a positive value in the stencil buffer for each plane that was clipped away at the view plane. The normal depth tested shadow volume was drawn next, with the change polarity reversed, decrementing for back sides and incrementing for front sides. The areas not equal to the initial clear value were in shadow.

To demonstrate imagine we were shining a bright light into Fredrik's face:

        ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ |/ 
  ___/|~ ~ ~ ~ ~||||||||        |/
 [___ | ~ ~A~ ~ |o) (o)|        |/
     \|~ ~ ~ ~ ~| ( )  |   B    |/
        ~ ~ ~ ~ ~\____ |        |/
                   |   |        |/

Now apart from the fact that Fred is now permanently blind due to the power of the 2 million candlepower light being shone directly into his eyes from a distance of 30cm, we can see that:

o Area A is lit up
o Area B is in shadow

Now imagine Carwank was to "preload" (drop) the standard stencil shadow (10 ton weight) by the number of clipped away planes (onto Fred's head). The result would be something like this:
        ~ ~ ~ ~ ~ ~ __~ ~ ~ ~ ~ |/ 
  ___/|~ ~ ~ ~ ~ __(__)_ _      |/
 [___ | ~ ~A~ ~ /       | \   B |/
     \|~ ~ ~ ~ / 10 TON |  \    |/
        ~ ~ ~ /_________|___\   |/
               $%&^^%&$%$%%^    |/

Now if we were to measure the new area B compared with the old area B and then factor in the weight of the ten ton weight, using a formula something like this
 / (B.x^10 * B.y^10)                     \
 |  ------------------ * B.z^10 * B.y^10 | * 1337E10 * $666 & 110110110
 \ (B.z^10 * B.x^10)                     /

We'd get the sextant coordinates to the secret map showing the location of the lost city of atlantis, in the centre of which lies the great lost oracle database containing the shadow values for every possible situation in any fps game EVER, all within a 12k zip file, searchable with only a 0.004 second delay.

I hope this explanation clears up any confusion, feel free to contact JC himself for any clarification, through the healing power of prayer! You CAN change your life!

Share this post


Link to post
Guest
This topic is now closed to further replies.
×