Switching Cam Position Based on Distance to Targeted Object

Discussions about animating in SOFTIMAGE©
Frank1000
Posts: 349
Joined: 16 Oct 2011, 14:13
Skype: the2he

Re: Switching Cam Position Based on Distance to Targeted Object

Post by Frank1000 » 13 Nov 2011, 01:10

if I want to move ahead or behind the cone, how is this to be achieved ? I basically want to set the distance to keep to the cone ... distinguishing between ahead of the cone and running after the cone.

Image

Chris_TC
Posts: 411
Joined: 22 Mar 2010, 17:43

Re: Switching Cam Position Based on Distance to Targeted Object

Post by Chris_TC » 13 Nov 2011, 01:30

Frank1000 wrote:did implement it but cam still pointing to interest and not oriented by null orientation ... do I need to apply the positioning to the cam-root rather than to the cam itself ... so interest is dependent to cam ?
If you don't want to use the camera interest, you'd typically delete it. The camera's rotation is constrained by the interest, so setting its rotation has no effect as long as that constraint exists.
Frank1000 wrote:if I want to move ahead or behind the cone, how is this to be achieved ? I basically want to set the distance to keep to the cone ... distinguishing between ahead of the cone and running after the cone.
Instead of getting the Array Minimum, you would have to find the value that's closest to what you want. Let's say the distance values are 10, 20 and 30. You want the camera to be at a distance of 27. You would then have to find the value 30, because that's closest to your desired value of 27.
Instead of directly hooking the Distance Between Node into the Array Minimum, you would first SUBTRACT a scalar value (e.g. 27), then do an ABSOLUTE VALUE, then hook that into the Array Minimum.

Frank1000
Posts: 349
Joined: 16 Oct 2011, 14:13
Skype: the2he

Re: Switching Cam Position Based on Distance to Targeted Object

Post by Frank1000 » 13 Nov 2011, 19:13

ok, interest del works nice. now to the minimum array, I opened it but don't know how and where to subtract the scalar value :

Image

Chris_TC
Posts: 411
Joined: 22 Mar 2010, 17:43

Re: Switching Cam Position Based on Distance to Targeted Object

Post by Chris_TC » 13 Nov 2011, 20:12

You don't have to open the node. You can put the subtract outside, between the Distance Between and the Array Minimum.

Think about the data we're looking at (and simply right click any of the pipes to visualize that data in the viewport):
The Distance Between outputs an array of distance values. One distance for every position null. So let's say these are the values that flow out of the Distance Between: 10.3 | 18.9 | 13.4 | 7.7
You now want to find a camera position that has a distance of about 11. So you subtract 11 from the data we looked at above. You will get: -0.7 | 7.9 | 2.4 | -3.3
Now you do an Absolute value, so you get: 0.7 | 7.9 | 2.4 | 3.3
The result of that plugs into the Array Minimum, which will figure out that 0.7 is the smallest value, and that it is found at index 0. The rest of the tree behaves as always.

Frank1000
Posts: 349
Joined: 16 Oct 2011, 14:13
Skype: the2he

Re: Switching Cam Position Based on Distance to Targeted Object

Post by Frank1000 » 13 Nov 2011, 23:39

thx, did "subtract" and "absolute value" which works fine now, only thing is that the cam still jumps back and forth in front or behind the targeted cone, depending on which distance is closer at that time ... how is this solved that I can determine whether I want to be in front or behind the target ?

Image
Image

Chris_TC
Posts: 411
Joined: 22 Mar 2010, 17:43

Re: Switching Cam Position Based on Distance to Targeted Object

Post by Chris_TC » 14 Nov 2011, 01:27

What exactly are you trying to do? It looks like you're working with a second curve and many different nulls now.
There is no way to define what's "in front" or "behind". For each cone-null pair you have two positions in 3d space which let you determine a distance vector.

If you want the camera to be positioned on the exterior curve, it would make more sense to directly sample the curve at various positions instead of using nulls. This way you could determine what's in front and what's behind, because from any given point on the curve you can only move in two possible directions.

Frank1000
Posts: 349
Joined: 16 Oct 2011, 14:13
Skype: the2he

Re: Switching Cam Position Based on Distance to Targeted Object

Post by Frank1000 » 14 Nov 2011, 11:47

ya exactly, I have a 2nd curve around the cone path that I used for duplicating by animation the nulls. I'm working on this study simulating to accompany a moving object, lets say a speed car, with camera poles placed around the speed track. Each pole then has multiple cams looking towards different angles so the spectator can choose which distance he likes to follow the object, while the function would determine the closest matching pole and angle automatically ... in terms of fetching the corresponding cam on a 25 frames (or else) per second.
I'm trying to narrow down the necessary circumstances of placing cam-poles to achieve useful results, in terms of object stability in the resulting movies.
You remember "The Matrix" camera effect, where the spectator could move around a still or slowmo in real time ... this is similar, but this time used for following. I'm checking what the least amount of cam poles would be to achieve ok results.
Question would be if it makes sense to give the object 3 positions, adding 3 nulls to it like a triangle, so the info is given what is the front and what is the back of the object, even if it is spinning. Probably in conjunction of using the numbering of the poles, so that the forward and backward direction of the fetch-pic-cam on the cam-pole sequence is determined. Otherwise if the object starts spinning, the cam would jump around again, but should stay calm at the distance defined by the spectator earlier.

