PDA

View Full Version : Automatic Forester



Fluesopp
01-05-2010, 08:06 PM
Tired of making those vast forests in photoshop? Tired of having to change your brush every second to get that variation your map requires? Try the new Automatic Forester. With this neat tool your lands will be filled with forests in no time!

Nah, seriously.

I got an idea as I sat on the bus from school today and made a little prototype. It uses Ramah's forest brushes.
The idea came after spending hours on hours trying to get the forests right on a huge map I'm making, using Ramah's quick forest image. But to remove all those trees were really a pain!
So I figured I could make a program which did it for me. And here it is.
It can create a 1024x1024 transparent png filled with trees, both as the brushes (transparent) and with a solid white color to avoid trunks from showing through.
And more importantly, if you load an image into the program, it creates a forest based on the shape. And if you click the screen, it generates a new set of random positioned trees.

It's still a proof of concept, but I plan on making it possible to load in a background image, being able to add trees independently of the randomizer. (And change the size of the mountains) I also plan on making a quick mountain adder to create massive mountain ranges quickly without having to manually erase those showing through parts of mountains behind.

It's a simple algorithm which decides where the trees can be positioned, but if you want to take a look or improve it, I'm including the source code.
Also, I'm aware of the bugs where a tree shows through even with fill on. It's because the algorithm is running two or more times.

Anyway, it works and it should make those pesky forests easier to make. Just draw a shape where you want your mountains and save it as a PNG with transparency. Everything that is not transparent will receive a treatment of trees.

~Fluesopp

(And I'll open source everything if anyone wondered)

update: Now with 100% better masking and with adjustable scale. Also included in this package is a panning and zooming tool for those far-away forests.

Ramah
01-05-2010, 08:27 PM
That sounds really awesome. Do you have a screeny you could post to show the result?
And yeah... I know it is a pain to remove the trees around the edge of my forest sheet, made worse by the fact that the style I used had them all pretty damn close to each other. But I've used it a few times now and it is a LOT faster than doing the whole forest by hand a brush at a time. But yes, it is fiddly.

This sounds like it could be really cool. :)

Fluesopp
01-05-2010, 08:30 PM
A little walkthrough. ;)

You may want to create a little forest island for your map. It's not large and it would be pretty simple, but maybe time consuming, to create the forest manually.

But, you also want a name, and a oddly shaped lake, and some towns around the island. And then suddenly it's not just pay and spray.

Instead, pain over wherever you want the forest to appear, on a second layer.

Turn off all other layers and save the forest mask as a PNG file, with transparency.

(image limit...)

Fluesopp
01-05-2010, 08:33 PM
(continued)

Open up the Mapper tool and click on the load button.

Check fill, if you want (looks seriously better) and save the file as a png file.

Now, open the new file in photoshop and drag it onto your map, holding shift as you do so; it snaps right to the center and align perfectly.

Add some fancy coloring and Voila! Your forest isle is complete.

edit: Oh, and since this is only a prototype, be careful. If you choose a file with data already on it, it will not ask you if you want to overwrite. It just does it.. :shock: (Gonna add that next, just in case)

Ramah
01-05-2010, 08:41 PM
Wow. That is awesome. :)

I can see a few odd bod trees on your screeny where they've gone over another but for a prototype version it's amazing.
Does it have the ability to load another pack of brushes?

Have some rep to help keep your heart warm as you continue to develop this. :D

RobA
01-05-2010, 08:55 PM
If you want something similar in Gimp, here (http://www.cartographersguild.com/showthread.php?t=2443) is a script I wrote to do much the same thing, using gimp brushes.

An example of its use are the forests for my Ascadia (http://www.cartographersguild.com/showthread.php?t=7312)map.

-Rob A>

Coyotemax
01-05-2010, 09:22 PM
a suggestion for you: would it be possible to implement a size feature?

for example, on me Darklands map, the default sized tree brushes (~30px) were way too large, but when dropped to 1/3 (~10px) they were perfect. Or would it be too hard to program in? I suppose one alternative would be to take your masked area, triple it in size, and save that as the png, then shrink it when it's done.

Also, another suggestion would be a way to increase/decrease density (more scattered trees, or more overlapping etc).

Wish I could program so I could help on this.. (and this is in no way trying to slight your work, just giving you feedback as a potential user as to the things that would be useful features to me). Repworthy, for sure!

guyanonymous
01-05-2010, 11:37 PM
What's the file-size limit (resolution)?

Fluesopp
01-06-2010, 05:29 AM
I'm working on a size feature. It's not that hard, I just need to figure how to properly scale down the brush images. For now your workaround works.
And I've experimented with the density. I had a small UI going, but it was just weird and crashed all the time, but it does work.

And the file-size limit is pretty large. I'm not sure as I haven't tested it yet. Please give feedback if you experience problems.

edit: It can't load another brushpack. What I have done is to make each brush into two images; one with color, and one 'alpha' image. So you could manually replace each brush with your own if you want.

guyanonymous
01-06-2010, 09:53 PM
I'll let you know - try number one will be on my largest image...

Coyotemax
01-06-2010, 10:16 PM
Ok, I've been testing this out. Apparently anything over 4k pixels won't run, it will only generate 1k x 1k squares. I also noticed that it seems to load with the non-filled defaulted, and it won't generate a new fill if I toggle the fill on/off for the 4k images like it does for the 1k squares. (if you follow what i mean).

Hope that helps some!

Fluesopp
01-07-2010, 06:35 AM
I tried some images myself, and when an image reaches 50mb, it won't load.
I might be able to increase the heap memory.

But the fil-box it's actually supposed to be off by default. I just have to find out how to erase parts of an image based on another image, so the trunks don't overlap.

Ramah
01-07-2010, 07:17 AM
I just have to find out how to erase parts of an image based on another image, so the trunks don't overlap.

(sorry, this post turned out a lot longer than I expected)

Isn't it possible to have your program turn the brush into a mask and then make two placements? So have your program select a position to stamp the brush, stamp the mask brush first and then stamp the actual brush in the same place? Of course, this would need doing from top to bottom so you don't get a mask erasing a tree below it on the Y axis, but I'm guessing if you can write a program like this then that would be easy for you. :)

I still need to check out your program, which I will do today, but from what has been said so far I can see it still lacks a few things that would make it perfect. Maybe you already intend to add these but I'll list out a bunch of features that I personally would love. Sorry if this seems cheeky, feel free to ignore this of course.

1) The ability to load other brush packs. I'm sure you intend this, whether or not it's in yet.

2) Size variation. A minimum and maximum size for the tree brushes so you can get a little variation in the forest.

3) Forest density. Obviously how closely packed you want your trees and also maybe a checkbox whether you want any overlapping trees or not.

