Results 1 to 2 of 2

Thread: Shadow Mapping

  1. #1

    Thread Starter
    Android OpenGL ES Guru Jacob Roman's Avatar
    Join Date
    Aug 2004
    Miami Beach, FL

    Shadow Mapping

    I doubt any of you will respond but....as usual, here we go

    Well for the first time ever, I'm going to attempt to do shadows in my Android app.

    And I heard the modern approach to this is what is called "Shadow Mapping" which basically is a texture map that has the shadow I'm guessing. But I'm a complete noob at it. I found this awesome tutorial here:


    Problem is, most of the functions either don't exist, or require a higher level API. And that I don't want, because I want to support multiple devices. I also came across this:


    And I'm still struggling trying to understand it. I know how to setup the Shadow Map, but to get the closest depth for the shadow map, and to render it blew a few fuses in my brain. Even if I get just simple "Shadow Acne", I would be happy with the results. Does anyone know anything about shadows and shadow mapping? Thanks!

  2. #2
    Frenzied Member
    Join Date
    May 2014
    Central Europe

    Re: Shadow Mapping

    Hi Jacob. I am generally interested in 3d graphics and every now and then i dig into this topic and everytime a bit deeper but my knowledge i currently not deep enough to cover lights and shadows, i am happy i just got my fbx reader finished supporting textures.
    So hopefully i dont get you bored because of my uneducated answer

    Anyhow. My understanding of the shadow mapping method is that the map is created in a first rendering step where the camera is in the position of the light source.
    so every vertex is processed by a normal vertex shader but the pixelshader, instead of writing the color of the pixel, actually writes the distance to the light source into the scene.
    so the result is an image that, for every pixel visible from the position of the lightsource, does have a color representing the distance (from the light source) of the object closest to the light source, this is the shadow map. Any object hidden behind another object (from the view of the light source) is not represented in the shadow map because of the usual depth test.

    Now this shadow map image is used in the second rendering process where in addition to the normal rendering, the pixel shader transforms the vertex coordinates into the coordinates where this vertex is in the shadow map (by transforming it to the MVP Space of the first rendering), then looking up the value in the shadowmap at this coordinates, then comparing this value, which is the closest objects distance to the light source to the distance to light for the current vertex and if the value coming form the shadow map is less, then the vertex is behind some other object that is closer to the light source and therefore the pixel is in shadow.

    I hope this makes sense. Its all my theoretical understanding of it as i have never done this.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts


Click Here to Expand Forum to Full Width