5
$\begingroup$

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.

How does this technique work, and how can I learn more about it?

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

$\endgroup$
3
  • 5
    $\begingroup$ " in early 3d (2000 - 2004)" Hah! You youngsters. $\endgroup$
    – Simon F
    Commented Feb 22, 2018 at 9:01
  • $\begingroup$ There were more earlier games from 90's :) Those were incredible in their times. $\endgroup$ Commented Feb 27, 2018 at 11:00
  • 1
    $\begingroup$ en.wikipedia.org/wiki/Shadow_volume <-- that $\endgroup$
    – Alan Wolfe
    Commented Feb 27, 2018 at 14:50

2 Answers 2

5
$\begingroup$

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.

$\endgroup$
2
  • $\begingroup$ 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. $\endgroup$ Commented Feb 23, 2018 at 11:02
  • $\begingroup$ @SteffanDonal fair point. I will add some details of what I had in mind. $\endgroup$
    – Olivier
    Commented Feb 23, 2018 at 14:19
2
$\begingroup$

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.

$\endgroup$
4
  • $\begingroup$ 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 $\endgroup$
    – Alan Wolfe
    Commented Feb 27, 2018 at 14:49
  • $\begingroup$ @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. $\endgroup$ Commented Feb 27, 2018 at 21:41
  • $\begingroup$ Exactly @NathanReed - Shadow volumes were one of my first research points but it just didn't seem right. $\endgroup$ Commented Feb 28, 2018 at 12:49
  • $\begingroup$ It depends on how the volume is created, if it was just built as a vertical pillar for whatever reason in that particular game, it would always shade the full height of the wall. But who knows what they did exactly. $\endgroup$
    – DanielB
    Commented Oct 27 at 10:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.