Position reference pass AOV

Hello!
I am looking for a way to create a Pref pass for a project. (A position pass referring to the default state/position of an object and therefore allowing for sticky masks on deformed and animated geometry.)
I am aware that a world position could be done through a material override layer, but I am really looking for something that is moving with the character. Going through the UV AOV is of course an alternative but I would like to avoid that mess in comp.

Is there any reasonable way to do this in Blender atm? I know P and Pref have been requested as default AOVs more than once but I never found any updates on it.

Thanks a lot

I’m not used to the terms:

… but isn’t this just the Object Info → Location using a mapping node to center and scale this ??

Not quite: a P-ref pass isn’t just a coordinate system referenced to a particular object’s transform, but is actually attached to its geometry, including accounting for deformation. A certain Pref value representing a point on a character’s hand on frame 1 should still be there on frame 50, even if the character has moved 20m away and raised their arm above their head.

Hmm slowly learning this… so for example in Maya you can just generate a “texture reference object” and select for example somethign like Pworld… or Pref… and then generate a texture using EXR (for precision)…

So then it’s (?)… using the object coordinate system to bake a texture onto the UVs and then use this (high definition → EXR) texture for referencing the object surface coordinates… for further FX… (?)

Thanks for taking the time to answer.
And yes, what you just did in this screenshot is pretty much a Position pass. Often artists switch the RGB colors up to match the axis of other DCCs on top of your setup.
Baking this to an EXR is definitely a work around that I have planned to try. Although I am still hoping to find a workaround without that as it does not scale very well for bigger scenes with loads of objects and UV maps.
I appreciate you bringing up the texture reference object in maya! I will see if that can be an inspiration for a different solution in Blender, too.

Thanks a lot for your inputs, I will get back to this thread once I had the time to test more options.

Hi, you can use the rest coordinates (=original coordinates) in geometry nodes and pass them to the shader as a vector attribute, finally registering them as an AOV. You’ll need to check “Add Rest Position” in the object data properties first, in the “Shape Keys” panel. But it’s tedious if you need to do it for many objects. I don’t think there is a builtin pass for this.
I suggest bringing this up on Devtalk (devtalk.blender.org/). Recently someone brought up the need for a world position pass, and it was recognized & added. If this Pref pass is indeed a standard feature of other renderers, it might be considered. Brecht is usually sensible to that sort of stuff, as he has “commercial renderer” experience. My advice is to word it as an inquiry instead of a feature request for better reception.

1 Like

Thank you! I don’t have experience with geometry nodes and was not aware that rest coordinates are already implemented there. I think this is exactly what I need. At least in the houdini/arnold workflow I am used to we start from the rest pos, too, so I hope the name does not fool me here.

Thanks so much! I hope I find the time to test this and as a follow up potentially make a more informed inquiry to the devs.

More information about Pref!

#ObjectPointPosition #Pref #ObjectPointReference

I just wanted to update this topic for future readers since I was looking for this information the other day and wasn’t quite sure how to proceed after reading the above.

For those who don’t know, Pref (or any variant on the name Object Point Position Reference ) usually pronounced “Pee Ref” is a common AOV pass used by compositors in VFX because It provides a coordinate system that sticks to the vertices by basing it off the original vertex positions before the object was deformed. As a compositor, you would use it to single out a portion of the object for a matte or stick a texture/decal onto a character just to name a few things.

It would seem trivial to create since there are already object coordinates available. But as mentioned above, the issue comes into play when you have deforming objects. This is because deformers like bones, move the object’s points “Through” the objects coordinate system just like Pworld (the World “Position” pass in Blender). So, as mentioned above, you’ll need to use the new built in “rest_position” attribute which provides a consistent point value in object space.

Okay, but how?

1.) Box or shift select all the objects that need Pref. Basically, all deforming objects and even non deforming objects that are being moved by bones (because they actually are deforming :wink: ).

2.) Go to the Object Data Properties and find the “Add Rest Position” button At the bottom of the Shape keys panel. Now, hold ALT ( or Option on Mac) and click it. This will make the change for all selected objects

Screenshot 2023-12-09 at 5.01.18 PM

3.) Select one of the objects and go to the Shader Editor. Add an Attribute Node and fill in the blank name field with “rest_position”. This is the standard name that Blender give to that attribute.

4.) Now add an AOV Output node and connect the color output of the attribute to the color input of the AOV. Give it the name Pref or whatever you like.

5.) go to the View Layer Properties and scroll down to where you see Shader AOV. Click the little “+” icon and change the name to the name in the AOV Output node we just created: Pref (or whatever you called it).

6.) Now, when you render, you’ll see “Pref” in the passes list of the render viewer.

I’m Sorry to say, this isn’t visible in the viewport passes yet. However, if you have Node Wrangler enabled you can just CTRL+SHIFT click the AOV Output node in the shader editor and it will be displayed in the viewport so you can check to see if it’s working in realtime.

If all the objects in question have the same material then you’ll only need to do this once but chances are, that’s not the case. You’ll need to copy and paste these nodes to your other materials.

In fact, you can just create a node group and call it “Pref” and drop that down instead. Not only that but you can just add this node group to your default scene along with the Shader AOV setting in View Layer Properties and you’re good to go.

Note: There are times when you see that your objects are black in the Pref pass in the render view. This may be an indication that something is wrong but MAYBE NOT! You’ll need to check with the eye dropper tool to see if there are actually values in the black parts or not.

This happens when objects exist entirely in the negative object space. Don’t panic, this is normal. Just use the eye dropper tool and check if you see negative values in the black.

Nerdy stuff: This of course, happens because floating point colors can only be represented as a value from 0 to 1 in the viewport. So if your object is larger than 1 unit, or has parts that are located in negative values, it will likely be in a value that can’t be represented accurately by a 0 to 1 color. You can see this happening in the screenshot above. The tall box has a very thin gradient in the center that goes from Blue to black. The pivot point was in the center. If you sample the black, you’ll see values going down into the negatives and that’s totally normal.

Good luck!

3 Likes