[Bf-funboard] A needed node.

Patrik Andersson patrik.andersson.se at gmail.com
Mon Jul 1 21:14:37 CEST 2013


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

On Jul 1, 2013, at 8:29 PM, Knapp wrote:

> 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/
> _______________________________________________
> 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