Planetside Software Forums

General => Terragen Discussion => Topic started by: choronr on October 26, 2008, 11:30:17 PM

Title: Clumping of vegatation...
Post by: choronr on October 26, 2008, 11:30:17 PM
A feature in object populations would be clumping of trees and etc. A settings under the .tgo settings wold be helpful.
Title: Re: Clumping of vegatation...
Post by: bigben on October 26, 2008, 11:59:24 PM
Isn't that handled by the population's density shader?
Title: Re: Clumping of vegatation...
Post by: Oshyan on October 27, 2008, 12:18:28 AM
Yes, exactly Ben. A "clumping" feature might be nice, but you generally get a lot more control with specific density shaders.

- Oshyan
Title: Re: Clumping of vegatation...
Post by: gregsandor on October 27, 2008, 12:27:24 AM
Quote from: bigben on October 26, 2008, 11:59:24 PM
Isn't that handled by the population's density shader?

Not really; I have to set up two pupulations, one sparse, and one dense to control that.  Masks seem to read on or off.  If they could also intensify concentration at whitest points I could use one maks and distribution setup rather than two.
Title: Re: Clumping of vegatation...
Post by: Oshyan on October 27, 2008, 01:05:13 AM
Quote from: gregsandor on October 27, 2008, 12:27:24 AM
Quote from: bigben on October 26, 2008, 11:59:24 PM
Isn't that handled by the population's density shader?

Not really; I have to set up two pupulations, one sparse, and one dense to control that.  Masks seem to read on or off.  If they could also intensify concentration at whitest points I could use one maks and distribution setup rather than two.
You can essentially do this. The maximum density will always be as you set it in the population's controls, but you can vary density from that point down to 0 by using grayscale density masks. So what you'd basically want to do is set a very high density, and then use masking to get your desired distribution and density in each area.

- Oshyan
Title: Re: Clumping of vegatation...
Post by: gregsandor on October 27, 2008, 01:54:25 AM
I think that is what I'm doing with bigben's clip.  The functions measure the intensity of my Forest mask, and split it into three density masks.
Title: Re: Clumping of vegatation...
Post by: bigben on October 27, 2008, 01:57:17 AM
Think of it in terms of the maths.  Density mask should be a BW image/PF (clamped to 0-1 for easier interpretation of the visual representation). The density of objects is thus mask density X object spacing.  To be useable, a PF mask should have a relatively large scale.  There's not much point having a minium scale of 0.1 is your object spacing is 10  

Another thing to consider is that unless your density mask has large areas of white (density =1), it may be necessary to decrease the object spacing to compensate for apparent reduction in overall density.  In my test forest in http://forums.planetside.co.uk/index.php?topic=5049.0 (http://forums.planetside.co.uk/index.php?topic=5049.0) the object spacing was between 3-5 for the different populations, even though I would normally have set this to around 10 without a mask... or what Oshyan said  ;)
Title: Re: Clumping of vegatation...
Post by: N810 on October 27, 2008, 01:51:47 PM
would this be an instance where the cloud shader would be helpfull as a mask ?
Title: Re: Clumping of vegatation...
Post by: gregsandor on October 27, 2008, 02:12:50 PM
What would be useful is two options in population masking:

As it is now darker areas of the map are just less likely to place a tree at that point.
Use mask, density evenly distributed across the mask.

Option:
Use mask, density at black 0, 0, 0 = 0/m density at grey 128,128,128 = 10/m , density at white 255,255, 255= 20/m and the shader interpolates a curve along the whole spectrum.
Title: Re: Clumping of vegatation...
Post by: buzzzzz1 on October 27, 2008, 02:43:38 PM
I'm hoping the new "Painter Shader" will take care of this when it comes out?  Isn't that basically what you guys are talking about?
Title: Re: Clumping of vegatation...
Post by: choronr on October 27, 2008, 04:00:09 PM
So do I; when developing a mask, you must take an orthographic shot of the terrain; draw the mask; and later find you missed the spot where you wanted the mask on your POV. The painter shader would be an easier way around to produce clumping ...maybe?
Title: Re: Clumping of vegatation...
Post by: bigben on October 27, 2008, 06:34:08 PM
Quote from: gregsandor on October 27, 2008, 02:12:50 PM
What would be useful is two options in population masking:

As it is now darker areas of the map are just less likely to place a tree at that point.
Use mask, density evenly distributed across the mask.

No. It's not a probability, it's an adjusted density of objects

Quote from: gregsandor on October 27, 2008, 02:12:50 PM
Option:
Use mask, density at black 0, 0, 0 = 0/m density at grey 128,128,128 = 10/m , density at white 255,255, 255= 20/m and the shader interpolates a curve along the whole spectrum.

