Baking a sequence of PP AOV

Ok, here’s a real challenge. I need to bake a texture sequence (problem n.1) and the pass I want to bake is the point position. I can create the PP AOV in 2.83. I just don’t know how to bake it (problem n.2).

ATM, there’s no implementation for baking texture sequences… I also don’t know if there’s any addon that does this…
But because the baking operator uses the current frame for baking, it’s possible to write a small python script to bake a sequence.
Something like this (in a very pseudocode fashion):

jump to frame start
while not last frame: 
    save bake with name+frame_number
    advance one frame

For baking Position, just plug the coordinate vector (world, object, screen, etc) directly to the Surface output and bake ‘Emit’.

Of course this could be turned into a fully addon, with some panel for settings, etc… :slight_smile:

My experiment failed. Before I started to bake a sequence, I tried only one frame using the tip you gave me about baking the emit. I connected the PP directly into the surface input. What I was trying to achieve is to see if I could use that baked file in combination with a displace modifier in RGB to XYZ mode in order to recreate the shape of the baked object on the original one. Hard to explain. On the left is a sphere that I modified. I baked the PP from that object. On the right is the original sphere with the displacement modifier. I was expecting them to look the same since the PP represent the position in space. I’m trying to reproduce a technic used in game engins where they use a texture to distort an object. If you have a tree with thousands of leaves, you won’t move them with bones or deformers. It would be insane. So they use a texture to drive the movement of the geometry. And it’s way lighter than an alembic.

Don’t forget that just baking the position doesn’t make the texture suitable for displacement… You need to subtract the original position from the displaced position.

In a previous test I did I got what I wanted. Two planes. The one on the left shows the texture that I used on the one one the right. You don’t see it but there’s a column in the texture with negative values. That why the plane gets distorted in both directions. I will keep investigating. I got to get this to work.

Screen Shot 2020-03-31 at 9.39.01 AM

The technic i normally use for vector displacements is this:

Bake the position (object space) of your mesh without the displacement.
Bake the subtraction of the position with displacement and the first bake.
The result, will be a suitable vector displacement texture.
(of course, avoid sRGB or any color management)

For a texture sequence, you can reuse the first bake (without displacement), and just do the animated with the second step.

edited: btw, the reason it worked with your plane, is mainly because the plane is centered at its origin (pivot) , and your vector is parallel to the normal vector. In this situation, the original coordinates will be 0 (in respect to the displacent direction, normal and pivot) and subtracting the displaced position with that will return the same.

1 Like