In EvaluatePixel, if the input pixel is part of the object being shadowed (i.e. the input pixel is not transparent or not in a designated mask color) you would first draw another another pixel in the designated shadow color at another location, projected down and to the left from the input pixel location via some formula. Next, you would output the original pixel in its normal location (thus automatically occluding the shadow where the shadow was behind the original object.
if the evaluated pixel is part of the original background, (i.e. is transparent or a designated mask color) that seems to be a problem. If there were a way to evaluate pixels in PixelBender in reverse order (right to left, bottom to top) its no problem because any shadow pixel would be drawn over the background.
Well that's the best I personally could come up with at the moment.
Edit: You undoubtedly would have to save an array or vector during rendering to keep track of already drawn pixels so you wouldn't draw over a shadow with a transparent pixel, or part of the object with a shadow pixel.
Just forget the above. Pixel Bender operations may be performed in parallel, so I don't think the above will work.
well thank you for your suggestions so far, but i must admit that i don't really understand what you are saying. could you explain a little further or give me some links with more information?
You must have even less expertise with graphics then I do, because a solution for it immediately suggested itself (Not to mention the solution of just doing a search on 3-D shadow). But anyway, as I said, the parallel issue of Pixel Bender isn't dealt with in my proposed solution, but as it stands, I would have hoped it would have been clear what I was suggesting. Let me walk back through some of it.
To create this shadow, its just a matter of taking an existing pixel from the object and and then outputting the original pixel where it is, but also another pixel, which will be down and to the left of the original pixel and in some predesignated shadow color. Hopefully that's understandable. There's some little formula out there presumably that says if your object pixel is at x,y and your light source is whatever, than x',y' is the location of the shadow pixel. If you're not aware, for PixelBender you write a function called EvaluatePixel that all it does is given an input pixel it generates an output pixel.
But anyway, to determine if an input pixel is part of the object to be shadowed, you would presumably just check its alpha channel, and if its less than 1, then its not transparent so thus part of the object. So hopefully you know what I'm talking about here.
But also you would have to consider which type of pixel occludes (is on top of) which other type of pixel, so somehow the drawing order would have to be, 1)background 2)shadow 3)object.
Well maybe someone with a little more expertise than me might come on and walk you through a more detailed specific solution.
thanks for the hints. i do not find anything good when searching for 3-d shadow (for example a formula how to calculate it). Do you have any link available?
im new to pixelbender. this would be my first filter. I had hoped that a filter like this already existed and I could just use it .