The object spacing is the distance between objects, not the density of objects.

Object spacing = 20m
White = 1 ... 20/1 = 20m spacing
Grey = 0.5 ... 20/0.5 = 40m spacing
Black = 0 ... 0/0.5 = infinntie spacing (no objects)

If you're area of grey is only 20m wide, then with an effective object spacing of 40m there's a chance that you won't have any trees at all in this area... This is why the scale of the mask (or it's contrast/gamma) is important and why you usually have to decrease the object spacing.  A colour adjust node on the mask can be very useful for tweaking the density across the range of mask values... particularly the gamma.  The other thing I find useful for image maps is to check Data is linear in the colour section of the image map node. This ensures a linear relationship between the "brightness" of the original image and the numerical value it represents.
Title: Re: Clumping of vegatation...
Post by: gregsandor on October 27, 2008, 08:04:40 PM
I'm glad you mentioned checking linear.  Can you explain what that means please.
Title: Re: Clumping of vegatation...
Post by: Oshyan on October 27, 2008, 10:42:10 PM
Greg, I don't think I fully understand your suggestion(s).

- Oshyan
Title: Re: Clumping of vegatation...
Post by: Matt on October 27, 2008, 11:19:38 PM
The populator creates a number of candidate instances, with the average spacing you specify, e.g. 10 metres). (It's not completely accurate to say that's the average spacing, but that's approximately what happens.) For each candidate instance, the density shader is evaluated at the candidate's location to determine the probability that the candidate will be accepted. If the density shader has a value of 0.5 then there is a 50% chance that the candidate will be accepted. If the density shader returns 0.1, then there is a 10% chance that the candidate will be accepted and a 90% chance that it will be rejected. The density shader doesn't actually control the spacing or density of the instances - but that happens as a natural consequence of changing the probability of acceptance of a large number of instance.

As an example: over a large area with a density shader of 0.5, if your original point spacing was 10 metres (in other words 0.01 objects per square metre), the density shader would reduce the density to 0.005 objects per square metre or increase the average spacing to about 14 metres (not 20 metres, because density is per square metre).

Even if the density is as low as 0.1, it will only increase your average spacing by a factor of about 3.16 (because 1 / 0.1 = 10, square root of 10 is approximate 3.16). So you might want to make dark parts of your density shader much darker than you intuitively expect.

Matt
Title: Re: Clumping of vegatation...
Post by: bigben on October 28, 2008, 12:45:43 AM
Thanks for the clarification Matt.

Quote from: gregsandor on October 27, 2008, 08:04:40 PM
I'm glad you mentioned checking linear.  Can you explain what that means please.

There will be a linear correlation between the pixel value in the original image and the density it represents in TG2.  Without checking this, a non-linear gamma adjustment is made to the image which is commonly used for getting a better visual representation of images used for textures.   Having a linear correlation between the two just makes it easier to calculate what scalar value it will translate to in TG2 when you're creating your mask image.  TG2 scalar = pixel value / 256
Title: Re: Clumping of vegatation...
Post by: gregsandor on October 28, 2008, 01:07:07 AM
Thanks.
Title: Re: Clumping of vegatation...
Post by: gregsandor on October 28, 2008, 01:15:35 AM
Oshyan, what I'm suggesting is that in addition to the way we mask populations at present (a stencil), we add the ability (which we can kind of fake now with layers of populations) to plug the mask into the actual density too.  Not only would the mask limit the geographic distribution of objects in the population, it also would numerically limit them.  If you input say 10 meter spacing, the shader would then multiply that by the colors in the mask.  At pure white, the objects would be numerically more dense, and at dark grey, numerically less dense.  I also want to do this with object scale in the population.
Title: Re: Clumping of vegatation...
Post by: Matt on October 28, 2008, 01:27:31 AM
Quote from: gregsandor on October 28, 2008, 01:15:35 AM
Oshyan, what I'm suggesting is that in addition to the way we mask populations at present (a stencil), we add the ability (which we can kind of fake now with layers of populations) to plug the mask into the actual density too.  Not only would the mask limit the geographic distribution of objects in the population, it also would numerically limit them.  If you input say 10 meter spacing, the shader would then multiply that by the colors in the mask.  At pure white, the objects would be numerically more dense, and at dark grey, numerically less dense.  I also want to do this with object scale in the population.

I hope you'll see from my last post that this is exactly how it works already.

Being able to do that for scale too is something we'll add in future.

Matt
Title: Re: Clumping of vegatation...
Post by: gregsandor on October 28, 2008, 02:16:43 AM
Matt, got it.  I'm looking forward to the scale modifier too.  Thanks.