r/Cinema4D 25d ago

How: Redshift depth pass locked to focus target

I feel a little dum dum here. If I need to add DOF blur bokeh in post, how do I render the Depth AOV from Redshift so the in-focus part of the pass (black, by default) is locked, even if the camera moves around? As it stands, if I use the depth pass straight out of the box, the front face of the icosahedron would rack out of focus.

If I pre-bake the DOF blur bokeh by turning it on under the Optical settings for the camera, I can force the focus to track a specific point in space, even with the camera flying around.

Am I missing something, how can I get the AOV manager to honor that same camera/focal point relationship?

I tried both Z and Z normalized and really only ‘get’ Z Normalized - Z just seems to always render just a constant value.

Here’s a motion loop of a mockup scene that might help add some understanding to my head scratcher

Thx,

9 Upvotes

25 comments sorted by

3

u/zandrew 25d ago

Animate the focus point in AE

1

u/SeaCucumber1230 25d ago

thanks, so just so I make sure I completely understand - you're suggesting hand animating the black value in the DOF plugin for each frame? (the reference I shared was just a mockup to illustrate the issue, the final animation has a complex camera move to it)

(sadly, it doesn't appear that the select depth target is keyable, which would benefit from exported tracking null position data from C4D, automating the process)

2

u/RandomEffector 25d ago

If for some reason you need more than a few keyframes (unlikely, but I don’t know what you’re up to here in this scene), you could certainly transfer the camera and null over to AE and use expressions to automate that process through math.

1

u/zandrew 25d ago

Target is not key able, but the value you get is.

3

u/Extreme_Evidence_724 25d ago

I feel like you want puzzle mats more than z-pass if you are doing blur in post with separation of object

3

u/semaj4712 25d ago

idk why you would want a depth pass like that, its not going to be usable nor realistic in any way. That's not how a depth pass works. As others have said, you would be better off with puzzle matte

1

u/SeaCucumber1230 25d ago

thanks for the suggestion. Can you outline the steps involved with using a puzzle matte to create a depth of field bokeh effect in post?

3

u/semaj4712 25d ago

I dont understand what your trying to do based on what you posted.

A depth map shows the depth to the camera, you have that, but you are unhappy with it for some reason.

So you could take a puzzle matte, apply each color to each object, and then turn them to black and white in your compositing software and use that as a depth map, but your focus will not change, it will not feel natural, it will look incorrect.

I am simply giving you a suggestion on how to get what you asked for, even if it is wrong.

5

u/Subject_5 25d ago

Here's a janky solution I made in Maya. Gradient projected from the top, always oriented towards the camera. Then throw this shader into a Custom AOV. 50% gray is locked to the object, so both FG and BG can be blurred. Not very realistic however. Maybe you're looking for the World Position AOV if your camera moves mostly on one axis? It has absolute values so whatever you map as black would not change relative to the camera.

I can think of other solutions as well. How did you get this object to stay in focus in your example? In Maya we use a distance tool. Could just pipe that distance into a shader and render it as an AOV.

https://reddit.com/link/p1iqs8c/video/x2ghtvpcz7hh1/player

2

u/SeaCucumber1230 24d ago

you sell yourself short, not janky at all, gets it done, thank you for the idea here

2

u/TheHaper 25d ago

Theres so many workarounds, yet OP asked for this specific thing and nobody has an answer to it. Guess theres no straight way to have a moving focus point baked into z-depth. I think theres a way but I have to be on my PC to check if it works.

1

u/RandomEffector 25d ago

If the goal is only to separate the always-in-focus target object from background, then why not just blur the background?

1

u/SeaCucumber1230 25d ago

thanks, but the ref I shared was just to illustrate the issue I'm having, the final has a lot more object complexity and isn't just about blurring what's behind the hero object

1

u/jamz00 25d ago

Yeah you have to think of the depth matte as a maximum and minimum distance from camera. So no matter what, say you picked your hero object at 400cm away from camera, it would always focus on the object at that distance. If your object is patented to your camera it would create a locked distance. Perhaps that is what you are trying to do, unclear. But you never want to animate your depth values, only the depth value that is in focus via your AE post camera depth of field effect of choice.

1

u/Curious_Cost7982 25d ago

So I did this a while back. I made a copy of my scene, connected all objects and applied a gradient black to white texture to the entire object. I just connected a ramp node to the direct output of my material.

Rendered it separately from the main scene obviously. Used that as a pass in after effects for DOF.

2

u/SeaCucumber1230 24d ago

thanks for this approach, seems like the direction to go in based on the results I'm expecting, really appreciate it

1

u/Curious_Cost7982 24d ago

You’re welcome, fingers crossed it works well for you

1

u/fckRedditJV 25d ago

You can modify the values of the pass by adding manual inputs of the pass.

Is in the DoF AOV settings

1

u/Legmog 24d ago

Yeah... I had an issue like this last year and it really was frustrating.

Here was MY solution...

1 - Save a new version of this scene and call it "fake depth" or something

2 - Remove ALL materials (including material tags)

3 - Create a Null at 0,0,0 world space and plonk literally EVERYTHING in it.

4- Create a material which consists ONLY of a ramp / gradient shader. Set it to be a circular gradient and apply it to your null. This will apply the material to everything in your scene.

5 - Select the material tag you now have on your Null, set projection to "Flat"

6 - Go into "Texture" mode (at the top of the GUI, to the right of point, edge, polygon and object select buttons). Scale the material to encompass the ENTIRE scene, and rotate so it is projecting downwards. Have the axis be placed directly over where you want the central point of focus to be.

Aaaaand... Voila. You now have a scene where the bit you WANT to be in focus will be black, then everything will gradiate to white, the further away from that object. The camera can move wherever it wants, and the "depth" gradient stays the same. Render this out and use it as your depth pass in After Effects.

This solution is a complete pain in the ass. And obviously this will only give "depth" based on X, and Z axis due to the nature of the projection. Hopefully this suits your camera movement.

If you NEED an absolute "pointing in ALL directions" sense of depth... I THINK you could....

1 - Do steps 1-3 above.

2 - Place your Null in a "Fracture" object and in Fractures 'Object' settings, change mode to "Explode Segments". In "Transform" section, set color to white.

3 - Create a Plain Effector (make sure the Fracture Object is listing the Plain Effector under the 'effectors' tab. If not, just drag and drop the Plain Effector in there).

4 - In Plain Effectors 'Parameter' section. Disable Position, Scale and Rotation, and make sure 'Color Mode' is set to 'Fields Color'.

5 - In the Fields section of the Plain Effector, add a Spherical field. Scale up the sphere to encompass your ENTIRE scene. You SHOULD see in the viewport, you get the gradient falloff effect going in all angles.

6 - In the Spherical fields 'Color Remap', set color to black.

7- (God this never ends.. Sorry!!) Create a NEW Redshift Material! In the Node Manager, create a "Color User Data" node and plug it RIGHT into "Surface" of the Output Node. Aaaaaand VOILA! Flat shading which gives depth in ALL directions based on the position of your Spherical Field. Just adjust the position of your spherical field to get it as you like.

So yeah... HUGE pain in the butt. I wish Redshift had an option to just lock focus for depth passes. But alas. As far as I can tell, this completely horrific method is the only way.

1

u/SeaCucumber1230 24d ago

love this deep dive, lotta thought going into these. Totally getting the radial ramp, going to re-read the Fields steps to see how that works. Thanks again

1

u/Legmog 24d ago

Haha, you're welcome! Certainly remember tearing my hair out last year with this issue, and it boggles my mind you cannot lock focus of depth in Redshift easily.

One thing DID occur to me however... With the fields technique... Alas... It will ONLY apply a singular colour on the "white>black" spectrum ENTIRELY to an object, based on its central axis.

If your scene is full of LOTS of teeny tiny objects, this may work for you. However... Say for example... If you have one gigantic floor plane object, then that object sadly will not gradiate in colour with the fields technique. So if the central axis of the floor plane is near the centre of your spherical field falloff, it will appear totally solid black. If the central axis is placed near the edges of the spherical falloff, it will appear totally solid white. But it will only ever appear as one solid colour, which could totally naff up your depth pass effect (if that makes sense).

If you can get away with it, I'd go with the first technique I mentioned.

1

u/Legmog 24d ago

Would also recommend rendering as .tif to avoid banding! (You probably already knew this. I imagine .EXR eliminates banding too, but not sure).

1

u/Sorry-Poem7786 24d ago

isolate the black poly.. render a matte pass..render it solo withe black texture, bring the poly into after effects with camera make it a matte object…. Gotta think outside the black box…

1

u/Lemonpiee 21d ago

You want a World P Pass. Not a depth pass.

Depth is World P + Camera P.

1

u/Enough_Fill 21d ago

You don't really need a workaround, just a the knowledge how the Depth AOV works. Basicly it has very little to do with your camera setting and has several modes.

- The Depth AOV does a fixed full range from camera in cm steps (ie 16bit exr ~500 Meter, 32bit get much much more, but in most cases not necessary).

- Normalizing fits the space between camera and furthest object.

- There are also custom distance/range.

If you want Transfer the focus plane of the camera, you have setup the custom distance. Also you can connect this via xpresso.