4) This would be the trickiest I imagine but super cool for me... an ability to create a separate layer that contains just the shading of the trees. And while I'm at it, if that last one is possible then one for shadows too. :D
I guess I need to embelish on how I think that would be possible and then you can say whether it is theoretically sound or just plain bobbins.
I would guess that you would need a series of brushes linked by filename.
So maybe there is a brush called "Tree1" and then following that there could be a "Tree1_Shading" (maybe "Tree1_Shading2" etc. for variation) and then obviously "Tree1_Shadow".
So, when your program works out all the positions of the forest, it would go down, from top to bottom, stamp the tree mask, stamp the tree brush (which would be just the outline), stamps the shading on a new layer or image but in the same position, stamps the shadow, again on a new layer (if a shadow is required) and then moves on to the next point down the Y axis, returns to the first image and carries on the process.
Is that possible? So you'd end up with one layer with tree outlines. One layer with tree shading and then one with tree shadows.
I would imagine that it is actually, although as I see it, the main problem would be linking the different brushes that would make up each tree (or even mountain or hill :D ) together so that they would be in the right position relative to each other as each one will be a different size or shape. To do that you would either need an extra bit of UI where you could link them together and save the co-ordinates relative to each other in your program. Or if that isn't possible be a little more creative during the brush creation.

Anyway, I can see your program is already an excellent tool but if you can tailor it so that it becomes more editable in these ways then I can see this program being used by just about everyone who wants to make a hand-drawn style map and I gotta say, I'm quite excited by the prospect.
It would literally save me hours per map.

Really hoping you keep developing this. Great stuff. :)

Fluesopp
01-07-2010, 07:34 AM
Actually, that's what I'm doing right now, drawing a mask first, and then drawing the outline afterwards (if fill is selected). But just a quick question... Those tree brushes of yours, how do you apply them to your maps? The brushes are just outlines, are they not? Do you create a shading layer behind? And if so, how do you do that?

1) Currently I have a png image for each tree, and one png image for each mask. It's pretty simple, but not very customizable. I would add support for loading brush packs, but I don't know how to do that. It might not even be possible in Java. (Talking about those abr files now) What I did was to make a macro in photoshop to extract them. It required some effort on my part (as in drawing the tree in photoshop and selecting the name of the files). With it, making the images only takes a minute.

2) It should not be a problem. I just need a proper UI first.

3) I have something here, but I'm not sure it's actually working properly. Definitely something I'm going to add.

4) It's possible, and if you could provide me with such a brush pack, I'll see what I can do. (I can't draw myself...)

And I plan on adding mountains support, and the ability to create the mask inside the program as well, so it might become a complete map tool. Perhaps even landmass generation.

Ramah
01-07-2010, 07:36 AM
Ok, so I just re-read the posts in the thread and I see you have already created another brush out of white to act as a mask.
Did you physically create these yourself? Or does the program do it?
I'm guessing you did them yourself otherwise you already have most of the ability you need to load in other brush packs.
Shame.

Anyway... from what I can gather, and I could be wrong here, your problem is that on successive passes of your program generating random positions, the new trees paint over the old ones? And you want to figure out how to stop it drawing the new ones over the old?
If that is the case, is it not possible for your program to keep the X, Y co-ordinates of every tree placed, and then if it makes another pass and adds more tree positions add these new X, Y co-ordinates to the array and then re-draw the whole image again, from the top down.

Edit: Heh, I typed this as you were typing yours...

Ramah
01-07-2010, 07:55 AM
The tree brushes that you have used in your program are already shaded. I don't place a shading layer behind them other than the colour of the background. They are transparent so unless you use Midgardsomr's clone stamping trick you have to be very careful in how you place them. So my problem with them is that they are not very customizable.

I find that I much prefer it to keep shading, shadows and the outlines of the elements (trees, mountains, hills) on different layers so I can edit them and treat them separately. And this just isn't feasibly possible with brushes.

On the new map I am working on I used a single tree outline brush and with the clone stamping technique I was able to place trees in front of the others without the ones behind showing through. But I still wanted some variation in them so I hand shaded every tree on a new layer which took a long time.

So I'd absolutely love it if your program would be able to get me to this stage. A layer of outlines and a layer of shading.


I will certainly draw some sample brushes for you to use in your experimenting if you need them. And I can understand if your program cannot read the .abr files, but if you could get it so that it could import a .zip file full of png's then that would be awesome too.
I'm sure whoever would use this program in the future would be willing to create and share their own packs of brushes for it if it had that functionality.


Edit: Oh, and before I forget again, RobA, your Gimp script is amazing. I do wish you'd hurry up and get PS and a Java manual and start writing your fantastic scripts for PS as well. :D
I did notice, however, a few misplaced trees on your Ascadia map. For instance, there's one a little to the left of the "rd" in "Dorderoth". Does your script resolve the tree positions from top to bottom?

Fluesopp
01-07-2010, 11:30 AM
So for a forest, you only have two layers, right? One for the trees and one for the shadows?
What I'm aiming to do, to resolve that, is to draw the outline of a tree, without anything behind. And for the tree underneath, I draw the mask, only instead of drawing in a color, everything it draws should become transparent. This solves the problem with trunks overlapping a tree below. (The problem with trees coming on top of another tree is because of I draw them when they are assigned. It will be changed, but it's a different
problem.)

And what's the clone stamp technique?

Ramah
01-07-2010, 12:15 PM
Yes, for the forests I did on my first two maps I only had two main layers, trees and shadows.
My new map has three.

The clone stamp technique is explained here...

http://www.cartographersguild.com/showthread.php?t=7336

but it is basically what you are doing anyway, with the white behind a brush to mask off previous trees. It's nice but one problem is you have to the tree layer on multiply, or mess around with the magic wand to delete the white - something which doesn't really work if you have shading on the brush.

Fluesopp
01-07-2010, 02:34 PM
I see. That's what the program is doing right now. But what I'm aiming to do is to achieve the same look, but without the shading layer. (see image)

Ramah
01-07-2010, 02:59 PM
Ok, but I think we may have crossed wires with what you define as the "shading" layer.

I've whipped up a quick example of what I was hoping you would be able to use...

20091

If you could take two brushes like that and somehow get the program to recognise where they fit in relation to each other and then have them on two separate layers.... easy peasy. Hehe.

Fluesopp
01-07-2010, 03:19 PM
Ok, so that's what you mean by shading layer. I was thinking of shading layer as the color behind the brush. But then I see. And the shadows are that which are coming out from the tree, and falling on the ground. (Not shadows in the tree, right?)

Ramah
01-07-2010, 03:24 PM
Yup, that's right. :)

Fluesopp
01-08-2010, 05:48 AM
Here is an updated versjon. Now it correctly removes trees showing through other trees. (It's still a bit buggy, creating outlines around the trees, but that's only a problem with the images)

Scaling is up next, and a GUI...

Ramah
01-08-2010, 07:26 AM
Ok, checked out your new version and it works great. There are no trees overlapping others from above so mission accomplished on that score. :)

However, I know you said it's a little buggy but I noticed one thing you might not be aware of. The only way I could get anything to save from it was to overwrite another file. It won't save an image if I give it a name such as "Treetest.png" unless that file already exists. Not a huge problem I guess now I've worked out how to get around it but I guess something you want to fix.

Another thing I noticed that you might want to adjust is when you click the "fill" checkbox it redraws the whole image randomly again. I know that this is how you've intended it but if you can somehow make it so that clicking the "fill" checkbox just leaves the same image but with a masking background that would be awesome.
The layer WITHOUT the background is good because you can do more with it as far as blend modes go. However, if you wanted to paint a colour behind it it is awkward because of the transparency of the image. Having another version of the same image that you can use as a mask, the filled layer, would be great for manipulating whatever layers you want to under your elements. I say again, that would be awesome. :D

