Jump to content

[Help] random quads generator? (non-uniform grid?)


Recommended Posts

Hi,

 

I'm looking for a way to create random quads, so that it will look something like that:

 

image.thumb.png.383d4e4428b4a9d2919021e749074b91.png

 

I'm looking for a generator though since

(1) I want to create it on a somewhat big resolution (1024x1024)

(2) I want the squares to be smaller than the picture

(3) I want the lines to align together and be straight

 

Any ideas how can on create such a texture, hopefully not manually?

Link to comment
Share on other sites

I have attempted to search a solution and tried coding it, I do find this problem to be difficult because no one has coded up a random texture generator with squares and rectangles connecting to each other. For reference, here's my current g'mic code.

 

repeat $! l[$>]
new_dimension_w={ceil(w/50)*50+1}
new_dimension_h={ceil(h/50)*50+1}

r $new_dimension_w,$new_dimension_h,100%,1

f. "begin(qmd=50;);
xor(x%qmd?0:1,y%qmd?0:1);
"

label_fg 0,0

f. "begin(T=vectoriM(0);
for(v=1,v<iM-1,v++,
T[v]=round(u(0,1));
);
);
if(i,T[i]);;
"

f. "
A=i(x-2,y)+i(x+2,y)+i(x,y+2)+i(x,y-2)>=2?1:0;
B=i(x-1,y)+i(x+1,y)+i(x,y+1)+i(x,y-1)>=2?1:0;
A+B==2?1:i;
"
endl done

r is resize ; I resized it into 1 channel with the nearest number to the multiples of a variable number.

f is fill vector from left to right and top to bottom

label_fg basically finds the shape and fill them

50 is a variable.

 

First fill generates a grid. Second fill finds the lines and removes some of them. Third fill fills the missing dots. The problem now is to get it into square and rectangle form.

 

Another solution I can think of in theory is to use multiple fills, and using a master fill to determine the end fill. I'm not sure how to explain that.

Edited by Reptillian

G'MIC Filter Developer

Link to comment
Share on other sites

I posted this reply yesterday - but it didn't appear.  *shrugs*

 

Random quads:

 

1. On a transparent layer render a Random Maze 1 from this plugin pack: MadJik's Plugins

2. Add a new layer and run the plugin again.

3. Flip the last layer for different combinations.

 

randomquads.png

 

It's not perfect - but it should give you a great starting point.

 

  • Upvote 1
Link to comment
Share on other sites

Eli - they are used as a texture so there isn't much "purpose". Just something I want to create I guess

 

Reptillian - what's g'mic? what is that code? how are they related? anywhere I can read about the 2?

 

Red Ochre - Really cool plugin! The quads either align too well (which is a simple grid) or not, but I'm not strict about it so I'll play with it - might like the result. Thanks!

 

Ego Eram Reputo - Awesome! I loved how you took the plugin and combined the layers together. Really cool trick!

Link to comment
Share on other sites

4 hours ago, Creed31 said:

Reptillian - what's g'mic? what is that code? how are they related? anywhere I can read about the 2?

G'MIC is a plugin for Paint.NET, and it is a image processing library. Those are the WIP codes to attempt to solve the problem of creating only rectangle and squares with random layout. It is a very interesting problem because no one else has solved it. The attempt to solve it has been split into a different thread in plugin development.

Edited by Reptillian

G'MIC Filter Developer

Link to comment
Share on other sites

@Creed31, you could also try Fibonacci Fill plugin.  I realize it will not generate random rectangles you want, but if you think outside the box for a bit, you could use magic wand to select a rectangle generated by the Fibonacci Fill plugin, copy it, and paste it on a transparent layer.  It would be worth exploring.

 

 

Link to comment
Share on other sites

I have something here @Creed31 .

 

Is this something you want?

 

Colored version (with predefined palette)

 

tiacrGR.png

 

Black and White version

 

V5JJNPt.png

 

Using Image to define the color

 

Xhil1K1.png

 

These are made with the recent filters I have made using the G'MIC QT scripting language. If you want it, I'll let you know when they're pushed to G'MIC-QT.

 

Edited by Reptillian

G'MIC Filter Developer

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...