Switch BSDF

Description

../../../_images/switch.jpg

Example of switch BSDF between a metal and diffuse clay

BSDF This special BSDF switches between other BSDFs, following a user-defined switch function varying between 0 and 1. This is often used for defining areas with different BSDFs on the same surface.

For instance, if five child BSDFs are defined, they will be activated when the blend function has a value:

  • Between 0 and 0.2 for the BSDF n°1
  • Between 0.2 and 0.4 for the BSDF n°2
  • Between 0.4 and 0.6 for the BSDF n°3
  • Between 0.6 and 0.8 for the BSDF n°4
  • Between 0.8 and 1 for the BSDF n°5

Note

Before Ocean 2017 R2, this was described by a Blend BSDF with the parameter forcestep set to true

Children Nodes

Scalar shader switch The switch function selecting the BSDF, between 0 (first bsdf) and 1 (last bsdf)
bsdf user-defined First BSDF
bsdf user-defined Second BSDF
bsdf user-defined ...

Parameters

none

Ocean XML 5.0 example

<bsdf type="blend" name="switch">
   <bsdf type="reflective" name="bsdf1" rereflections="true">
      <intlaw type="cfresnel" name="intlaw">
         <medium type="linked" name="medium" target="ocean-metals::Ti"/>
      </intlaw>
      <roughness type="phong" name="roughness">
         <scalarshader type="uniform" name="exponent" value="500"/>
      </roughness>
   </bsdf>
   <bsdf type="oren_nayar" name="bsdf2">
      <filtershader type="uniform" name="diffuse">
         <spectrum type="tabulated" name="spectrum" start="380E-9" end="780E-9" num="8">
            0.2 0.25 0.3 0.35 0.5 0.6 0.7 0.7
         </spectrum>
      </filtershader>
      <scalarshader type="uniform" name="sigma" value="1"/>
   </bsdf>
   <scalarshader type="texture" name="blend" greypt="0.5">
      <image type="" name="image" path="gradient.png"/>
   </scalarshader>
</bsdf>