Real-Time Shadows in Augmented Reality

This is the title on the semester project I did last semester (7th) as a Medialogy student.

The idea behind the semester project was to look into generating shadows for Augmented Reality, as we hadn’t seen shadows implemented in many frameworks for Augmented Reality.

We looked into creating projection shadows, shadow maps and shadow volumes for ARToolkit.

Simple example of shadows for Augmented Reality

Simple example of shadows for Augmented Reality

As the project evolved, we became more and more interested in updating the positions for the shadows in real time, so the shadows aren’t static. As the shadows themselves were not important for this, we implemented projected shadows (as they were the fastest to implement), and focussed on a way for finding light in the environment and create shadows based on this.

Based on prior research, we created a reflective sphere to collect light in the environment and used math to calculate an environment map of the scene.

Environment map created from the reflective sphere (painted black)

Environment map created from the reflective sphere (painted black)

From this, we used median cut [gl.ict.usc.edu] (which is usually used for HDR environment maps), and created light sources and direction based on this. From there it was just using OpenGL lights and our created projected shadows.

Image showing the light directions computed from the reflective sphere

Image showing the light directions computed from the reflective sphere

Image of the final implementation:

Final implementation. Showing a bed with multiple=

Final implementation. Showing a bed with multiple shadows.

The paper is available for download here [jbmadsen.com].

A video of the implementation has been uploaded to youtube and can be seen here [youtube.com].

17 Responses to “Real-Time Shadows in Augmented Reality”

  1. cikz Says:

    Hi,
    i’m very interested with your project, shadow in AR.
    Can u share a code that i can try to run it…
    i’m very appreciate if u can share with me..tq

  2. Jacob Says:

    Sure.. here’s the link.

  3. cikz Says:

    thanks..:)

  4. cikz Says:

    may i know, what the size of reflective sphere u used in ur research..?

  5. Jacob Says:

    It was a normal table-tennis ball painted glossy black, so roughly 38-40mm in diameter.

  6. Lilian Says:

    when did you do this research?

  7. Jacob Says:

    Fall 2009, September to December.

  8. cikz Says:

    Hi Jacob,
    I’m already run your code and it looks interesting.I’m really satisfied.
    But, there are some parts that i not really understand..If you don’t mind, i really hope that you can share the documentation/ thesis with me.
    I really appreciate your help…tq

  9. cikz Says:

    thanks..i already received ur attachment in my email…

  10. Jacob Says:

    No problem.

    If there are any questions feel free to contact me.

    And I hope you will keep me updated with your research. It would be fun to see what comes out of it :)

  11. weihuan Says:

    hi, jacob. i want to know that every shadow must be draw on a plane or a model, how did you hide them to make shadow looks like on real scene?

  12. Jacob Says:

    The shadows in this project is just projected shadows, which are drawn on the base plane. The base plane itself is just the point of origin and the normal vector up. There is no geometry plane needed for drawing the shadows… not using this method.

    Hope that clarifies it :)

  13. weihuan Says:

    thank you very much, jacob. because i am using artoolkit and osgart, the osg can generating shadow map shadow, and i want to hide the base plane, any ideas?

  14. Jacob Says:

    I haven’t tried that, but I read a paper about a year ago, “Image Based Shadowing in Real-Time Augmented Reality” by Peter Supan. They used a principle similar to this one, and they used shadow maps as far as I remember.

    I think they used the shadow map information and subtracted it from the camera feed, then rendered only the objects on top that they wanted rendered. (It was a bit more complex then that, but I bet the paper explains it better). :)

  15. Jacob Says:

    And here is a quick link:
    http://academic.research.microsoft.com/Paper/2518565.aspx?viewType=1

  16. weihuan Says:

    thanks a ton, jacob. i’ll have to look at it:)

  17. Hoshang Says:

    Dear Jacob,
    Thank you for sharing your knowledge. I am really interested in this area. I need to have shadow on other objects in AR. I mean shadow volume or shadow mapping. Can you help me to do this or guide me what can I do? I have problem with assembling the codes. I have shadow mapping code and shadow volume code but it is difficult to merge them for me.

    Your cooperation is highly appreciated.
    Hoshang

Leave a Reply