LOVING your work on this by the way and I'm REALLY looking forward to you refining this further. I know that I for one will be using this tool as I'm sure will a lot of others. I'll rep you again as soon as I can.

Fluesopp
01-08-2010, 09:10 AM
Whoops...:o Added an if test which only saves if the file exists, and the user presses yes. But it should indeed save if the file does not exist. heh... Better add that back in.

I plan on doing that later. It's not difficult. The only problem is the GUI. I'm not quite sure how I should build it up, and how I should present the information. I have a GUI class at school, but I'm not sure if we are going to learn much.. It's very basic, and not in Java. But I'll see what I can do. Right now it's scaling functionality I'm working on.

Ramah
01-08-2010, 10:26 AM
I'm not sure you need that much of a GUI for this. You already have a basic one with a few buttons you can press and all it needs is a few more I would say.
I guess once you get the code in for altering the size of the brushes then the easiest thing to do would be to have two edit boxes, one for minimum size and one for maximum size.

Maybe a slider would work for forest density but if that is too much hassle then a simple button that changes the status from things like:

Sparse
Light Woodland
Woodland
Heavy Woodland
Rainforest

...and then back to the beginning again so you can rotate around the settings would do just fine.
Also I think another checkbox to say whether overlapping trees should be turned off would be a nice feature.

Umm... that's about it in its basic form. If you can fulfil my wish of having it do layers for shading and shadows then you might need an extra UI element for defining where the separate brushes should be placed in relation to each other but that's not needed right now I guess.

Edit: Also, could you upload your source code for your latest version too? :) I've never learned Java but I know enough of Pascal/Delphi to understand enough of what you are doing, even if I don't know all the commands/syntax exactly. I'd be interested to see how you solved the overlapping trees.

Fluesopp
01-08-2010, 11:06 AM
I'll include some sliders to change size and density. Zooming and panning is already implemented.
As I said, if you could provide me with a set of images where the outline and shading are separated, I'll try to work something out. But right now scaling and density is a bitch..:x
I know what I want, it's just the math that's confusing.

Ramah
01-08-2010, 11:11 AM
But right now scaling and density is a bitch..:x
I know what I want, it's just the math that's confusing.

Hehe. I can imagine. Ah well... keep on it, you'll figure it out.

And I'll get some of those brushes rattled off this evening so you can get cracking on it. They'll only be quick and not very pretty but they will work for testing purposes.

Fluesopp
01-08-2010, 01:36 PM
Ok, I think the scaling works now. But I can't do anything about the density. I just don't really know how I should do it. Might ponder out a way later. Also, the fill acts weird when it's resized.. don't know why.

All in all, I think it's at least usable now.
(And the source is so messy you probably won't understand anything. What I do is I divide the canvas up into a grid, and draw a tree over 16 of those. For the next tree I check if the grid I'm painting over is already filled. If it's not, then I draw the next tree.
The tree goes a little beyond the 16 tiles, so there is a small overlap in several places. But no large overlaps.)

Ramah
01-08-2010, 02:40 PM
Yes, your scale seems to work although I'm finding the placement of trees are not as good as they were previously. Some are overlapping in, not ncessarily wrong positions but places that don't look too good. I've definitely seen at least one tree that was higher than some others yet overlapping them too.
The trouble with the slider is it makes the refresh slow and also all the trees are the same size still. I'd say that if you want to keep the slider then only make it refresh the image when "Generate" is pressed again.
That still doesn't fix the fact that all the trees are the same size though. I guess a quick workaround for that though is to change the brushes so that some of them are different size to begin with.

I thought your "Fill" button was broken to start off with but then I realised you were just showing the mask layer which is what I requested so good stuff on that. :)

I have some thoughts on how to solve your placement problems but I'll just go whip up a few example images first and you can then tell me if it's crap or it can help.

Ramah
01-08-2010, 03:26 PM
Ok... here would be how I did it if I was working out how to place trees and trying to keep in with how I think you are doing it with your 16 square grid.
I'm assuming your placement routine starts in the top left corner, goes along the x-axis, then down one row on the Y-axis and returns to X0.

The first thing I would do is have the program examine each of the brushes in its list looking for the widest one. I would then divide this by 4 to get the size of your grid - giving you your sixteen sections which the tree would occupy. As long as all the tree brushes are reasonably close in size then it doesn't matter that some would be smaller and not fit exactly to the edges of the grid.

If you resize the trees with your slider this calculation would need doing again obviously.

I'd then send the subroutine crawling through my array, starting at X0, Y0 (or X1 Y1 if Java doesn't use zero-based arrays or whatever). You know where to place the trees in relation to the .png alpha image (no idea how you do that by the way) so as soon as you reach a point in the matrix where a tree is allowed relative to the png mask you do your random check and figure out if a tree is placed and which tree is used etc. Your subroutine would then flag certain positions in your array as unavailable or illegal. If your array is boolean then I guess it would mark them as false.
Your subroutine would then repeat until you got to the next space which you are allowed to grow a tree on looking at both the .png mask AND the positioning of the last tree. You then do your random check again etc...

Here's an image to help demonstrate what I mean...

20144

So, when tree 1 is placed I would mark off all the places where I have the red X's as ungrowable. So.. X+1, X+2, X+3, X-1 Y+1, Y+1, X+1 Y+1 in the array would be marked as False.
If a tree is placed in those positions it is too close to the original and looks odd.

If you do no random checks on the positions where the tree is placed (only for which tree brush is used) then this would be the maximum density forest. There would be a tree in every available position that your .png mask allows.
To lower the density you would either
a) do a random chance check for each LEGAL space, lowering the odds each time the density is lowered.
b) Increase the number of positions marked as ILLEGAL whenever a tree is placed. So each tree is forced to grow further away from the others the lower the density is.
c) A combination of both of the above.

I hope this helps. It makes perfect sense to me but I'm not the one programming it and you would obviously know more about whether this is doable for you or not.

EDIT: I forgot to say... the red X's on the image above are ONLY relative to the first tree placed. If that image was correct there would be other red X's placed relative to the positions of the other two trees.

Ramah
01-08-2010, 04:51 PM
Gah! In an attempt to learn to understand Java a little more I've downloaded an editor and I'm trying to get the source code running in it but I'll be damned if I can get it to work. It took me ages to figure out how to open up the two files as a project so they would build without throwing errors up. And now I cannot get it to run without throwing an error up that it cannot open an image. But I can't figure out how to link to the image folder.
Opening that folder in the project doesn't work.

Gah. I'm sure there's something else I'm supposed to be getting on with... ah wait... doing a map. Hmm... but wasn't there something else? Ah yeah... working on my story. :(

Fluesopp
01-08-2010, 05:28 PM
Mapping is funnier than writing? Heh.

I'll take a look on that idea. I might even rewrite the whole program now that I know it works.

If you are using netbeans, the Image folder must be placed in the project folder. If you are using eclipse, I don't know. Probably the same place.

Ramah
01-08-2010, 06:08 PM
Ok, well I'll wait and see what you come up with then. No point in me trying to get my head around your code if you're just gonna go and rewrite it all on me. :)

