PDA

View Full Version : 3D object - reflection animation follow and mirror


suztv
10-29-2007, 02:19 PM
I posted a request in the scripts request section in Aenhancers - but after working with one of my programmer guru friends I just have to share this with you. In the video comps that I produce I have to create 3D reflections of items moving around in 3D space with camera moves etc. If I select the continuously rasterize feature on the layer sometimes it works and sometimes, well - it doesn't work so great (camera's seem to get confused and then jump). What I wanted was a way to reflect the object without having to precompose positional information. In other words if I have a phone with a 3D spin brought in and I have it come into my scene with camera moves and spins - it gets pretty confusing and time consuming to pre-compose, apply continual rasterization and then hope the camera works correctly. Also the reflections don't always work out the way they should. So here is the expression that we came up with that works great! The only caveat is that your anchor point must be at the bottom of your "object" and any z spins you must do in a precompose (but this isn't nearly as intense as keying out an entire positional sequence and then tweaking them for the reflection).
Duplicate your main object - this will be the reflection. Apply the following expression in the position. You will also have to invert the scale on y (x=100% y=-100%).

// name of the variable for the main object you want to reflect
V=thisComp.layer("Object");
//get the positional information from your main object
VPOS=V.transform.position;
// name of the variable for the floor plane
F=thisComp.layer("Floor");
//position information of the floor
FPOS=F.transform.position;
//the distance between the floor and the object you want to reflect
Distance=VPOS-FPOS;
//this line is where the information is applied to the reflection and viola! your reflection is acting the way it should
NEWPOS=FPOS+Distance;
[NEWPOS[0], NEWPOS[1]+(NEWPOS[2]/4), NEWPOS[2]]


You will need to duplicate the object and apply what ever falloff or blur attributes necessary. Also scrubbing through and finding the lowest point that the reflection should touch at and setting the reflections anchor point is a good idea. I cannot tell you how much time this has saved me and I hope that some of you can get some mileage out of it.

payton
10-30-2007, 07:44 PM
what should be reflected from what???
maybe some screens will transport your idea much better.
just curious...
cheers,
payton

suztv
10-30-2007, 08:10 PM
"what should be reflected from what???"
Answer: Any 3D scene with a floor that has objects moving independent of the camera that need to be reflected.

I have attached a JPG for reference. Normally if the camera was the only thing moving or if the movement for the object/comp - whatever was simple I would just create a duplicate of the comp and apply . But most of the things I do are complex and become cumbersome to re-work everytime the client needs a change. So this was created to save me from having to jump from comp to comp just to re-time my main timeline.

payton
11-10-2007, 12:48 PM
hi suztv,
right now i need to implement your script.
unfortunately it does not work for me.
can you help me out with this.
i attached a file that does not work the way it should.
do you know the answer?

thanks in advance,
payton

suztv
11-12-2007, 01:32 PM
I can't open your file - I have AE7 not CS3. :(


If you could possibly give me a screen shot of your timeline and viewer I might be able to help you from there...

delaque
11-12-2007, 01:42 PM
thanks for answering. you can see a simplified version of it here:

http://www.filmbilder.de/ae.png

payton

suztv
11-12-2007, 02:22 PM
You may want to adjust the anchor point of both your object and object 2 to be at the bottom of the object - instead of 512, 576, 0 - try 256,576,0. You may have to mess with the anchor to get it right...

If that does not work - try this one:
temp=thisComp.layer("object").transform.position;[temp[0], temp[1]+222, temp[2]]

the second transform coordinate has +222 - this number indicates how far away the refelected comp is from the original comp. This is a simplified version of the other expression but it does not calculate the distance of your floor like the other expression - hence the "+222"


Also if you have any turns or spins use this expression for the z rotation:

-thisComp.layer("object").transform.zRotation

CGTalk Moderation
11-12-2007, 02:22 PM
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.