Blender Position Pass.

I have played a bit with the solution by Francois Tarlier that I linked to in my previous post. The file below contains 3 groups: One is called: “RotatePPassXYZ” and it “rotates” the world (offsets values) using standard blender’s euler rotation order, which is XYZ.
If you want to change this order you can use 3 groups: “RotatePPassX”, “RotatePPassY” and “RotatePPassZ”. Just connect them in the order you want to rotate the world. It will work similarly to parenting objects to one another.
Hopefully I didn’t make any mistake, but the more tests, the better. Please let me know if you find any problems with this setup.

http://dl.dropbox.com/u/18831655/RotatePositionPass_blend.zip

Here’s the result of some more playing with position pass. This is the example of 3d matte with 3d feather. This setup creates matte that cuts everything placed between -0.6 BU and 0.5 BU with feather of 0.35 BU.
You can as well rotate this matte in 3d space. Check possibilities. It’s a lot of fun.


Attachments

3dMatte.blend (798 KB)

More fun with position pass and world normals.

Render image and play with selected empty’s position. It’s “fake” lamp.

To refresh - go frame forward or back.

File’s breakdown:

There are 2 render layers:

  1. p-pass:
    material override. Material created so that it stores position in rgb. Blacks are being clamped, so 1000 is added to rgb in material
    and then 1000 is subtracted in compositing.

2 normals_world.
Fake world normals. Pure white lambert shader. Material created in nodes:
2 materials used and subtracted from one another.
“nor +” lit by 3 suns of 3 colors to have “positive” world normals,
“nor -” - different 3 suns to give “negative” normals.
“nor -” is subtracted from “nor +”

Fake lamp position driven by empty’s position.

Distance between “lamp” and each point from p-pass is calculated, then some math to calculate influance of “lamp” basing on all of it and managed to relight the scene.

http://dl.dropbox.com/u/18831655/reLightPPass.blend.zip



A bit more fun with p-pass and world normals. Here we have a group for re-lighting, so we can easily introduce more than one fake lamps:

http://dl.dropbox.com/u/18831655/reLightComp.blend.zip

This setup is NOT 100% accurate. When I tested it with a sphere which is a “perfect” shape - the light is kind of squeezed a bit. Perhaps some more complicated math should be used to make it perfect, but at this stage I wouldn’t care about it that much.

Attachments


So I guess this would be useful for tracking real lights in scene? Perhaps by infering position from shadows? I love the multi point lamp positioning. Quick 3 point light setup.

Home sick today, thought I’d play with this. A thing we use a lot in nuke is a p_matte; given a position pass, you can pick a colour from the p-passs, and it’ll create you a nice spherical gradient that you can use as a mask to control other things, usually grading.

turns out the colour picker in blender doesn’t recognise negative colours, which is a shame, so you have to type in the values manually. still, it works. i looked at the nuke gizmo to work this out, the logic is pretty simple; use the selected colour to offset the pass, scale by the user requested amount, then use pythagoras to get the distance of all points to that selected point.

this is all using bartek’s original setup, would be great to get P as a default pass type ala z/normal/uv/etc, its very useful. Bonus points if we could have the 3 common variants we use a lot in vfx; P in world space, P in camera space, and P in object space.




link to blend file: p_matte.blend (841 KB)