LDraw.org Discussion Forums

Full Version: Tool request: object scatter
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I would like to request a simple tool to randomly distribute objects (such as trees or bushes) over a wide area, taking into account collision with other objects and the ground. I.e. just drop them vertically from the sky and make sure the trees 1) don't intersect with each other and 2) stop falling when they collide with other objects below them such as bumpy terrain. If the tool runs from the command line that is okay! Thanks!
(2021-04-20, 3:48)Michael Horvath Wrote: [ -> ]I would like to request a simple tool to randomly distribute objects (such as trees or bushes) over a wide area, taking into account collision with other objects and the ground. I.e. just drop them vertically from the sky and make sure the trees 1) don't intersect with each other and 2) stop falling when they collide with other objects below them such as bumpy terrain. If the tool runs from the command line that is okay! Thanks!

I fully support it. Great idea!!
(2021-05-12, 13:45)MadeleineBailey Wrote: [ -> ]I fully support it. Great idea!!

I am getting help doing it in POV-Ray since it has all sorts of maths features! The caveat is that you have to convert your model to POV-Ray format *first*. (But then you can export the generated coordinates to whatever format you wish, such as a spreadsheet table.)



Mike
I started a thread on the POVray newsgroup:

http://news.povray.org/povray.advanced-u...ay.org%3E/

The "clutter.mcr" script mentioned down-thread works extremely well, but does NOT play nice with `mesh` or `mesh2` objects. (Some kind of bug in the script.) Your best bet is to generate a 2D grayscale image representation of your terrain, i.e., a "heightmap" or "heightfield", then feed that into the script.

https://en.wikipedia.org/wiki/Heightmap

Tools such as World Machine (the one I use) can generate such images. Other programs include Wilbur and Terragen. If your image is 1 pixel = 1 stud resolution, it should work well in most cases.

I will write a tutorial when I get all the issues ironed out. (I have to convert my terrain back into the 2D grayscale image format first, since I deleted the original one by accident.) There are some examples in the discussion thread I linked to for you to look at, in the meantime.

If you are interested in the bug I mentioned, see this thread:

http://news.povray.org/povray.advanced-u...ay.org%3E/
(2021-05-21, 3:56)Michael Horvath Wrote: [ -> ]I started a thread on the POVray newsgroup:

http://news.povray.org/povray.advanced-u...ay.org%3E/

The "clutter.mcr" script mentioned down-thread works extremely well, but does NOT play nice with `mesh` or `mesh2` objects. (Some kind of bug in the script.) Your best bet is to generate a 2D grayscale image representation of your terrain, i.e., a "heightmap" or "heightfield", then feed that into the script.

https://en.wikipedia.org/wiki/Heightmap

Tools such as World Machine (the one I use) can generate such images. Other programs include Wilbur and Terragen. If your image is 1 pixel = 1 stud resolution, it should work well in most cases.

I will write a tutorial when I get all the issues ironed out. (I have to convert my terrain back into the 2D grayscale image format first, since I deleted the original one by accident.) There are some examples in the discussion thread I linked to for you to look at, in the meantime.

If you are interested in the bug I mentioned, see this thread:

http://news.povray.org/povray.advanced-u...ay.org%3E/

You can see it working here:

[Image: 51207485841_663dcae650_k.jpg]ldview_screenshot_024.fs by Michael Horvath, on Flickr

That's 24000 trees, and LDView is not happy!
(2021-05-28, 1:46)Michael Horvath Wrote: [ -> ]You can see it working here:

[Image: 51207485841_663dcae650_k.jpg]ldview_screenshot_024.fs by Michael Horvath, on Flickr

That's 24000 trees, and LDView is not happy!

Looks great though. Makes me happy if there would be an LDraw tool that has this feature or embedded in LDCad for example.
Not only for trees, but also random parts for landscaping. We did some tests on that in LDCad using the LUA script.

Would this also be possible to create an effect like the transparent blue 1x1 plates in the Ship in a Bottle and so scatter them in a certain area?
(2021-06-11, 9:18)Jaco van der Molen Wrote: [ -> ]Looks great though. Makes me happy if there would be an LDraw tool that has this feature or embedded in LDCad for example.
Not only for trees, but also random parts for landscaping. We did some tests on that in LDCad using the LUA script.

Would this also be possible to create an effect like the transparent blue 1x1 plates in the Ship in a Bottle and so scatter them in a certain area?

I am not familiar with that model, so I dunno.

The effect cannot be stacked, however. It is only one layer deep, not multiple layers deep into the ground.

I.e., it is effectively a 2D effect or projection, not voxels.