Animated Z-Depth Focal Point

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  03 March 2013
Animated Z-Depth Focal Point

Hello all,

I've been searching all morning and haven't found a suitable solution for what should be a very simple problem to fix.

What I'd like, is for a render pass (or separate render completely), to provide a Z-Depth based on the camera target. I understand that Z-Depth is designed to be a linear flow from white to black, but what I'd like to do is have the focal object be the white or black extreme, and have the grayscale fall away based on distance from that object. I found a article where someone accomplished this in Maya ( ) using stock tools.

I'm using MAX 2013, and have a several thousand frame render coming up where the camera target is animating as well as the camera position, and ideally, I'd like to plunk that in After Effects to run the blur in post without also having to reanimate the focal point in post.

Is there anyone who knows how to recreate what that artist did for Maya in the link above? Also (and yes I know this is asking a lot), if it's possible to do this with stock MAX tools and shaders, as this will be a distributed backburner render.

Any help would be appreciated! Thanks in advance
  03 March 2013
Render out a regular Z-Depth pass, import it into After Effects, apply Colorama to it, use Lightness as input phase, load the Ramp Gray preset, untick Modify Alpha and add keys on the wheel to specify the focus/focal distance. Depending on how you're blurring, you may need to pre-compose the layer.
  03 March 2013
Nice! Funky Koval. Thanks
But i got some white edge issue along my foreground objects when i tried ur method. Any ideas how to avoid that?

Sorry Mike, dun mind me asking question in ur thread.
  04 April 2013
Thanks for the replies, (sorry for my delayed reponse, I didn't get the notification I subscribed for).

I had the same edge issue as Simply. Also what I truly want is for the Zdepth to render in Max based on the camera target, and have it auto-update as my animation progresses.

So for example, if my target is 500 units from the camera at frame 0, and 1000 units from the camera at frame 100, the render would show the distance of the target as maximum white, and have the gradient fall to black from there and animate as the distance grows. So at 1000 units of distance, 1000 would be white, 2000 would be black and 0 would black. But at 500 units of target distance, 500=white 1000=black, 0=black. Am I explaining that right?

That way in AE, all I have to do is set the blur maximum value to black, and minimum value to white, and at worst, manually key in aperature if the target is super close or super far. But I have a 14800 frame render with a very dynamic camera, and I'd hate to have to re-animate the whole thing in AE.
  04 April 2013
hi mike,
i think u could try applying a fully self illum shader, with a falloff map in the diffuse to everything in ur scene.

Set the type to distance blend, direction to object. Then create a dummy and pick that dummy in the falloff map as the object. Finally link the dummy to ur already animated camera target.

So when u render now, the dummy (camera target) position will be white and falloff to black in other objects u have in ur scene.

Hope it helps ur problem.

I still hope Funky Koval can help answer the edge issue problem i faced.
  04 April 2013
Simply, I think you're the man.

Preliminary tests show that this will be very possible. I think I'll have to find a happy medium for near\far distances since my target ranges from 100 units to 700 units. Fast render times too. On frames that take 5-10 minutes, the ZDepth is completed in 6 seconds. I'll know in a bit if there will be the edge issue.
  04 April 2013
Falloff Issue

I've discovered an issue that took me quite some time to isolate. I haven't found a fix for it yet.

The falloff map doesn't appear to be updating with each frame, it calculates on the first frame, and then leaves the material settings for the remainder of the render. This means that the camera flies past the 'in-focus' point and the rest of the render is black, unless the camera happens to catch the first frame's location in view in the distance. I have found a couple people having this same issue, but I haven't found a solution to it yet.

UPDATE: Okay, so I've found a less-than-ideal, but satisfying solution. It's not fully proven yet through the full 14800 frame project, but I did run a couple tests. The falloff map is most conveniently done in the render setup Global Material Override in Mental Ray.

Mental Ray does not (as far as I can find out) update the falloff coordinates each frame, however Scanline does. The problem with Scanline is that it doesn't have a material override option. So if anyone is reading this and has a several thousand object scene with hundreds of materials, save a copy of the scene under a new name, and then in that scene assign the falloff map to every object. Run the same render again under the scanline renderer, and the falloff map does update every frame. In my test scene, the update calculation was instantaneous, but in my big project, it was about 2-3 seconds per frame.

Hope this helps someone

Last edited by mike_gauer : 04 April 2013 at 08:32 PM.
  04 April 2013
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 06:03 PM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.