6 Replies Latest reply: Oct 18, 2013 11:26 AM by moldyboot RSS

    Can you add global visibility into a scene to effect all 3D objects?

    richtbh

      Hi there

       

      I am wondering if it is possible to achieve a specific type of effect.

       

      I'd like to be able to add global visibility into a scene with parameters, so that 3D objects over a certain distance from the camera become either invisible or less visible. As if there was fog in the scene. For example you can achieve this type of effect in Cinema 4D by adding an 'environment' into your scene and then adjust the settings. It takes just seconds to do and its a very powerful effect. It means you can very quickly add the equivalent of fog into a scene where objects that are further away do appear more distant because they are less visible / have less contrast. Not only is it quick, its also extremely accurate because it is based on the distance the objects they are from the camera in real time. It would otherwise require a lot of painstaking animation on all your individual objects and this would be less accurate.

       

      Anyone know if you can do this, or if there is a plugin?

       

      Many thanks

      Rich

        • 1. Re: Can you add global visibility into a scene to effect all 3D objects?
          Szalam MVP

          There are plugins out there to simulate atmosphere, but you would might like a distance expression from the layer to the camera just as much.

          • 2. Re: Can you add global visibility into a scene to effect all 3D objects?
            moldyboot Community Member

            you'll find an expression for something similar here:

             

            http://www.motionscript.com/design-guide/falloff.html

             

            you'll want to change the light layer in the expression to your camera.

             

            the expression is to simulate light falloff.  if you just need your layers to fade to black, then that will probably work for you, if you need it to fade to white (of another color or backgound layer), then try adding compound arithmetic, set the second source layer to the background layer (or a solid that is the color that you want) and apply the expresson to the 'blend with original' property.

             

            if that works for you, then you can create a preset with the effect and expression and then quickly apply it to all the 3d layers that you need.

            • 3. Re: Can you add global visibility into a scene to effect all 3D objects?
              richtbh Community Member

              Hi there, thanks for the suggestions.

               

              I used the motionsript example to map an expression to reduce the opacity of the objects based on the distance they were from the camera. This was very effective at first and I was pleased by the results.

               

              Unfortunately I found a few inconsitencies that took some time to iron out. The most noteable one was when my 3D objects had a parent null object, this threw out the expressions as they were somehow influenced by the coordinats of the null object. Ideally if my javascript and knowledge of the expressions were better I could have a function with all the objects in an array with some kind of For loop so I wouldnt need to repeat the code.

               

              I ended up giving up and animating all the objects by hand for this project. I would still be interested in knowing if there is a better way of setting up expressions, if there is a specific plugin for this or if there is another way? I think this would be quite a common type of effect so was hoping for a quick and accurate way of setting it up? I would have thought this effect should be included unless it is just me who is looking for it of course!

               

              Rich

              • 4. Re: Can you add global visibility into a scene to effect all 3D objects?
                Rick Gerard MVP

                You have to add a little language to the expressions to make them look at comp space instead of layer space when you have layers with spatial transformation expressions that have a parent.  Did that make sense?

                 

                Look up toWorld and toComp in the expressions guide or show us a screenshot of your project with the layer properties revealed and we can help you fix the expressions to take care of the parenting issue. Without a good screenshot and a good understanding of your project structure we can't write an example expression that is guaranteed to work.

                • 5. Re: Can you add global visibility into a scene to effect all 3D objects?
                  richtbh Community Member

                  Hi Rick

                  Thanks for your reply. I see what you mean that it is probably difficult to follow without seeing a screenshot.

                   

                  • I've attached the main composition screenshot. There are 2 other compositions linked to this composition, one consisting of just 2D text, called '[Text]' and the other with some 2D background graphics called '[Background]'.
                  • The screenshot of '[Comp 12]' is where I have 3D objects in space and where I have the camera that I have animating accross the scene.
                  • I have colour coded the layers into Cyan, Blue and Green as there are 3 main sections to the sequence.
                  • Each of the objects have their own parent null: **PET 1 CONTAINER**, **PET 2 CONTAINER**, **PET 3 CONTAINER**
                  • All the layers called '[Paw---Blue.png]' are what I am trying to attach some kind of visibility expression on based from the distance it is from the camera.

                   

                   

                  When I did have an expression setup it looked like this (based on the motion script example above):

                   

                   

                  decay = .005;

                  noFalloff = 1500;

                   

                  L = thisComp.layer("Camera 1");

                   

                  d = length(L.transform.position,transform.position);

                  if (d < noFalloff){

                    value;

                  }else{

                    value/Math.exp((d - noFalloff)*decay);

                  }

                   

                   

                  If you could help suggest a better way of setting of the scene that would be fantastic.

                   

                  Many thanks

                  Rich

                  Screen Shot 2013-10-15 at 10.09.17.png

                  • 6. Re: Can you add global visibility into a scene to effect all 3D objects?
                    moldyboot Community Member

                    i must admit i still get confused with layer space transforms... so i'd modify the expression to detect a parent, something like this:

                     

                    decay = .005;

                    noFalloff = 1500;

                     

                    L = thisComp.layer("Camera 1");

                     

                    if (hasParent==true){

                        d = length(L.position, parent.position + position);

                    }else{

                        d = length(L.position, position);

                    }

                     

                    if (d < noFalloff){

                        value;

                    }else{

                        value/Math.exp((d - noFalloff)*decay);

                    }

                     

                    it's not as robust as using layer space transformations (which i really should sit down and figure out), but it should work with single level parenting.  however it would not work if the parent also had a parent.