Drop shadow with skew from 2D image?

I have a 2D image on one layer and a 3D scene in another layer, the 2D image (sequence) is of actors from footage and the 3D scene is a rendered scene.

Is there a node setup to create a drop shadow on the 2D image before mixing it with the 3D rendered image so that he actors look like they are in the scene?

Here is an example of what I want things to look (assuming the 3D scene is all white and the red pixels are the actors from the 2D scene).


a/ Yes
b/ not easily.

Effectively you are using the shape of the 2D art to create a mask that will stand in for the shadow. The mask must then be altered so that you create a location of the foot ground intersection. This is something that you have to generate from scratch. There must be a pseudo z-depth allocated to the foot of each actor from which you will distort the image.

2D shadow comp.blend (568 KB)

I give you an example of one. Where the texture ramp creates a distortion effect, note that the ramp starts and stops places non zero or non 100%. Also I needed to add translate and scale to modify the size based on taste. As there is no interactive canvas in Blender this is all based on value inputs.

An easier way may be to generate keyed art and import them as planes into a 3D scene using transparency in your material.

Hmmm, so basically the key here is that I need to manually tell Blender where the “base” or “foot” of each actor is.

Also, that would involve moving the base around as the actors walk around as well, so there is a lot of motion tracking involved.

Yup, no easy fix I’m afraid. The problem is the skew, as the compositor doesn’t really know where the ground is. You are really just inferring it through interpretation of the image.

Horizontal or planar walking is ok but any traversing of the z distance (from camera, away) will screw up the 2D fake.

What if instead, since the scene is outdoors with ambient light coming from everywhere, is there a node setup that can create just a generic eliptical blurred shaddow below the actor?

I was thinking of somehow just using Blur and Translate down, but somehow I need to scale down the Y axis, but is that running into the same problem as the Skew method? I was thinking if there was someway to just extend pixels down and blur them somehow into an eliptical like shape (a cheap shaddow). So we don’t need motion tracking.

You use the source image to get a/ shape and b/ location. So if you use a proxy shape then you have the tracking problem. I guess you could squash the actor and apply a heavy x direction blur but you will have to offset the shadow to see it behind the actor. Post an example here of your success :wink:

Yeah I think the real problem I have here is that there are multiple actors on one 2D image, so, scaling, skewing and other such distortions will also “distort” the base location. I can get one actor’s shadow to follow perfectly with a simple translate but it will mess up the tracking for the others. I didn’t realize that problem at first. My bad. :frowning:

Well I guess I will just have to track a sinple eliptical shadow for each actor now. Lot of work but its still the easiest that I can think of. Thanks for your help. :slight_smile:

If you are going to track you could apply to each track a small region of gradient distortion, instead of using a generic blob. Just a thought.

If the actors are on a greenscreen, then I think that it might be possible to get it working without putting too much effort into it.
Here’s an example of how to get realistic (?) shadows using the BI renderer and the transparency of the plane:

It solves all the shadow perspective issues and if you put the shadow catcher plane on its own render layer then you can tweak shadows at will (gradient blur etc). You could key the actors and place them on an image sequence, then import the sequence into 3D using an image plane, and the rest would be relatively simple to figure out.

However, if no greenscreen is used, then depending on the setup more work might be required. In principle, you could create a rough mask and use that as an input following the same technique.

Yeah this is how the compositor should work. As a feed to texture for 3D. It would be sweet if the Keyer nodes were in the Texture node editor!

Yes, although the actors were taken on a green screen, the problem was that the camera angle is not always at base level on all the footage. Most camera angles were takent from a jib (elevated) and angled downward, so a plane wouldn’t work because multiple actors walk up and down (or maybe there was an orientation of the plane I haven’t thought of yet).

The cameras were all still, no movement, so it was easy to get it into a 3D scene as a 2D plane with a textured video. The problem casting the shadow onto a plane was that we need a different plane for each actor and each plane needs to follow each actor… which means a lot of work.

