Difference between revisions of "Custom Linden Plants"

From Second Life Wiki
Jump to navigation Jump to search
Line 6: Line 6:
       branch_length="8.0" trunk_length="11.5" leaf_scale="22.0" billboard_scale="39.5"
       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"
       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" /</pre>
       noise_mag="0.5" noise_scale="2.5" taper="0.8" repeat_z="3" /></pre>


and '''grass.xml''', which looks like this:
and '''grass.xml''', which looks like this:

Revision as of 08:35, 26 March 2007

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

llPlantSystem(list plant)

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 thetree or grass systems.