LSL control of materials available for beta testing

Things moved faster than I expected. So, as reported by Inara Pey, Maestro Linden announced in last night’s Server Beta meeting that Simon Linden’s work for LSL control of materials (normal and specular maps) is now available for testing on Aditi (the beta grid). The regions allocated for testing are roller-test102 and roller-test103, both on channel DRTSIM-253. They both have the server-side scripting support. I will remind you again that the SLurls are on Aditi. Of course, this is all a beta testing stage, so everything is work-in-progress, and the Lab itself is testing these new capabilities.

Liara Okiddo's "The Botanique". Observe the raindrops on the stone pavement; normal maps are used, besides the diffuse (texture) maps, and they are animated for a truly exquisite effect - provided, of course, that your graphics card can handle it.

Liara Okiddo’s “The Botanique”. Observe the raindrops on the stone pavement; normal maps are used, besides the diffuse (texture) maps, and they are animated for a truly exquisite effect – provided, of course, that your graphics card can handle it. Click on the image for a larger version. Original image by Liara Okiddo.

You can find more information on the Wiki page of the Server Beta User Group. I provide the details below as well.

The capabilities:

You can add and control (SET functions) materials 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]

You can read (GET functions) materials with 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]

Other details:

  • Behaviour for both getting and setting materials parameters should basically correspond to PRIM_TEXTURE’s behaviour
  • The colour vectors use 0.0-1.0 as the range, as is the case 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:

  • At this time, there is a viewer rendering issue, where the face will not be rendered and you’ll see log spam (BUG-6187), under the following circumstances:
    • 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).
  • The version currently on Aditi lacks proper throttling, so there could be performance issues if scripts behave badly.

Regarding BUG-6187, Maestro Linden explained (as reported by Inara Pey): “One thing to keep in mind …  is that if your diffuse texture lacks an alpha channel, you’ll also want to set the alpha mode to PRIM_ALPHA_MODE_NONE to avoid the bug, even if you really just want to add a normal map.” This bug does not mean that the alpha mode should be set everytime a material (normal) map is changed; only when adding a material map to a face that didn’t previously have one. Maestro gave some further information on the issue (again, as reported by Inara Pey):

What happens when you add a material via the build tool, is that the viewer inspects whether the current diffuse texture has an alpha channel and automatically sets the alpha mode to ALPHA_MODE_NONE if the diffuse texture is opaque, but keeps it at _BLEND if there’s an alpha channel. Unfortunately, the simulator can’t do this, because it doesn’t necessarily have the texture asset and doesn’t have the right libs to process texture assets in that manner. The build tool has some trickery where it always greys out the UI for alpha mode when the texture doesn’t have an alpha channel. Anyway, it’s kind of a hassle, but once PRIM_ALPHA_MODE is set to something ‘friendly’, you should be able to update normal or specular settings without touching it again.

As Simon Linden has explained during his meetings, the final version of LSL functionality for materials will include throttling to make it more difficult for griefers to user these new functions for malicious purposes. As I wrote in my previous post, I expect and hope that, sometime within this year, we’ll have the ability (on the main grid) to control normal and specular maps with the LSL functions presented. As for BUG-6187, it’s a viewer rendering bug, so it is uncertain, for the time being, when it’ll be fixed.

.

See also:

.

Shortlink: http://wp.me/p2pUmX-wx

Advertisements