http://files.2he.com/Cam_02_06.scn

Chris_TC
Posts: 411
Joined: 22 Mar 2010, 17:43

Re: Switching Cam Position Based on Distance to Targeted Object

Post by Chris_TC » 14 Nov 2011, 13:16

Well, you could use the outer curve to determine what's in front and what's behind. I can build a tree later, but the theory would be something like this:

1) Get the cone's closest location on the outer curve. Let's say this is at curve U 0.7
2) Do the same math with the Subtract and absolute value that we did before
3) Instead of just finding the minimum in array, we would now also check whether that null's closest location on the outer curve is greater than or less than U 0.7

Frank1000
Posts: 349
Joined: 16 Oct 2011, 14:13
Skype: the2he

Re: Switching Cam Position Based on Distance to Targeted Object

Post by Frank1000 » 15 Nov 2011, 03:46

so you mean using the passage already left behind on the 2nd curve, sounds good.

1) U being the % of the cuves length ... is there a certain function for this you have in mind ?
3) Another "if greater than" function to be added ? So needs to determine if to use the current calculated nearest value or uses the next calculated value if first value was with 2nd curve smaller than example 0.7. Do we then have to place the last valid value as variable that gets refreshed per cycle ?

Chris_TC
Posts: 411
Joined: 22 Mar 2010, 17:43

Re: Switching Cam Position Based on Distance to Targeted Object

Post by Chris_TC » 15 Nov 2011, 13:20

Hi, I've made an ICE tree that works, I'll post it later today with some annotations.

Frank1000
Posts: 349
Joined: 16 Oct 2011, 14:13
Skype: the2he

Re: Switching Cam Position Based on Distance to Targeted Object

Post by Frank1000 » 15 Nov 2011, 18:04

ok thx

Chris_TC
Posts: 411
Joined: 22 Mar 2010, 17:43

Re: Switching Cam Position Based on Distance to Targeted Object

Post by Chris_TC » 15 Nov 2011, 19:54

I was going to simplify the tree, but my new version didn't work, and I don't have time to really look over it now.
So I have attached my original compound, which is probably confusing but seems to work.

First, you replace the ICE tree on your camera by this:
Image

For evaluation reasons, we're now doing the calculation on a separate null. So make a new null, add an ICE tree to it, then drag the attached compound in and connect it.
Image
Attachments
Null Distance.xsicompound
(43.94 KiB) Downloaded 51 times

Frank1000
Posts: 349
Joined: 16 Oct 2011, 14:13
Skype: the2he

Re: Switching Cam Position Based on Distance to Targeted Object

Post by Frank1000 » 16 Nov 2011, 00:34

the 2nd part with creating a new null and connecting the Null Distance compound I was able to do, but the 1st part I'm not able to create a Get null.NewCamMatrix ... I tried to name the null that way, but it won't let me yet


Image
Image

Chris_TC
Posts: 411
Joined: 22 Mar 2010, 17:43

Re: Switching Cam Position Based on Distance to Targeted Object

Post by Chris_TC » 16 Nov 2011, 01:36

You can double click the Get Data node and type it out. "null.NewCamMatrix" means that the attribute "NewCamMatrix" lives on an object called "null"
You can either chain Get Data nodes together and do: "Get null" into "Get .NewCamMatrix" or just put it all into a single Get Data. The attribute "NewCamMatrix" is calculated inside of the compound. The camera's ICE tree just reads this attribute and uses it to set its own matrix.

Frank1000
Posts: 349
Joined: 16 Oct 2011, 14:13
Skype: the2he

Re: Switching Cam Position Based on Distance to Targeted Object

Post by Frank1000 » 16 Nov 2011, 11:30

bingo that worked. so you're building the logic on a separate null, like a container that holds the logic. I was trying to get the distance slider, but wasn't able to find out how ... once I expand a compound, how can I collapse it back ? I think when the compound was collapsed I could click on it to get the custom slider ?
Image

User avatar
Hirazi Blue
Administrator
Posts: 5107
Joined: 04 Jun 2009, 12:15

Re: Switching Cam Position Based on Distance to Targeted Object

Post by Hirazi Blue » 16 Nov 2011, 11:39

Frank1000 wrote:once I expand a compound, how can I collapse it back ?
The "K" marks the spot... ;)
SS-2011-11-16_11.35.20.png
SS-2011-11-16_11.35.20.png (2.84 KiB) Viewed 774 times
(From here)
Stay safe, sane & healthy!

Post Reply

Who is online

Users browsing this forum: No registered users and 26 guests