1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Computer graphic mathematical modelling question

  1. Dec 29, 2009 #1

    I am just finished my Calc II class and a programming class and I am trying to write a computer graphics shader...

    My goal is to model this scenario:
    "Imagine a brick wall standing on a plane --- a shadow will be cast depending on the light source" ---my goal is to model the dispersion of the shadow (area?) at the point of intersection between the wall and ground plane.

    Eventually I want to eliminate the light source from the equation and control through variables the amount of shadow dispersion...a kind of faux shadow shader based on object intersections.

    Problem is Ive learned how to solve alot of calculus problems and math problems in general...but Ive had trouble modelling them (especially in 3 dimensions)....and this is the area I really want to break into, and where I think an example could really help me get started.

    Can anyone help me get started or at least point me in the right direction with the mathematics I may need? Thanks in advance...
  2. jcsd
  3. Dec 29, 2009 #2


    User Avatar
    Science Advisor

    What do you mean by "dispersion of the shadow"? What is it measured by?
  4. Dec 29, 2009 #3
    What I am trying to describe when I say "shadow dispersion" is I am attempting to fill a given area (the shadow area--blob shape at the object intersections) with pixels of a different color (say black at 75% opacity...that disperse and fade out in a gradient-like falloff from the intersection).
    My units of measure would be the amount of pixels to fill that area...which are basically points in computer screen space.

    This is not 'physically accurate' but would be very efficient in real-time applications.
  5. Dec 30, 2009 #4


    User Avatar
    Science Advisor

    Well, obviously a straight line from your light source to the top of the wall will hit the floor at the edge of the shadow. And that's a simple "proportion" problem. If the light is at height "H" above the floor and distance "d" from the wall, while the wall has height "h", then, letting "x" be the distance to the edge of the shadow on the other side of the wall, x/h= (x+d)/H so Hx= hx+ hd, (H- h)x= hd and x= hd/(H-h).
  6. Dec 30, 2009 #5
    Thanks for the reply!
    This is great I needed to see this kind of example.
    I like that nice little equation...I was way off;...getting way too complex and researching things that were much more complex than needed to be (looking at things like differential geometry, vector calculus etc.)
    I guess these subject areas would be used more for accurate physical modeling of light and shadow behavior.
    Again, I appreciate your contribution...
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook