3
$\begingroup$

I have been studying computer graphics, from the book Fundamentals of Computer Graphic (but the third edition), and I lastly read about texture mapping and shadow maps. Though, I didn't exactly understand how they function. I know there is also another type of texture map called projective texture map which allows to cast hard shadows, but how they function? On the other hand, how are soft shadows cast? And what's exactly the difference between hard and soft shadows?

$\endgroup$

2 Answers 2

3
$\begingroup$

Hard shadows are simple that only needs a point light.

How it's done is by rendering the scene from the point of view of the light and only keep only the depth information. This is the shadow map.

Then when doing the actual rendering you calculate the point on the triangle in world space and find where it would be on the shadow map. Then you sample the depth from the shadowmap at that point and compare it to the distance to the light.

Soft shadows are harder. They require figuring out how close you are to the edge of what would be a hard shadow and adjusting the light value based on that. There are several techniques for that. One of which is simply sampling multiple times.

$\endgroup$
1
  • $\begingroup$ A image might do wonders. $\endgroup$
    – joojaa
    Commented May 3, 2016 at 4:43
1
$\begingroup$

@ratchetfreak's answer describes shadow mapping, however, there's another not so difficult to implement way of drawing hard shadows. The shadow volume technique uses extruded geometry plus some stencil buffer tricks to simulate the area occluded by an object. The idea behind it is to generate a volume from the light source's perspective and then render it as you would render other geometry. The resulting shadow geometry will be as accurate as your graphics hardware is capable of rendering it, so the shadows will be very clear cut. There's no simple way of producing soft shadow edges with this technique though.

shadow volume

$\endgroup$
2
  • $\begingroup$ I'd upvote if there was also an example of a (possibly unrelated) soft shadow technique for contrast, as part of the question was what is the difference between them. $\endgroup$ Commented May 3, 2016 at 14:56
  • 1
    $\begingroup$ Soft shadows with shadow volumes makes me think of Instant Radiosity - essentially approximate area light sources as multiple point light sources and accumulate the results. Many shadow (100+) passes are doable in real time on a modern GPU with stacked memory if the shadow casting geometry can be limited. $\endgroup$
    – user2500
    Commented May 3, 2016 at 19:09

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.