User:Darien Caldwell/New Materials

From Second Life Wiki
Jump to: navigation, search

•LSL support for materials

•Materials can be added to object faces with llSetPrimitiveParams() functions

•[PRIM_SPECULAR, integer face, string texture, vector repeats, vector offsets, float rotation_in_radians, vector color, integer glossy, integer environment]

•[PRIM_NORMAL, integer face, string texture, vector repeats, vector offsets, float rotation_in_radians]

•[PRIM_ALPHA_MODE, integer face, integer alpha_mode, integer alpha_cutoff]

Wiki Pages: PRIM_NORMAL, PRIM_SPECULAR, and PRIM_ALPHA_MODE

•Valid alpha_mode options are PRIM_ALPHA_MODE_NONE, PRIM_ALPHA_MODE_BLEND, PRIM_ALPHA_MODE_MASK, PRIM_ALPHA_MODE_EMISSIVE


•Materials can be read with the various llGetPrimitiveParams() functions

•[PRIM_SPECULAR, integer face] returns [string texture, vector repeats, vector offsets, float rotation_in_radians, vector color, integer glossy, integer environment]

•[PRIM_NORMAL, integer face] returns [string texture, vector repeats, vector offsets, float rotation_in_radians]

•[PRIM_ALPHA_MODE, integer face] returns [integer alpha_mode, integer alpha_cutoff]


•Behavior for both getting and setting materials parameters should basically correspond to behavior with PRIM_TEXTURE

•The color vectors use 0.0-1.0 as the range, as with llSetColor()

•The integer parameters for PRIM_SPECULAR correspond to the same values that you see in the build tool

•Components of a material can be ‘reset’ as follows:

• •PRIM_NORMAL and PRIM_SPECULAR settings are set to ‘default’ values by setting the texture to NULL_KEY

•PRIM_ALPHA_MODE settings are set to ‘default’ values by setting the alpha_mode to PRIM_ALPHA_MODE_BLEND

•mask_cutoff is actually reset to 0 unless the alpha mode is PRIM_ALPHA_MODE_MASK

•When PRIM_NORMAL, PRIM_SPECULAR, and PRIM_ALPHA_MODE settings are all set to ‘default’ values, the material is deleted from that prim face, and LI may be updated accordingly

•Known issues

•There is a viewer rendering issue, where the face will not be rendered and you’ll see log spam (BUG-6187),

•If the viewer has ALM enabled

•and a prim face has a material on it

•and PRIM_ALPHA_MODE is PRIM_ALPHA_MODE_BLEND (this is the default after a material is added)

•and the diffuse texture does not have an alpha channel (e.g. plywood)