<?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="INTERNAL" script="0" vector="Vector(0.0, 0.0, 0.0)" diffuseamt="0.75" specularamt="0.25" roughness="0.125" 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>
	<scripts>
		<script name="DWParqueteTile.osl" id="0">
/*<br /> * DWParquetTile.sl -- yet another surface shader for wood<br /> *-was:<br /> * parquet_plank.sl -- another surface shader for wood.<br /> *<br /> * DESCRIPTION:<br /> *   Makes texture of wooden planks in s-t space.  This wood looks rather<br /> *   like oak plank parquet floor tiles.  The actual wood and plank pattern<br /> *   is based on my &quot;planks&quot; shader.  This shader works best if &quot;s&quot; and &quot;t&quot;<br /> *   units are both the same size in world space.<br /> *<br /> * PARAMETERS:<br /> *   Ka, Kd, Ks, specular, roughness - work just like the plastic shader<br /> *   txtscale - overall scaling factor for the texture<br /> *   plankwidth - width of each plank (in terms of s/t)<br /> *   plankspertile - number of planks in each parquet tile<br /> *   ringscale - scaling for the ring spacing<br /> *   grainscale - scaling for the fine grain<br /> *   groovewidth - width of the grooves between the planks (in terms of s/t)<br /> *   lightwood, darkwood - surface colors for the wood itself<br /> *   groovecolor - the color of the &quot;grooves&quot; between the planks<br /> *   plankvary - controls how much wood color varies from plank to plank<br /> *   grainy - relative graininess (0 = no fine grain)<br /> *   wavy - relative wavyness of the ring pattern<br /> *<br /> * ANTIALIASING: this shader does a pretty good job of antialiasing itself,<br /> *   even with low sampling densities.<br /> *<br /> * AUTHOR: written by Larry Gritz, the George Washington University<br /> *         email: gritz AT seas DOT gwu DOT edu <br /> *         snail: Dept. of EE &amp; CS<br /> *                801  22nd St. NW, Rm. T-624-G<br /> *                Washington, DC 20052<br /> *<br /> * HISTORY:<br /> *    10 Feb 1995 - written by Larry Gritz, based on my &quot;plank&quot; shader.<br /> *    10 Feb 1995 - modified by wave to change the name<br /> *    18 Dec 2012 - converted to blender osl shader by Shane Ambler<br /> *<br /> * last modified 10 Feb 1995 by wave<br /> * <br /> *<br /> * modified again by Dan Weeks &lt;dan AT mango DOT sfasu DOT edu &gt; on 08 Dec 1996<br /> *   - made one plank per tile like the flooring in our lab<br /> *   - comments appear where changes are made<br /> *   - many thanks to Larry Gritz and wave for creating the original<br /> *<br /> * modified by Shane Ambler 18 Dec 2012<br /> *  - convert to work as blender osl shader<br /> *  - capitalise various user visible variable names<br /> *  - remove Ka - no ambient interaction calculated within shader<br /> *  - rename Kd to DiffuseAmt<br /> *  - rename Ks to SpecularAmt<br /> *  - rename txtscale to TextureScale<br /> *  - change PlanksPerTile to an int<br /> */<br /><br /><br /><br />/*<br /> * changed:<br /> *   - name from LGParquetPlank to DWParquetTile<br /> *   - ringscale from 15 to 25<br /> *   - grainscale from 60 to 55<br /> *   - plankspertile from 4 to 1<br /> *   - plankwidth from .05 to .2<br /> */<br /> <br />#include &quot;stdosl.h&quot;<br /><br />shader DWParquetTile (<br />        point Vector = P,<br />        float DiffuseAmt = 0.75 ,<br />        float SpecularAmt = 0.15,<br />        float Roughness = 0.025,<br />        color SpecularColor = color(1.0),<br />        float RingScale = 25.0,<br />        float GrainScale = 55.0,<br />        float Grainy = 1.0,<br />        float Wavy = 0.08,<br />        float TextureScale = 5.0,<br />        color LightWood = color (0.57, 0.292, 0.125),<br />        color DarkWood  = color (0.275, 0.15, 0.06),<br />        color GrooveColor  = color (0.05, 0.04, 0.015),<br />        int PlanksPerTile = 1,<br />        float PlankWidth = 0.2,<br />        float PlankVary = 0.6,<br />        float GrooveWidth = 0.1,<br />        output closure color BSDF = diffuse(N) )<br />{<br />#define snoise(x) (2 * noise((x)) - 1)<br />#define boxstep(a,b,x) (clamp(((x)-(a))/((b)-(a)),0,1))<br />#define MINFILTERWIDTH 1.0e-7<br /><br />    float su = Vector[0];<br />    float tv = Vector[1];<br />    float r, r2;<br />    point Nf;<br />    float whichrow, whichplank;<br />    float swidth, twidth, fwidth, ss, tt, w, h, fade, ttt;<br />    color Ct, woodcolor;<br />    float groovy;<br />    float PGWIDTH, PGHEIGHT, GWF, GHF;<br />    float tilewidth, whichtile, tmp, planklength;<br /><br />    PGWIDTH = PlankWidth+GrooveWidth;<br />    planklength = PGWIDTH * PlanksPerTile - GrooveWidth;<br />    PGHEIGHT = planklength+GrooveWidth;<br />    GWF = GrooveWidth*0.05/PGWIDTH;<br />    GHF = GrooveWidth*0.05/PGHEIGHT;<br /><br />    /* Determine how wide in s-t space one pixel projects to */<br />    swidth = (max (abs(Dx(su)*su) + abs(Dy(su)*tv), MINFILTERWIDTH) / PGWIDTH) * TextureScale;<br />    twidth = (max (abs(Dx(tv)*su) + abs(Dy(tv)*tv), MINFILTERWIDTH) / PGHEIGHT) * TextureScale;<br />    fwidth = max(swidth,twidth);<br /><br />    ss = (TextureScale * su) / PGWIDTH;<br />    whichrow = floor (ss);<br />    tt = (TextureScale * tv) / PGHEIGHT;<br />    whichplank = floor(tt);<br />    if (mod (whichrow/PlanksPerTile + whichplank, 2) &gt;= 1) {<br />        ss = TextureScale * tv / PGWIDTH;<br />        whichrow = floor (ss);<br />        tt = TextureScale * su / PGHEIGHT;<br />        whichplank = floor(tt);<br />        tmp = swidth;  swidth = twidth;  twidth = tmp;<br />    } <br />    ss -= whichrow;<br />    tt -= whichplank;<br />    whichplank += 20*(whichrow+10);<br /><br />    /*<br />     * Figure out where the grooves are.  The value groovy is 0 where there<br />     * are grooves, 1 where the wood grain is visible.  Do some simple<br />     * antialiasing.<br />     */<br />    if (swidth &gt;= 1)<br />        w = 1 - 2*GWF;<br />    else {<br />        w = clamp (boxstep(GWF-swidth,GWF,ss), max(1-GWF/swidth,0), 1)<br />        - clamp (boxstep(1-GWF-swidth,1-GWF,ss), 0, 2*GWF/swidth);<br />    }<br />    if (twidth &gt;= 1)<br />        h = 1 - 2*GHF;<br />    else {<br />        h = clamp (boxstep(GHF-twidth,GHF,tt), max(1-GHF/twidth,0),1)<br />        - clamp (boxstep(1-GHF-twidth,1-GHF,tt), 0, 2*GHF/twidth);<br />    }<br />    /* This would be the non-antialiased version:<br />     * w = step (GWF,ss) - step(1-GWF,ss);<br />     * h = step (GHF,tt) - step(1-GHF,tt);<br />     */<br />    groovy = w*h;<br /><br /><br />    /*<br />     * Add the ring patterns<br />     */<br />    fade = smoothstep (1/RingScale, 8/RingScale, fwidth);<br />    if (fade &lt; 0.999) {<br />        ttt = tt/4+whichplank/28.38 + Wavy * noise (8*ss, tt/4);<br />        r = RingScale * noise (ss-whichplank, ttt);<br />        r -= floor (r);<br />        r = 0.3 + 0.7 * smoothstep(0.2, 0.55, r) * (1 - smoothstep(0.75, 0.8, r));<br />        r = (1-fade)*r + 0.65*fade;<br /><br />        /*<br />         * Multiply the ring pattern by the fine grain<br />         */<br />        fade = smoothstep (2/GrainScale, 8/GrainScale, fwidth);<br />        if (fade &lt; 0.999) {<br />            r2 = 1.3 - noise (ss*GrainScale, (tt*GrainScale/4));<br />            r2 = Grainy * r2*r2 + (1-Grainy);<br />            r *= (1-fade)*r2 + (0.75*fade);<br />        }<br />        else<br />            r *= 0.75;<br />    }<br />    else<br />        r = 0.4875;<br />  <br /><br />    /* Mix the light and dark wood according to the grain pattern */<br />    woodcolor = mix (LightWood, DarkWood, r);<br /><br />    /* Add plank-to-plank variation in overall color */<br />    woodcolor *= (1-PlankVary/2 + PlankVary * noise (whichplank+0.5));<br /><br />    Ct = mix (GrooveColor, woodcolor, groovy);<br />    Nf = normalize(N);<br />    BSDF = Ct * DiffuseAmt * diffuse(Nf);<br /><br />    BSDF += SpecularColor * SpecularAmt * microfacet_beckmann(Nf,Roughness);<br />}<br /><br />
		</script>
	</scripts>
</material>