[Bf-funboard] A needed node.

Knapp magick.crow at gmail.com
Mon Jul 1 20:29:25 CEST 2013


A lot of people would like a random number input. The only thing I can find
is the random on the object

You see a lot of hacked things on the net like this or other hacks but they
are not nicely done or clean. A simple node that gives out a random number
would be great to have, with a seed input? . Perhaps other ideas might be
perlin noise etc and a time node so that we can feed that into the seed.

Using the Object Random is OK but if you feed it into a combine RGB you
just get shades of grey, not what is needed in many cases. We need 3
different numbers.

Here is on OSL node that is trying to get past the problem. Don't know but
would bet this is slower than a built in node.

#include "stdosl.h"

shader RandomColor(
    output color RandomColor=0)
{
    float Random=0;
    float R=0;
    float G=0;
    float B=0;
    getattribute("object:random", Random);
    R=trunc(Random*100.0)/100.0;
    G=trunc((Random*100.0-trunc(Random*100.0))*100.0)/100.0;
    B=trunc((Random*10000.0-trunc(Random*10000.0))*100.0)/100.0;
    RandomColor=color(R,G,B);
}

-- 
Douglas E Knapp

Creative Commons Film Group, Helping people make open source movies
with open source software!
http://douglas.bespin.org/CommonsFilmGroup/phpBB3/index.php

Massage in Gelsenkirchen-Buer:
http://douglas.bespin.org/tcm/ztab1.htm
Please link to me and trade links with me!

Open Source Sci-Fi mmoRPG Game project.
http://sf-journey-creations.wikispot.org/Front_Page
http://code.google.com/p/perspectiveproject/


More information about the Bf-funboard mailing list