Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
113 lines (108 sloc) 4.82 KB
<?xml version="1.0" encoding="UTF-8"?>
<materialx version="1.36" cms="ocio" colorspace="lin_rec709">
<xi:include href="stdlib_defs.mtlx"/>
<!-- Define a node that implements a checker board pattern -->
<!-- Using a graph for the implementation. -->
<nodedef name="ND_checker_float" node="checker" type="float">
<input name="scale" type="vector2" value="8.0, 8.0"/>
</nodedef>
<nodegraph name="IM_checker_float" nodedef="ND_checker_float">
<texcoord name="texcoord1" type="vector2">
<parameter name="index" type="integer" value="0"/>
</texcoord>
<multiply name="mult1" type="vector2">
<input name="in1" type="vector2" nodename="texcoord1"/>
<input name="in2" type="vector2" interfacename="scale"/>
</multiply>
<floor name="floor1" type="vector2">
<input name="in" type="vector2" nodename="mult1"/>
</floor>
<modulo name="mod1" type="vector2">
<input name="in1" type="vector2" nodename="floor1"/>
<input name="in2" type="vector2" value="2.0, 2.0"/>
</modulo>
<swizzle name="swizz_x" type="float">
<input name="in" type="vector2" nodename="mod1"/>
<parameter name="channels" type="string" value="x"/>
</swizzle>
<swizzle name="swizz_y" type="float">
<input name="in" type="vector2" nodename="mod1"/>
<parameter name="channels" type="string" value="y"/>
</swizzle>
<add name="add1" type="float">
<input name="in1" type="float" nodename="swizz_x"/>
<input name="in2" type="float" nodename="swizz_y"/>
</add>
<clamp name="clamp1" type="float">
<input name="in" type="float" nodename="add1"/>
<parameter name="low" type="float" value="0.0"/>
<parameter name="high" type="float" value="1.0"/>
</clamp>
<smoothstep name="smoothstep1" adskDisplayName="smoothstep1" type="float">
<input name="in" type="float" value="1.5000" />
<input name="low" type="float" nodename="add1" />
<input name="high" type="float" nodename="add1" />
</smoothstep>
<invert name="invert1" type="float">
<input name="in" type="float" nodename="smoothstep1"/>
<parameter name="amount" type="float" value="1.0"/>
</invert>
<subtract name="sub1" type="float">
<input name="in1" type="float" nodename="clamp1"/>
<input name="in2" type="float" nodename="invert1"/>
</subtract>
<invert name="invert2" type="float">
<input name="in" type="float" nodename="sub1"/>
<parameter name="amount" type="float" value="1.0"/>
</invert>
<output name="out" type="float" nodename="invert2"/>
</nodegraph>
<!-- Define a node that uses the checker pattern for mixing two colors. -->
<!-- Using a graph for the implementation. checker1 becomes a sub-graph. -->
<nodedef name="ND_color_checker_color3" node="color_checker" type="color3">
<input name="color1" type="color3" value="0.8, 0.2, 0.1"/>
<input name="color2" type="color3" value="0.1, 0.1, 0.8"/>
<input name="scale" type="vector2" value="8.0, 8.0"/>
</nodedef>
<nodegraph name="IM_color_checker_color3" nodedef="ND_color_checker_color3">
<checker name="checker1" type="float">
<input name="scale" type="vector2" interfacename="scale"/>
</checker>
<mix name="mix1" type="color3">
<input name="fg" type="color3" interfacename="color1"/>
<input name="bg" type="color3" interfacename="color2"/>
<input name="mix" type="float" nodename="checker1"/>
</mix>
<output name="out" type="color3" nodename="mix1"/>
</nodegraph>
<!-- Example1: Applying a color checker pattern to an image texture. -->
<!-- Showing subgraphs with multiple levels. -->
<nodegraph name="subgraph_ex1">
<constant name="c1" type="color3">
<parameter name="value" type="color3" value="1.0,0.0,0.0"/>
</constant>
<constant name="c2" type="color3">
<parameter name="value" type="color3" value="0.0,1.0,0.0"/>
</constant>
<constant name="scale1" type="float">
<parameter name="value" type="float" value="8.0"/>
</constant>
<texcoord name="texcoord2" type="vector2">
<parameter name="index" type="integer" value="0"/>
</texcoord>
<image name="image1" type="color3">
<parameter name="file" type="filename" value="image.tif"/>
<input name="texcoord" type="vector2" nodename="texcoord2"/>
</image>
<color_checker name="checker1" type="color3">
<input name="color1" type="color3" nodename="c1"/>
<input name="color2" type="color3" nodename="c2"/>
<input name="scale" type="vector2" nodename="scale1"/>
</color_checker>
<multiply name="multiply1" type="color3">
<input name="in1" type="color3" nodename="image1"/>
<input name="in2" type="color3" nodename="checker1"/>
</multiply>
<output name="out" type="color3" nodename="multiply1"/>
</nodegraph>
</materialx>