Square Shape selecto to get new X-Y values for Shape Control

Smart people ~ Great Scripts
Post Reply
User avatar
Draise
Captain
Posts: 3198
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia
Contact:

Square Shape selecto to get new X-Y values for Shape Control

Post by Draise »

Hi there!

I'm nearly getting to a point where Shape animation will be coming in handy within trueSpace, to see how I can make a GPU opensource and freeware little web series..

I have learned that someone has developed a colour selector that can output a number of values, each value could then potentially drive shapes.

Image

But I only need X and Y values to drive the two or more shapes according to one control in the LE.

For example:

Image


How would I code this? I know I could use a bitmap control, then move the selector of a gradien value with grey to white at the X and White values. I could then pipe them out to two new values of the new shape. How do I make those controls?
User avatar
Draise
Captain
Posts: 3198
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia
Contact:

Re: Square Shape selecto to get new X-Y values for Shape Control

Post by Draise »

Image

Ok, I have some ideas.

I can get two channels from only two colour values, say R and Green and then their strength with Blues colour gradient below. I can also, with some work, make multiple controls in the node by duplicating code and changing it when needed.

Now how do I devide the final value to values decimal values of 10 or 100? So that instead of getting the Green value of 255, but instead to convert it to 2.55?

How do I do that?

I'm not the best at coding, any help would be appreciated.
User avatar
trueBlue
Captain
Posts: 5214
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Square Shape selecto to get new X-Y values for Shape Control

Post by trueBlue »

You will find a BianryOp object in the Math - Operations library.
This example shows how to divide A from B by using the / (division) as an Operand.
You can also use several other math operations like + - * MAX MIN etc...
HTH
You do not have the required permissions to view the files attached to this post.
User avatar
Draise
Captain
Posts: 3198
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia
Contact:

Re: Square Shape selecto to get new X-Y values for Shape Control

Post by Draise »

Thanks! That makes life easier. I was sitting down doing a Jscript tutorial to make exactly that! Now that makes life much easier. Thanks trueblue.
User avatar
Draise
Captain
Posts: 3198
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia
Contact:

Re: Square Shape selecto to get new X-Y values for Shape Control

Post by Draise »

Image

There you go... 4 inputs from a colour selector.

I put the colour to 100 G, 100 R and 100 B.. With that you get 3 values of each. To get a fourth value, I added both R and G values to get the opposite of the Blue value for a fourth control.

My only unfortunate thing, due to the bitmap generated, is that when I am at the V value of 50%, the left and right U values are halved due to the gradient with the U value even at 100% left or right. I need to somehow make a texture map that has value gradients of 100 percent half way in the middle of each edge all ways.

I can think of two maybe 3 other values I could get out of one slider using add and even subtract. That's more than good enough for me.

My next trick is getting multiple controls influencing the same morph.

I guess I could get another colour picker so I have two R values. So I add both R values and then use that for the single morph. So I have to controllers to the one morph. That makes sense.


Another thing is that the single controller colour value can control any amount of morphs of as many objects as I want, so that works. I just found out you can't add morphs to parented objects, which is sad, only to single meshes. But that's no biggie.
User avatar
Draise
Captain
Posts: 3198
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia
Contact:

Re: Square Shape selecto to get new X-Y values for Shape Control

Post by Draise »

Image

HAH! :bananacheers: :bananacheers: :bananacheers: :bananacool2:

Figured the simple solution. Changed everything so that the lower two gradients on the botton left and bottom right also contained green and red values, then I added them to the blue value and substracted them again. So that when You move up, you get all the blue gradient in all the image, plus left in right R and G in the image... creating a perfct X/Y -1 +1 slider control! GREAT!

Seems like simple programming, but damn was it easier to do than in Softimage or Maya, I didn't have to write any code after all! yay for the LE!

Now my only concern is blending clips..... smoothly with bezier clip blending.. Seems like they only blend in a linear way, unless I work with bezier curves in the animation clips intro and outro... Have to think that through on how to get good smooth animation now.
Post Reply