While looking for a solution to precisely populate objects on a terrain using a map, I came across this topic: http://www.planetside.co.uk/forums/index.php/topic,9685.msg101614.html#msg101614
The first experiment I did gave me good result but there was always that special case where you would have two trees on the same spot or a missing tree.
After a bit more work I managed to come out with a 100% reliable solution
that gives you the ability to distribute trees (or any other objects) exactly where you want on the terrain.
First thing, you will need to make you map so that 1 pixel = 1 meter
. Each pixel will determine the precise location of the instances of the object you want to populate. So ideally you will have something like this:
In Terragen you have several option to place your texture. Use an image map shader with the projection type on "Plan Y" and determine the size manually. Or you can use a geog image map shader and do the same thing. If you do so, you will have do change the load method to "terragen" and remove "georeference from file" to manually setup your area.
What's really important here is to have the exact same value between the definition of your map in pixel and the size of the texture in meters.
Now in the image map shader Colour tab, be sure to turn off Smooth interpolation, Unpremultiply
, and turn on Data is linear
. This is mandatory to be sure your texture is not affected in any way before driving the population density.
In the populator, place object spacing to 1,1
and spacing variation to 0,0
You should have a 1:1 match between your map and the populated result. Something I noticed is that you will always have one instance invisible as a bounding box. Don't panic, if you switch to shaded preview or render the scene, the object is there. I think it might be because it's either the first or the last instance to be populated and for some reason its bounding box is invisible.
I am using this technique heavily now and it turns out really efficient. I usually use 10k map to have a large enough area to drive my population.
One last thing, try to keep you population area as low as possible. Population with a 1m spacing takes time, even if 99% of you map is empty.
Some of you might already know this technique, but as I couldn't find anything really reliable I rather liked to do a quick post here.
happy tree painting!