I just downloaded Netbeans after you said that and I managed to get it to work in that. It was a different editor I was using before.
Well... I say I've got it to work but unless you included a different build in your source code to the one you used in your application then they are behaving very differently.
The amount of trees showing up on the screen is far fewer when run through the compiler, and they don't scale up to such a massive size.
Does the source code include the changes you made whilst trying to get the density to work?

Ramah
01-09-2010, 08:26 PM
I had a play with the source code this evening and this is what I came up with...

The positions of the trees are more along the lines of a maximum density forest how I would do it. I gave each tree a random little jiggle so it wasn't too uniform but I would say it needs each tree jiggle to effect its neighbours too, so it will look less like a pattern.

20191

One thing I can't seem to fix are those holes in the forest. I thought at first you had it randomly choosing whether to place a tree or not but upon investigation I believe its because the Tree0 image doesn't seem to work. I thought it may be because the count started at 1 but all my experiments to fix it failed.

I'll try rattling a few new brushes off for it tomorrow. To me it looks like they would be better with a hard edge so the program has no problem masking them off.

Ascension
01-09-2010, 08:39 PM
I think the holes look nice...ya gotta have some open spaces so I'd have a white blank picture for my spacer. If you could set how many holes per hundred that you want then you could get rid of the holes or have a whole bunch of holes.

Ramah
01-09-2010, 08:55 PM
I agree, Ascension. The holes do add to it and if they weren't there I would certainly want a random check to put a few holes like that in it. It's just bugging me as to why they are there. It's nice to understand something.
Anyway, until Fluesopp checks this out then I guess I won't know. Unless someone else with more Java knowledge than me checks it out.

Anyway... I just had another quick play with it before bed as I had a little brainwave on how to get rid of the obvious pattern without too much hassle.
I included a 4% random check on every tree placed along the x-axis and if it fired then that tree and all other after it move along an extra grid space.
I think this looks a lot nicer.

20196

This, to me, with a change of the brushes, would already work amazingly well and will get some use. I'm really looking forward to seeing what else Fluesopp can do with it. :)

Steel General
01-10-2010, 09:51 AM
Cool stuff here folks!

Ramah
01-11-2010, 07:11 PM
New forest on Lykarnia courtesy of this program...

20230

I still had to shade the trees etc. but the shape and placement is down to the program.

Fluesopp
01-12-2010, 08:37 AM
That's very nice.

Can you perhaps send me those improvments you made?
Currently rewriting the program now.

Ramah
01-12-2010, 10:43 AM
Sure. I'll post the source later when I have more time - I'm in a rush to go out at the moment.
I'm not sure how useful it will be to you though. They may be improvements to the utility of the program but they're not particularly well programmed. :) All global variables etc.

I also have a few more ideas of how it can be improved, some of which I lack the knowledge to implement but I'm sure you could have a crack at them.

Fluesopp
01-12-2010, 10:46 AM
I'm not going to use them straight out of the box. It was just the idea of how to position them properly. And as you have much more experience than me in that field..
And I'd like to know which ideas you have.

Ramah
01-12-2010, 01:48 PM
Ok. Well I'm not sure experience has too much to do with it. I just think that if one tree is being drawn over the top of another one then in certain places it just doesn't look good.
I think strictly speaking, if one tree is overlapping another then it's trunk needs to be lower than the one behind to give the illusion that it is closer to the viewer. It also can't be too close to covering the whole tree, unless the whole forest is like that so it appears that the viewing angle is lower.

The way I have done it so far (and it is by no means perfect yet) is basically your own way of doing it modified to allow a little random tree movement. This is fine on the X-axis using the current method as you can easily find out where the last tree was positioned. It's not too clever with jitter on the Y-axis though as it doesn't know where the tree above is. This is perfectly ok when the trees are spaced a little but the more compact they are the harder it is to make them appear randomly placed as the Y jitter is restrained too much because of bad tree placement. And that's what I was trying to work towards - a really compact forest that follows the rules of overlapping but without too many obvious rows or columns.

So I believe the best way to go from here, which is what I hope you are doing, is rewriting it to populate an array that holds every tree position.
My own next move with the version I have would be to just hold the previous row of trees in an array to see if that can solve the Y jitter problem.

Anyway... here's the source of what I have so far. I managed to get about half an hour on it this morning so I may have broken it a little. I was playing around with allowing Y-jitter when there is a slight overlap but I didn't have time to see it through to completion so it may behave oddly there.

I'm looking forward to seeing your new version. How long do you think it will take you?
I'll make a post with the few new features I've been considering later.

Ramah
01-16-2010, 06:33 PM
I thought I'd have a crack at changing the way the trees are placed to use mathematical equations and see if I could deform the forest for a different effect.
Here are the results I have at the moment...

20366

This image started out as a square forest.

And to be honest, I'm baking my noodle trying to sort out x's and y's and pluses and minuses. :s
This is just using simple right-angled triangle math to tie a tree position to the two above it. I'm pretty sure that to get it to work how I would want to I need to start using trig and not be tied down to a fixed size array but... gah... the thought of tackling such a thing leaves me depressed. So for now I think I'll close this avenue of experimenting. If anyone feels they would like to have a crack at solving it then I'll post the source code. It ain't pretty though. Hehe.

Edit: Oh, and any progress on the new version Fluesopp?

Ramah
01-16-2010, 06:43 PM
Hmm, even though it isn't working as it needs to yet, it still can kick out a decently placed small forest...

20367

The bigger the forest the worse it would look though as it stands.
Ah well. :)

Fluesopp
01-16-2010, 07:28 PM
Some progress, yes, but I just got Vue 8 and a Dragon model for Daz, so I spend my time right now rendering images...

But I've had to remake the way I draw the trees to enable a more 'plug-and-play' kind of workflow. And I had some problems with the drawings taking about ten times as long as the previous versions, which took some time to fix. And it now supports larger images.
And I think I can implement a couple of different generation algorithms, and giving the user the option to choose between them.

Ramah
01-16-2010, 08:03 PM
Sounds cool. Looking forward to trying it. :)

I have a few ideas you can implement in it if you are of a mind to. But I won't post them just yet as I don't want you to get sidetracked from doing the main thing.

Ramah
01-17-2010, 04:54 PM
Another quick forest generated tonight. All in all this image took me about 2 minutes to create....

20388

The tree outlines, shading and masks are now all on separate layers and so can all be manipulated individually. The density of the forest isn't set at maxiumum in this forest.
I've altered the order in which it paints the trees now so there should be no more trees overlapping another when its trunk is higher. There may, however, still be trees that break my own personal rules about how close it is allowed to get to another but this is a problem with the jittering. I doubt with the current way it is done it can ever be perfect on that score but I wait Fluesopp's next version with great anticipation. :D

Next up for this version I will have it generate shadows as well which will be simple to add to the program as the bulk of the work was already completed by modifying it for shading. It may be a little more awkward with brushes though. I think it will just be easier to redraw my brushes to allow the shadows to fit in their overall size and then adjust the program to suit, rather than try to attach an oddly shaped shadow image to the ones already in.

As soon as I've got the shadows working I'll upload the program and the source.

Ascension
01-17-2010, 05:56 PM
Looks pretty good to me. The line patterning around the edges (trees follow the line of the image) I can just erase out.

Ramah
01-17-2010, 06:01 PM
Looks pretty good to me. The line patterning around the edges (trees follow the line of the image) I can just erase out.

