# How did the hard, accurate shadows, work in early 3d (2000 - 2004) games?

I've been hunting around the internet for a while now, and I can't find anything about the specific shadow technique that I'm looking for.

I can only recall one game in particular that used it, and I know that it happens on the PC port of the game too. The game in question is "Sonic Adventure 2: Battle" for GameCube. I remember it happening on "Super Mario Sunshine", but I could be mistaken.

• The shadows are only cast from the main player character.
• It is 100% sharp, no matter the resolution the game is rendered at.
• They are cast perfectly parallel down onto the surface the player stands on.
• Interestingly, if the shadow intersects with a vertical wall, the shadow is drawn all the way up the wall, even higher than the original intersection.
• You can also see the shadow on ceilings directly above the player character, and even on floors above ceilings. It's as if there's a big character-silhouette shaped tube being cast onto surfaces.

I'm going to hunt for a picture of this particular technique, but I don't have one right now.

• " in early 3d (2000 - 2004)" Hah! You youngsters. Feb 22 '18 at 9:01
• There were more earlier games from 90's :) Those were incredible in their times. Feb 27 '18 at 11:00
• Feb 27 '18 at 14:50

Having not worked on these games, I can only speculate... but from your description, it sounds like a crude shadow map with orthogonal projection and no depth information. It probably has (or had) a specific name but the way I suspect they did it is:

• Render the character from above to a binary texture (eg. white there there's nothing, black where the character is), using an orthographic camera.
• When rendering the scene, perform a lookup in that texture and multiply by that color. You would of course exclude your characters from that.

The calculations involved for the texture lookup would be trivial as everything is 2D, in a plane of the world coordinates. It also does not need programmable shaders which IIRC were not around yet at that time. What you would need as texture coordinates is simply the (x,z) location of the vertex (assuming y is toward the sky here), along with an offset equal to the (x,z) location of your character. In OpenGL, I believe that could be achieved by glTexGen along with a texture transformation matrix.

The reason for the artifacts is that this really does make a "character-silhouette shaped tube", as you put it. Looking from above, the shadow is painted on every surface regardless of it being in front of or behind the character (above or below, from the camera's view). It's like you're dropping black ink from the sky inside the outline of the character and it goes through everything.

• I feel like this is pretty close, but I'd love a slightly more in-depth answer - specifically how this texture lookup works and why specifically this method results in artifacts of the shadow on walls and ceilings. Feb 23 '18 at 11:02
• @SteffanDonal fair point. I will add some details of what I had in mind. Feb 23 '18 at 14:19

Don't know the game but hard shadows are usually shadow volumes, often implemented with help of a stencil buffer. You can find a short description of the algorithm on Wikipedia.

• Yes this is the technique the person is looking for. It is perfectly crisp because the shadows are actual rendered geometry. It would be nice if you could provide a simple description of the technique! Wikipedia has some decent info too: en.wikipedia.org/wiki/Shadow_volume Feb 27 '18 at 14:49
• @AlanWolfe Shadow volumes would explain the crispness, however does not fit the OP's statement that the shadows extend above the character (closer to the light than the shadow caster). The classic shadow volume algorithm doesn't have that artifact. Feb 27 '18 at 21:41
• Exactly @NathanReed - Shadow volumes were one of my first research points but it just didn't seem right. Feb 28 '18 at 12:49