Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float seed = 5.0; //allows R, G or B to dominate
- //Lower seeds even out RGB values and produce more
- //desaturated colors. For less saturation keep your
- //combined brightener + seed value below 10.0 and try
- //experimenting with seed values less than 1.0
- float brightener = 5.0; //pushes up luminance value
- //Try to keep values for brightener + seed <= 10.0
- //A negative brightener (with a seed of 10.0) produces
- //darker colors.
- string base_texture = "5748decc-f629-461c-9a36-a35a221fe21f";
- //replace the UUID with the name or key of the object's
- //base texture. The base texture should be a light de-
- //saturated texture like a shadow map. If you have a
- //detailed "white" version of the texture, even better!
- vector RandomColor(float hiValue, float lighten)
- {
- //The RandomColor function prevents muddy colors you'd
- //get from completely randomizing the R, G, and B values
- //separately.
- //RandomColor allows one color to dominate by giving it
- //the full "seed" value and splits the "seed" value bet-
- //ween the other two colors. You still end up with more
- //"greenish" colors, but at least they're a bit more
- //vibrant than the purple and mustard browns you get with
- //R, G, and B being purely random.
- hiValue = hiValue/10;
- lighten = lighten/10;
- float x = hiValue; //One lucky color will get the full seed value
- float y = llFrand(hiValue); //The next gets a random portion of it
- float z = hiValue - y; //The last gets the remaining portion.
- list colorMix = [x + lighten, y + lighten, z + lighten];
- list cRND = llListRandomize(colorMix,1);
- vector nuColor= <llList2Float(cRND,0),llList2Float(cRND,1),llList2Float(cRND,2)>;
- return nuColor;
- }
- default
- {
- state_entry()
- {
- llSetTexture(base_texture,ALL_SIDES );
- //...or just the side you need it on.
- }
- on_rez(integer start_param)
- {
- llSetColor(RandomColor(seed, brightener), ALL_SIDES);
- //llSetTimerEvent(14400); //Change color every SL day cycle.
- }
- touch_start(integer total_number)
- {
- llSetColor(RandomColor(seed, brightener), ALL_SIDES);
- }
- timer()
- {
- llSetColor(RandomColor(seed, brightener), ALL_SIDES);
- }
- }
Advertisement