That line patterning is there simply because this was an unmasked generation so it just fills in the square pane. For a usable forest you would simply load a .png file like Fluesopp describes in his opening posts.
I think with how the jitter is currently working (I broke it a little while trying to get maximum density forest looking better) the forest would look better packed in tighter or spaced out more. The more it is spaced the greater the tree jitter but at the current density on that image it isn't wide enough to benefit from either the larger jitters or the smaller jiters that show up more when trees are closer. If you follow that stream of consciousness typing. Hehe.

waldronate
01-17-2010, 06:24 PM
It might be useful to add an option to make the forest into a tiling texture (remove the edge constraint and allow the image to wrap around). You can also do this by starting with a larger canvas and rendering the individual symbols twice (one time on the left/top and one time on the right/bottom edge) to get proper wrap. The final output would be cropped down to the smaller area. While this would seem to defeat the basic idea and purpose of the program it might be a generally useful tool for generating fills.

The last iteration does have one visual issue for me: my primitive visual system wants closer items to always be in front of items farther away. It wants to see forest areas as stretching off into the distance as though they are being viewed from above and the jumble of overlaps makes my eyes water... I had this problem with CCx maps long ago but the SYMSORT command fixed it for me. Generating the symbol entities for the whole area, sorting them on bounding box (the appropriate metric is the hard part) and then rendering them might make the whole thing a little clearer.

This program reminds me of the ancient SymFill command I did for CC2 back in 2002 (the current drawing tools have similar functionality, I understand). http://www.ridgenet.net/~jslayton/SymFill/index.html has the toy from way back then. Some of the options on the UI dialog might be useful as suggestions for ways to get the forest variance up. There was a suggestion to use multiple symbols, but I never got around to it.

Ramah
01-17-2010, 06:52 PM
These are all suggestions for Fluesopp. :)

I'm no programmer myself, knowing just enough to be able to get by programming basic functions. I've had no experience with Java until a week ago and I'm just messing around editing Fluesopp's work and trying to stumble on something that works for me.

As for your variables you have in your program, they are all basically in this one except for the symbol rotation . Unfortunately, I only have so many available to edit at run-time as I really don't know how to build up the UI. (my attempts at drop-down menus etc. ended with me pretty annoyed and I don't know how to apportion pieces of the work pane over to the UI).

I can change the scale of the trees, the x density and y density on the fly. All the jitter variables need changing in the program manually atm, although they do change depending on density and scale.

I'm quite intrigued to find out what this SYMSORT command is.

waldronate
01-17-2010, 06:57 PM
Dropping symbols in CCx leaves them overlapping in the order they are placed (first placed are on the bottom). If you have to go back and fill in holes in an area of symbols then the hole patches will be on top, which looks funny. SYMSORT sorts the selected symbols based on their insertion point from top to bottom, left to right. This operation generally fixes the problems with insertion order. It will look funny from time to time with certain layouts but it works well enough for the most part.

Ramah
01-17-2010, 07:14 PM
Hmm... well that is what this is doing. It goes down the image painting the highest trees in first from left to right. There shouldn't be any illegally painted trees in there (unless I screwed up the code, which I could well have done but in this particular case I'm not sure how to test it other than spotting a badly placed tree. And I'm ok with testing it that way. :) ).
There should be no trees overlapping another tree that is "lower" down in the image. That being said, there are certainly overlaps, some of which are more than I want (but it is hard to get an appearance of randomness without enough jitter). The overlaps should all be below another tree though although, as I say, some are closer than I would like. There could be some overlaps on the x-axis too if a tree is the same position on the y-axis, or as near as dammit, but these should be small.

If you can see any trees that blatantly overlap a tree that is lower than it then could you point it out to me?

Fluesopp
01-17-2010, 07:57 PM
Just an update: Here is how much I've finished.
I'm still a bit unsure about how I should do the rest of the GUI. I need some config, a toolbar for drawing and erasing trees and a proper layer viewer like in photoshop.
And I need an efficient way of determining how the trees should be positioned in relation to the mask.

waldronate
01-17-2010, 08:24 PM
If you can see any trees that blatantly overlap a tree that is lower than it then could you point it out to me?

The attachment shows the areas that bother me the most. They technically don't have overlap, but the way that some of the trees show large amounts of canopy near other trees without overlap gives the illusion that the sort order is incorrect.

Ramah
01-17-2010, 08:50 PM
Fluesopp: Cool, I'll take a look at that tomorrow. :D

Waldronate: Ah. Well yeah, technically they aren't bad spots. I can smooth those spots out no problem but the more you smooth things like that out the more uniform the whole forest becomes. I'm hoping for magic algorithm stuff from Fluesopp's new version.

Anyway... one last image before bed. I added shadow support with a few very quick shadow brushes. They aren't great but you can get the picture I guess...

20398

Again that took me only a few minutes to put together and I am actually very happy with it. There are lots of spots like you didn't like on the other one I guess, Waldronate, but maybe because I made the density thicker on this one the fact that there are more of those places helps them not stand out? It looks pretty good to me.

Ramah
01-17-2010, 09:07 PM
Forgot to add the latest version of...er... this version, like I said I would.

Here it is.

Ascension
01-18-2010, 12:13 AM
Now I know why I decided to never learn how to program anything other than my vcr...this is nice. Keep up the hard work, bro. Unless you're done, of course, then have a pint :)

Ramah
01-20-2010, 04:16 PM
Ok, so I'm hoping that even Waldronate won't be able to find too many problems with this next image. :) This is just the tree outline layer png output. Nothing done to it of course.

I've put in a new form of jitter that I think works really well. Better than I thought it would really. My next attempt was going to be circular jitter, which in theory (ie. in my brain) would work really well. That would be where I select a tree and then rotate the six trees surrounding it by a small angle around it. Do this all over the forest and I think it could work great. But to be honest, I'm happy enough with the jitter on this and don't think I'll bother trying any more techniques for now.

http://www.cartographersguild.com/asset.php?fid=21089&uid=7436&d=1264018146

I want to make a few more small changes to the program so that everything I've added is working fine then I'll upload everything and call my time on it done. I've now made the jitter more modular so I can switch each one on and off without changing anything else on the forest, so the effects of each can be seen and used or not as required. What I need to do though is figure out how to get more UI area so I can add edit boxes or more spinners to give more control over that jitter on the fly. A pop-up window would do it but I spend more time fighting with the damn java interface than anything else when I spend time on this. :S

Coyotemax
01-21-2010, 02:44 AM
If I replaced it with my own brushes, I would *totally* use that at this point. Dunno about others, but I'd be ready to start using it as of now :) *oh yes, rep worthy*

Ramah
01-21-2010, 07:30 AM
That isn't hard to do, as long as you stick to certain naming conventions, although at the moment the shading layer would be a problem as it is set to use multiple shade brushes for every tree. So unless your tree outlines were very similar in shape and size it would look pretty bad. It's on my todo list of little things to fix before I sign off on this but I'm still unsure as the best way to go about it, naming-conventionwise. I want to keep the ability to have multiple shade brushes per tree, but then when you add in multiple trees the naming gets more awkward. I guess Shade1_1, Shade1_2 etc. like I suggested several pages pack is the way to go.
Of course, you don't need to use the shading layer if you don't want to.
I also need to make a small addition so that brush sets can be changed on the fly. It can already do it except I haven't added the option to the UI yet.

