noise rotation

Hello everybody,

I've been looking for a script to do something I can´t do inside max (or I dont knwo how to do it) let me explain:

I have lot of planes and I want them to rotate in the Y axis (locally) according to the color of noise i have texture them with. please look at the picture to have a better idea.
Other thing is that I dont want them to rotate more than 90 degrees, just from 0º to 90º.

Do you know if there´s a way to do this? I've been trying with wire parameters but it does't work.

sorry if I haven´t explain very clear, my english is not very good.

Thanks in advance

AttachmentSize
example_01.jpg72.19 KB

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
emonimo's picture

Anubis, I really appreciate

Anubis, I really appreciate the effort you made with this... thank you very much.
I haven't try it yet (too bussy at the moment). Hope tonight I'll have some time.

Thank you again.

nodeynnek's picture

emonimo, were you able to

emonimo, were you able to try this script? I am trying to do something similar.

Anubis's picture

This is interesting question

This is interesting question and i spend a little time to help you. If i understand, the following code is what you ask for:

for i in selection do
(       -- assign random grayscale color
	i.wirecolor.r = random 0 255
	i.wirecolor.g = i.wirecolor.b = i.wirecolor.r
	-- test result to Listener (optional)
	print i.wirecolor
	-- handle variables to achieve rotation b/n 0 and 90 deg.
	perc = (i.wirecolor.r as float) / 255
	ang = 90 * perc -- 
	-- finaly rotate them
	doRotate = rotate i ang y_axis
) -- thats all :)

And if it's not exactly that you need, there is some theory notes to can continue yourself form this point. So... you said so you first try with wirecolor and if this is the most prefered way to do then you will like to see so i use just wirecolor. This is a simple loop FOR in Selection, that means to select your planes first. And what's happen'd into... First assign a random value to Red channel of RGB and in next line assign this value to the rest channels G and B. Why? Following your query you work in grayscale, so there channels is always identical. Black is 0 0 0, White is 255 255 255, some dark gray could be to say 28 28 28. So as you want to work with only one rotation axis as its enough to hold only one of RGB channels to proceed. Next i add "print" just to see in Listener what i mean. Next i get one of the RGB (r) as rate (percentage) of 255 and in next line for angle i multipled 90 by this rate, so the final line will use this value for rotation. And you can calculate yourself, if the color is pure white (255 255 255) - an angle of rotation will be 90, and if the color is pure black (0 0 0) - an angle will be 0. And the problem is solved :)

I'll attach and screenshot here:

AttachmentSize
the_result.jpg 24.28 KB

my recent MAXScripts RSS (archive here)

emonimo's picture

the problem is that I dont

the problem is that I dont know how to make them rotate according to the color of the noise...
in wire parameters it says it not able to make the conection between the color and the Y axis rotation.... any idea?

thanks.

masquerade's picture

If I understand correct, you

If I understand correct, you want to make a script which rotates the planes according to their texture colors, but no more than 90 degrees right?

 You can assign each objects related controller a "Float Limit" controller, and make maximum minimum values 90/-90. Search for "float_limit" in maxscript documentation for usage.

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.