Author Topic: Control object placement with map  (Read 1294 times)

Offline KyL

  • Member
  • *
  • Posts: 107
Control object placement with map
« on: May 04, 2016, 05:09:55 PM »
Hello guys!

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:
64233-0

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

Click "populate"!
64235-1

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!



Offline Dune

  • Member
  • *
  • Posts: 12266
  • Corkscrew Bird
    • www.ulco-art.nl
Re: Control object placement with map
« Reply #1 on: May 05, 2016, 06:46:01 AM »
Very logical indeed, and very useful too! Great find. Thanks for posting!
In case you still haven't seen enough of my work: www.ulco-art.nl

Offline AP

  • Member
  • *
  • Posts: 2616
Re: Control object placement with map
« Reply #2 on: May 05, 2016, 07:31:51 AM »
Interesting and it makes sense.
« Last Edit: May 05, 2016, 08:07:36 AM by AP »

Offline Kadri

  • Member
  • *
  • Posts: 7576
Re: Control object placement with map
« Reply #3 on: May 05, 2016, 02:59:39 PM »

Thanks. Good to know.

Offline bobbystahr

  • Member
  • *
  • Posts: 7452
  • Turn, and face the Strange Ch Ch Changes...D Bowie
Re: Control object placement with map
« Reply #4 on: May 07, 2016, 12:47:58 AM »
Boffo, a Cinco de Mayo present...well thought out.Thanks for sharing this.
something borrowed,
something Blue.
Ring out the Old.
Bring in the New

bobbystahr

 

anything