PDA

View Full Version : How to control the Beam effect in 3d space?


senny2002
12-11-2007, 02:43 AM
I want to control the Beam effect in 3d space.but startingpoint and endingpoint only have xy value in Beam effect.so,how can i control the Z value?

Basically,i just want to something like that:
http://www.graymachine.com/content/index.php?option=com_content&task=view&id=73&Itemid=1

If you get the idea,please help me out.

Mylenium
12-11-2007, 07:08 AM
so,how can i control the Z value?

You don't as it has none. ;-) You need to transform the target point coordinates from 3D space to the 2D projection of the effect. Something like that might do:

Start Point:

layerA=thisComp.layer("A");
pointA=layerA.toComp(anchorPoint);

[pointA[0],pointA[1]]

End Point:

layerB=thisComp.layer("B");
pointB=layerB.toComp(anchorPoint);

[pointB[0],pointB[1]]

Mylenium

senny2002
12-11-2007, 08:21 AM
thanks!Mylenium (http://forums.cgsociety.org/member.php?u=14998) vbmenu_register("postmenu_4827250", true);
I get the point,the Layer Space Transforms methods is very useful.

graymachine
12-17-2007, 02:54 PM
thanks!Mylenium (http://forums.cgsociety.org/member.php?u=14998) vbmenu_register("postmenu_4827250", true);
I get the point,the Layer Space Transforms methods is very useful.

That's pretty much what I did. Because there were so many, I used:

layerA=thisComp.layer(index-1);
pointA=layerA.toComp(anchorPoint);

and placed the beam layer underneath the Null object for each one. This way, I could keep recycling the same layer over and over.

Be warned.. if a null passes behind the camera with this expression, it will freak out.

senny2002
12-18-2007, 12:04 AM
THanks again.I just done a sample
http://www.youtube.com/watch?v=u8iWMPspIFQ

I also add expression into the starting thickness and ending thickness,to make the beam more like 3d.

distance = length(position, thisComp.layer("Camera 1").position);
m = thisComp.layer("A point ").transform.position[2]/distance/300;
n = thisComp.layer("A point ").transform.position[2]*(m*thisComp.layer("Controller").effect("Thickness Control")("Slider"));
if (n< 1){3}
else {
thisComp.layer("A point ").transform.position[2]*(m*thisComp.layer("Controller").effect("Thickness Control")("Slider"))
}

Like graymachine (http://forums.cgsociety.org/member.php?u=223846) said if a null passes behind the camera with this expression, it will freak out.I try add an other camera to fix it,but it couldn't work.

CGTalk Moderation
12-18-2007, 12:04 AM
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.