# Opus Pattern Grid

## Recommended Posts

Hi Houdini hive-mind

new here (sort of)

looking for some advice on how I might be able to create a grid where the cells are arranged in an opus pattern.

I have a cell of a minimum dimension (lets say 200x200), I want to be able to have the other cells multiple dimension of that in x and y.  (400x800, 600x400 or even 200x2000 for example).

Crucially there are no L shaped/tetris type arrangments.

Im fairly sure it involves making a grid of cells with the minimum size, and making random selections to delete and build bigger patches, but not sure the best way to go about it without creating odd shapes.

I've reached my intelligence limit, and I defer to clever folk here for any kind suggestions (or of course, solutions posted elsewhere)

Thanks

• 1

##### Share on other sites

I'm very curious, about this too. I'm moving today so I don't have access to phone. One I know bad idea would be to copy boxes to the point with random scale, the biggest one select first and remove from the group, and you can perform a check for over lap. And then correspondingly add smaller boxes.... A better idea is to use the same vine growth method with food, but in vex... A third idea would be to use a noise function and clamp to 5-6 tiers. I think there is a function in vex(math in general) that does this. No guarantee there would be not be an L, but you may be able to pick an appropriate noise function for the variety like a small perlin. Good luck. Hope u solve it.

• 1

##### Share on other sites

Hi,

I don't know how to make it mathematically.

Here you can find different Opus Pattern:

As you can see most pattern are based on a 7x7 grid layout. There are mostly 4 different tile types with a aspect ratio relationship. (A=3x2 units, B=2x2 units, C=2x1 units, D=1x1 units). So you can use the points of  7x7 grid and assign scaling attributes to the points according to the type of opus pattern and copy a 1x1 tile to the points with the scaling attributes.

Hope that helps...

OpusPatternTool.hiplc

• 1

##### Share on other sites

here's my attempt....it has a bit more randomizations...but also more 'blocky' cuz my approach is to repeat a 3x3 block...a variety of them...(plus another excuse to practice For Loop...)

vu_opus_grid_1.00.zip

• 2

##### Share on other sites

It's just a start, but you could turn colorful points into quads and let them randomly overwrite each other.

Edited by konstantin magnus
Highlighted the nodes that randomize the pattern.
• 3

##### Share on other sites

I guess you could check for every patch if the area is equal to the width*height, if not its an "L" shape and should be split.
Fixing the corner shapes is probably the biggest challenge of this pattern, while also maintaining the larger block shapes.

• 1

##### Share on other sites
1 hour ago, acey195 said:

I guess you could check for every patch if the area is equal to the width*height, if not its an "L" shape and should be split.
Fixing the corner shapes is probably the biggest challenge of this pattern, while also maintaining the larger block shapes.

this is the logic I'm trying to work with (get 'box' of section, measure area of box vs section, if not equal then it is an irregular shape, then also must be equal or less than 6 times a 'unit' area) but..struggling with recursive coding...(clustering into 2 smaller pieces)

Edited by Noobini
• 1

##### Share on other sites

wow, thanks so much to everyone for all these great ideas, I have been playing with them all and I really appreciate it.

I have tried a few things now.

I had started by using using a voronoi cluster and fracture similar to the method as outlined on @mestela's cgwiki , but I could never quite get the level of control vs randomness I wanted.  I also struggled to get rid of the L/Tetris shape, although I did try a similar approach as outlined by some of you.

However I recently stumbled upon a thread with a brilliant solution from @trandzik which absolutely nails what I am trying to achieve  and I can adapt it very well to my particular needs.  Thank you so much Peter.

A super-cute and most unexpected side-effect of playing about with his setup today, (and throwing in some symmetry and random deletion) - I inadvertently ended up with a pretty excellent space invader generator!

See attached

smaller gif size
• 3

##### Share on other sites

Playing with Konstantin's setup with an extrude sop and a for loop

Edited by loudsubs
• 2

##### Share on other sites
On 6/22/2017 at 10:33 PM, deadpixel said:

wow, thanks so much to everyone for all these great ideas, I have been playing with them all and I really appreciate it.

I have tried a few things now.

I had started by using using a voronoi cluster and fracture similar to the method as outlined on @mestela's cgwiki , but I could never quite get the level of control vs randomness I wanted.  I also struggled to get rid of the L/Tetris shape, although I did try a similar approach as outlined by some of you.

However I recently stumbled upon a thread with a brilliant solution from @trandzik which absolutely nails what I am trying to achieve  and I can adapt it very well to my particular needs.  Thank you so much Peter.

A super-cute and most unexpected side-effect of playing about with his setup today, (and throwing in some symmetry and random deletion) - I inadvertently ended up with a pretty excellent space invader generator!

See attached

You are welcome! I am really happy to see it helped someone By the way that gif is just great

Peter

• 1

##### Share on other sites

Even though @trandzik already has an amazing solution for creating these patterns, I wanted to take a shot at it myself and ended up with the following.

I didn't clean up any of the code, so this is just a mess but it works .

divide_grid_2.hipnc

Edited by Gorrod
changed the code to make a bit more sense ;)
• 7

##### Share on other sites

Because I was curious i expanded the idea of @konstantin magnus a bit and ended up with this setup.

divide_grid3.hipnc

• 2

##### Share on other sites

nice one! no L-shapes.

As an improvement, maybe you could add some constraints to the width/height ratio of the polygons.
In a way that would make the generation shapes that are a bit long+thin.

##### Share on other sites

with this setup there will kind of always be some small ones left to fill up space that's left because of random length. I did improve it a little bit though so you can have some control over length / height.

divide_grid3.hipnc

• 1

##### Share on other sites

Hey @Gorrod,

..one thing I was curious:

min/max Height range seems to do exactly as expected (if you set between '1 to 1', or '1 to 3' there will be a variety of primitives at this scale in height)

however minLength doesn't seem to do the same...setting '1 to 1' there will still be some larger in length.

I have absolutely no vex experience, but I messed about and adjusted the line:

```if(primNumbers[j] == primNumbers[j-yAmount] || primNumbers[j] == primNumbers[j+yAmount] || len(thisPrims)-1 > maxLength) break;
```

to

`if(primNumbers[j] == primNumbers[j-yAmount] || primNumbers[j] == primNumbers[j+yAmount] || len(thisPrims)+1 > maxLength) break;`

and it seems to do the right thing?  any thoughts?

J

##### Share on other sites

...also I would be interested if there was any way in your setup to blast the primitives that dont meet the set min/max requirements (rather than keep any small ones to fill up space of the grid)?

##### Share on other sites

As far as just deleting the primitives that are too small you could just measure their length/height in the foreach loop (see attached)

For the rest there's definitly a way better (and cleaner) way to do this but I'm too lazy to rewrite the nodes right now .

divide_grid3.hipnc

## Create an account

Register a new account