Trying to make a Checkered Floor

   2857   6   3
User Avatar
Member
517 posts
Joined: 12月 2013
Offline
Hi All,

Just trying to get my head around some attribute stuff. I managed to make these tiles randomised but I was wondering if anyone might know how I could make them checkered. I was thinking I could use the base mesh point number to control an attribute, and access that from a colour node, but I cant figure out a way to do that.





Any ideas??
Thanks,
Pete
User Avatar
Member
702 posts
Joined:
Offline
As long as the rows and columns of your grid are equal the equation in this hipfile will work

Attachments:
checkered_pattern.hip (67.0 KB)

User Avatar
Member
702 posts
Joined:
Offline
updated wrangle code with comments:
————————————————————

f@test = ch(“rows”)%2; //use this value to determine if the row count is odd or even

//test which row we are on and shift the value for every other
//row by an amount based on if the rows are odd or even
if( int(@ptnum/ch(“rows”))%2 )
@Cd = clamp( @ptnum%ch(“modder”),0,1);
else
@Cd = clamp( (@ptnum+(@test+1))%ch(“modder”),0,1);

//Size the copied grid based on the distance between two points
//multiply the results by the grout size ( 0.95)
@pscale = distance( vector(point(0,“P”,0)), vector(point(0,“P”,1)) ) * 0.95;

—————————————————————————
User Avatar
Member
517 posts
Joined: 12月 2013
Offline
Cool! Thanks man!
I noticed if I put += on the @Cd it would add to the existing colour too which is nice.
I'd like to learn how to code in that a little better, I'm just starting though. What language is it written in?
User Avatar
スタッフ
3455 posts
Joined: 7月 2005
Offline
wrangles are written in VEX
http://www.sidefx.com/docs/houdini15.0/vex/_index [sidefx.com]
Michael Goldfarb | www.odforce.net
Training Lead
SideFX
www.sidefx.com
User Avatar
Member
517 posts
Joined: 12月 2013
Offline
Ahhh okay cool, I'll check it out.
  • Quick Links