Browse files

Add bcm file for each sample render node setup

update readme to explain bcm files
also mention that some shaders are renderman shader conversions
  • Loading branch information...
1 parent 66000cd commit 1eec02929359f39aa1c9b522c5372717700c3ddf SAmbler committed Dec 19, 2012
View
11 README
@@ -1,10 +1,15 @@
This is a collection of osl shaders that I have found.
-For each shader you should find a script file, a small rendered preview file and a sample noodle image showing the node setup used for the preview render. The preview renders were generated using bmps.blend which is available from blenders svn repository at https://svn.blender.org/svnroot/bf-blender/trunk/lib/tests/rendering/cycles/blend_files/bmps.blend a copy is not included here due to size considerations.
-
This collection is intended for use with a version of blender that has been compiled with osl shading enabled. OSL was introduced into blender svn around November 2012 to be included in the 2.65 release. There is a good chance that these can also be adapted with minimum effort to other render engines that support OSL shaders.
+For each shader you should find a script file, a small rendered preview file and a sample noodle image showing the node setup used for the preview render as well as a bcm file (see below) to recreate the material. The preview renders were generated using bmps.blend which is available from blenders svn repository at https://svn.blender.org/svnroot/bf-blender/trunk/lib/tests/rendering/cycles/blend_files/bmps.blend a copy is not included here due to size considerations.
+
+BCM files are used by Online Material Library (OML) by Peter Cassetta and include the osl script as well as the node setup used for the sample render. The OML addon isn't included with official releases but is included with most svn builds from graphicall. To add manually see --
+http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Material/Online_Material_Library
+for more details.
+From the OML Panel click the tools button and either open a local bcm file or open the file with blenders text editor and read bcm data from text block. Once you apply it to active you will have the node tree all setup for you ready to render.
+
To make use of OSL in blender -
1. Enable cycles as the render engine
@@ -14,7 +19,7 @@ To make use of OSL in blender -
If you don't have the Open Shading Language option then you need to get a blender build that has OSL enabled.
-Most shaders here can be found elsewhere on the web, I am just collecting them here and providing some conversion to be used in blender if needed.
+Some shaders here can be found elsewhere on the web, I am just collecting them here and providing some conversion to be used in blender if needed. Others are renderman shaders that I have converted to blender osl format.
DISCLAIMER:
While I try and find relevant licensing info and keep it with each shader I cannot guarantee that you are totally free to use these shaders the way you plan. It is up to you to make sure you use these within any legal bounds.
View
42 cloth/MAweave/MAweave.osl.bcm
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.80000, 0.80000, 0.80000)" sample_lamp="True">
+ <nodes>
+ <node type="MIX_RGB" blend_type="SCREEN" use_clamp="False" fac="0.15000" color1="rgba(0.29999, 0.11030, 0.09969, 1.0)" color2="rgba(0.5, 0.5, 0.5, 1.0)" loc="-245, 168" />
+ <node type="MIX_RGB" blend_type="SCREEN" use_clamp="False" fac="0.15000" color1="rgba(0.5, 0.39131, 0.19054, 1.0)" color2="rgba(0.5, 0.5, 0.5, 1.0)" loc="-244, 364" />
+ <node type="MAPPING" translation="Vector(0.0, 0.0, 0.0)" rotation="Vector(0.0, 0.0, 0.0)" scale="Vector(50.0, 50.0, 50.0)" use_min="False" use_max="False" vector="Vector(0.0, 0.0, 0.0)" loc="-541, 439" />
+ <node type="BSDF_DIFFUSE" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.0" loc="232, 423" />
+ <node type="OUTPUT_MATERIAL" loc="843, 297" />
+ <node type="MIX_SHADER" fac="0.5" loc="634, 332" />
+ <node type="MIX_SHADER" fac="0.15999" loc="424, 408" />
+ <node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.80000, 0.61282, 0.55566, 1.0)" roughness="0.20000" loc="396, 264" />
+ <node type="MATH" operation="POWER" use_clamp="False" value1="0.5" value2="0.5" loc="475, 107" />
+ <node type="MATH" operation="SUBTRACT" use_clamp="False" value1="0.5" value2="0.5" loc="311, 102" />
+ <node type="MATH" operation="ADD" use_clamp="False" value1="0.5" value2="0.5" loc="650, 142" />
+ <node type="TEX_COORD" dupli="False" loc="-764, 427" />
+ <node type="TEX_NOISE" scale="545.0" detail="2.0" distortion="5.0" loc="-477, 122" />
+ <node type="SCRIPT" mode="INTERNAL" script="0" warpcolor="rgba(0.80000, 0.0, 0.0, 1.0)" weftcolor="rgba(0.0, 0.80000, 0.0, 1.0)" skip="1" underrun="2" overrun="1" warpwidth="0.80000" weftwidth="0.79999" coordinates="Vector(0.0, 0.0, 0.0)" loc="-37, 410" />
+ </nodes>
+ <links>
+ <link to="2" input="0" from="11" output="2" />
+ <link to="0" input="2" from="12" output="1" />
+ <link to="1" input="2" from="12" output="1" />
+ <link to="13" input="1" from="0" output="0" />
+ <link to="13" input="0" from="1" output="0" />
+ <link to="13" input="7" from="2" output="0" />
+ <link to="4" input="0" from="5" output="0" />
+ <link to="5" input="1" from="6" output="0" />
+ <link to="6" input="1" from="3" output="0" />
+ <link to="3" input="0" from="13" output="0" />
+ <link to="5" input="2" from="7" output="0" />
+ <link to="4" input="2" from="10" output="0" />
+ <link to="10" input="0" from="8" output="0" />
+ <link to="8" input="0" from="9" output="0" />
+ <link to="10" input="1" from="12" output="1" />
+ <link to="9" input="1" from="13" output="2" />
+ </links>
+ <scripts>
+ <script name="MAweave.osl" id="0">
+/*<br /> weave shader by Michel J. Anders (c)2012<br /> license: cc-by-sa<br /> http://blenderthings.blogspot.com.au/2012/12/a-fabric-osl-shader-for-blender-cycles.html<br />*/<br /><br />#include &quot;stdosl.h&quot;<br /><br />// greatest common divisor<br />int gcd(int A, int B){<br /> int a=A, b=B;<br /> if (a == 0) { return b; }<br /> while (b != 0) {<br /> if (a &gt; b) {<br /> a = a - b;<br /> } else {<br /> b = b - a;<br /> }<br /> }<br /> return a;<br />}<br /><br />// smallest common multiple (assumes a, b &gt; 0 )<br />int scm(int a, int b){ return a*b/gcd(a,b); }<br /><br />shader MAweave(<br /> color WarpColor = color(0.8,0,0),<br /> color WeftColor = color(0,0.8,0),<br /> int skip = 1,<br /> int underrun = 1,<br /> int overrun = 1,<br /> float WarpWidth = 0.8,<br /> float WeftWidth = 0.8,<br /> vector Coordinates = 0,<br /> output color Color = 0,<br /> output int Index = 0,<br /> output float Dist = 0)<br />{<br /> int ny = underrun + overrun;<br /> int nx = scm(skip,ny);<br /> <br /> float x = mod(Coordinates[0],1.0);<br /> float y = mod(Coordinates[1],1.0);<br /> <br /> int ix = int(floor(x*nx));<br /> int iy = int(floor(y*ny));<br /> <br /> float cx = mod(x*nx,1.0);<br /> float cy = mod(y*ny,1.0);<br /> <br /> int top;<br /> top = ((iy+skip*ix)%ny) &lt; overrun;<br /> <br /> float lx = (1-WarpWidth)/2;<br /> float hx = 1-lx;<br /> float ly = (1-WeftWidth)/2;<br /> float hy = 1-lx;<br /> <br /> if (top) {<br /> if ( cx &gt; lx &amp;&amp; cx &lt; hx ){<br /> Index = 1;<br /> Color = WarpColor;<br /> Dist = abs(0.5-cx);<br /> } else if (cy &gt; ly &amp;&amp; cy &lt; hy ){<br /> Index = 2;<br /> Color = WeftColor;<br /> Dist = abs(0.5-cy);<br /> }<br /> } else {<br /> if (cy &gt; ly &amp;&amp; cy &lt; hy ){<br /> Index = 2;<br /> Color = WeftColor;<br /> Dist = abs(0.5-cy); <br /> } else if ( cx &gt; lx &amp;&amp; cx &lt; hx ){<br /> Index = 1;<br /> Color = WarpColor;<br /> Dist = abs(0.5-cx); <br /> }<br /> }<br />}<br /><br />
+ </script>
+ </scripts>
+</material>
View
19 patterns/LGHexTile/LGHexTile.osl.bcm
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.80000, 0.80000, 0.80000)" sample_lamp="True">
+ <nodes>
+ <node type="OUTPUT_MATERIAL" loc="17, 420" />
+ <node type="TEX_COORD" dupli="False" loc="-885, 347" />
+ <node type="SCRIPT" mode="INTERNAL" script="0" vector="Vector(0.0, 0.0, 0.0)" diffuseamt="0.70000" specularamt="0.10000" roughness="0.19999" specularcolor="rgba(1.0, 1.0, 1.0, 1.0)" tilecolor="rgba(0.55000, 0.04777, 0.06694, 1.0)" mortarcolor="rgba(0.12053, 0.13075, 0.39999, 1.0)" tileradius="0.20000" mortarwidth="0.01999" tilevary="1.0" scuffing="0.70000" scufffrequency="4.0" scuffcolor="rgba(0.05000, 0.05000, 0.05000, 1.0)" stains="0.60000" stainfrequency="2.0" loc="-269, 467" />
+ <node type="MAPPING" translation="Vector(0.0, 0.0, 0.0)" rotation="Vector(0.0, 0.0, 0.0)" scale="Vector(10.0, 10.0, 10.0)" use_min="False" use_max="False" vector="Vector(0.0, 0.0, 0.0)" loc="-626, 392" />
+ </nodes>
+ <links>
+ <link to="0" input="0" from="2" output="0" />
+ <link to="2" input="0" from="3" output="0" />
+ <link to="3" input="0" from="1" output="2" />
+ </links>
+ <scripts>
+ <script name="LGHexTile.osl" id="0">
+/*<br /> * hextile.sl -- surface shader for hexagonal tiles in st space<br /> *<br /> * DESCRIPTION<br /> * This surface shader operates in s-t space and gives a pattern of<br /> * hexagonal tiles, similar to that found as floor patterns in public<br /> * places and such.<br /> * The basic pattern is a hexagonal tiling, with a little bit of<br /> * color variation from tile to tile. On top of that is some staining<br /> * (presumably due to water or something), which darkens the tile or<br /> * mortar underneath it. Finally, there is Scuffing due to people's<br /> * shoes, which really only affects the tile part not the mortar part.<br /> *<br /> *<br /> * PARAMTERS<br /> * DiffuseAmt, SpecularAmt, Roughness, SpecularColor - work just like plastic<br /> * TileColor - the color of the tiles<br /> * MortarColor - the color of the mortar (space between the tiles)<br /> * TileRadius - the &quot;radius&quot; (in s-t units) of a single tile<br /> * MortarWidth - the width of the mortar (in s-t units)<br /> * TileVary - the color variance from tile to tile<br /> *<br /> * ANTIALIASING<br /> * Some rudimentary antialiasing is performed on the borders between<br /> * tile and mortar.<br /> *<br /> * HINTS &amp; APPLICATIONS<br /> * If all of the default parameters are used, the tiles look just like<br /> * the floors in the public areas of the Washington DC subway system.<br /> *<br /> * AUTHOR: written by Larry Gritz, 1994<br /> *<br /> * HISTORY:<br /> * 15 Feb 1994 -- written by lg<br /> * Dec 2012 -- converted/hacked to OSL by varkenvarken<br /> * 17 Dec 2012 -- rename inputs by SAmbler<br /> *<br /> * last modified 15 Feb 94 by Larry Gritz<br /> */<br /><br />shader<br />LGHexTile (<br /> point Vector = P,<br /> float DiffuseAmt = .5,<br /> float SpecularAmt = .2,<br /> float Roughness = .1,<br /> color SpecularColor = 1,<br /> color TileColor = color(.55,0,0),<br /> color MortarColor = color(.5,.5,.5),<br /> float TileRadius = 0.2,<br /> float MortarWidth = 0.02,<br /> float TileVary = 0.15,<br /> float Scuffing = 0.5,<br /> float ScuffFrequency = 4,<br /> color ScuffColor = color (.05,.05,.05),<br /> float Stains = 0.4,<br /> float StainFrequency = 2,<br /> output closure color BSDF = diffuse(N)<br />)<br />{<br /> #define snoise(x) (2*noise(x)-1)<br /> #define snoise2(x,y) (2*noise((x),(y))-1)<br /> #define MINFILTERWIDTH 1.0e-7<br /> #define M_SQRT3 1.7320508 /* sqrt(3) */<br /> <br /> point Nf;<br /> color Ct, Ctile;<br /> float tilewidth;<br /> float ss, tt;<br /> float ttile, stile;<br /> float x, y;<br /> float mortar;<br /> float swidth, twidth, sfuzz, tfuzz, fuzzmax;<br /> float mw2, mw2srt3;<br /> float tileindex;<br /> float stain, scuff;<br /> float ks;<br /><br /> float s = Vector[0];<br /> float t = Vector[1];<br /><br /> swidth = abs(Dx(s)) + abs(Dy(s));<br /> twidth = abs(Dx(t)) + abs(Dy(t));<br /> sfuzz = 0.5 * swidth;<br /> tfuzz = 0.5 * twidth;<br /> fuzzmax = max(sfuzz, tfuzz);<br /> Nf = N;<br /><br /> tilewidth = TileRadius * M_SQRT3;<br /> tt = mod (t, 1.5*TileRadius);<br /> ttile = floor(t/(1.5*TileRadius));<br /> if (mod(ttile/2, 1) == 0.5)<br /> ss = s + tilewidth/2;<br /> else ss = s;<br /> stile = floor(ss / tilewidth);<br /> ss = mod(ss, tilewidth);<br /> mortar = 0;<br /> mw2 = MortarWidth/2;<br /> if (tt &lt; TileRadius) {<br /> mortar = 1 - (smoothstep(mw2,mw2+sfuzz,ss) *<br /> (1 - smoothstep(tilewidth-mw2-sfuzz,tilewidth-mw2,ss)));<br /> }<br /> else {<br /> x = tilewidth/2 - abs(ss - tilewidth/2);<br /> y = M_SQRT3 * (tt - TileRadius);<br /> if (y &gt; x) {<br /> if (mod (ttile/2, 1) == 0.5)<br /> stile -= 1;<br /> ttile += 1;<br /> if (ss &gt; tilewidth/2)<br /> stile += 1;<br /> }<br /><br /> mw2srt3 = M_SQRT3*mw2;<br /> mortar = (smoothstep(x-mw2srt3-tfuzz, x-mw2srt3, y) *<br /> (1 - smoothstep(x+mw2srt3, x+mw2srt3+tfuzz, y)));<br /> }<br /><br /> tileindex = stile+41*ttile;<br /> Ctile = TileColor * (1 + TileVary * snoise(tileindex+0.5));<br /><br /> stain = Stains * smoothstep (.5,1, noise(s*StainFrequency,t*StainFrequency));<br /><br /> scuff = Scuffing * smoothstep (.6,1, noise(t*ScuffFrequency-90.26,s*ScuffFrequency+123.82));<br /><br /> ks = SpecularAmt * (1-scuff/2);<br /> Ct = (1-stain) * mix(mix(Ctile, ScuffColor, scuff), MortarColor, mortar);<br /><br /> Nf = normalize(N);<br /> BSDF = Ct*DiffuseAmt*diffuse(Nf);<br /> BSDF += SpecularColor*ks*microfacet_beckmann(Nf,Roughness);<br />}<br /><br />
+ </script>
+ </scripts>
+</material>
View
26 patterns/MABarbWire/MABarbWire.osl.bcm
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.80000, 0.80000, 0.80000)" sample_lamp="True">
+ <nodes>
+ <node type="SCRIPT" mode="INTERNAL" script="0" width="0.05000" turns="2" spiketurns="2" xscale="1.0" pos="Vector(0.0, 0.0, 0.0)" loc="-219, 356" />
+ <node type="BSDF_TRANSPARENT" color="rgba(1.0, 1.0, 1.0, 1.0)" loc="-224, 120" />
+ <node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.48658, 0.48658, 0.48658, 1.0)" roughness="0.20000" loc="-222, 41" />
+ <node type="MAPPING" translation="Vector(0.0, 0.0, 0.0)" rotation="Vector(0.0, 0.0, 0.0)" scale="Vector(15.0, 15.0, 15.0)" use_min="False" use_max="False" vector="Vector(0.0, 0.0, 0.0)" loc="-503, 315" />
+ <node type="TEX_COORD" dupli="False" loc="-702, 259" />
+ <node type="MIX_SHADER" fac="0.5" loc="-31, 231" />
+ <node type="OUTPUT_MATERIAL" loc="165, 323" />
+ </nodes>
+ <links>
+ <link to="6" input="0" from="5" output="0" />
+ <link to="6" input="2" from="0" output="1" />
+ <link to="5" input="0" from="0" output="0" />
+ <link to="0" input="4" from="3" output="0" />
+ <link to="3" input="0" from="4" output="2" />
+ <link to="5" input="1" from="1" output="0" />
+ <link to="5" input="2" from="2" output="0" />
+ </links>
+ <scripts>
+ <script name="MABarbWire.osl" id="0">
+/*<br /> Barbwire shader by Michel J. Anders (c)2012<br /> license: cc-by-sa<br /> http://blenderthings.blogspot.com.au/2012/12/a-barbwire-osl-shader-for-blender-cycles.html<br />*/<br /><br />#include &quot;stdosl.h&quot;<br /><br />float arc(float r){ return sqrt(0.25-(r-0.5)*(r-0.5)); }<br /><br />shader barbwire(<br /> float Width = 0.05,<br /> int Turns = 2,<br /> int Spiketurns = 2,<br /> float Xscale = 1,<br /> point Pos = P,<br /> output float Fac = 0,<br /> output float Displ = 0 )<br />{<br /> float x = mod(Pos[0],1);<br /> float y = mod(Pos[1],1);<br /><br /> if ( x &gt; 0.5 ) {<br /> x = 1 - x;<br /> y = 1 - y;<br /> }<br /><br /> float w = Width/2;<br /> float t = M_2PI*x*Turns;<br /><br /> float c = cos(t);<br /> float h = c*w+w;<br /> float l = c*w-w;<br /><br /> y -= 0.5;<br /> // the barb part<br /> float BWidth = Width*Xscale;<br /> float Lw = BWidth*(Spiketurns-1);<br /> float Hw = BWidth*Spiketurns;<br /> if ( x &gt; Lw &amp;&amp; x &lt; Hw &amp;&amp; y &gt; 1.5*Width &amp;&amp; y&lt;4*Width ) { // the spikey part<br /> if( y&lt;3*Width || y-3*Width &lt; x-Width){<br /> Fac = 1;<br /> Displ = arc(mod(x,BWidth)/BWidth);<br /> }<br /> } else if ( x &lt; Hw &amp;&amp; abs(y) &lt; 2*Width ){<br /> if ( abs(y) &gt; 1.5*Width) { // the rounded top and bottom parts<br /> if ( abs(y) - 1.5*Width &lt; w*arc(mod(x,BWidth)/BWidth) ){<br /> Fac = 1;<br /> Displ = arc(mod(x,BWidth)/BWidth);<br /> }<br /> } else { // the main part<br /> Fac = 1;<br /> Displ = arc(mod(x,BWidth)/BWidth);<br /> }<br /> }<br /> // the wire part<br /> else {<br /> // alternating top/bottom checks to get correct crossings<br /> if ( (int)(t/M_PI) % 2 == 1 ){<br /><br /> if ( y &gt; l &amp;&amp; y &lt; h ) {<br /> Fac = 1;<br /> Displ = arc((y-l)/Width);<br /> } else if ( -y &gt; l &amp;&amp; -y &lt; h ) {<br /> Fac = 1;<br /> Displ = arc((-y-l)/Width);<br /> }<br /><br /> } else {<br /><br /> if ( -y &gt; l &amp;&amp; -y &lt; h ) {<br /> Fac = 1;<br /> Displ = arc((-y-l)/Width);<br /> } else if ( y &gt; l &amp;&amp; y &lt; h ) {<br /> Fac = 1;<br /> Displ = arc((y-l)/Width);<br /> }<br /> }<br /> }<br />}<br /><br />
+ </script>
+ </scripts>
+</material>
View
26 patterns/MAChainLink/MAChainLink.osl.bcm
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.80000, 0.80000, 0.80000)" sample_lamp="True">
+ <nodes>
+ <node type="MAPPING" translation="Vector(0.0, 0.0, 0.0)" rotation="Vector(0.0, 0.0, 0.0)" scale="Vector(30.0, 30.0, 30.0)" use_min="False" use_max="False" vector="Vector(0.0, 0.0, 0.0)" loc="-718, 291" />
+ <node type="SCRIPT" mode="INTERNAL" script="0" vector="Vector(0.0, 0.0, 0.0)" width="0.05000" loc="-417, 331" />
+ <node type="BSDF_TRANSPARENT" color="rgba(1.0, 1.0, 1.0, 1.0)" loc="-415, 151" />
+ <node type="BSDF_GLOSSY" distribution="GGX" color="rgba(0.47248, 0.47248, 0.47248, 1.0)" roughness="0.30000" loc="-423, 64" />
+ <node type="TEX_COORD" dupli="False" loc="-942, 196" />
+ <node type="OUTPUT_MATERIAL" loc="-58, 331" />
+ <node type="MIX_SHADER" fac="0.5" loc="-233, 233" />
+ </nodes>
+ <links>
+ <link to="5" input="2" from="1" output="1" />
+ <link to="5" input="0" from="6" output="0" />
+ <link to="6" input="0" from="1" output="0" />
+ <link to="6" input="1" from="2" output="0" />
+ <link to="1" input="0" from="0" output="0" />
+ <link to="0" input="0" from="4" output="2" />
+ <link to="6" input="2" from="3" output="0" />
+ </links>
+ <scripts>
+ <script name="MAChainLink.osl" id="0">
+/*<br /> Chainlink shader by Michel J. Anders (c)2012<br /> license: cc-by-sa<br /> http://blenderthings.blogspot.com.au/2012/12/a-chainlink-fence-osl-shader-for.html<br />*/<br /><br />#include &quot;stdosl.h&quot;<br /><br />float arc(float x){ return sqrt(1-(x-0.5)*(x-0.5)/0.25); }<br /><br />shader chainlink(<br /> point Vector = P,<br /> float Width = 0.05,<br /> output float Fac = 0,<br /> output float Displ = 0<br />){<br /> float x = mod(Vector[0],1);<br /> float y = mod(Vector[1],1);<br /> float ox = x ;<br /> float oy = y ;<br /> x += Width * (0.5 - oy );<br /> y -= Width * (ox - 0.5 );<br /><br /> if ( y &gt; 0.5 ){<br /> y = 1 - y;<br /> x = 1 - x;<br /> }<br /> if ( x &gt; 0.5 ){<br /> if ( y &gt; 0.5 - Width ){<br /> Fac = 1;<br /> Displ = arc((y-(0.5-Width))/Width);<br /> }else if (x &lt; 0.5 + Width) {<br /> Fac = 1;<br /> Displ = arc((x-0.5)/Width);<br /> }else{<br /> float r = hypot(x-0.5,y-0.5);<br /> if (r &lt; Width) {<br /> Fac = 1;<br /> Displ = arc(r/Width);<br /> }<br /> }<br /> }<br />}<br /><br />
+ </script>
+ </scripts>
+</material>
View
55 patterns/MAFingerprint/MAFingerprint.osl.bcm
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.80000, 0.80000, 0.80000)" sample_lamp="True">
+ <nodes>
+ <node type="VALTORGB" interpolation="LINEAR" fac="0.5" stops="2" stop1="0.0|rgba(0.0, 0.0, 0.0, 1.0)" stop2="1.0|rgba(1.0, 1.0, 1.0, 1.0)" loc="8, 456" />
+ <node type="TEX_NOISE" scale="5.0" detail="2.0" distortion="0.0" loc="-195, 467" />
+ <node type="MATH" operation="GREATER_THAN" use_clamp="False" value1="0.5" value2="0.0" loc="-129, -8" />
+ <node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="0.5" loc="20, 118" />
+ <node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="0.5" loc="163, 242" />
+ <node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="0.5" loc="303, 403" />
+ <node type="MATH" operation="LESS_THAN" use_clamp="False" value1="0.5" value2="0.20000" loc="451, 326" />
+ <node type="BSDF_DIFFUSE" color="rgba(1.0, 1.0, 1.0, 1.0)" roughness="0.0" loc="180, 83" />
+ <node type="MIX_SHADER" fac="0.79999" loc="373, 95" />
+ <node type="MIX_SHADER" fac="0.5" loc="606, 201" />
+ <node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.10000" loc="178, -39" />
+ <node type="BSDF_TRANSPARENT" color="rgba(1.0, 1.0, 1.0, 1.0)" loc="376, -48" />
+ <node type="MATH" operation="SINE" use_clamp="False" value1="0.5" value2="1.0" loc="-272, 138" />
+ <node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="24.0" loc="-419, 137" />
+ <node type="SCRIPT" mode="INTERNAL" script="0" vector="Vector(0.0, 0.0, 0.0)" scale="1.0" ridges="50" seed="42" loc="-588, 137" />
+ <node type="SCRIPT" mode="INTERNAL" script="1" vector="Vector(0.0, 0.0, 0.0)" center="Vector(0.5, 0.5, 0.5)" radius="0.15000" ellipse="0.90000" rotation="10.0" blur="1.0" loc="-593, 388" />
+ <node type="TEX_COORD" dupli="False" loc="-1050, 186" />
+ <node type="MAPPING" translation="Vector(-0.49999, 0.09999, 0.0)" rotation="Vector(0.08726, 0.10471, 0.03490)" scale="Vector(1.89999, 1.89999, 1.89999)" use_min="False" use_max="False" vector="Vector(0.0, 0.0, 0.0)" loc="-865, 265" />
+ <node type="OUTPUT_MATERIAL" loc="811, 307" />
+ </nodes>
+ <links>
+ <link to="18" input="0" from="9" output="0" />
+ <link to="0" input="0" from="1" output="1" />
+ <link to="5" input="0" from="0" output="0" />
+ <link to="6" input="0" from="5" output="0" />
+ <link to="5" input="1" from="4" output="0" />
+ <link to="4" input="0" from="15" output="0" />
+ <link to="13" input="0" from="14" output="0" />
+ <link to="12" input="0" from="13" output="0" />
+ <link to="3" input="0" from="12" output="0" />
+ <link to="2" input="0" from="12" output="0" />
+ <link to="3" input="1" from="2" output="0" />
+ <link to="4" input="1" from="3" output="0" />
+ <link to="9" input="2" from="11" output="0" />
+ <link to="9" input="1" from="8" output="0" />
+ <link to="8" input="2" from="10" output="0" />
+ <link to="8" input="1" from="7" output="0" />
+ <link to="18" input="2" from="5" output="0" />
+ <link to="17" input="0" from="16" output="2" />
+ <link to="9" input="0" from="6" output="0" />
+ <link to="14" input="0" from="17" output="0" />
+ <link to="15" input="0" from="17" output="0" />
+ </links>
+ <scripts>
+ <script name="MAFingerprint.osl" id="0">
+/*<br /> fingerprint pattern by Michel J. Anders (c)2012<br /> license: cc-by-sa<br /> http://blenderthings.blogspot.com.au/2012/12/a-fingerprint-osl-shader-for-blender.html<br />*/<br /><br />#include &quot;stdosl.h&quot;<br />#include &quot;node_texture.h&quot;<br /><br />shader MAFingerprint(<br /> point Vector = P,<br /> float Scale = 1.0,<br /> int Ridges = 5,<br /> int Seed = 42,<br /> output float Fac = 0.0 )<br />{<br /> float da;<br /> point pa;<br /> float d;<br /><br /> vector up = vector(0,0,1);<br /> vector tdir = 0;<br /><br /> int pi;<br /><br /> for(pi=0; pi&lt; Ridges; pi++){<br /> pa = Scale * point(<br /> cellnoise(point(pi,pi,pi)),<br /> cellnoise(point(pi,pi+Seed,pi)),<br /> cellnoise(point(pi,pi,pi+Seed)));<br /> da = pa[2];<br /> vector v = pa - Vector;<br /> float d = length(v);<br /> v[2]=0;<br /> v = normalize(v);<br /> tdir += cross(v,up)*da*d;<br /> }<br /> Fac = sqrt(dot(tdir,tdir));<br />}<br /><br />
+ </script>
+ <script name="MAEllipseMask.osl" id="1">
+/*<br /> ellipse mask by Michel J. Anders (c)2012<br /> license: cc-by-sa<br /> http://blenderthings.blogspot.com.au/2012/12/a-fingerprint-osl-shader-for-blender.html<br />*/<br /><br />#include &quot;stdosl.h&quot;<br /><br />shader MAEllipseMask(<br /> point Vector = P,<br /> point Center = 0.5,<br /> float Radius = 0.5,<br /> float Ellipse = 1.0,<br /> float Rotation = 0.0,<br /> float Blur = 0.0,<br /> output float Fac = 0.0 )<br />{<br /> point p = rotate(Vector,radians(Rotation),Center,Center+vector(0,0,1));<br /> vector d = p - Center;<br /> d[0] *= Ellipse;<br /> float r2 = d[0]*d[0]+d[1]*d[1];<br /> if (r2 &lt;= Radius*Radius) {<br /> Fac = 1-Blur*sqrt(r2/(Radius*Radius));<br /> }<br />}<br /><br />
+ </script>
+ </scripts>
+</material>
View
33 patterns/MAhexagon/MAhexagon.osl-2.bcm
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.80000, 0.80000, 0.80000)" sample_lamp="True">
+ <nodes>
+ <node type="MAPPING" translation="Vector(0.0, 0.0, 0.0)" rotation="Vector(0.0, 0.0, 0.0)" scale="Vector(80.0, 80.0, 80.0)" use_min="False" use_max="False" vector="Vector(0.0, 0.0, 0.0)" loc="-765, 418" />
+ <node type="SCRIPT" mode="INTERNAL" script="0" diffuse_color1="rgba(0.20000, 0.80000, 0.20000, 1.0)" diffuse_color2="rgba(0.80000, 0.20000, 0.20000, 1.0)" diffuse_color3="rgba(0.20000, 0.20000, 0.80000, 1.0)" coordinates="Vector(0.0, 0.0, 0.0)" loc="-454, 343" />
+ <node type="VALTORGB" interpolation="B_SPLINE" fac="0.5" stops="3" stop1="0.80454|rgba(1.0, 1.0, 1.0, 1.0)" stop2="0.90227|rgba(0.16354, 0.16354, 0.16354, 1.0)" stop3="1.0|rgba(0.0, 0.0, 0.0, 1.0)" loc="-158, 314" />
+ <node type="VALTORGB" interpolation="CARDINAL" fac="0.5" stops="2" stop1="0.81363|rgba(0.0, 0.0, 0.0, 1.0)" stop2="0.90909|rgba(1.0, 1.0, 1.0, 1.0)" loc="-157, 555" />
+ <node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="0.60000" loc="-112, 49" />
+ <node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.88280, 0.88280, 0.88280, 1.0)" roughness="0.09999" loc="104, 233" />
+ <node type="BSDF_TRANSPARENT" color="rgba(1.0, 1.0, 1.0, 1.0)" loc="112, 317" />
+ <node type="TEX_COORD" dupli="False" loc="-962, 354" />
+ <node type="MIX_SHADER" fac="0.09999" loc="350, 349" />
+ <node type="OUTPUT_MATERIAL" loc="552, 199" />
+ </nodes>
+ <links>
+ <link to="9" input="0" from="8" output="0" />
+ <link to="8" input="2" from="5" output="0" />
+ <link to="0" input="0" from="7" output="2" />
+ <link to="4" input="0" from="1" output="2" />
+ <link to="9" input="2" from="4" output="0" />
+ <link to="1" input="3" from="0" output="0" />
+ <link to="6" input="0" from="2" output="0" />
+ <link to="8" input="1" from="6" output="0" />
+ <link to="2" input="0" from="1" output="2" />
+ <link to="8" input="0" from="3" output="0" />
+ <link to="3" input="0" from="1" output="2" />
+ </links>
+ <scripts>
+ <script name="MAhexagon.osl" id="0">
+/*<br /> hexagon shader by Michel J. Anders (c)2012<br /> license: cc-by-sa<br /> http://blenderthings.blogspot.co.uk/2012/11/a-hexagon-osl-shader.html<br />*/<br /><br />#include &quot;stdosl.h&quot;<br /><br />#define A 0.86602540378443864676372317075294 // sqrt(3)/2<br />#define A2 (2*A)<br />#define A4 (4*A)<br />#define SY (1/A)<br /> <br />shader MAhexagon( <br /> color Diffuse_Color1 = color(0.2, 0.8, 0.2),<br /> color Diffuse_Color2 = color(0.8, 0.2, 0.2),<br /> color Diffuse_Color3 = color(0.2, 0.2, 0.8),<br /> vector Coordinates = 0,<br /> output color Color = 0,<br /> output int Index = 1,<br /> output float Distance = 0)<br />{ <br /> // calculate the color<br /> <br /> color colors[3] = {Diffuse_Color1,<br /> Diffuse_Color2,<br /> Diffuse_Color3};<br /> <br /> // we warp the grid so that two adjacent equilateral triangles<br /> // are mapped to two triangles that fit in a square <br /> float syc = Coordinates[1] * SY;<br /> float sxc = Coordinates[0] + 0.5 * syc;<br /> <br /> int ind[18] = {1,1,3,3,3,1, 2,2,2,3,3,3, 1,2,2,2,1,1};<br /> <br /> int iy = int(mod(syc,3.0));<br /> int ix = int(mod(sxc,3.0));<br /> ix = iy * 6 + ix * 2 + ( mod(sxc,1.0) &gt; mod(syc,1.0) );<br /> Index = ind[ix];<br /> Color = colors[Index-1];<br /> <br /> // calculate the distance to the center of the hexagon<br /> <br /> float sx = mod(Coordinates[0],3);<br /> float sy = mod(Coordinates[1]+0.75,A4);<br /> <br /> // map everthing to a single quadrant<br /> if ( sx &gt; 1.5 ) sx = 3 - sx;<br /> if ( sy &gt; A2 ) sy = A4 - sy;<br /> <br /> // the distance were interested in is the distance to<br /> // the *closest* center point<br /> float d1 = distance(vector(sx,sy,0),vector(1.5,A2,0));<br /> float d2 = distance(vector(sx,sy,0),vector(0,A,0));<br /> float d6 = distance(vector(sx,sy,0),vector(1.5,0,0));<br /> <br /> Distance = min(min(d1,d2), d6);<br /> <br />}<br /><br />
+ </script>
+ </scripts>
+</material>
View
28 patterns/MAhexagon/MAhexagon.osl.bcm
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.80000, 0.80000, 0.80000)" sample_lamp="True">
+ <nodes>
+ <node type="MAPPING" translation="Vector(0.0, 0.0, 0.0)" rotation="Vector(0.0, 0.0, 0.0)" scale="Vector(80.0, 80.0, 80.0)" use_min="False" use_max="False" vector="Vector(0.0, 0.0, 0.0)" loc="-765, 418" />
+ <node type="SCRIPT" mode="INTERNAL" script="0" diffuse_color1="rgba(0.20000, 0.80000, 0.20000, 1.0)" diffuse_color2="rgba(0.80000, 0.20000, 0.20000, 1.0)" diffuse_color3="rgba(0.20000, 0.20000, 0.80000, 1.0)" coordinates="Vector(0.0, 0.0, 0.0)" loc="-454, 343" />
+ <node type="TEX_COORD" dupli="False" loc="-1007, 347" />
+ <node type="BSDF_DIFFUSE" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.09999" loc="-186, 376" />
+ <node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="0.60000" loc="-215, 79" />
+ <node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.88280, 0.88280, 0.88280, 1.0)" roughness="0.09999" loc="-165, 244" />
+ <node type="MIX_SHADER" fac="0.09999" loc="39, 363" />
+ <node type="OUTPUT_MATERIAL" loc="239, 266" />
+ </nodes>
+ <links>
+ <link to="7" input="0" from="6" output="0" />
+ <link to="6" input="2" from="5" output="0" />
+ <link to="4" input="0" from="1" output="2" />
+ <link to="7" input="2" from="4" output="0" />
+ <link to="1" input="3" from="0" output="0" />
+ <link to="6" input="1" from="3" output="0" />
+ <link to="3" input="0" from="1" output="0" />
+ <link to="0" input="0" from="2" output="2" />
+ </links>
+ <scripts>
+ <script name="MAhexagon.osl" id="0">
+/*<br /> hexagon shader by Michel J. Anders (c)2012<br /> license: cc-by-sa<br /> http://blenderthings.blogspot.co.uk/2012/11/a-hexagon-osl-shader.html<br />*/<br /><br />#include &quot;stdosl.h&quot;<br /><br />#define A 0.86602540378443864676372317075294 // sqrt(3)/2<br />#define A2 (2*A)<br />#define A4 (4*A)<br />#define SY (1/A)<br /> <br />shader MAhexagon( <br /> color Diffuse_Color1 = color(0.2, 0.8, 0.2),<br /> color Diffuse_Color2 = color(0.8, 0.2, 0.2),<br /> color Diffuse_Color3 = color(0.2, 0.2, 0.8),<br /> vector Coordinates = 0,<br /> output color Color = 0,<br /> output int Index = 1,<br /> output float Distance = 0)<br />{ <br /> // calculate the color<br /> <br /> color colors[3] = {Diffuse_Color1,<br /> Diffuse_Color2,<br /> Diffuse_Color3};<br /> <br /> // we warp the grid so that two adjacent equilateral triangles<br /> // are mapped to two triangles that fit in a square <br /> float syc = Coordinates[1] * SY;<br /> float sxc = Coordinates[0] + 0.5 * syc;<br /> <br /> int ind[18] = {1,1,3,3,3,1, 2,2,2,3,3,3, 1,2,2,2,1,1};<br /> <br /> int iy = int(mod(syc,3.0));<br /> int ix = int(mod(sxc,3.0));<br /> ix = iy * 6 + ix * 2 + ( mod(sxc,1.0) &gt; mod(syc,1.0) );<br /> Index = ind[ix];<br /> Color = colors[Index-1];<br /> <br /> // calculate the distance to the center of the hexagon<br /> <br /> float sx = mod(Coordinates[0],3);<br /> float sy = mod(Coordinates[1]+0.75,A4);<br /> <br /> // map everthing to a single quadrant<br /> if ( sx &gt; 1.5 ) sx = 3 - sx;<br /> if ( sy &gt; A2 ) sy = A4 - sy;<br /> <br /> // the distance were interested in is the distance to<br /> // the *closest* center point<br /> float d1 = distance(vector(sx,sy,0),vector(1.5,A2,0));<br /> float d2 = distance(vector(sx,sy,0),vector(0,A,0));<br /> float d6 = distance(vector(sx,sy,0),vector(1.5,0,0));<br /> <br /> Distance = min(min(d1,d2), d6);<br /> <br />}<br /><br />
+ </script>
+ </scripts>
+</material>
View
32 patterns/MAscales/MAscales.osl.bcm
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.80000, 0.80000, 0.80000)" sample_lamp="True">
+ <nodes>
+ <node type="MAPPING" translation="Vector(0.0, 0.0, 0.0)" rotation="Vector(0.0, 0.0, 0.0)" scale="Vector(60.0, 60.0, 60.0)" use_min="False" use_max="False" vector="Vector(0.0, 0.0, 0.0)" loc="-486, 554" />
+ <node type="SCRIPT" mode="INTERNAL" script="0" diffuse_color1="rgba(0.20000, 0.80000, 0.20000, 1.0)" diffuse_color2="rgba(0.80000, 0.20000, 0.20000, 1.0)" coordinates="Vector(0.0, 0.0, 0.0)" n="0.0" loc="-138, 556" />
+ <node type="TEX_MUSGRAVE" musgrave="FBM" scale="0.48800" detail="4.80000" dimension="2.0" lacunarity="1.0" offset="0.0" gain="1.0" loc="163, 618" />
+ <node type="VALTORGB" interpolation="CONSTANT" fac="0.5" stops="4" stop1="0.0|rgba(0.02624, 0.00802, 0.04817, 1.0)" stop2="0.11818|rgba(1.0, 1.0, 1.0, 1.0)" stop3="0.81363|rgba(0.79910, 0.43965, 0.13563, 1.0)" stop4="1.0|rgba(0.79910, 0.43965, 0.13563, 1.0)" loc="424, 643" />
+ <node type="OUTPUT_MATERIAL" loc="1161, 405" />
+ <node type="TEX_COORD" dupli="False" loc="-725, 478" />
+ <node type="BSDF_DIFFUSE" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.0" loc="729, 610" />
+ <node type="MIX_SHADER" fac="0.11999" loc="976, 560" />
+ <node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.20000" loc="727, 475" />
+ <node type="INVERT" fac="1.0" color="rgba(0.0, 0.0, 0.0, 1.0)" loc="199, 287" />
+ </nodes>
+ <links>
+ <link to="1" input="2" from="0" output="0" />
+ <link to="2" input="0" from="1" output="3" />
+ <link to="4" input="0" from="7" output="0" />
+ <link to="7" input="1" from="6" output="0" />
+ <link to="7" input="2" from="8" output="0" />
+ <link to="6" input="0" from="3" output="0" />
+ <link to="3" input="0" from="2" output="1" />
+ <link to="9" input="1" from="1" output="2" />
+ <link to="4" input="2" from="9" output="0" />
+ <link to="0" input="0" from="5" output="2" />
+ </links>
+ <scripts>
+ <script name="MAscales.osl" id="0">
+/*<br /> scales shader by Michel J. Anders (c)2012<br /> license: cc-by-sa<br /> http://blenderthings.blogspot.co.uk/2012/11/a-scales-osl-shader-for-blender.html<br />*/<br /><br />#include &quot;stdosl.h&quot;<br /><br />shader MAscales(<br /> color Diffuse_Color1 = color(0.2, 0.8, 0.2),<br /> color Diffuse_Color2 = color(0.8, 0.2, 0.2),<br /> vector Coordinates = 0,<br /> float n = 0,<br /> output color Color = 0,<br /> output int Index = 1,<br /> output float Distance = 0,<br /> output vector Vindex = 0)<br />{<br /> float sx = mod(Coordinates[0],1);<br /> float sy = mod(Coordinates[1],1);<br /> <br /> vector p = vector(sx,sy,0);<br /> vector p0 = vector(0.5,0,0);<br /> vector p1 = vector(0.5,1,0);<br /> vector p2 = vector(0,0.5,0);<br /> vector p3 = vector(1,0.5,0);<br /> <br /> vector cell = vector(floor(Coordinates[0]),floor(Coordinates[1]),0);<br /> int oddx = int(cell[0])%2;<br /> int oddy = int(cell[1])%2;<br /> <br /> float dist(vector a, vector b, float n){<br /> float x = b[0]-a[0];<br /> float y = b[1]-a[1];<br /> float r2 = x*x+y*y;<br /> if ( n != 0.0 ) {<br /> float theta = atan2(y,x);<br /> float cost, sint;<br /> sincos(theta, sint, cost);<br /> float cost2= cos(theta*2);<br /> float Y = pow(abs(sint),1+n*(1-cost2*cost2));<br /> r2 /= cost*cost+Y*Y;<br /> }<br /> return sqrt(r2);<br /> }<br /> <br /> float d1 = dist(p,p0,n);<br /> if ( d1&lt;=0.5 ){<br /> Color = Diffuse_Color1;<br /> Index = 0 ;<br /> Distance = d1;<br /> Vindex = cell + p0;<br /> } else {<br /> float d2 = dist(p,p2,n);<br /> float d3 = dist(p,p3,n);<br /> if ( d2 &lt;= 0.5 ) {<br /> Color = Diffuse_Color2;<br /> Index = 1;<br /> Distance = d2;<br /> Vindex = cell + p2;<br /> } else if ( d3 &lt;= 0.5 ) {<br /> Color = Diffuse_Color2;<br /> Index = 1;<br /> Distance = d3;<br /> Vindex = cell + p3;<br /> } else {<br /> Color = Diffuse_Color1;<br /> Index = 0;<br /> Distance = dist(p,p1,n);<br /> Vindex = cell + p1;<br /> }<br /> }<br />}<br /><br />
+ </script>
+ </scripts>
+</material>
View
23 patterns/MRMandelbrot/MRMandelbrot.osl.bcm
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.80000, 0.80000, 0.80000)" sample_lamp="True">
+ <nodes>
+ <node type="SCRIPT" mode="INTERNAL" script="0" vector="Vector(0.0, 0.0, 0.0)" maxiteration="500" loc="-625, 412" />
+ <node type="VALTORGB" interpolation="EASE" fac="0.5" stops="7" stop1="0.0|rgba(1.0, 0.0, 0.0, 1.0)" stop2="0.16818|rgba(1.0, 0.21223, 0.0, 1.0)" stop3="0.32727|rgba(1.0, 1.0, 0.0, 1.0)" stop4="0.5|rgba(0.0, 1.0, 0.0, 1.0)" stop5="0.66818|rgba(0.0, 0.0, 1.0, 1.0)" stop6="0.83636|rgba(0.07036, 0.0, 0.22322, 1.0)" stop7="1.0|rgba(0.27467, 0.0, 1.0, 1.0)" loc="-392, 413" />
+ <node type="BSDF_DIFFUSE" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.0" loc="-104, 408" />
+ <node type="OUTPUT_MATERIAL" loc="92, 399" />
+ <node type="MAPPING" translation="Vector(0.0, 0.0, 0.0)" rotation="Vector(0.0, 0.0, 0.0)" scale="Vector(20.0, 20.0, 20.0)" use_min="False" use_max="False" vector="Vector(0.0, 0.0, 0.0)" loc="-902, 392" />
+ <node type="TEX_COORD" dupli="False" loc="-1089, 374" />
+ </nodes>
+ <links>
+ <link to="4" input="0" from="5" output="2" />
+ <link to="1" input="0" from="0" output="0" />
+ <link to="0" input="0" from="4" output="0" />
+ <link to="2" input="0" from="1" output="0" />
+ <link to="3" input="0" from="2" output="0" />
+ </links>
+ <scripts>
+ <script name="MRMandelbrot.osl" id="0">
+/*<br /> * MRmand.sl -- Mandelbrot texture<br /> * MRmandelbrot.osl<br /> *<br /> * DESCRIPTION:<br /> * Creates a Mandelbrot set as a texture<br /> *<br /> * PARAMETERS:<br /> * Vector -- texture coordinates<br /> * maxIterations -- maximum loops to calculate the factor<br /> * smaller values give less colour variation<br /> *<br /> * HINTS:<br /> * Feed the factor into a colorRamp to control the colour being fed into the next node.<br /> *<br /> * AUTHOR: Michael Rivero<br /> * rivero AT squareusa DOT com <br /> *<br /> * History:<br /> * Created: 12/18/98<br /> * 17/12/2012 - converted to blender osl shader by Shane Ambler<br /> *<br /> */<br /><br /><br />surface MRMandelbrot (<br /> point Vector = P,<br /> int maxiteration = 500,<br /> output float Fac = 1.0 )<br />{<br /> float lt;<br /> float ls;<br /><br /> /* Map the U and V values to the bounds of the Mandelbrot set. */<br /><br /> ls = mod(Vector[1], 1.0);<br /> lt = mod(Vector[0], 1.0);<br /><br /> float real = ( ls * 3.0 ) - 2.0;<br /> float imag = ( lt * 3.0 ) - 1.5;<br /> float tmpval;<br /> float got_away = 0, iter;<br /> float tempreal, tempimag, Creal, Cimag;<br /> float r2;<br /> Creal = real;<br /> Cimag = imag;<br /><br /> for (iter=0; iter&lt;maxiteration &amp;&amp; got_away == 0; iter+=1)<br /> {<br /> /* z = z^2 + c */<br /> tempreal = real;<br /> tempimag = imag;<br /> real = (tempreal * tempreal) - (tempimag * tempimag);<br /> imag = 2 * tempreal * tempimag;<br /> real += Creal;<br /> imag += Cimag;<br /> r2 = (real*real) + (imag*imag);<br /><br /> if(r2 &gt;= 4) got_away = 1;<br /> }<br /><br /> Fac = mod((iter / 10), 1.0);<br /> <br />}<br /><br />
+ </script>
+ </scripts>
+</material>
View
23 patterns/SAMandelbrot/SAMandelbrot.osl.bcm
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.80000, 0.80000, 0.80000)" sample_lamp="True">
+ <nodes>
+ <node type="VALTORGB" interpolation="EASE" fac="0.5" stops="7" stop1="0.0|rgba(1.0, 0.0, 0.0, 1.0)" stop2="0.16818|rgba(1.0, 0.21223, 0.0, 1.0)" stop3="0.32727|rgba(1.0, 1.0, 0.0, 1.0)" stop4="0.5|rgba(0.0, 1.0, 0.0, 1.0)" stop5="0.66818|rgba(0.0, 0.0, 1.0, 1.0)" stop6="0.83636|rgba(0.07036, 0.0, 0.22322, 1.0)" stop7="1.0|rgba(0.27467, 0.0, 1.0, 1.0)" loc="-345, 410" />
+ <node type="BSDF_DIFFUSE" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.0" loc="-48, 407" />
+ <node type="OUTPUT_MATERIAL" loc="147, 400" />
+ <node type="SCRIPT" mode="INTERNAL" script="0" maxiterations="500" vector="Vector(0.0, 0.0, 0.0)" loc="-603, 411" />
+ <node type="MAPPING" translation="Vector(-0.19999, 0.09999, 0.0)" rotation="Vector(0.0, -0.52359, 0.52359)" scale="Vector(10.0, 10.0, 10.0)" use_min="False" use_max="False" vector="Vector(0.0, 0.0, 0.0)" loc="-896, 411" />
+ <node type="TEX_COORD" dupli="False" loc="-1134, 377" />
+ </nodes>
+ <links>
+ <link to="2" input="0" from="1" output="0" />
+ <link to="1" input="0" from="0" output="0" />
+ <link to="0" input="0" from="3" output="0" />
+ <link to="3" input="1" from="4" output="0" />
+ <link to="4" input="0" from="5" output="2" />
+ </links>
+ <scripts>
+ <script name="SAMandelbrot.osl" id="0">
+/*<br /> SAMandelbrot -- a mandelbrot texture by Shane Ambler (c)2012<br /> License: BSD<br /> <br /> While this gives basically the same pattern as MRMandelbrot I find this<br /> one has more detail and a smoother gradient with more predictable colour selection <br /> when fed into a colour ramp.<br />*/<br /><br />#include &quot;stdosl.h&quot;<br /><br />shader mandelbrot(<br /> point Vector = P,<br /> int maxIterations = 100,<br /> output float Fac = 0.0)<br />{<br /> int max_iterations = 100;<br /> float x = 0.0;<br /> float y = 0.0;<br /><br /> float tu = (mod(Vector[0],1.0)*3.0)-1.5;<br /> float tv = (mod(Vector[1],1.0)*3.0)-2.0;<br /> <br /> int i = 0;<br /> while (x*x + y*y &lt; 4 &amp;&amp; i &lt; max_iterations) {<br /> float t = x*x - y*y + tv;<br /> y = 2*x*y + tu;<br /> x = t;<br /><br /> ++i;<br /> }<br /><br /> Fac = (float)i / (float)max_iterations;<br />}<br /><br />
+ </script>
+ </scripts>
+</material>
View
25 patterns/TDsine_stripes/TDsine_stripes.osl.bcm
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.80000, 0.80000, 0.80000)" sample_lamp="True">
+ <nodes>
+ <node type="TEX_COORD" dupli="False" loc="-942, 265" />
+ <node type="MAPPING" translation="Vector(0.45000, 0.0, 0.0)" rotation="Vector(0.0, -0.78539, 0.0)" scale="Vector(4.0, 4.0, 4.0)" use_min="False" use_max="False" vector="Vector(0.0, 0.0, 0.0)" loc="-718, 333" />
+ <node type="BSDF_DIFFUSE" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.29999" loc="-221, 329" />
+ <node type="BSDF_VELVET" color="rgba(1.0, 0.26910, 0.18532, 1.0)" sigma="1.0" loc="-215, 178" />
+ <node type="MIX_SHADER" fac="0.09999" loc="-21, 291" />
+ <node type="OUTPUT_MATERIAL" loc="185, 294" />
+ <node type="SCRIPT" mode="INTERNAL" script="0" color="rgba(1.0, 0.93714, 0.69854, 1.0)" time="0.40000" intensity="0.50000" stripes="10" vector="Vector(0.0, 0.0, 0.0)" loc="-425, 329" />
+ </nodes>
+ <links>
+ <link to="4" input="1" from="2" output="0" />
+ <link to="2" input="0" from="6" output="1" />
+ <link to="1" input="0" from="0" output="0" />
+ <link to="5" input="0" from="4" output="0" />
+ <link to="4" input="2" from="3" output="0" />
+ <link to="6" input="4" from="1" output="0" />
+ </links>
+ <scripts>
+ <script name="TDsine_stripes.osl" id="0">
+/*<br /> Sine stripes texture by Thomas Dinges (c)2012<br /> http://www.openshading.com/osl/example-shaders/<br />*/<br /><br />#include &quot;stdosl.h&quot;<br /><br />shader TDsine_pattern(<br /> color Color = color(0.8),<br /> float Time = 1.0,<br /> float Intensity = 1.0,<br /> int Stripes = 10,<br /> point Vector = P,<br /> output float Fac = 1.0,<br /> output color ColorOut = color(0.8))<br />{<br /> point Pos = Vector;<br /> Pos[0] -= 0.5;<br /> float pattern_col = 0.0;<br /> <br /> for( float i = 0.0; i &lt; Stripes; ++i )<br /> {<br /> float t = Time/10.0 * (i);<br /> <br /> Pos[0] += sin( (Pos[1] + t) * 10.0 ) * 0.1;<br /> <br /> float f = abs(Intensity / Pos[0] / 1000.0);<br /> pattern_col += f;<br /> }<br /> <br /> color C = transformc(&quot;hsv&quot;, Color);<br /> <br /> Fac = pattern_col;<br /> ColorOut = color(&quot;hsv&quot;, C[0], C[1], (Fac*C[2]));<br />}<br /><br />
+ </script>
+ </scripts>
+</material>
View
17 ramps/MAlight_vec/MAlight_vec.osl.bcm
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.80000, 0.80000, 0.80000)" sample_lamp="True">
+ <nodes>
+ <node type="BSDF_DIFFUSE" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.0" loc="10, 300" />
+ <node type="OUTPUT_MATERIAL" loc="307, 288" />
+ <node type="SCRIPT" mode="INTERNAL" script="0" loc="-260, 294" />
+ </nodes>
+ <links>
+ <link to="1" input="0" from="0" output="0" />
+ <link to="0" input="0" from="2" output="0" />
+ </links>
+ <scripts>
+ <script name="MAlight_vec.osl" id="0">
+/*<br /> light vector shader by Michel J. Anders (c)2012<br /> license: cc-by-sa<br /> http://blenderthings.blogspot.co.uk/2012/11/getting-light-vector-in-osl-for-blender.html<br />*/<br /><br />/* not working as expected - request for lamp appears to be failing */<br /><br />#include &quot;stdosl.h&quot;<br /><br />shader MAlightvec(<br />output color Color = 1)<br />{<br /> vector L;<br /> getattribute(&quot;Lamp&quot;,&quot;object:location&quot;,L);<br /> P=transform(&quot;object&quot;,&quot;world&quot;,P);<br /> float cost=abs(dot(normalize(L-P),N));<br /> Color = color(cost,1-cost,.2);<br />}<br /><br />
+ </script>
+ </scripts>
+</material>
View
29 ramps/MAsoap_bubble/MAsoap_bubble.osl.bcm
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.80000, 0.80000, 0.80000)" sample_lamp="True">
+ <nodes>
+ <node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.38999" loc="-171, 314" />
+ <node type="BSDF_GLOSSY" distribution="SHARP" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.00499" loc="-174, 156" />
+ <node type="MIX_SHADER" fac="0.23999" loc="63, 257" />
+ <node type="BSDF_TRANSPARENT" color="rgba(1.0, 1.0, 1.0, 1.0)" loc="73, 343" />
+ <node type="MIX_SHADER" fac="0.20000" loc="270, 339" />
+ <node type="OUTPUT_MATERIAL" loc="487, 316" />
+ <node type="TEX_MUSGRAVE" musgrave="FBM" scale="5.0" detail="2.0" dimension="2.0" lacunarity="1.0" offset="0.0" gain="1.0" loc="85, 129" />
+ <node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="0.40000" loc="316, 186" />
+ <node type="SCRIPT" mode="INTERNAL" script="0" interiorior="1.0" surfaceior="1.29999" thickness="1000.0" loc="-435, 269" />
+ </nodes>
+ <links>
+ <link to="7" input="0" from="6" output="1" />
+ <link to="5" input="2" from="7" output="0" />
+ <link to="2" input="2" from="1" output="0" />
+ <link to="2" input="1" from="0" output="0" />
+ <link to="4" input="1" from="3" output="0" />
+ <link to="4" input="2" from="2" output="0" />
+ <link to="5" input="0" from="4" output="0" />
+ <link to="0" input="0" from="8" output="0" />
+ </links>
+ <scripts>
+ <script name="MAsoap_bubble.osl" id="0">
+/*<br /> soap bubble shader by Michel J. Anders (c)2012<br /> license: cc-by-sa<br /> http://blenderthings.blogspot.co.uk/2012/11/a-soap-bubble-osl-shader-for-blender.html<br />*/<br /><br />#include &quot;stdosl.h&quot;<br /><br />surface MAsoapbubble (<br /> float InteriorIOR = 1, // approximate refractive index of air<br /> float SurfaceIOR = 1.3, // approximate refractive index of water<br /> float Thickness = 1000, // 1000 nm = 1 micron<br /> output color Color = 0)<br />{<br /> // condition for constructive interference:<br /> // 2 * SurfaceIOR * Thickness * cos(t2) == (m-0.5)*lambda<br /> // Thickness and lambda in nm<br /> float eta = InteriorIOR/SurfaceIOR;<br /> // note that N should be the perturbed normal<br /> vector T = normalize(refract(I,N,eta));<br /> // no need to divide by (len(-I) * len(T)) as these are normalized<br /> float cost2 = dot(-I , T);<br /> float opd = 2*SurfaceIOR*Thickness*cost2;<br /> <br /> int mmin = int(ceil(opd/750+0.5));<br /> int mmax = int(floor(opd/350+0.5));<br /> // if mmax &lt; mmin the film is too thin to show an effect<br /> int m = (mmin + mmax)/2;<br /> <br /> if (m &gt; 0){<br /> float lambda = opd / (m - 0.5);<br /> color c = wavelength_color(lambda);<br /> Color = c;<br /> }<br />}<br /><br />
+ </script>
+ </scripts>
+</material>
View
21 ramps/MAtoon/MAtoon.osl.bcm
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.80000, 0.80000, 0.80000)" sample_lamp="True">
+ <nodes>
+ <node type="OUTPUT_MATERIAL" loc="300, 300" />
+ <node type="MIX_SHADER" fac="0.18000" loc="60, 310" />
+ <node type="BSDF_DIFFUSE" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.0" loc="-196, 300" />
+ <node type="BSDF_GLOSSY" distribution="SHARP" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.20000" loc="-199, 154" />
+ <node type="SCRIPT" mode="INTERNAL" script="0" color="rgba(0.31456, 0.41073, 1.0, 1.0)" angle="50.0" loc="-451, 288" />
+ </nodes>
+ <links>
+ <link to="1" input="1" from="2" output="0" />
+ <link to="0" input="0" from="1" output="0" />
+ <link to="1" input="2" from="3" output="0" />
+ <link to="2" input="0" from="4" output="0" />
+ </links>
+ <scripts>
+ <script name="MAtoon.osl" id="0">
+/*<br /> toon shader by Michel J. Anders (c)2012<br /> license: cc-by-sa<br /> http://blenderthings.blogspot.co.uk/2012/11/a-toon-osl-shader-for-blender.html<br />*/<br /><br />#include &quot;stdosl.h&quot;<br /><br />shader MAtoon(<br /> color Color = 1,<br /> float Angle = 50,<br /> output color Col = 0)<br />{<br /> float angle = cos(radians(Angle));<br /> if(abs(dot(-I,N)) &gt; angle) Col = Color;<br />}<br /><br />
+ </script>
+ </scripts>
+</material>
View
19 ramps/TDdiffuse_ramp/TDdiffuse_ramp.osl.bcm
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.80000, 0.80000, 0.80000)" sample_lamp="True">
+ <nodes>
+ <node type="OUTPUT_MATERIAL" loc="-139, 337" />
+ <node type="MAPPING" translation="Vector(0.0, 0.0, 0.0)" rotation="Vector(0.0, 1.57079, 1.57079)" scale="Vector(1.0, 1.0, 1.0)" use_min="False" use_max="False" vector="Vector(0.0, 0.0, 0.0)" loc="-718, 358" />
+ <node type="TEX_COORD" dupli="False" loc="-1001, 267" />
+ <node type="SCRIPT" mode="INTERNAL" script="0" normal="Vector(0.0, 0.0, 0.0)" color1="rgba(0.80000, 0.0, 0.0, 1.0)" color2="rgba(0.0, 0.80000, 0.0, 1.0)" color3="rgba(0.0, 0.0, 0.80000, 1.0)" color4="rgba(0.10000, 0.10000, 0.10000, 1.0)" color5="rgba(0.20000, 0.20000, 0.20000, 1.0)" color6="rgba(0.30000, 0.30000, 0.30000, 1.0)" color7="rgba(0.40000, 0.40000, 0.40000, 1.0)" color8="rgba(0.5, 0.5, 0.5, 1.0)" loc="-380, 344" />
+ </nodes>
+ <links>
+ <link to="0" input="0" from="3" output="0" />
+ <link to="3" input="0" from="1" output="0" />
+ <link to="1" input="0" from="2" output="0" />
+ </links>
+ <scripts>
+ <script name="TDdiffuse_ramp.osl" id="0">
+/*<br /> diffuse ramp texture by Thomas Dinges (c)2012<br /> http://www.openshading.com/osl/example-shaders/<br /> <br /> NOTE: diffuse_ramp function added to blender svn at r52887 12/12/2012<br /> This will not run in the 2.65 release<br />*/<br /><br />#include &lt;stdosl.h&gt;<br /><br />shader TDnode_diffuse_ramp_bsdf(<br /> color Color1 = color(0.8, 0.0, 0.0),<br /> color Color2 = color(0.0, 0.8, 0.0),<br /> color Color3 = color(0.0, 0.0, 0.8),<br /> color Color4 = 0.1,<br /> color Color5 = 0.2,<br /> color Color6 = 0.3,<br /> color Color7 = 0.4,<br /> color Color8 = 0.5,<br /> normal Normal = N,<br /> output closure color BSDF = 0)<br />{<br /> color Color[8] = {Color1, Color2, Color3, Color4, Color5, Color6, Color7, Color8};<br /><br /> BSDF = diffuse_ramp(Normal, Color);<br />}<br /><br />
+ </script>
+ </scripts>
+</material>
View
15 ramps/TDphong_ramp/TDphong_ramp.osl.bcm
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.80000, 0.80000, 0.80000)" sample_lamp="True">
+ <nodes>
+ <node type="OUTPUT_MATERIAL" loc="-172, 333" />
+ <node type="SCRIPT" mode="INTERNAL" script="0" exponent="1.20000" normal="Vector(0.0, 0.0, 0.0)" loc="-385, 342" />
+ </nodes>
+ <links>
+ <link to="0" input="0" from="1" output="0" />
+ </links>
+ <scripts>
+ <script name="TDphong_ramp.osl" id="0">
+/*<br /> phong ramp texture by Thomas Dinges (c)2012<br /> http://www.openshading.com/osl/example-shaders/<br />*/<br /><br />#include &lt;stdosl.h&gt;<br /><br />shader TDphong_ramp_bsdf(<br /> float Exponent = 2.0,<br /> normal Normal = N,<br /> output closure color BSDF = 0)<br />{<br /> color Color[8];<br /> <br /> for(int i = 0; i &lt; 8; i++)<br /> Color[i] = transformc(&quot;hsv&quot;, &quot;rgb&quot;, color(i/7.0, 1.0, 1.0));<br /> <br /> BSDF = phong_ramp(N, Exponent, Color);<br />}<br /><br />
+ </script>
+ </scripts>
+</material>
View
21 ramps/TDwireframe/TDwireframe.osl.bcm
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.80000, 0.80000, 0.80000)" sample_lamp="True">
+ <nodes>
+ <node type="OUTPUT_MATERIAL" loc="300, 300" />
+ <node type="MIX_SHADER" fac="0.5" loc="75, 304" />
+ <node type="BSDF_DIFFUSE" color="rgba(0.0, 0.0, 0.0, 1.0)" roughness="0.0" loc="-149, 133" />
+ <node type="BSDF_DIFFUSE" color="rgba(0.14668, 0.26591, 0.39999, 1.0)" roughness="0.0" loc="-145, 262" />
+ <node type="SCRIPT" mode="INTERNAL" script="0" line_width="0.99999" raster="1" loc="-142, 435" />
+ </nodes>
+ <links>
+ <link to="0" input="0" from="1" output="0" />
+ <link to="1" input="0" from="4" output="0" />
+ <link to="1" input="2" from="2" output="0" />
+ <link to="1" input="1" from="3" output="0" />
+ </links>
+ <scripts>
+ <script name="TDwireframe.osl" id="0">
+/*<br /> Wireframe texture by Thomas Dinges (c)2012<br /> http://www.openshading.com/osl/example-shaders/<br />*/<br /><br />#include &quot;stdosl.h&quot;<br />#include &quot;oslutil.h&quot;<br /><br />shader TDwireframe(<br /> float Line_Width = 2.0,<br /> int Raster = 1,<br /> output float Factor = 0.0)<br />{<br /> //Factor = wireframe(&quot;triangles&quot;, Line_Width, Raster);<br /> /* currently blender always provides triangles at this point in the render <br /> as in fully triangulated mesh that the render engine works with<br /> at some stage the polygons option will provide original poly edges instead */<br /> Factor = wireframe(&quot;polygons&quot;, Line_Width, Raster);<br />}<br /><br />
+ </script>
+ </scripts>
+</material>
View
19 random-noise/MA4d_voronoi/MA4D_voronoi.osl.bcm
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.80000, 0.80000, 0.80000)" sample_lamp="True">
+ <nodes>
+ <node type="TEX_COORD" dupli="False" loc="-466, 275" />
+ <node type="SCRIPT" mode="INTERNAL" script="0" scale="5.0" vector="Vector(0.0, 0.0, 0.0)" time="0.0" loc="-265, 321" />
+ <node type="BSDF_DIFFUSE" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.0" loc="-76, 318" />
+ <node type="OUTPUT_MATERIAL" loc="115, 309" />
+ </nodes>
+ <links>
+ <link to="3" input="0" from="2" output="0" />
+ <link to="1" input="1" from="0" output="3" />
+ <link to="2" input="0" from="1" output="1" />
+ </links>
+ <scripts>
+ <script name="MA4D_voronoi.osl" id="0">
+/*<br /> 4d voronoi shader by Michel J. Anders (c)2012<br /> license: cc-by-sa<br /> http://blenderthings.blogspot.com.au/2012/12/a-4d-voronoi-osl-shader-for-blender.html<br />*/<br /><br />#include &quot;stdosl.h&quot;<br /><br />void cellnoise_color4d(float p[4], float c[4])<br />{<br /> c[0] = cellnoise(point(p[0],p[1],p[2]),p[3]);<br /> c[1] = cellnoise(point(p[1],p[0],p[2]),p[3]);<br /> c[2] = cellnoise(point(p[1],p[2],p[0]),p[3]);<br /> c[3] = cellnoise(point(p[3],p[1],p[2]),p[0]);<br />}<br /><br />/* Voronoi 4D . we always use distance squared as the distance metric */<br /><br />void voronoi4d(point p, float t, float da[4], point pa[4], float ta[4])<br />{<br /> /* returns distances in da, point coords in pa and time coords in ta*/<br /> int xx, yy, zz, tt, xi, yi, zi, ti;<br /><br /> float op[4] = {p[0],p[1],p[2],t};<br /><br /> xi = (int)floor(p[0]);<br /> yi = (int)floor(p[1]);<br /> zi = (int)floor(p[2]);<br /> ti = (int)floor(t);<br /><br /> da[0] = 1e10;<br /> da[1] = 1e10;<br /> da[2] = 1e10;<br /> da[3] = 1e10;<br /><br /> for (xx = xi - 1; xx &lt;= xi + 1; xx++) {<br /> for (yy = yi - 1; yy &lt;= yi + 1; yy++) {<br /> for (zz = zi - 1; zz &lt;= zi + 1; zz++) {<br /> for (tt = ti - 1; tt &lt;= ti + 1; tt++) {<br /> float ip[4] = {xx, yy, zz, tt};<br /> float vp[4];<br /> cellnoise_color4d(ip,vp);<br /> float pd[4] = { op[0] - (vp[0] + ip[0]),<br /> op[1] - (vp[1] + ip[1]),<br /> op[2] - (vp[2] + ip[2]),<br /> op[3] - (vp[3] + ip[3])};<br /> // always distance squared<br /> float d = pd[0]*pd[0]+pd[1]*pd[1]+pd[2]*pd[2]+pd[3]*pd[3];<br /><br /> vp[0] += xx;<br /> vp[1] += yy;<br /> vp[2] += zz;<br /> vp[3] += tt;<br /><br /> if (d &lt; da[0]) {<br /> da[3] = da[2];<br /> da[2] = da[1];<br /> da[1] = da[0];<br /> da[0] = d;<br /><br /> pa[3] = pa[2]; ta[3] = ta[2];<br /> pa[2] = pa[1]; ta[2] = ta[1];<br /> pa[1] = pa[0]; ta[1] = ta[0];<br /> pa[0] = point(vp[0],vp[1],vp[2]); ta[0] = vp[3];<br /> }<br /> else if (d &lt; da[1]) {<br /> da[3] = da[2];<br /> da[2] = da[1];<br /> da[1] = d;<br /><br /> pa[3] = pa[2]; ta[3] = ta[2];<br /> pa[2] = pa[1]; ta[2] = ta[1];<br /> pa[1] = point(vp[0],vp[1],vp[2]); ta[1] = vp[3];<br /> }<br /> else if (d &lt; da[2]) {<br /> da[3] = da[2];<br /> da[2] = d;<br /><br /> pa[3] = pa[2]; ta[3] = ta[2];<br /> pa[2] = point(vp[0],vp[1],vp[2]); ta[2] = vp[3];<br /> }<br /> else if (d &lt; da[3]) {<br /> da[3] = d;<br /> pa[3] = point(vp[0],vp[1],vp[2]); ta[3] = vp[3];<br /> }<br /> }<br /> }<br /> }<br /> }<br />}<br /><br />shader node_voronoi_texture(<br /> float Scale = 5.0,<br /> point Vector = P,<br /> float Time = 0,<br /> output float Fac = 0.0,<br /> output color Color = color(0.0, 0.0, 0.0) )<br />{<br /> /* compute distance and point coordinate of 4 nearest neighbours */<br /> float da[4];<br /> point pa[4];<br /> float ta[4];<br /><br /> voronoi4d(Vector * Scale, Time * Scale, da, pa, ta);<br /><br /> Fac = fabs(da[0]); <br /> Color = color(Fac);<br />}<br /><br />
+ </script>
+ </scripts>
+</material>
View
29 random-noise/TD4d_noise/TD4d_noise.osl.bcm
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.80000, 0.80000, 0.80000)" sample_lamp="True">
+ <nodes>
+ <node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="0.69999" loc="-310, 48" />
+ <node type="SEPRGB" image="rgba(0.80000, 0.80000, 0.80000, 1.0)" loc="-445, 180" />
+ <node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="0.49999" loc="-298, 378" />
+ <node type="COMBRGB" red="0.0" green="0.0" blue="0.0" loc="-123, 207" />
+ <node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="1.30000" loc="-307, 211" />
+ <node type="BSDF_DIFFUSE" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.0" loc="-7, 217" />
+ <node type="OUTPUT_MATERIAL" loc="219, 212" />
+ <node type="SCRIPT" mode="INTERNAL" script="0" time="1.0" loc="-692, 121" />
+ </nodes>
+ <links>
+ <link to="6" input="0" from="5" output="0" />
+ <link to="2" input="0" from="1" output="0" />
+ <link to="4" input="0" from="1" output="1" />
+ <link to="0" input="0" from="1" output="2" />
+ <link to="5" input="0" from="3" output="0" />
+ <link to="3" input="2" from="0" output="0" />
+ <link to="3" input="0" from="2" output="0" />
+ <link to="3" input="1" from="4" output="0" />
+ <link to="1" input="0" from="7" output="0" />
+ </links>
+ <scripts>
+ <script name="TD4d_noise.osl" id="0">
+/*<br /> 4D noise texture by Thomas Dinges (c)2012<br /> http://www.openshading.com/osl/example-shaders/<br />*/<br /><br />#include &lt;stdosl.h&gt;<br /><br />shader TD4D_noise(<br /> float Time = 1.0,<br /> output color Perlin = (0.8),<br /> output color UPerlin = (0.8))<br />{ <br /> /* Perlin*/<br /> Perlin= noise(&quot;perlin&quot;, P, Time);<br /> <br /> /* UPerlin */<br /> UPerlin= noise(&quot;uperlin&quot;, P, Time);<br />}<br /><br />
+ </script>
+ </scripts>
+</material>
View
21 random-noise/TDcell_noise/TDcell_noise.osl.bcm
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.80000, 0.80000, 0.80000)" sample_lamp="True">
+ <nodes>
+ <node type="TEX_COORD" dupli="False" loc="-811, 338" />
+ <node type="MAPPING" translation="Vector(0.0, 0.0, 0.0)" rotation="Vector(0.0, 0.0, 0.0)" scale="Vector(100.0, 100.0, 100.0)" use_min="False" use_max="False" vector="Vector(0.0, 0.0, 0.0)" loc="-615, 360" />
+ <node type="SCRIPT" mode="INTERNAL" script="0" saturation="0.70000" value="0.79999" vector="Vector(0.0, 0.0, 0.0)" loc="-334, 351" />
+ <node type="BSDF_DIFFUSE" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.0" loc="-101, 350" />
+ <node type="OUTPUT_MATERIAL" loc="109, 341" />
+ </nodes>
+ <links>
+ <link to="4" input="0" from="3" output="0" />
+ <link to="3" input="0" from="2" output="0" />
+ <link to="2" input="2" from="1" output="0" />
+ <link to="1" input="0" from="0" output="2" />
+ </links>
+ <scripts>
+ <script name="TDcell_noise.osl" id="0">
+/*<br /> cell noise texture by Thomas Dinges (c)2012<br /> http://www.openshading.com/osl/example-shaders/<br />*/<br /><br />#include &lt;stdosl.h&gt;<br /><br />shader TDcellnoise(<br /> float Saturation = 0.5,<br /> float Value = 1.0,<br /> point Vector = P,<br /> output color Color = (0.0))<br />{<br /> float Fac = (noise(&quot;cell&quot;, Vector));<br /> Color = color(&quot;hsv&quot;, (smoothstep(0, 1, Fac)), Saturation, Value);<br />}<br /><br />
+ </script>
+ </scripts>
+</material>
View
15 stone/LGVeinedMarble/LGVeinedMarble.osl.bcm
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.80000, 0.80000, 0.80000)" sample_lamp="True">
+ <nodes>
+ <node type="OUTPUT_MATERIAL" loc="-207, 322" />
+ <node type="SCRIPT" mode="INTERNAL" script="0" vector="Vector(0.0, 0.0, 0.0)" diffuseamt="0.89999" diffusecolor="rgba(0.0, 0.0, 0.0, 1.0)" specularamt="0.20000" roughness="0.10000" specularcolor="rgba(0.56471, 0.56471, 0.56471, 1.0)" veinfreq="0.69999" veinlevels="1.60000" veincolor="rgba(0.65837, 0.61720, 0.0, 1.0)" warpfreq="0.60000" warping="0.69999" sharpness="6.0" loc="-463, 334" />
+ </nodes>
+ <links>
+ <link to="0" input="0" from="1" output="0" />
+ </links>
+ <scripts>
+ <script name="LGVeinedMarble.osl" id="0">
+/*<br /> * veinedmarble.sl -- surface shader for a nice veined marble.<br /> *<br /> * DESCRIPTION:<br /> * Makes solid marble texture with strong veins. The &quot;veincolor&quot; parameter<br /> * controls the color of the veins. The background color is given by the<br /> * surface color (Cs).<br /> * <br /> * PARAMETERS:<br /> * Ka, Kd, Ks, roughness, specularcolor - same as plastic<br /> * veinfreq - controls fhe lowest frequency of the color veins<br /> * veinlevels - how many &quot;levels&quot; of vein tendrills it has<br /> * warpfreq - lowest frequency of the turbulent warping in the marble<br /> * warping - controls how much turbulent warping there will be<br /> * veincolor - the color of the veins<br /> * sharpness - controls how sharp or fuzzy the veins are (higher = sharper)<br /> *<br /> *<br /> * AUTHOR: Larry Gritz, the George Washington University<br /> * email: gritz AT seas DOT gwu DOT edu <br /> *<br /> * HISTORY:<br /> *<br /> * last modified 29 Jun 1994 by Larry Gritz<br /> * 2012-12-19 converted to blender osl shader by Shane Ambler<br /> *<br /> */<br /><br /><br />#include &quot;stdosl.h&quot;<br /><br /><br />shader LGVeinedMarble (<br /> point Vector = P,<br /> float DiffuseAmt = 0.8,<br /> color DiffuseColor = color(1.0),<br /> float SpecularAmt = 0.2,<br /> float Roughness = 0.005,<br /> color SpecularColor = color(1.0),<br /> float VeinFreq = 1.0,<br /> float VeinLevels = 2.0,<br /> color VeinColor = color(0.2, 0.15, 0.08),<br /> float WarpFreq = 1.0,<br /> float Warping = 0.5,<br /> float Sharpness = 8.0,<br /> output closure color BSDF = diffuse(N) )<br />{<br />#define snoise(x) (2*noise(x)-1)<br /> color Ct;<br /> point Nf;<br /> point PP, offset;<br /> float i, turb, freq, j;<br /> float turbsum;<br /><br /> PP = transform (&quot;shader&quot;, Vector);<br /><br /> /* perturb the lookup */<br /> freq = 1;<br /> offset = 0;<br /> for (i = 0; i &lt; 6; i += 1) {<br /> offset += 2 * Warping * ( noise (WarpFreq * freq * PP) - 0.5) / freq;<br /> freq *= 2;<br /> }<br /> PP += offset;<br /><br /> /* Now calculate the veining function for the lookup area */<br /> turbsum = 0; freq = 1;<br /> PP *= VeinFreq;<br /> for (i = 0; i &lt; VeinLevels; i += 1) {<br /> turb = abs (snoise (PP));<br /> turb = pow (smoothstep (0.8, 1, 1 - turb), Sharpness) / freq;<br /> turbsum += (1-turbsum) * turb;<br /> freq *= 3;<br /> PP *= 3;<br /> }<br /><br /> Ct = mix (DiffuseColor, VeinColor, turbsum);<br /><br /> Nf = normalize(N);<br /> BSDF = Ct * DiffuseAmt * diffuse(Nf);<br /> BSDF += SpecularColor * SpecularAmt * microfacet_beckmann(Nf,Roughness);<br />}<br /><br />
+ </script>
+ </scripts>
+</material>
View
12 wood/DWParquetTile/DWParqueteTile.osl.bcm
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.80000, 0.80000, 0.80000)" sample_lamp="True">
+ <nodes>
+ <node type="OUTPUT_MATERIAL" loc="-75, 344" />
+ <node type="TEX_COORD" dupli="False" loc="-524, 318" />
+ <node type="SCRIPT" mode="EXTERNAL" script="file:///home/shane/Projects3D/BlenderLib/OSL-Shaders/patterns/DWParquetTile/DWParqueteTile.osl" vector="Vector(0.0, 0.0, 0.0)" diffuseamt="0.75" specularamt="0.24999" roughness="0.19999" specularcolor="rgba(1.0, 1.0, 1.0, 1.0)" ringscale="25.0" grainscale="55.0" grainy="1.0" wavy="0.07999" texturescale="15.0" lightwood="rgba(0.56999, 0.29199, 0.125, 1.0)" darkwood="rgba(0.27500, 0.15000, 0.05999, 1.0)" groovecolor="rgba(0.05000, 0.03999, 0.01499, 1.0)" plankspertile="4" plankwidth="0.20000" plankvary="0.60000" groovewidth="0.10000" loc="-333, 353" />
+ </nodes>
+ <links>
+ <link to="0" input="0" from="2" output="0" />
+ <link to="2" input="0" from="1" output="2" />
+ </links>
+</material>

0 comments on commit 1eec029

Please sign in to comment.