Coyotemax
01-21-2010, 09:07 AM
I do recall the swapping of files with different brushes and naming conventions, wouldn't be too bad to put in that work for me. The shading i'm not as worried about, but I wouldn't mind putting forth the extra effort to create that as well.

I'll still wait till you're done, it just occurred to me that it would be perfect for the project I'm currently doing :)

Coyotemax
01-21-2010, 06:14 PM
Ok, so I'm testing the latest version of Ramah's out. It won't let me load a mask file.
To be more precise, it pulls up the requester, but then appears to ignore the fact I'm trying to load a mask to use, and sits there. When I first open the program it either sits there with a full layer of trees and the option bar across the top is missing, or if I'm lucky it IS there and it has a full square page of trees. Is there a specific order I should use for changing things around? Changing the numbers (fill, and density) changes the appearance, and shadow/shading works fine, I'm assuming mask works fine though it's hard to tell :)

I've tried it with a variety of filesizes, all the way down to 800px square, and I still get nothing but a single full square of trees.

I'm using XP with sp2 if that helps, and I do have the latest java installed.

Ramah
01-21-2010, 06:42 PM
Hmm, no idea why that is. I haven't had a mask refuse to load before. Before tonight that is. I was having some out of heap memory errors while trying to load a mask that was bigger than 1024 x 1024. :S I have no idea how to fix that. It's very likely that it is because I have a zillion memory leaks in the program but... meh. The mask was only that big because I was trying to see what happened if I used one double size and then scaled it in PS. I think most forests should be able to fit in an image smaller than that. Anyway... sorry CM, no idea why that is happening.
I'll post the latest version in a few minutes once I've zipped it etc. and see if that helps. It's still not completly feature complete but it's nearly there.

Ramah
01-21-2010, 07:02 PM
Ok, here's the latest version.
It should all be self-explanatory but there are a few things to watch.

The image now resizes itself to the frame window (except for when a mask is loaded). If you then increase the scale/density it will grow beyond the window and will slow down as it does more calculations. If you press generate it resizes itself to the window again so if you really need to have big trees etc. then use generate to speed up the process.
You can change the brushes from the file menu. Just select the directory where the brushes are that you want. You may need to press Generate once they've changed though as there may be some graphical glitch. There's some residual variable left over from the previous set that I haven't nailed down yet. Generate clears it. Or probably any of the other buttons/menu items will clear it too.
As I said in the last post, there seems to be a limit of 1024 x 1024 on the masks you can load. Bummer.
Shade and Shadow brushes work with all trees. So if you have different size or shaped trees then shading will be bad. As in, you may get a nice round shading file placed over a tall, thin tree etc. Shadows will probably be ok.
There are some naming conventions if you want to use your own brushes (saved as png files). All the trees need to begin with "Tree" (not case sensitive). You can have anything after that name as long as it begins with Tree. They will need some masks. The masks need to be the same shape as the tree and their filename needs to start with "Alpha". Again, you can have whatever you like after the word Alpha but be aware that if you have odd words or numbers after the tree and alpha names then they may load in the wrong order so a wrong mask will be loaded for a tree. Just call them the same name to be sure.
You can also have "Shade" files and "Shadow" files. Again, you can have whatever you like after those two names but unlike the masks it makes no difference what order they are loaded in so call them whatever you like as long as they start with Shade and Shadow.
Also, tree images should try to be kept at roughly the same width and height. It's ok to have a little variation but the program works on the widest and the tallest and not individually, so if you have a tree that is a lot smaller or fatter than others you may get bad placements.
Just take a look in the image directory's included with the zip to see how it needs to be done.
Umm... that's about it I think.

Hope this version works for you CM. Let me know how you get on.

Coyotemax
01-21-2010, 08:46 PM
Seems to work fine as long as I use small files.
I tried making a mask for the forest layer and cut it to 1000px squares, but stitching them together is going to take a lot of effort, plus they don't seem to match up evenly - they seem to be not as square as they were when i put them in.

I think I'll finish the current map off with my current method (I used your tree layer again, why reinvent the wheel yet another time, hah) and then experiment on something that's not client critical :)

Btw don't take my comments as negative towards what you and fluesopp are doing - this is a wonderful program, and I fully expect to figure out a way to use it at some point :)

Ramah
01-22-2010, 05:03 AM
You cut i down to 1000 px? How big are your damn forests? :s

Are you trying to put every single forest from the map in at once? Can't you do a forest or two at a time? I really doubt that a single forest is going to be bigger than that.
Anyway, thanks for the feedback.

Coyotemax
01-22-2010, 09:04 AM
You're right, smaller ones at once is a better way to go *d'oh*

But there are a few forests larger than 1000, yes. The full map is 4800x6600, and there's at least three forests that need to be chopped apart. Woo!

But yeah, I'm gonna retry - stitching together 3 forests will be easier than all of them :)

Coyotemax
01-23-2010, 07:39 AM
Ok, feedback time! The jitter is making it interesting to work with the masks. With no jitter, you can trust the forest to show up mostly withing the mask. Once you add the jitter, some of the trees (or large portions of them) end up outside the masked areas. I'm assuming they overlap the mask edges at that point. I did have all the jitter options turned on though. I also had the brush size set for 10 and x/y set for 3 each. I did end up having to go through and do a fair amount of erasing/masking along edges. I'm thinking if I decreased the mask size that might work (contract the selection by 5 or 10 perhaps) to reduce that happening. I really like the jitter effect - it really does make it look better. While working on the map, I had 15 forest masks set up for creation - it was actually quite easy to run them all through. If someone wanted to go nuts, they could make a batch image processing function to process all the images in a dir as alpha maps and save them with a modified filename :) No idea how hard that would be to set up though (i mention, because i see myself working at this filesize often in the future.. 4800x6600). If it's not worth the effort to implement, i'm not worried, this wasn't all that painful, the only tedious part was the saving under a new filename :) I still think this is one of the coolest things I've seen hit the forum. Yay!

Ramah
01-23-2010, 07:58 AM
That batch file certainly soundslike an interesting idea. That might be one for Fluesopp to implement though.
I have an idea that might make jittered trees stay in the alpha mask area more. It shouldn't be too hard to implement either. It might slow the program down even more though but meh. Waiting a few more seconds is still a LOT faster than spending hours on a single forest.
Btw, it will be the accumalative jitter that is making the most change to the trees going over your mask area I would guess. The other jitters just move the trees a small amount relative to the size of the tree. The accumalative one moves them relative to the size of the density and has a knock-on effect with the trees in the same row/column. It's meant for forests where the density is turned down so you get lots of randomness there.

You mentioned in an earlier post that you thought the generated forests were not coming out as square as they should be. Or I guess the same as the aplhamask? Is this still the case? Or is it this jitter that is making them appear out do you think? I ask because the statement has been bothering me and although the shapes seem ok to me, there is obviously something wrong when you use taller trees. The shape seems ok still but you need to leave quite a large blank area at the top of your mask or trees seem to get cut off. I'm guessing there's a problem with the scaling somewhere but I'll need to think on it.

