[Bf-funboard] A needed node.

Patrik Andersson patrik.andersson.se at gmail.com
Tue Jul 2 07:52:31 CEST 2013


Well, just export my first script to .osl and provide the community with them, I think it does what you are asking for.

The first shader is a OSL shader/Node for random color depending on object. 

Link it with object-info->random, the rate make it possible to give a better spread for your randomness.

shader RandomColor(
    float objInd = 1.0,
    float rate = 1000.0,
    output color RColor = 0.8)
{   
    RColor = noise("cell",objInd*rate);
}

Eg. of a random number node, with a seed input, gives u a perlin-noise. Well I don't suggest to use this one, it is highly dependent on the seed value.

shader RandomNumber(
	float seed,
	output float rn = 1.0)
{
	rn = noise("perlin",seed);
}

Best regards

Patrik

On Jul 1, 2013, at 9:34 PM, Knapp wrote:

> On Mon, Jul 1, 2013 at 9:14 PM, Patrik Andersson <
> patrik.andersson.se at gmail.com> wrote:
> 
>> Well can't you just use the OSL standard function for noise? (see
>> https://github.com/imageworks/OpenShadingLanguage/raw/master/src/doc/osl-languagespec.pdf
>> )
>> 
>> It says that "noise" is able to return a random
>> colour/point/normal-vector. If you would like an object depending noise,
>> combine it object:random number with e.g. cellnoise.
>> 
>> An example is shown in built-in the "noise" template for osl-shaders.
>> 
>> Best regards
>> Patrik
> 
> 
> I have not had time to look at your idea but a big problem is that most
> artists simply want a random number and they know nothing of OSL.
> 
> 
> -- 
> 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/
> _______________________________________________
> Bf-funboard mailing list
> Bf-funboard at blender.org
> http://lists.blender.org/mailman/listinfo/bf-funboard



More information about the Bf-funboard mailing list