Custom Linden Plants

From Second Life Wiki
Jump to navigation Jump to search

Background

Currently, all plants are defined in trees.xml, which looks like this

<tree name="Pine 1" species_id="0" texture_id="0187babf-6c0d-5891-ebed-4ecab1426683"
      droop="60.0" twist="5.0" branches="5.0" depth="1" scale_step="0.7" trunk_depth="6"
      branch_length="8.0" trunk_length="11.5" leaf_scale="22.0" billboard_scale="39.5"
      billboard_ratio="1.1" trunk_aspect="0.1" branch_aspect="0.05" leaf_rotate="20.0"
      noise_mag="0.5" noise_scale="2.5" taper="0.8" repeat_z="3" />

and grass.xml, which looks like this:

<grass
    name="Grass 0"
        species_id="0"
        texture_name="grass_texture_2.tga"
        blade_size_x="1.35"
        blade_size_y="1.35"
     />

Either of these are pretty small chunks of data, and could easily be attached to a prim and configured with an LSL call similar to LLParticleSystem. Any other shape attributes of the prim so equipped could be ignored (and as an optimization, could simply not be downloaded). The prim would display as the selected plant, phantom, non-physical, moved by wind, etcetera.

Implementation

<lsl>llPlantSystem(list plant)</lsl>

Set the "plant system" parameters for the prim.

Parameters:

  • PLANT_TEXTURE, texture_id
    • texture_id is a key or string.
    • For grass, this is the billboard for the grass.
    • For trees, this contains the trunk, the leaves, and the billboard.
  • PLANT_TYPE_GRASS, blade_size_x, blade_size_y
    • No other parameters are allowed but PLANT_TEXTURE.
  • PLANT_TYPE_TREE, species_id
    • species_id is one of SPECIES_PINE_1 through SPECIES_WINTER_ASPEN, integer constants 0 through 12.
    • All parameters will be copied from the matching species_id in trees.xml, and then modified by additional parameters in the list. This allows further savings in download, since most people will probably simply replace the texture in an existing tree.
  • Additional parameters from trees.xml
    • PLANT_DROOP, float droop
    • PLANT_TWIST, float twist
    • PLANT_BRANCHES, float branches
    • Etcetera...

Notes

Since these are prims they could be linked to a build, and would be able to replace unlinked Linden trees in sold builds simply by specifying (for example) llPlantSystem([PLANT_TYPE_TREE,SPECIES_PINE_1]) with no texture or other parameters.

Since they would be phantom and simple, they would have as little impact on the sim as a regular tree.

They would reduce the number of prims in use.

They would create new building opportunities, including things like:

  • Seasonal trees that changed from a summer to a winter appearance dynamically.
  • Growing trees.
  • Unexpected use of the tree or grass systems.

Enhancements

  • Possibly separate textures for trunk, branches, and billboard?
  • Throw some random numbers into the generation so that you get plants that are individuals, and not all exactly identical clones of each other.