Mapping material based on color?

   1084   1   0
User Avatar
Member
2 posts
Joined: April 2020
Offline
Hey guys!…I have a simple grid in Houdini which has an attribute transfer to change color(its animated). How do I attach material based on color here? So that red and black both have different materials attached and therefore, I can see the material change in render time

Attachments:
grid.PNG (293.0 KB)

User Avatar
Member
2537 posts
Joined: June 2008
Offline
Each one of those squares in the grid is called a primitive. Promote your color to the primitive context. After that, you can use a primitive wrangle to write the attribute which holds the name of the material.
s@shop_materialpath = "/mat/mat_center";
if (@Cd.r > 0.6){s@shop_material_path = "/mat/mat_red";}
if (luminance(@Cd)<0.1){s@shop_material_path = "/mat/mat_black";}
The next step would be to actually manually create three new materials in the /mat context that match the names given in the code. That's all there is to material assignment in Houdini. It is a string attribute called "shop_materialpath" that points to a material.

NOTE: Inside the Solaris context materials work a differently so you have to decide which Render system you want to use first.
Edited by Enivob - Oct. 1, 2020 09:46:28
Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
  • Quick Links