Coyotemax
01-23-2010, 08:16 AM
Yeah, it was the accumulative jitter that's killing me. I'll turn that off and try the next round with the correctly shaded brushes :) Incidentally, here's the brushes arranged by lightsource direction as requested (took longer to rename the folders than it did to batch process them, woot)

Coyotemax
01-23-2010, 08:21 AM
Yeah, it was the accumulative jitter that's killing me. I'll turn that off and try the next round with the correctly shaded brushes :) Incidentally, here's the brushes arranged by lightsource direction as requested (took longer to rename the folders than it did to batch process them, woot)

Interesting. I cannot edit my posts. Well, i can edit, but then I cannot save. *note to self - mention to Arcana* Anyhow, Ramah - Interesting behaviour discovered - without a folder titled "Default Brushes" exactly as spelled, it won't allow me to open a new brush directory - won't allow a requester of any kind. Oops.

Ramah
01-23-2010, 08:25 AM
That directory is hard-coded into the program as the place to first look for brushes. You can replace the brushes in there with some you'd sooner have it start with if you like but yeah, don't change it. :)

Btw, I think you may need the accumalative jitter on as it does look like you lowered the density of your forests. I doubt you will have enough jitter without it. I'll have a think about the problem and see if I can get a fix out later to make them stay in the confines of the mask more.

Coyotemax
01-23-2010, 08:38 AM
I ran a quick test, and it seems to work ok without the cumulative. there's a few trees going well outside of the mask, but only 2 or 3 as opposed to anything that's near the edge :) We'll see, I'll run them all through and see what happens. Oh, and you may want to rename/adjust the directory names from the zipfile then. Now that I think about it, the default set didn't have any shading on it anyhow, right :)

Fluesopp
01-23-2010, 08:39 AM
Ramah, if you upload that source code, I can try to implement it into the UI I'm making.
It's pretty impressive, what you have managed to do with the simple code. Where exactly do you change it? In the tree gen method or in the paint method?

Coyotemax
01-23-2010, 08:53 AM
Here's what happens when I have the current settings Scale 10, X/Y 4 each, X and Y normal Jitter, tree spaces. The thing that's most interesting is the huge space it causes across the top.

Ramah
01-23-2010, 09:26 AM
Dammit! The forum swallowed the answer I just typed. :@

Fluesopp: I changed loads of things. I'll upload the source for you later.

CM: The banding is due to how it starts a little in from the edge when drawing. If you want a square edge like that on your forest, I would recommend leaving a blank space at the top of your alpha so that the forest starts a little way in and avoid that band. Size permitting of course.
As to the trees being out of the alpha... the ones near the edge will be down to jitter. The other ones which are way out I would suspect are placed on an area of your alpha that is not quite completely empty. I see you have a thin line of grean at the bottom of one of your sections showing where you went across with an eraser. I would guess that there are other, smaller places where you didn't quite erase it all and the program found that spot to place a tree on.
Looks like you need more jitter on that btw. The diagonals are far too uniform. I'm working on getting the cumulative to behave better with the mask boundaries now.

Gandwarf
01-23-2010, 09:29 AM
Bad, bad forum... :D

Coyotemax
01-23-2010, 09:42 AM
Ramah: is there a way to add in control over the jitter? And you might be right about the artifacts pulling trees over to them, but I thought I was pretty good at getting rid of those :)

Ramah
01-23-2010, 10:22 AM
Heh. The adding the control in is the $64k question. The simple answer is yes. It would be a cinch to change the variables for the jitter on the fly. If only I knew how to increase the UI to do such a thing. I've learned quite a lot about java over the past few weeks and I am sure without a doubt that I would be able to do it. But if the previous two weeks has taught me anything it's that I will be throwing hours at it to get something that appears to be simple to work, only to find that it is some kind of weird syntax that any young teen would know off the bat. So I might just leave that to Fluesopp as he is much better equipped to extend it in such a way.

Anyway... back to the main reason for my post. I think... THINK... I have solved the problem of the trees straying out of bounds. Not only that but fixing it has also solved the problem of the taller trees straying up the image and requiring a larger blank space at the top... AND... AND... I seem to have fixed the 1024 x 1024 limit for a mask at the same time. Yay. Well.. I've just tested it with a 1204 x 2048 image and it worked fine.

I'll just get it all cleaned up and post the new version shortly.

Ramah
01-23-2010, 10:45 AM
Ok. So here's the latest version then. I haven't included your lightsourced brushes yet CM. I'm not really sure what you meant in your earlier post about changing the directory names. The brushes I made the default ones DO have shading images with them. And shadows.

Anyway... here it is. Let me know how you get on with it. If you load your alpha BEFORE you add the jitter then you may need to press generate to have any trees out of the confines deleted. Oh and btw, I forgot to mention earlier, the program offsets the trees so that they should be positioned from the base of the trunk. So the trees will stick out at the top but there shouldn't be any trunks outside the area.

The sourcecode is also uploaded for Fluesopp to pick apart and for anyone with a mind to see if they can spot how many memory leaks there are and how much garbage is generated every time a button is pressed. :D

