In the vex builder, how can I create a checkboard pattern? I saw the “Ginham checks” but I still want a checkboard pattern to do some shader testing.
pls help!
very basic vop question
3627 5 1- brucelay
- Member
- 313 posts
- Joined: July 2005
- Offline
- Simon
- Member
- 2199 posts
- Joined: July 2005
- Offline
You need to combine two stripe vops together. Wire a global s into the s input of one and then the global t into the s input of the second. This should give you two sets of stripes at 90 degrees to each other. Next multply the outputs together and also take the complement of each and multiply them together too. Finally use a compare and a two way switch to always pick the greater of the two results.
I'll post a shader on exchange if you get stuck.
(RFE: to Sesi this would be a very useful standard shader to have)
However you might want to consider making one with a small bitmap and a VEX decal shader, that way you can see the checker in the viewport.
I'll post a shader on exchange if you get stuck.
(RFE: to Sesi this would be a very useful standard shader to have)
However you might want to consider making one with a small bitmap and a VEX decal shader, that way you can see the checker in the viewport.
The trick is finding just the right hammer for every screw
- Mario Marengo
- Member
- 941 posts
- Joined: July 2005
- Offline
What Simon said! It works perfectly.
I just wanted to add, for the curious, that there is an interesting alternative that allows you to do this sort of thing arithmetically (I mean without the need of a max() function) by using boolean operators.
Given two patterns ‘a’ and ‘b’, both in the range (in this case, two antialiased orthogonal pulse trains), you can define a “Union” operator as:
Union = (a+b) - (a*b)
And an “Intersection” operator as:
Intersection = (a*b)
We can describe a checkered pattern as the Union minus the Intersection, so we have:
Checks = Union - Intersection
= (a+b) - (a*b) - (a*b)
= (a+b) - (2*a*b)
This stuff comes from Perlin, who gives two other operators:
Difference = a - (a*b)
Complement = 1 - a
We already have “Complement” in VOPs, maybe SESI could add the others as “standard” VOPs since they're pretty useful for describing patterns in an intuitive way. (maybe stuff them into a single “Boolean” OP?).
Cheers!
I just wanted to add, for the curious, that there is an interesting alternative that allows you to do this sort of thing arithmetically (I mean without the need of a max() function) by using boolean operators.
Given two patterns ‘a’ and ‘b’, both in the range (in this case, two antialiased orthogonal pulse trains), you can define a “Union” operator as:
Union = (a+b) - (a*b)
And an “Intersection” operator as:
Intersection = (a*b)
We can describe a checkered pattern as the Union minus the Intersection, so we have:
Checks = Union - Intersection
= (a+b) - (a*b) - (a*b)
= (a+b) - (2*a*b)
This stuff comes from Perlin, who gives two other operators:
Difference = a - (a*b)
Complement = 1 - a
We already have “Complement” in VOPs, maybe SESI could add the others as “standard” VOPs since they're pretty useful for describing patterns in an intuitive way. (maybe stuff them into a single “Boolean” OP?).
Cheers!
- mark
- Staff
- 2590 posts
- Joined: July 2005
- Offline
Simon
You need to combine two stripe vops together. Wire a global s into the s input of one and then the global t into the s input of the second. This should give you two sets of stripes at 90 degrees to each other. Next multply the outputs together and also take the complement of each and multiply them together too. Finally use a compare and a two way switch to always pick the greater of the two results.
I'll post a shader on exchange if you get stuck.
(RFE: to Sesi this would be a very useful standard shader to have)
However you might want to consider making one with a small bitmap and a VEX decal shader, that way you can see the checker in the viewport.
Actually, the conditional produced by the switch may cause aliasing issues near the corners of the squares.
I've always thought the easiest way was to put down a “Boxes” VOP and set the number of layers to 2.
The Boxes works by splatting boxes and thus doesn't have the filtering issues the switch VOP has. Aside from which you can play with the random offsets and move some of your squares around.
- Simon
- Member
- 2199 posts
- Joined: July 2005
- Offline
- Mario Marengo
- Member
- 941 posts
- Joined: July 2005
- Offline
-
- Quick Links