Gimp-Forum.net

Full Version: Aligning a pattern or texture from a line?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Angry Angry Angry

Not mad at GIMP, the forum just ate my earlier post. lol. Probably too many image examples. I will try to be more concise.

Found this post: https://www.gimp-forum.net/Thread-Roofto...p-building

Rich made a video on that one that was excellent and just wanted to shout out to Rich for doing these, they are a life saver.

So I build maps, different kinds depending on needs for gaming. At the moment, I am looking to texture, pattern or stamp buildings for about 70 cities. These were generated using the Watabou generator and thus the angles of the buildings can be quite varied. I am looking for a way to align the rooftop patterns to the angles of the roof, essentially, in a quick manner. Here is an example city:
[attachment=7063]
Here are some examples I have done, which work because I played with each of them for 10-15 minutes to figure out a pattern that worked with the angle of the building. I am using filters to apply the textures right now because of speed, but I would ideally like to use real pattern images or a brush.
[attachment=7064]

Hopefully I have been clear on what I am trying to do, but in summary I'd like to find an easy way to apply textures to roughly rectangular areas that align to the angle of the rectangle, rather than to the X-Y axis of the image.

Thanks for any thoughts.

- E
So, apparently, the answer to this question is: do some hard math, Ernie. Fortunately, it looks like someone has done the hard math already. Here is a tool that can work out the angles for you:

https://www.flickr.com/photos/90104203@N00/5761692756/

Caveats:
1. Some (many?) values are simply not calculable because they involve cosigns of equations that do not always return rational numbers.
2. You will still have to figure the angle that you want to rotate to (I am assuming the Measuring tool will be best for this).

I will follow up on this if I am successful and maybe post some tips if I find them.

- E
Interesting town generator you are using.  I did look at this last night using 'possible' pattern-along path scripts. Not much success with buildings of  all different size / shape / orientation.

Those odd angular shapes will be a problem but for the more regular ones a brush and paint as a straight line gets a result. Painfully slow to adjust the brush angle and the aspect ratio to suit different sizes.

[attachment=7068]

For a more regular pattern it might be possible to select buildings with a similar orientation, put the selection as a layer group layer mask and rotate a pattern layer under that in the group. Still a problem with those odd shaped buildings.

[attachment=7069]
Just an unsolicited suggestion from the peanut gallery, but shaped gradients (spherical, dimpled) will follow the perimeter of whatever shape they are entered. Following is made with the "four bars" gradient that comes with gimp, but you could make your own  in colors and spacings that more  closely approximated shingles. What I did was to (after the fact) take a pattern of gravel, use "color to alpha" to remove the body color of the stones, leaving the grid lines only, and then bucket fill with a high threshold level that remaining grid over the top of the shaped gradient. Because the lines of the gradient dominate the image, the lines from the pattern drawn over them, appear subtle in comparison

[Image: f7KCQk7.gif]

Again, you'd want to draw your own source gradient to approximate roofing.  But if you make a lot of these, then I'm sure you would get good use out of it
FWIW
(11-17-2021, 12:05 AM)rickk Wrote: [ -> ]Just an unsolicited suggestion from the peanut gallery, but shaped gradients (spherical, dimpled) will follow the perimeter of whatever shape they are entered. Following is made with the "four bars" gradient that comes with gimp, but you could make your own  in colors and spacings that more  closely approximated shingles. What I did was to (after the fact) take a pattern of gravel, use "color to alpha" to remove the body color of the stones, leaving the grid lines only, and then bucket fill with a high threshold level that remaining grid over the top of the shaped gradient. Because the lines of the gradient dominate the image, the lines from the pattern drawn over them, appear subtle in comparison

[Image: f7KCQk7.gif]

Again, you'd want to draw your own source gradient to approximate roofing.  But if you make a lot of these, then I'm sure you would get good use out of it
FWIW

Thanks, Rickk. I may try this to provide a framework to lay the patterns on, but it does not solve the alignment problem. Tiles and other roofing generally follow the rule of being parallel with the roof peak or edge (or both in some cases). Getting patterns (or filters) to do that or not matter if they do that is the bigger issue for me.

- E
[quote pid='26746' dateline='1637168673']
 it does not solve the alignment problem.
[/quote]

By all means, suit yourself... Wink  I was just thinking that with the gradients providing the predominate view while conforming to the building's outlines,  that aspect kinda overwhelms the patterns, regardless of their orientation.

The other thing I noticed with bilinear gradients, you can orient them at any angle on the dial by dragging the gradient axis around while plotting the gradient.  Such as when creating a pitched roof.
(11-17-2021, 06:32 PM)rickk Wrote: [ -> ][quote pid='26746' dateline='1637168673']
 it does not solve the alignment problem.

By all means, suit yourself... Wink  I was just thinking that with the gradients providing the predominate view while conforming to the building's outlines,  that aspect kinda overwhelms the patterns, regardless of their orientation.

The other thing I noticed with bilinear gradients, you can orient them at any angle on the dial by dragging the gradient axis around while plotting the gradient.  Such as when creating a pitched roof.
[/quote]

Okay, if anyone else runs across this problem, there is a solution. RobA over on cartographers guild built a script (all the way back in 2009!) that handles the math for you. Thread: https://www.cartographersguild.com/showt...php?t=4293

Here is my result on 4 buildings. I created the initial bump map by simply selecting the insides of the buildings and ran a black and white gradient on them:

[attachment=7089]

The results:

[attachment=7090]

It took less than a minute to render. If anyone would like the plugin I will attach it here for convenience. [attachment=7091]

- E
That works really well. Good Find!!