conditional_if_float.mtlx 1.8 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?xml version="1.0"?>
  2. <materialx version="1.39">
  3. <surfacematerial name="mat_ifgreater_blue" type="material" nodedef="ND_surfacematerial">
  4. <input name="surfaceshader" type="surfaceshader" nodename="surface_shader1" />
  5. </surfacematerial>
  6. <standard_surface name="surface_shader1" type="surfaceshader" nodedef="ND_standard_surface_surfaceshader">
  7. <input name="base_color" type="color3" output="out" nodegraph="ifgreater_blue" />
  8. </standard_surface>
  9. <nodegraph name="ifgreater_blue">
  10. <image name="input_image" type="float">
  11. <input name="file" type="filename" value="resources/Images/grid.png" />
  12. <input name="default" type="float" value="0.0" />
  13. </image>
  14. <!-- Output a gradient of blue based on the image value for debugging -->
  15. <combine3 name="blue_gradient" type="color3">
  16. <input name="in1" type="float" value="0.0" />
  17. <input name="in2" type="float" value="0.0" />
  18. <input name="in3" type="float" nodename="input_image" />
  19. </combine3>
  20. <!-- Use ifgreater to output bright blue above threshold, dark blue below -->
  21. <ifgreater name="ifgreater1" type="color3">
  22. <input name="value1" type="float" nodename="input_image" />
  23. <input name="value2" type="float" value="0.5" />
  24. <input name="in1" type="color3" value="0.2, 0.2, 1.0" /> <!-- bright blue -->
  25. <input name="in2" type="color3" value="0.0, 0.0, 0.2" /> <!-- dark blue -->
  26. </ifgreater>
  27. <!-- Mix between the blue_gradient and the thresholded blue for debug visualization -->
  28. <mix name="debug_mix" type="color3">
  29. <input name="bg" type="color3" nodename="blue_gradient" />
  30. <input name="fg" type="color3" nodename="ifgreater1" />
  31. <input name="mix" type="float" value="0.5" />
  32. </mix>
  33. <output name="out" type="color3" nodename="debug_mix" />
  34. </nodegraph>
  35. </materialx>
粤ICP备19079148号