4 Replies Latest reply on May 20, 2009 11:47 AM by Adolfo Rozenfeld

    Depth sorting composition


      I'm working on a project that involves hundreds of animated dynamics objects (e.g. object involves spring with dynamics fields).  Since it's impossible to rendering all objects together due to memory limit, I have to render each object separatedly. So I have hundreds of layers.  I wonder if I can do depth sorting composition in AE. That is, for a pixel, AE somehow can figure out which color should be chosen from those layers based on the depth info. I checked online and couldn't find a good solution. Some people suggested to render one object with the rest in solid black. However, this won't work for my case since the object is dynamically animated. Does anyone know if it can be solved in AE?



        • 1. Re: Depth sorting composition
          Adolfo Rozenfeld Adobe Employee

          After Effects doesn't expose to users a depth map for its' internal 3D compositing engine.

          The Depth plug-in in the Buena Depth Cue set (now owned by Digieffects) seems to be exactly what you need. It displays a depth map for the layers in a 3D scene, based on distance from the camera or POV.

          1 person found this helpful
          • 2. Re: Depth sorting composition
            Mylenium Most Valuable Participant

            You need to be more specific. What kind of "objects" and what kind of sorting? Since AE's rendering order for 2D layers is dictated by how they are stacked, it's quite possible you could use that to your advantage somehow. If that doesn't work, adding some simple distance-based expressions can produce depth fade effects with 3D cameras. You are also presenting us with kind of an oximoron here. If Z sorting is so important, then the way I see it, your layers are simply too big and memory inefficient, thus not being renderable in one comp. My assumption here is, that by all rights, layers further back would sufficiently be presented with smaller resolutions, even more so, if DOF is added to them or they fade into fog/haze. If you get my meaning - who cares, if some DOF effect was derived on quarter res layers as long as it looks convincing? Likewise, even without such fancies, layers farther away in the scene would only occupy a fraction of the overall pixel area. To me that, too means, that you may work with low res versions a lot of times. At worst, you will have to cross-fade between lo and hi versions, should they come closer to the camera, but that seems an acceptable compromise. And yeah, Depth Cue would be an option, but be aware that it still will leave you with your memory problems and ever since CS3 compatibility is less than ideal. It may cause crashes on its own.



            • 3. Re: Depth sorting composition
              cz3 Level 1

              Thank you for your reply, Adolfo. Your answer consists with the result I searched online. http://www.highend3d.com/boards/index.php?showtopic=24574&hl=After+effect (some people conclude AE didn't have such function or a lot of pain to make this works)


              I also checked Duena Depth Cue, but I am not sure if it is my solution. In their website, they mentioned:"3D Composite: Allows 2D footage with a depth channel, such as you might generate in 3D applications, to interact with After Effects' 3D layers." I just want to generate final images based on the depth info rather than interact with AE's 3D layers. Maybe "interact with AE's 3D layers" could lead to some solution, but how?

              Let me explain more about my question (also for Mylenium). I have about a hundred objects, which creation and evolution (i,e. animation) are done by dynamics simulations. My goal is to generate a video to show the creation and evolution of these objects together rather than DOF effect/fog/haze. You know, as usual dynamics simulation is computation expensive, particularly in memory. Machines I used cannot afford to run these simulations of all objects simultaneously. That's what I mean memory limit. Once the simulation is done, the rendered images themselves are not very large. By the way, the dynamics simulations and rendering are done in Maya. These objects should intersect each other. Here is an example (from the highend3d website):

              "For example, say I got two spheres in my scene. I want to turn off one sphere and render it by itself. Then I want to turn the other one on and render it by itself. Then I want to composite it in AE and have the correct sphere appear in front regardless of the order in which I place them in AE."


              Thanks again,

              • 4. Re: Depth sorting composition
                Adolfo Rozenfeld Adobe Employee
                "For example, say I got two spheres in my scene. I want to turn off one sphere and render it by itself. Then I want to turn the other one on and render it by itself. Then I want to composite it in AE and have the correct sphere appear in front regardless of the order in which I place them in AE."

                "Regardless of the order" is not really true, since you would be performing 2D compositing of 3D elements. Stacking order still matters. You can produce something that looks like it's 3D compositing, even if it's 2D. That's what matters.


                Most (all?) 3D application should let you export a separate depth map pass, so that you can then use for example After Effects' Depth Matte effect. This way you could make the object placed behind intersect or overlap the front object, based on distance from the camera.


                Another idea is the Object ID channel, which stores the area for each 3D object in a scene so you can select it in a 2D composite (the parts in which an object is obscured by another are missing, which is part of the trick). However, this kind of requires all objetcts to be rendered, otherwise each Object's ID wouldn't have the substractions cause by other objects. I am sure there's a workaround for this. Or simply a clever way of doing it.


                Depending on the 3D application you use, you can include these channels as part of EXR or RPF/RLA sequences, for example.