<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <HTML ><HEAD ><TITLE >Shaders</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+ "><LINK REL="HOME" TITLE="Blender Documentation Volume I - User Guide" HREF="book1.html"><LINK REL="UP" TITLE="YafRay" HREF="c11488.html"><LINK REL="PREVIOUS" TITLE="Scene Description Language Overview" HREF="x11539.html"><LINK REL="NEXT" TITLE="Renderable Objects" HREF="x11783.html"></HEAD ><BODY CLASS="section" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Blender Documentation Volume I - User Guide: Last modified April 29 2004 S68</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="x11539.html" ACCESSKEY="P" ><<< Previous</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >YafRay</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="x11783.html" ACCESSKEY="N" >Next >>></A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="section_yafray_shaders" ></A >Shaders</H1 ><DIV CLASS="section" ><H2 CLASS="section" ><A NAME="section_yafray_shaders_base" ></A >Base Shaders</H2 ><P > These shader blocks determine the BiDirectional Reflectivity Function (BDRF) or Illumination Model that the object is shaded with. Each different base shader type has various inputs that can receive the outputs from other shader blocks, altering the surface characteristics . </P ><DIV CLASS="section" ><H3 CLASS="section" ><A NAME="section_yafray_shaders_base_constant" ></A >Constant</H3 ><P >A uniformly constant shader</P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><PRE CLASS="programlisting" > <shader type = "constant" name = "Sphere.mat"> <attributes> <color r="15.000000" g="15.000000" b="15.000000" /> </attributes> </shader> </PRE ></TD ></TR ></TABLE ></DIV ><DIV CLASS="section" ><H3 CLASS="section" ><A NAME="section_yafray_shaders_base_generic" ></A >Generic</H3 ><P >The most versatile shader</P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><PRE CLASS="programlisting" > <shader type = "generic" name = "Sphere.mat"> <attributes> <color r="0.800000" g="0.800000" b="0.800000" /> <specular r="1.000000" g="1.000000" b="1.000000" /> <reflected r="0.000000" g="0.000000" b="0.000000" /> <reflected2 r="1.000000" g="1.000000" b="1.000000" /> <transmitted r="0.197183" g="0.197183" b="0.225352" /> <transmitted2 r="1.000000" g="1.000000" b="1.000000" /> <hard value = "25.000000"/> <IOR value = "1.592105"/> <min_refle value = "0.200000"/> <fast_fresnel value = "off"/> </attributes> </shader> </PRE ></TD ></TR ></TABLE ></DIV ><DIV CLASS="section" ><H3 CLASS="section" ><A NAME="section_yafray_shaders_phong" ></A >Phong</H3 ><P >Classic Phong shader</P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><PRE CLASS="programlisting" > <shader type="phong" name="phongshader"> <attributes> <environment value="fresnel"/> <<color value="rgb"/> </attributes> </shader> </PRE ></TD ></TR ></TABLE ></DIV ></DIV ><DIV CLASS="section" ><H2 CLASS="section" ><A NAME="section_yafray_shaders_proc" ></A >Procedural</H2 ><P > These Shading blocks create various procedural patterns with inline values. No inputs are needed. </P ><DIV CLASS="section" ><H3 CLASS="section" ><A NAME="section_yafray_shaders_marble" ></A >Marble</H3 ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><PRE CLASS="programlisting" > <shader type="marble" name="Marble" size="4.00" depth="4" hard="off" turbulence="5" sharpness="5.00"> <attributes> </attributes> </shader> </PRE ></TD ></TR ></TABLE ><P ></P ><UL ><LI ><P > <TT CLASS="literal" >size</TT > size of the marble effect, lower numbers = less veins, higher numbers = more veins </P ></LI ><LI ><P > <TT CLASS="literal" >depth</TT > : controls the number of iterations (number of noise frequencies added to the swirl) </P ></LI ><LI ><P > <TT CLASS="literal" >hard</TT > : controls the noise type, when set to "off" the noise varies smoothly while setting it to "on" will show more abrupt changes in color </P ></LI ><LI ><P > <TT CLASS="literal" >turbulence</TT > : controls the amount of noise turbulence </P ></LI ><LI ><P > <TT CLASS="literal" >sharpness</TT > : controls the sharpness of color 1 compared to color 2, the higher this value, the thinner the color band of color1. This effect is similar to the soft/sharp/sharper switches of the Blender marble texture, the difference is that it is more controlable here. The value must be at least 1 or higher. </P ></LI ></UL ><DIV CLASS="informalfigure" ><A NAME="AEN11610" ></A ><P ></P ><DIV CLASS="mediaobject" ><P ><IMG SRC="PartBE/yafray/gfx/marble.png"></P ></DIV ><P ></P ></DIV ></DIV ><DIV CLASS="section" ><H3 CLASS="section" ><A NAME="section_yafray_shaders_proc_wood" ></A >Wood</H3 ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><PRE CLASS="programlisting" > <shader type="wood" name="Wood" size="5.00" depth="5" hard="off" turbulence="40"> <attributes> <ringscale_x value="5" /> <ringscale_y value="5" /> </attributes> </shader> </PRE ></TD ></TR ></TABLE ><P ></P ><UL ><LI ><P > <TT CLASS="literal" >size</TT > size of the wood effect, lower numbers = less wood grain, higher numbers = more wood grain </P ></LI ><LI ><P > <TT CLASS="literal" >depth</TT > : controls the number of iterations (number of noise frequencies added to the swirl) </P ></LI ><LI ><P > <TT CLASS="literal" >hard</TT > : controls the noise type, when set to "off" the noise varies smoothly while setting it to "on" will show more abrupt changes in color </P ></LI ><LI ><P > <TT CLASS="literal" >turbulence</TT > : controls the amount of noise turbulence </P ></LI ><LI ><P > <TT CLASS="literal" >ringscale_x</TT > : controls the width of the wood rings in the x axis </P ></LI ><LI ><P > <TT CLASS="literal" >ringscale_y</TT > : controls the width of the wood rings in the y axis </P ></LI ></UL ><DIV CLASS="informalfigure" ><A NAME="AEN11636" ></A ><P ></P ><DIV CLASS="mediaobject" ><P ><IMG SRC="PartBE/yafray/gfx/wood.png"></P ></DIV ><P ></P ></DIV ></DIV ><DIV CLASS="section" ><H3 CLASS="section" ><A NAME="section_yafray_shaders_clouds" ></A >Clouds</H3 ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><PRE CLASS="programlisting" > <shader type="clouds" name="Clouds" size="5.000" depth="3"> <attributes> </attributes> </shader> </PRE ></TD ></TR ></TABLE ><P ></P ><UL ><LI ><P > <TT CLASS="literal" >size</TT > size of the cloud effect </P ></LI ><LI ><P > <TT CLASS="literal" >depth</TT > : controls the number of iterations (number of noise frequencies added to the swirl) </P ></LI ></UL ><DIV CLASS="informalfigure" ><A NAME="AEN11650" ></A ><P ></P ><DIV CLASS="mediaobject" ><P ><IMG SRC="PartBE/yafray/gfx/clouds.png"></P ></DIV ><P ></P ></DIV ></DIV ></DIV ><DIV CLASS="section" ><H2 CLASS="section" ><A NAME="section_yafray_shaders_meta" ></A >Meta Shaders</H2 ><P >These allows the modification of other shader and the building of "chains" of simple shader to build a comlex shader</P ><DIV CLASS="section" ><H3 CLASS="section" ><A NAME="section_yafray_shaders_meta_c2f" ></A >Color2float shading block</H3 ><P > Takes a color as input & outputs a float </P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><PRE CLASS="programlisting" > <shader type="color2float" name="c2f" input="input" > <attributes> </attributes> </shader> </PRE ></TD ></TR ></TABLE ><P ></P ><UL ><LI ><P > <TT CLASS="literal" >input</TT > : input (color) to convert to float </P ></LI ></UL ></DIV ><DIV CLASS="section" ><H3 CLASS="section" ><A NAME="section_yafray_shaders_meta_cband" ></A >Colorband shading block</H3 ><P > Builds a color from a value input and a gradient. An unlimited number of modulators add nodes to the gradient. The shader interpolates the color values of the nodes at the given input value. In the below example, an input value of 0.12 would generate a colour between the first and second node, which are black and orange. So a dark orange would be the result. </P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><PRE CLASS="programlisting" > <shader type="colorband" name="Colorband" > <attributes> <input value="Wood" /> </attributes> <modulator value="0.00"><color r="0.00" g="0.00" b="0.00" /></modulator> <modulator value="0.26"><color r="1.00" g="0.36" b="0.00" /></modulator> <modulator value="0.66"><color r="1.00" g="1.00" b="0.00" /></modulator> <modulator value="1.00"><color r="1.00" g="1.00" b="1.00" /></modulator> </shader> </PRE ></TD ></TR ></TABLE ></DIV ><DIV CLASS="section" ><H3 CLASS="section" ><A NAME="section_yafray_shaders_meta_conet" ></A >Conetrace block</H3 ><P > It can be used to get reflections or transmited color from environment. But it could be used also to get blurry ones. </P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><PRE CLASS="programlisting" > <shader type="conetrace" name="env1" reflect="on/off" angle="number" samples="number" IOR="number"> <attributes> <color ... /> </attributes> </shader> </PRE ></TD ></TR ></TABLE ><P ></P ><UL ><LI ><P > <TT CLASS="literal" >reflect</TT > : on will reflect the ray, off will refract the ray. angle: angle of the cone (around the ray) to be sampled, 0 for a simple sharp reflection/refraction </P ></LI ><LI ><P > <TT CLASS="literal" >samples</TT >: number of samples to take inside the cone IOR: index of refraction color: color to filter the incoming light </P ></LI ></UL ><DIV CLASS="informalfigure" ><A NAME="AEN11680" ></A ><P ></P ><DIV CLASS="mediaobject" ><P ><IMG SRC="PartBE/yafray/gfx/Conetrace.png"></P ></DIV ><P ></P ></DIV ><P > spheres with varying levels of blurry reflections & refractions & a HDRI background </P ></DIV ><DIV CLASS="section" ><H3 CLASS="section" ><A NAME="section_yafray_shaders_meta_coords" ></A >Coords shading block</H3 ><P > Outputs a float based on object coords </P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><PRE CLASS="programlisting" > <shader type="coords" name="PosY" coord="Y" > <attributes> </attributes> </shader> </PRE ></TD ></TR ></TABLE ><P ></P ><UL ><LI ><P > <TT CLASS="literal" >coord</TT > : coordinate to use, either X, Y or Z </P ></LI ></UL ><DIV CLASS="informalfigure" ><A NAME="AEN11693" ></A ><P ></P ><DIV CLASS="mediaobject" ><P ><IMG SRC="PartBE/yafray/gfx/coords.png"></P ></DIV ><P ></P ></DIV ><P > clouds shader & coords shader (z) into multiply shader </P ></DIV ><DIV CLASS="section" ><H3 CLASS="section" ><A NAME="section_yafray_shaders_meta_f2c" ></A >Float2color shading block</H3 ><P > Takes a float as input & outputs a color </P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><PRE CLASS="programlisting" > <shader type="float2color" name="f2c" input="input" > <attributes> </attributes> </shader> </PRE ></TD ></TR ></TABLE ><P ></P ><UL ><LI ><P > <TT CLASS="literal" >input</TT > : input (float) to convert to color </P ></LI ></UL ></DIV ><DIV CLASS="section" ><H3 CLASS="section" ><A NAME="section_yafray_shaders_meta_fresnel" ></A >Fresnel shading block</H3 ><P > Can be used to get realistic reflections/refractions based on the angle of incidence </P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><PRE CLASS="programlisting" > <shader type="fresnel" name="fresnel1" reflected="..." transmitted="..." IOR="number" min_refle="number"> <attributes> </attributes> </shader> </PRE ></TD ></TR ></TABLE ><P ></P ><UL ><LI ><P > <TT CLASS="literal" >reflected</TT >: the input to use as reflected color (usually the conetrace output) transmitted: the input to use as transmitted color (usually another conetrace output) </P ></LI ><LI ><P > <TT CLASS="literal" >IOR</TT >: index of refraction min_refle: minimal reflection amount. </P ></LI ></UL ><DIV CLASS="informalfigure" ><A NAME="AEN11717" ></A ><P ></P ><DIV CLASS="mediaobject" ><P ><IMG SRC="PartBE/yafray/gfx/blurref_sample.png"></P ></DIV ><P ></P ></DIV ><P >mixing fresnel & conetrace blocks</P ></DIV ><DIV CLASS="section" ><H3 CLASS="section" ><A NAME="section_yafray_shaders_meta_HSV" ></A >HSV shading block</H3 ><P > Builds a color from either any inputs or inline values for HSV components. </P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><PRE CLASS="programlisting" > <shader type="HSV" inputhue="..." inputsaturation="..." inputvalue="..." hue="number" saturation="number" value="number" > </shader> </PRE ></TD ></TR ></TABLE ><P > As in the RGB color, if the inputs are omited, inline hue/saturation/value values are used. </P ></DIV ><DIV CLASS="section" ><H3 CLASS="section" ><A NAME="section_yafray_shaders_meta_image" ></A >Image shading block</H3 ><P > Assigns a bitmap image to the object according to its UV co-ordinates (outputs Color) </P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><PRE CLASS="programlisting" > <shader type = "image" name = "bitmap"> <attributes> <filename value = "c:\filename.tga" /> </attributes> </shader> </PRE ></TD ></TR ></TABLE ><P ></P ><UL ><LI ><P > <TT CLASS="literal" >filename</TT > : Path & name of bitmap to apply </P ></LI ></UL ></DIV ><DIV CLASS="section" ><H3 CLASS="section" ><A NAME="section_yafray_shaders_meta_mix" ></A >Mix shading block</H3 ><P > Mixes x2 inputs in different ways, depending on the mode used </P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><PRE CLASS="programlisting" > <shader type="mix" name="mixMode" input1="Colorband0" input2="Colorband" mode="add"> <attributes> </attributes> </shader> </PRE ></TD ></TR ></TABLE ><P ></P ><UL ><LI ><P > <TT CLASS="literal" >input1</TT > : First input to mix </P ></LI ><LI ><P > <TT CLASS="literal" >input2</TT > : Second input to mix </P ></LI ><LI ><P > <TT CLASS="literal" >mode</TT > : Possible mix modes (note, some modes output different results depending on the order of the imputs) </P ><P > These are: Add, Average, Color Burn, Color Dodge, Darken, Difference, Exclusion, Freeze, Hard Light, Lighten, Multiply, Negation, Overlay, Reflect, Screen, Soft light, Stamp, Subtractive, </P ></LI ></UL ></DIV ><DIV CLASS="section" ><H3 CLASS="section" ><A NAME="section_yafray_shaders_meta_mul" ></A >Multiply shading block</H3 ><P > Multiplies (float) input values or input value and const value, outputs a float </P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><PRE CLASS="programlisting" > <shader type="mul" name="Multiply" input1="input" input2="null" value="5.30"> <attributes> </attributes> </shader> </PRE ></TD ></TR ></TABLE ><P ></P ><UL ><LI ><P > <TT CLASS="literal" >input1</TT > : First input to multiply </P ></LI ><LI ><P > <TT CLASS="literal" >input2</TT > : Second input to multiply (if null, input1 is multiplied with the inline 'value' setting) </P ></LI ><LI ><P > <TT CLASS="literal" >value</TT > : Value to multiply if input2 is null </P ></LI ></UL ><DIV CLASS="informalfigure" ><A NAME="AEN11764" ></A ><P ></P ><DIV CLASS="mediaobject" ><P ><IMG SRC="PartBE/yafray/gfx/multiply.png"></P ></DIV ><P ></P ></DIV ><P > multiply shader with wood & marble as input </P ></DIV ><DIV CLASS="section" ><H3 CLASS="section" ><A NAME="section_yafray_shaders_meta_RGB" ></A >RGB shading block</H3 ><P > Builds a color from either any inputs or inline values for RGB components. </P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><PRE CLASS="programlisting" > <shader type="RGB" inputred="..." inputgreen="..." inputblue="..." > <color ...> </shader> </PRE ></TD ></TR ></TABLE ><P > If one of the inputs is omited, then the default color given by "color" tag is used for that input. </P ></DIV ><DIV CLASS="section" ><H3 CLASS="section" ><A NAME="section_yafray_shaders_meta_sin" ></A >Sin shading block</H3 ><P > Generates float values based on sine wave and input. </P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><PRE CLASS="programlisting" > <shader type="sin" name="Sin" input="input" > <attributes> </attributes> </shader> </PRE ></TD ></TR ></TABLE ><DIV CLASS="informalfigure" ><A NAME="AEN11778" ></A ><P ></P ><DIV CLASS="mediaobject" ><P ><IMG SRC="PartBE/yafray/gfx/sin.png"></P ></DIV ><P ></P ></DIV ><P > Wood shader is input for sin, which in turn is an input for the Hue channel of an HSV shader - the color value of a phong shader </P ></DIV ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="x11539.html" ACCESSKEY="P" ><<< Previous</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="book1.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="x11783.html" ACCESSKEY="N" >Next >>></A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Scene Description Language Overview</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="c11488.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Renderable Objects</TD ></TR ></TABLE ></DIV ></BODY ></HTML >