Coyotemax
01-23-2010, 11:33 AM
Well, it does appear to work exactly as described. I would have to redo the masks to take into account the distance between trunk and treetop (for some reason I was thinking it would keep the entire tree within the boundary of the mask, I forgot that point, my bad. I'm supposing that having the program calculate to keep the top within the mask would be hard on the computing?). I tested it with the fullsize forest mask for the map, and can tell you that 4800x6600 is too large for the program. I haven't tried cutting it down to see where the limits are yet, that will come soon. In the meantime, for actual work purposes, I just went over the previously generated trees and edited to fit within the shorelines etc. Oh, and it does look like it fills to the top of the mask on that example I posted earlier so that's perfectly done :) As to directory names from the upload, forget I said anything beyond "here are the brushes in renamed directories" lol Left LightSource and RightLightSource for ease of remembering. I was originally thinking of having them in 2 different direcotries.. LightsourceLeft and LightsourceRight to keep things easily separated. But I also renamed the brush directories themselves too. you'll see what I mean when you look in the zip. My original idea wouldn't work since it needs the default brush dir in with the program itself, so feel free to do what you need to for the directory structure. (sorry for the apparent lack of paragraph breaks, I've been putting them in but they don't always seem to stay after I hit "post")

Ramah
01-23-2010, 11:40 AM
The previous version you downloaded also positioned the trees from the trunks so their should be no change there.
The program does actually work on the top left boudary of the png and wants to position them from there. But I added an offset to each placement so that it is from the trunk, which makes a lot more sense to me and should certainly help positioning around things like rivers. I might add in the option to turn off this offset the same as with the jitters and indents, would only take a few minutes.

Edit: Actually... hmm... I think I have just thought of a problem with the offset. I need to do some tests and I may well need to upload another version later depending on the outcome.

Ramah
01-23-2010, 04:03 PM
Ok, so I fixed the perceived problem with the tree offsets. They really don't matter anyway, unless your alpha is the same size as your map and you want it to snap right into position it doesn't really matter if it is on or not. I also added the functionality you asked for CM to make the trees only placed within the bounds of the alpha and not poke out at the top. They may still poke out at the sides just a little though. I called it "Strict Mask Constraints" in the edit menu.

I also found that that large mask I managed to load up earlier won't let me change anything such as brushes on it. So yeah, problem not fixed. It MAY be that some masks a little above 1024 x 1024 will work but.... <shrug>

You should change to this version whether you want the constraints or not as the tree offsetting could well cut a little off the bottom of your alpha in the last build. Oops.

Edit: Oh, I also included the light sourced png's in this one. Although I had to place them all in the root directory for now and not separated into left and right directories. I need to alter the code to take in subdirectories I guess. But for now, don't place brush directories inside another one.

Oh.. nearly forgot.. thanks for editing those png's CM. Much appreciated. :)

Coyotemax
01-23-2010, 09:58 PM
Holycarp! yay! I'll test this out once my wife finishes making me spend time with her (oh the burden.. lol)

Coyotemax
01-25-2010, 12:50 AM
Ok, I just ran through a test with the strict mask enabled - omg yay! There's still a bit of work editing some of the edges here and there, but I'd say that combined time for creating masks, chopping them apart, generating the forests, pasting them in, and editing strays, worst case scenario for this large map of mine, maybe 1 hours total for the entire forest layout. Which I would guess is about 1/4 or less of the time I would expect to do them all by hand, especially when taking into account the overlapping..

As far as i'm concerned, we have a winner!

Ramah
01-25-2010, 07:19 PM
Ok, another update here.

I've given it the ability to save all 4 layers at once should you be needing that option. Saves a bit of arseing around changing views etc. If you do use this then be aware it will copy over any files with the same name. I'm not sure how best to do the dialog but at the moment if there is a file with the same name as you input then it will ask you if you are sure etc. then it will completely disregard that file anyway and save the four layers with the suffixes "_Trees", "_Masks", "_Shading", "_Shadows" on the end of them. Anyway, it works, it's just something to be aware of.
I've also finally given it the ability to edit the jittering amount on the fly. I've not added this ability for the cumulative jitters because they are more complex and there's not a lot of point. You can, however, now alter the amount of the X & Y jitters, the X & Y diagonal jitters and the amount of gaps in the trees.
The "Shuffle" button just reapplies whichever jitter is highlighted in the combo box. If you want to reapply all jitters at once hit "Generate." You can also use the Shuffle button to switch the jitters on instead of going into the edit menu.

As far as I am concerned now, the only pressing thing left to sort out in this is the shading and shadows being sorted on a per tree basis.

Anyhoos.. have fun.

Ramah
01-25-2010, 07:40 PM
I thought I'd post a quick screenie to show where the program is at and what it does more. The top image is obviously the program in use. Default jitter settings on x-jitter and x & y diagonal jitters. An alpha mask imported which takes all of 20 seconds to draw in PS or Gimp. The next four images below show the 4 separate layers that are saved (providing the brush set being used has shading and shadow brushes included). The bottom image shows all 4 layers combined and just ripe for a little blurring, blending, colouring and hey presto! A forest in a few minutes.

Coyotemax
01-25-2010, 07:47 PM
Perfect timing by the way. i've just been asked to redo the forests on the Dark Lands map :P

Korash
01-25-2010, 09:51 PM
been following this with interest, but a question arises to my mind...

Is this usable in Gimp?

I do not recall if that was asked or stated already or not.

RobA
01-25-2010, 10:10 PM
been following this with interest, but a question arises to my mind...

Is this usable in Gimp?

I do not recall if that was asked or stated already or not.

I had already pointed this out but I made a gimp plugin with similar capabilities using gimp image hose brushes and a density map: http://www.cartographersguild.com/showthread.php?2443-Random-Density-Map-GIMP-Script

But to answer your question more specifically, you should just be able to take the results of this program and import them into gimp as a layer.

-Rob A>

Ascension
01-25-2010, 10:13 PM
I'm wondering if there isn't a way to use building shapes instead of trees...make it a city generator as well.

Ramah
01-26-2010, 04:44 AM
Lorash: Aye, as RobA said, it just saves it as a .png image with the alpha intact. So any graphics editing program that can load a .png (which I guess is pretty much all of them) can use and edit the forest outputted.

Ascension: Well I guess you could change the tree brushes for buildings and get a kind of random cityright now, as long as you lower the density to get rid of the overlaps. It wouldn't look very good though I should imagine. Just a load of building brushes placed randomly on an alpha image with no thought for roads or orientation.
I know Fluesopp has plans to add the capability to do mountains and hills with the program but I'm not sure he had cities in mind.

Ascension
01-26-2010, 09:10 AM
I saw the alpha mask thing and thought if you make your alpha the inverse of roads, ie city blocks, then you'd have little sections.

Ramah
01-26-2010, 10:20 AM
Well yeah, you could make streets and roads in the alpha but the actual placement of houses would be much the same as the tests we were doing the other month to get instant cities, i.e. they wouldn't be rotated to follow any street angles etc. If you made an alpha with lots of roads that ran square to the x and y axis then it might be able to come up with something half decent.

Miss.Sunkiss
02-04-2010, 11:27 PM
So the person who created this sent me directions, but I don't understand them and I can't seem to get this to work. Would anyone be willing to send me screen shots of how to make this work or chat with me via hotmail so that I can put my forest on my map?

TheMarcus7
02-27-2010, 03:56 PM
Well I thought I posted something saying how much I liked this tool but it apparently went down the rabbit hole. I really like this tool.

.TM7

tilt
04-01-2010, 03:11 AM
wow - thats great work guys, can't wait to test it out :) ... consider yourself repped :)

Sapiento
05-16-2010, 01:28 PM
It's been now three weeks that I use my new PC with Windows 7. Today I tried to use the treemaker, but for some reason the system can't find the program to use the treething.jar file. Can someone give me a hint which program I have to download to make this work again?

When I start the Treething.jar file I get this error: java.lang.NoClassDefFoundError. It misses something, but I don't have a clue what.

Steel General
05-16-2010, 03:46 PM
You could try going to to java.com and updating the version of java installed on your PC.

Sapiento
05-17-2010, 02:13 AM
You could try going to to java.com and updating the version of java installed on your PC.

This was actually what I did, but it doesn't work despite I have the latest version for Windows 7 64-Bit.

Ramah
05-17-2010, 05:57 AM
Wish I could help you here but I have no idea why it wouldn't work for you.

Maybe if Fluesopp is around he might have an idea.

Steel General
05-17-2010, 08:12 AM
Maybe it has something to do with running it on 64-but Windows - have you tried it in some kind of "32-bit compatibility mode" (if there is one)

Sapiento
05-17-2010, 09:43 AM
That was my thought. But I don't have the slighest clue how to work with java files. Nevertheless, I PMed Fluesopp, I hope he'll answer shortly.

Ramah
07-26-2010, 06:40 AM
There will be an updated version of this hopefully in the near future. It still needs some work and as always it's about finding the time to do so but for now, here is an image that should hopefully illustrate a few changes to the program.

27482

When I post it I will start a new thread so I can keep any updates I do at the start of the thread instead of hijacking Fluesopp's thread.

Ascension
07-26-2010, 08:49 AM
Looks pretty good.

Sapiento
07-27-2010, 01:36 AM
Looks great!

letsgoheat
05-24-2012, 01:40 PM
Can someone help me with this please? I opened it up in Java and whenever I go to "Import Alpha" or whatever nothing happens??