Confused with Colours

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 12 December 2012   #1
Question Confused with Colours

Ok, I'm so close...


What I'm trying to do is have a colour picker change the first colour of a falloff map, and then have the second colour of the falloff map be a slightly darker version of the colour.

colorpicker theColor "Colour" color:[0,0,255] modal:false pos:[500,500]
on theColor changed new_col do
(
meditMaterials[1].texmap_diffuse.color1 = new_col
meditMaterials[1].texmap_diffuse.color2 = new_col.value - 50
)

Now from what I've been reading up from the maxscript help is that colors are 3point values. However the color component properties such as H.S.V are floats. So what I was trying to do here is decrease the value by 50, yet it comes back with a "Unable to convert to Point 3" error...

What am I misunderstanding?

Thanks

And Merry Christmas!
 
Old 12 December 2012   #2
Originally Posted by Animare: Ok, I'm so close...


What I'm trying to do is have a colour picker change the first colour of a falloff map, and then have the second colour of the falloff map be a slightly darker version of the colour.

colorpicker theColor "Colour" color:[0,0,255] modal:false pos:[500,500]
on theColor changed new_col do
(
meditMaterials[1].texmap_diffuse.color1 = new_col
meditMaterials[1].texmap_diffuse.color2 = new_col.value - 50
)

Now from what I've been reading up from the maxscript help is that colors are 3point values. However the color component properties such as H.S.V are floats. So what I was trying to do here is decrease the value by 50, yet it comes back with a "Unable to convert to Point 3" error...

What am I misunderstanding?

Thanks

And Merry Christmas!


Do you have a scene you could post with all the code? I'm trying to guess what you are trying to do this to but keep getting errors myself.

	meditMaterials[1][#Maps][#Diffuse_Color__Map__1____Falloff].color1 
	meditMaterials[1][#Maps][#Diffuse_Color__Map__1____Falloff].color2
__________________
Luke
Web site

3d Max 2012 Win 7
Intel Corei5 8g Ram

 
Old 12 December 2012   #3
Thumbs up

Thanks! Didn't expect a reply today, so definitely appreciated

I've condensed the scene and it is attached.

Also getting frustrated with materials, is there a way to reference materials the same way as objects, currently I am just going through the listener and selecting it through material editor slots

so for this example I have a material named 'mat', I thought selecting it would be similar to selecting an object e.g $mat.diffuse = colour 1 1 1 or something.

Please also find the script below :
------------------------------------------------------------------------------------------------------------------
try (closeRolloutfloater ColourChanger) catch()
rollout ColourFall "Colour"
(
colorpicker theColor "Colour" color:[0,0,255] modal:false
on theColor changed new_col do
(
meditMaterials[1][#Maps][#Diffuse_Color__Map__2____Falloff].color1 = new_col
meditMaterials[1][#Maps][#Diffuse_Color__Map__2____Falloff].color2 = new_col
)
)
ColourChanger = newrolloutfloater "Main" 500 565
addrollout Colourfall ColourChanger
Attached Files
File Type: zip colour_fallof.zip (19.1 KB, 1 views)

Last edited by Animare : 12 December 2012 at 01:52 AM.
 
Old 12 December 2012   #4
Try this

I'm multitasking watching Sri Lanka get their arses handed to them and surfing the net.

try (closeRolloutfloater ColourChanger) catch()
rollout ColourFall "Colour"
(
	local col = (Random 0 255)
	
	colorpicker theColor "Colour" color:[col,col,col] modal:false 

	on theColor changed new_col do 
	(
		meditMaterials[1][#Maps][#Diffuse_Color__Map__2____Falloff].color1 = new_col
		meditMaterials[1][#Maps][#Diffuse_Color__Map__2____Falloff].color2 = new_col/2
	)
)
ColourChanger = newrolloutfloater "Main" 200 100
addrollout Colourfall ColourChanger
__________________
Luke
Web site

3d Max 2012 Win 7
Intel Corei5 8g Ram


Last edited by lucpet : 12 December 2012 at 04:38 AM.
 
Old 12 December 2012   #5
Hahah nice, yes its a nice gloomy day for watching cricket!

Thanks for that, so simple....didn't even think of that I'll try it out!
 
Old 12 December 2012   #6
Originally Posted by Animare: Hahah nice, yes its a nice gloomy day for watching cricket!

Thanks for that, so simple....didn't even think of that I'll try it out!


You can perform all sorts of maths, divide, multiply, subtract etc. Try it out along with
different numbers.
Don't forget to (like I did) to change this number if you change things lol
[#Diffuse_Color__Map__!!!2!!!____Falloff]
If you could use the code symbol when you are posting code everyone's life
is made much easier.
The Hash symbol above where all the text formatting stuff is just highlight your
code and click it, it will format it for you.
Ramdom 0 255
__________________
Luke
Web site

3d Max 2012 Win 7
Intel Corei5 8g Ram

 
Old 12 December 2012   #7
Thanks! Will do, sorry about the code quote, I'll add that from now on


  if problem = solved then
     say thanks
  else
     beg some more
 
Old 12 December 2012   #8
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 05:23 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.