LANDSCAPE OBJECT SCATTERER
This script automatically places landscape objects such as trees, plants, mushrooms and rocks in any scene. While the script can work with very little configuration, there are a lot of features build-in that can not just be guessed or accidently stumbled upon. Please take your time with this documentation, the script can be quite fun to play with.
OVERVIEW
This script is designed to help you populate any landscape with an abundance of plants. All you do is to specify a rectangular area that will be measured (height and slope) to identify if a plant can grow in that area. Eligible spots are identified by looking at the height and slope of a potential placement position. The terrain measurement is then compared against the parameter you specified. The primary parameter you specify is the height range that a plant is allowed to grow on. Some plants will only be allowed at ground level, while other plants or objects may be set to only grow on mountain tops. The second parameter that is considered is the slope. Some tall plants can usually grow on fairly steep slopes, while others like bushes typically prefer flatter grounds. The plants can either always grow upright for things like trees, or adhere to the slope for things like grass.
FEATURES
- 20 Slots for 20 different plant groups (any inventory item, no plants included).
- Placement based on height ranges and slope angle.
- Plants are randomly rotated.
- All random parameters are repeatable. That way the scene can be created in a predictable way each time. To switch it up initially choose a random seed per group.
- Plants can adhere to the slope of the landscape, e.g. grass can grow on a hill or landscape objects stay upright.
- The script is best placed in a trigger volume, the size of the scan area can be set in units (x and y).
- Verbose mode will rezz corner beacons if you specify them. Corner beacon are available for free on the FULLSpectrum store).
- Verbose mode will give feedback on auto placement and what distribution algorithm was chosen by the code.
- Multiple scripts can be chained. That way the user can control what gets rezzed first and the throttles are never overwhelming the scene.
- Shielding objects to protect areas like structures can be placed at scan height.
Name: A label used in the verbose script output, making it easier to know which script is reporting.
-> Start: Simple Script command that can start the script (for chaining) use “auto” for immediate launch (but chain additional rezzers). The script places plants at the highest allowed speed. Two scripts on auto would cause problems.
On Completion -> : Simple Script command that gets sent when the script placed all landscape objects. Use for for chaining.
Landscape Objects: Allows you to choose up to 20 objects from your inventory.
Config Strings: Each config string contains 9 Numbers that specify how the script places your object
Use a semicolon or comma as separator! You can use text to label things in the config string, all text is filtered out before the script looks at the parameters.
Example config string
height:0.01; range:3; minSlope:0; maxSlope:5; maxObjects:15; zOffset-0.5; adhereToSlope:0; SEED:999; algorithm:0
1: Base height
2: Height range added to base height
3: Slope range minimum in degress. You will use 0 in most cases.
4: Slope range maximum in degrees. E.g. 45 means that your plant will not be placed if a slope is steeper than 45 degrees.
5: Maximum number of plants for that group.
6: Height offset, e.g. -0.5 is good for trees so they are always completely in the ground, if you do configure ground plants this value should be very very small e.g. 0.005 (5mm if a unit was one meter), please experiment!
7: Follow slope, use 0 for upright (much faster), 1.0 for completely aligning to the slope.
8: Specify seed to fix random positions, objects will be placed in the same position if seed remains unchanged. Use different seed values to mix things up.
9: Placement algorithm: Default is 0 for random distribution which creates natural clusters of objects. You can try the less natural linear distribution by setting this to 1. It depends largely on the amount of slots available. If there are way too many slots this will create rows of trees. If the amount of available placements slots are close to the amount of objects this can create the most even coverage, still somewhat randomized.
Corner Markers: Object to be rezzed in the four corners of scan matrix
Scan Height: Default 45, sets the height were the ray casts to find the ground level begin, objects that protect an area need to be placed at that exact height.
X Scan Area: X dimension of Scan Area
Y Scan Area: Y dimension of Scan Area
Grid Spacing Distance: Density of the grid used for placement.
Verbose: Turns on feedback in chat and the corner marker.
Please consider the following
- Be careful with the size and density of your scan area!!100×100 with density of 1 means there will be 10000 rays cast to find spots for your plants.
- Do not plant more than about 1000 landscape objects in a scene.
- Use the draw distance flag on your plants.
- AVOID using high polygon trees and plants etc. try to find objects with ~ 300 triangles for small ground objects and not more than perhaps 3000 for your trees.
- Start small with few groups, small areas and always have an eye on your framerate.
Trouble Shooting & General Tips
- If you are unhappy with the plant distribution, try to change many parameters even if the changes are subtle.
- Try not to use identical height and slope parameters in two groups, otherwise the plants will compete for the same spots. They are still going to be randomized, but if there only 77 spots for 40 plants some plants will merge into new species.
- Always use different seeds for each group.
- If plants stack on top of each other it means that they have collision enabled.
- Share your landscape results with Bagnaria she loves to see what you created.
CHAT COMMANDS
Since version 1.1 the Landscape Object Scatterer can be configured in chat. The script commands are entered in nearby chat. This is part of the verbose mode that is designed to optimize your configuration. You no longer need to build your entire scene over and over again to fine tune your landscape.
/lshelp
will print all available commands
All commands that allow to set a value have two parameters. The first is the slot of the plant group a number from 0-19. The second parameter is the actual value.
/height slot value
example: /height 0 0.01 – > sets eligible start height of the first plant group to 1 cm
/range slot value
example: /range 0 2 – > sets eligible start range of the first plant group to 2 meters, with the previous parameter that would mean plants are eligible to grow from a height of 1 cm to 2.01 meters.
/minslope slot value
example: /slope 1 0 – > sets eligible start slope of the second plant group to zero degrees (most common value is 0)
/maxslope slot value
example: /maxslope 1 30 – > sets eligible maximum slope of the second plant group to 30 degrees, with the previous parameter that would mean plants are eligible to grow from a 0 to 30 degrees.
/max slot value
example: /max 0 50 – > sets amount of plants of the first plant group to 50, with the previous parameter that would mean plants are eligible to grow from a height of 1 cm to 2.01 meters.
/zoffset slot value
example: /slope -0.1 – > sets root height of the second plant group to 0.1 meters underground (most common value is -0.01 for ground plants and -0.5 for tree roots so they do not stick out on slopes)
/adhere slot value
example: /adhere 1 1 – > tells each plant in the second plant group to grow ad the angle of it’s ground area, most commonly this is set to 0 which tells each plant to orient itself upright towards the sky
/seed slot value
example: /seed 2 1 – > set the seed value for the third plant group, use values from (999-999999) to mix up the randomization to your liking
/algo slot value
example: /algo 2 1 – > sets the algorithm to be used for the third plant group linear, usually this should be left at 0, but you are welcome to try this parameter which often lead to tree plantage like configurations
Important: Only one script should ever run in verbose mode! You will want to turn off any verbose script in your finalized scene.
VERSION HISTORY
Version 1.30 Added an optional ninth parameter that allows to select the distribution algorithm. Default is now the most natural random distribution, yet. Set to 1 if you want to play with linear distribution, which often ends up creating rows of trees, but can also provide the most even coverage.
Version 1.27 Better random seeding when parameters are nearly identical, added a problem solving segment to this listing for more tips. Fixed parsing error where sometimes float parameters would be ignored in chat.
Version 1.25 Improved object distribution
Version 1.2o /showconfig command added, optimized the distribution of objects so they always cover the whole grid, minor bug fixes
Version 1.1o /lshelp chat helper when in verbose, chat commands so that the config can be changed in-world without round trips, easier to read config
Version 1.o1 now supports seeds to keep randomization repeatable.