Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Maxon Cinema 4D Getting very bad results with Position Pass and Depth of Field in After Effects

  • Getting very bad results with Position Pass and Depth of Field in After Effects

  • Xavier Bonet

    December 3, 2021 at 12:50 pm

    I was wondering if you guys might have any tips to get better or more consistently good results rendering with Position Pass in C4D and then applying Depth of Field in After Effects.

    I use this workflow a lot (I almost never export with, say, true DoF from C4D unless it’s a still image) and sometimes I get perfect results, more often than not I get good results… but every so often I get terrible results such as the ones you can see in the image I’ve uploaded.

    Now, the jagged edges is a common occurrence and I understand it’s because Position Pass doesn’t render the transition in the pixels in borders between elements in order to keep the DoF more realistic. So at this time the only solution I have is to render the material at a WAY higher resolution than I need and then scale it down. I’m talking about rendering 4K in order to get a FullHD result, otherwise the jagged edges are still there. Still, I can’t really figure out why sometimes the jaggedness is almost imperceptible and, other times, it’s like this… I can’t for the life of me see what I’m doing different. The AE side is pretty mechanical, so even if I copy and paste I sometimes see this issue. I’m, exporting everything the same in C4D. I’ve even tried upping the anti-aliasing and that does nothing. Even with textures on the objects (ie no, no transparency, no materials) this happens. So I’m thinking it has to do with certain geometry. But I can’t figure it out. As I said, all I can do to the effect is to export way higher resolution than I need and scale it down in AW.

    But the other thing that I can’t figure out is why sometimes (very rare but when it happens it’s a pain…) I’m getting that halo from the in-focus plane on the out of focus planes… The same thing that causes the jaggedness is designed to avoid this kind of thing… So why is it happening? The jaggedness I can sort of understand but this makes absolutely no sense.

  • Steve Bentley

    December 3, 2021 at 4:01 pm

    That jagged edge must be there for the post DOF process to work correctly (and this is why you use Position instead of DOF pass as the DOF antialiases things.) By making the Pos pass really big and then scaling it, you are probably introducing antialiasing in that step through bicubic scaling.

    The trick with the Pos pass is the setting in C4D – that number is really sensitive to your scene scale. So using .01 instead of .02 can have huge effect.

    Have you seen this tut?

    Add DOF and Motion Blur to your C4D Render with After Effects

  • Xavier Bonet

    December 3, 2021 at 5:20 pm

    Thanks for your response! Indeed, that’s the tut I watched many years ago that taught me this process that usually works very well.😁

    Thing is, in the same scene, another camera, another object, the jaggedness isn’t so noticeable.

    I’m constantly toying around with the value, as you mention (though for some reason my scenes always tend to go down to 0.001 and thereabouts), to always try and get a good gradient that catches all the depth of my scene. Indeed, when I get stuff like too much jaggedness, I play around more, but nothing changes. I’ve always got it on Camera (as a pose to World, etc.) Also, in AE I invert the gradient you get with Extractor, as by default it puts black as the closest to the camera and white as the farthest; I don’t remember if that tut mentions it (it’s been ages since last I watched it all) but if you don’t invert it you get issues with the blur not looking right. I use levels to get a shallower depth of field (as I find that upping the Radius value on the FL Depth of Field makes the render much slower, when you can get the same result by upping the contrast on the EXtracted sub-comp and keeping the Radius lower). Also, I always keep that <i style=”font-family: inherit; font-size: inherit;”>EXtracted sub-comp on top of the Adjustment Layer that applies the effect. Etc. Basically to show that I think I’ve covered all the bases, but still can’t get perfect results every time.

    But what worries me more in this case (because the jaggedness I can solve) is that “bleed” you can see from the focused object into the background. With everything correctly set up… I really can’t think of any other instance in which I’ve had this issue. Or at least it’s never been as evident as to call my attention to it.

    As it stands, because this project has a tight deadline, I’m going to have to export each plane separately and then add Gaussian Blur to each, and animate it manually. But I really would like to get to the bottom of this for the future.

    If you have any other tuts that you think might come in handy, please do let me know! That one was great when I found it. Unfortunately, there aren’t many… Some years back I also found that wonderful plug-in Z-Blur, which would come in to save the day when Position Pass was being capricious, as in this case… unfortunately, it stopped working afer R19, and I don’t know if there’s an equivalent for newer iterations of C4D.

  • Steve Bentley

    December 3, 2021 at 5:37 pm

    Re the inverted map – yes that is mentioned in that tut and its because most depth plug ins in AE see “distant” as the opposite color that C4D puts out. So that’s normal.

    But you bring up a good point re using levels. They mention that in the Tut as I recall and that got me scratching my head because that will antialias the jaggies just as well as scaling would. And that’s bad. You shouldn’t need to – that is what the black and white point are for in the AE depth plugin (or is it in Extractor? – not in front of the machine at the moment). Either way, using the black and white point is what the levels is doing but by using in the b/w point in plugin it won’t add antialiasing. That could be where the fringe is coming from.

  • Xavier Bonet

    December 5, 2021 at 1:55 pm

    That’s very interesting, what you say about the using the B&W points (on EXtractoR, BTW) instead of levels… I sometimes have used the B&W points when it’s just a matter of bringing up one or the other level so the gradient is actually visible; but as the levels UI is so much more practical, and “visual,” I almost always use the levels instead. It’s much faster: drag 1-2-3 and you’re done! But I never thought there might be OR later realised there was a difference in using one or the other. As soon as I’m able I’ll test this out on the project that prompted this post. I’m not too hopeful, as I’m pretty sure that a first test I did (to see if the scene was set up correctly to have a nice DoF) I just used EXtractor, Invert and that’s it; I didn’t touch levels or B&W points, as I wanted to see if I got a nice DoF “out of the box,” so to speak. Still, I would like to see what the difference is between using one or the other.

    What do you think might be causing the halo or rather bleed, though? I don’t think I’ve ever seen that… at least not that I remember.

  • Steve Bentley

    December 5, 2021 at 4:30 pm

    That fringe or halo IS the antialiasing of the Pos pass. This is why “Your depth pass is wrong” is the title of that video – depth passes are antialiased from the get-go and will produce fringes, Pos passes are binary.

    Think of the black point sliders as a Levels control. The only difference is that Levels has an output setting as well, where here, we want our output to be full black and full white so you can think of those sliders as already being set (ok, levels also has the midpoint gamma control as well – I was hoping you wouldn’t notice that)

    So depending on how and where you use the levels control you may be adding antialiasing to the Pos pass. If you scale the Pos pass or comps that contain the Pos pass you may be adding antialiasing.

    With aliasing, you are defining which pixel is in front and which is behind and then adding a blur. With a depth pass or once you use levels, you already have a blur on the go there (the antialiasing) and then you are blurring it again with the DOF. Think of it this way – when you have an alpha channel on a superimposed comp layer, that alpha has antialaising to blend it with the background below, if you then blur that alpha (without blurring the RGB channels) some of the top layer’s “background” will leak in around the alpha – you will get a fringe that looks like 1970’s chromakey.

    If you had your Pos setting in C4D bang on (and it’s hard to do that with values like .0001) then yes you should just be able to add Extractor and you’re done. No black or white point messing around. So it is possible you got lucky there. But I’m usually sliding the B&W all over the place (and then in reverse of what I think they should be) hunting for the range. It’s quicker to do that then do multiple test renders in C4D to see where your correct Pos number is going to fall.

    Are you rendering to EXR in at least 16bit? And have you trapped all the channels in Extractor and sent them to blue? (I will think I have done this and then go back in and find that one has “slipped” back to red or green – Extractor has a problem – or maybe it’s AE when using extractor – it doesn’t always release the mouse).

  • Xavier Bonet

    December 7, 2021 at 12:18 pm

    I realise now I should’ve added an image of the actual EXtracted result, which would clearly show any issues with my Pos Pass. As I can’t edit my post, I’ll add a reply to my post with the new image below. As you can see there, it looks fine; I can’t see there’s any AA. It should be working correctly.

    I always try to get a good gradient from C4D that shows everything in my scene that needs to interact with the DoF. Often, if I’m not careful, I get a Pos Pass that shows absolutely nothing, ie it’s full black or white. Or it’ll show just part of the scene and the rest will probably be “in shadows,” so to speak.

    Indeed, I’ve even tried making displacement maps from some of my models (mostly for textures: say a microphone grill mesh), so I’ve needed to add a camera fairly far from the object and at, say, 300mm, in order to ensure everything is perfectly flat. And no matter what I did (I mean, I’ve gone from 0.000001 to 1000), it was impossible to get the Pos Pass to generate a full gradient for the object…

    I probably don’t really understand fully how it works… But IMHO it’s the opposite from being a straightforward tool, haha. For instance, it may just be the way I set up scenes, but I’ve NEVER had it over 0.001… So I feel like there’s some room for improvement there. (Especially when you take into consideration that once you go below 0.001, you’re basically driving blind, as it shows up as 0.)

    As to the other things you mention:

    I always render my EXRs at 16bit at least (in fact, I still follow exactly the same recommendation give in that tut).

    I’ve never had that issue with EXtractoR you mention. I always set all channels to blue, and it stays there. Furthermore, because it only turns into a grayscale gradient image when all channels are set to the same “colour,” and I always have to add invert and usually add levels after, as we’ve mentioned, I always have time to realise if there’s an issue as the one you mention. And it’s improbable I would mistake all 3 channels. However, what you tell me doesn’t surprise me; and I wouldn’t fault the tool, but rather Adobe: their CC is the MOST buggy set of software I have on my computers! (And that’s saying a lot, because I mostly use a Windows machine for my 3D stuff! And we all know what Windows is like…)

    Then, when I say i export in 4K and then scale down to FHD I mean that I scale the final output, after the DoF has been applied. If I were to scale it down, say, in the Pre-Comp used as the reference for the DoF, then, yes, it would be AA’d by that–and the resulting artefacts would be much worse!

    I’ll watch that tut again this weekend to see if there’s any “bad habit” I’ve adopted since I first watched it. But I’m pretty sure I’ve maintained the settings recommended there. If I remember correctly, it’s called “your depth pass is wrong” because people normally use the Depth Pass to get a Z-gradient for DoF, and that pass does use AA, so there aren’t any defined borders. So the tut says that, it might be counterintuitive, but instead of using Depth Pass you should use Pos Pass, which doesn’t apply AA. And Pos Pass is the only thing I use.

  • Xavier Bonet

    December 7, 2021 at 12:21 pm

    UPADATE: I realised I should’ve added an image of the actual Pos Pass, to see if there are any issues you might pick up on. As you can see here, the edges are quite jagged, but there’s no AA, which is good, and the gradient is good (it spans the entire depth of my scene). So it should work correctly… BTW, this is the Pos Pass without any tweaking of levels or B&W points; just inverted.

  • Steve Bentley

    December 7, 2021 at 6:49 pm

    It’s definitely not the easiest of work flows for sure but you get used
    to it. The current trend of doing everything in the render engine I
    think is unwise. You can do so much to achieve the final look of a shot
    in post and at 300x the speed vs doing it in 3D, it only makes sense.
    This new school of – where’s the button that says “a small miracle
    happens now?” – and expecting one setting to produce perfection is
    driving me nuts. (Kids today! And… Get off my lawn! Add your own
    industry-professional-long-in-<wbr>the-tooth saying here.)

    Yes that final scale down is just fine (post extractor).

    If you render out at 32 bit full you should never run out of “distance”
    in your Pos pass. The numbers capable of a 32 bit file are boggling. But
    really you shouldn’t run out of distance in a 16 bit either, that’s a
    ginormous number too. It’s just a matter of whether there is enough
    separation between coffee bean 1 and coffee bean 2 if you still have to
    include the coffee maker that’s in the scene and down the block. It
    should still work to the bare eye, it’s just that both coffee beans
    might be at the same “depth” blur when technically they shouldn’t be.
    But you won’t see that and the scene will look right.

    I don’t remember if the Pos file is log or linear (linear I would think)
    but either way, your monitor is not capable of seeing the slight
    differences once you get up into the shoulder and toe of the black to
    white “curve”. Your monitor is only 8 bit (or 10 bit at best), so you
    might think you are out of room but there should be plenty more there
    hidden in the hilights and shadows.

    I’ll dig out an AE project I’ve done with this workflow and send. What
    version are you using?

  • Xavier Bonet

    December 10, 2021 at 10:36 am

    I agree that doing everything inside C4D isn’t practical. It’s hardly a one-touch software, even if you don’t go for external compositing (maybe Blender is more one-touch), but, as you mention, I find that it often takes MUCH longer to do things that you can do yourself in, say, AE. And I also find there are some things C4D simply can’t do… which is a bummer. I sometimes feel like I’m making more work for myself but even in this project I’m talking about I’ve had a couple of scenes I’ve opted to export in different layers: subject, foreground, background, etc., and then recomposite in AE. That way I’ve been able to export just one frame of whatever is static, which has saved me a lot of time.

    Really, the only time I do everything in C4D is when it’s a still image… and even then I almost always bring it into AE (sometimes PS) to play around with the colours and levels, which I find is much better to do manage outside of C4D. And only when I have, say, 12 hours of render time, do I use C4D’s built-in Physical DoF. I must admit that for photo-realistic work it’s often the only one that really does the job for me.

    I’ve got to run some specific tests. Try exporting at 16-bit and 32-bit, even when the preview looks wrong. Hopefully over Christmas I’ll get a couple of days off to go down that rabbit-hole. Honestly, according to what you’re saying, my exports might become much easier, as one of the most tiresome tasks for me is finding the correct Pos Pass value…

    Would you say that having “the beans” modelled at real-life scale makes for a better Pos Pass? Or should they be scaled down OR scaled up? Because in order to avoid Pos Pass issues, I’ve stuck to what works for me–which as I mentioned is 0.0001 and around that value, hehe, so you might guess that my scenes are smallish. I started out doing miniature scenes, wanting to have that miniature DoF. Yeah, after finding the “bean tut” I realised I could get effectively get that aesthetic in AE after the fact, but as I started toying around with my miniature scenes that were already done, that’s what stuck. I’ve since tried making real-world scale scenes, and I haven’t quite got the same level of results. Perhaps I just have to play around until I get a good value and stick to that. (BTW, the problem scene I’m talking about here is real-world scale.)

    Maybe this is also why I’ve never really been able to effectively crack the Motion Blur part of the tut… I get pretty crummy results all the time.

    It’d be great to have that look at your workflow! Thanks a lot. I’m on AE 2020 17 and C4D r21 right now. 😊

Viewing 1 - 10 of 16 posts

Log in to reply.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy