Question

I'm making a game where the game's size varies, so I want to make my own shadows. The api i'm using can fill rectangles, make ellipses, horizontal lines etc. And supports rgba. Given this, how could I make a drop shadow? I tried making a black to white gradient and setting the alpha to 20%, but it didnt look very good... I'm not sure how they are done. Thanks

Was it helpful?

Solution

I would suggest:

  1. copy the object,
  2. move it in the opposite direction of the light source and use its distance as a weight,
  3. turn it totally black,
  4. blur it using the light source's distance as a weight, too,
  5. put it behind the object,
  6. lower the alpha if you want.
  7. ?????
  8. profit.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top