ofxBox2d shadows for box2d shapes?

Trying to figure out how I would go about implementing wall shadows for ofxBox2d elements. Any ideas on how I might do this?

I am wondering if it would be the same method as storing a grayscale image and iterating over that and drawing the shadow.


It depends on what look you are going for. Do you have an example image? a simple solution would be to draw the shapes black, with lower transparency and offset a bit and then draw the colored shapes. But not sure how that would turn out.

Thanks for the reply, nick. I’ve attached a simple example of what I was looking to do.

Any information is appreciated.

Since all of the circles are the same size. You could make a blurred image to serve as the shadow. First loop through all the circle locations and draw the shadows. Then loop through the circle locations and draw the solid red circles.

Hope that helps


I should
1- render the circles inside a grayscale FBO
2- then blur the FBO
3- drag the bluerd FBO with an offset
4- render the circles again.

I could be optimize if you render just once inside a FBO that you use again at the end… and some how turn the blured FBO on to grayscale.