johnl3d Posted April 15, 2014 Share Posted April 15, 2014 for fun trying to have random color changes in models but using a rand() expression in the color numbers causes AM to crash ..tried RGB(r,g,b ) with random numbers ..crash played with x,y,z size expressions and tried to have those number go into color number slots...crash weird numbers do not need to be integers so rand()*255 should work without color changes quick test front model has pose turned off randomize.mov Quote Link to comment Share on other sites More sharing options...
Hash Fellow robcat2075 Posted April 15, 2014 Hash Fellow Share Posted April 15, 2014 Have you tried it with integers? You might try a progressive test where R G and B are all constants, Dose that survive? then try R getting a random number and see if that works. then add G getting random... Quote Link to comment Share on other sites More sharing options...
johnl3d Posted April 15, 2014 Author Share Posted April 15, 2014 Tried that does not like it for even 1 factor Quote Link to comment Share on other sites More sharing options...
Hash Fellow robcat2075 Posted April 15, 2014 Hash Fellow Share Posted April 15, 2014 Is it possible it really takes a 0 to 1 value? Quote Link to comment Share on other sites More sharing options...
Admin Rodney Posted April 15, 2014 Admin Share Posted April 15, 2014 John, I'm not sure if this is what you are after but it appears to work on my end. Try: RGB(Rand()*255,Rand()*255,Rand()*255) Where you seed each of the RGB values with a different random number. Note that I don't know how to limit the Random value to a range between 1 and 255. Anyone? I've attached the project file with one groups surface property being altered and will post a few variations on the theme in order to explore more. This technically is the first expression I've ever written that had an actual reason for being written. Warning: Anyone prone to seizures due to rapid color change might want to forgo watching the .MOV. RandomColorExpression.prj randomcolorexpresssion.mov Quote Link to comment Share on other sites More sharing options...
itsjustme Posted April 15, 2014 Share Posted April 15, 2014 RGB(Rand()*255,Rand()*255,Rand()*255) Where you seed each of the RGB values with a different random number. Note that I don't know how to limit the Random value to a range between 1 and 255. Anyone? Rand() generates a number between 0 and 1, so multiplying that number by 255 (as you have already done) will limit the result to between 0 and 255. The project worked fine on my end. Quote Link to comment Share on other sites More sharing options...
Admin Rodney Posted April 15, 2014 Admin Share Posted April 15, 2014 Here's the same thing extended to each of the RGB values separately (i.e to isolate colors to their linear... yes linear... paths within their respective Red, Green and Blue color spaces). For the fun of it, I will note that linear color is an abstraction that allows us to interpret nonlinear color space. While the numbers 1 through 255 are linear, color isn't normally isolated as such in the real world and any path traced through time will be influenced by many other factors, creating nonlinear paths through color space. In short, it's all about relativity. Sometimes these paths are smooth... as in a weighted arc... and sometimes... as in these psuedo-randomly generated expressions... erratic. RandomColorExpressionRGB.prj randomcolorexpresssionRGB.mov Quote Link to comment Share on other sites More sharing options...
Admin Rodney Posted April 15, 2014 Admin Share Posted April 15, 2014 Rand() generates a number between 0 and 1, so multiplying that number by 255 (as you have already done) will limit the result to between 0 and 255. The project worked fine on my end. Outstanding. Thanks David! Edit: In looking back I see I would have to revise my words to state, 'a number between 0 and 255' as I'd need to account for the occurrence of multiplying by zero). Quote Link to comment Share on other sites More sharing options...
johnl3d Posted April 16, 2014 Author Share Posted April 16, 2014 Thanks Rodney I guess I was over thinking this and trying to use one of the functions while setting up a pose Quote Link to comment Share on other sites More sharing options...
Developer yoda64 Posted April 16, 2014 Developer Share Posted April 16, 2014 From the doc for RGB expression Creates a color by combining the three floating point values r, g, and b. These numbers should be expressed as 8 bit color, from 0 to 255. Version 18e , will clamp the values between 0 and 255 self and using absolute values, so a translate propertie can used as example . Quote Link to comment Share on other sites More sharing options...
Admin Rodney Posted April 16, 2014 Admin Share Posted April 16, 2014 Version 18e , will clamp the values between 0 and 255 self and using absolute values, so a translate propertie can used as example . That should prove to be useful and interesting. Thanks Steffen! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.