At least you could solve the misregistered floor placement (due to high angle) with stabilization. Once to lock the talent in space you can reintroduce their movement in 3D space.

Yeah, thanks for putting me on to that “track”.

I am experimenting a few things, including putting a plane under each actor and have the lamps from the 3D scene raytrace on to it casting a shadow on to that plane, it makes more defined shadows than my blurred elipse idea. Thanks for the hint. :slight_smile:

Seriously, I think that if you just see to it that credible shadows are present, the audience isn’t going to barbeque you for those shadows not being anatomically accurate. The surfaces upon which shadows are typically cast are not, say, “highly-polished stage floors.” You just expect to see that a shadow’s there, that it’s of a believable length and orientation, and that it’s moving around … if you actually notice it at all. The shadow is what establishes depth and 3D positioning in a flat, 2D picture. Your “blurred elipse idea” just might be good-enough, and “good enough” is really all you need.

@sundialsvc4 normally I would disagree with that severely :wink: Because I love realisim, but you are right, this particular scene is more of a fantasy and things don’t have to look super-real (but the work of the actors are top notch). That’s why I resorted to motion tracking those elipses.

Back to the topic at hand, one thing that my mind instantly keeps latching on to when it sees a 2D image that needs 3D shadows, is that it asks “why is there no plugin or feature to simply take the bottom-most pixels of a group of pixels and auto-generate a 3D like drop shadow with skew???” Identifying each group of pixels to be an actor or object on a 2D image with alpha (one taken of actors on a green screen and keyed out) should be easy programmatically.

Look at GIMP’s mask grow and shrink feature, I’m sure a few lines of code can check for any pixel and check if there is no opaque pixel below it, thus identifying it as a bottom most pixel and thus all neighboring side and top pixels are that of one actor or object.

Anyways, just wishful thinking right now. :slight_smile: Thanks for everyone’s help!

I guess it depends on where you want to sample these pixels. In the compositor you are limited to the tools available and you have to define stuff for a node to function. So how do you define a sample point/position of the source? Do you use pixels? They vary between sources or percentage?
Perhaps you could create a node group with a crop that takes a value as an input to determine the middle of a crop box, apply that to the source file (pre-cropped if from a larger set of actors and pre-keyed) alpha value. Then blur and distort this result.

But this still means that you need to interact with the node to tell it where the contact occurs, which is a problem when the talent is moving vertically on screen (eg. walking from top to bottom). You would need to use a tracker with off set to determine a constant ground point below the talent, but bodies typically move up and down as they walk and I guess your dancers jump up and down too.

I think that I would use a second version of your keyed 3D plane as a shadow mask and lay it over at 90deg on the floor, so that when the talent jump the shadow moves accordingly, whereas the blob shadow would not react appropriately.

Ugh, right, I forgot about jumps. X.X Ok so I guess my idea would not work then.

I was thinking about adding the shadow to the image sequence I have of the 2D key’ed footage. But jumping would cause a problem.

I’ll ask tech about recording shadows next time in the green screen during shoots perhaps (I doubt that can be done though).

You generally want to light for separation from the green screen so that you can cut the performer out. Although a good key solution should be able to retrieve the shadow to making it semi transparent.

Sandra, if that’s the scene (post #15 above) that you’re trying to get shadows for, then your “ellipses trick” ought to work just fine, IMHO. Any sort of ellipse that “moves around” is going to be utterly persuasive as being cast by her tutu. A small, more-directional ellipse will do for his shadow.

Sure, “realism” is a delightful goal, but it’s also a great big fat wad of “diminishing returns” sometimes. We have to remind ourselves that the audience is going to be watching the dancers … not the shadows that they cast. Yes, given the “dramatic overhead spotlighting” that you’ve set over the stage as the actors perform their routine, I do think that “moving shadows” ought to accompany them. But I suggest that you should be stingy with your computing/realism resources most of the time: “spend lavishly” only when a solid return-on-investment is actually there. Judging from what I see of this scene … “it’s not there.” Ergo, “cheat.”