Difference between revisions of "PRIM ALPHA MODE"

From Second Life Wiki
Jump to navigation Jump to search
m (<lsl> tag to <source>)
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<onlyinclude>{{#if:
<onlyinclude>{{#if:


{{#vardefine:texture_return|an empty list.}}
{{Issues/BUG-7306}}


{{#vardefine:texture_const|{{LSL Const|PRIM_ALPHA_MODE|integer|38|c=Used to {{GetSet|{{{1|}}}|get|set|/}} the diffuse texture alpha rendering mode of a prim's face}}}}
{{#vardefine:alpha_mode_const|{{LSL Const|PRIM_ALPHA_MODE|integer|38|c=Used to {{GetSet|{{{1|}}}|get|set|/}} diffuse texture alpha rendering mode of a prim's face.}}}}


{{#vardefine:p_alpha_mode_desc|which PRIM_ALPHA_MODE_ to use - valid options are '''PRIM_ALPHA_MODE_NONE''', '''PRIM_ALPHA_MODE_BLEND''', '''PRIM_ALPHA_MODE_MASK''', and '''PRIM_ALPHA_MODE_EMISSIVE'''}}
{{#vardefine:p_face_desc|a [[face]] number or [[ALL_SIDES]]}}
{{#vardefine:p_alpha_mode_desc|PRIM_ALPHA_MODE_* flag}}
{{#vardefine:p_mask_cutoff_desc|when the alpha rendering mode is '''PRIM_ALPHA_MODE_MASK''', sets the alpha value above which a pixel renders as fully opaque, in the range 0 to 255}}
{{#vardefine:p_mask_cutoff_desc|when the alpha rendering mode is '''PRIM_ALPHA_MODE_MASK''', sets the alpha value above which a pixel renders as fully opaque, in the range 0 to 255}}
{{#vardefine:p_mask_cutoff_hover|when the alpha rendering mode is PRIM_ALPHA_MODE_MASK, sets the alpha value above which a pixel renders as fully opaque, in the range 0 to 255}}


{{LSL_Function/inventory|texture|uuid=true|type=texture|no_caveat={{#ifeq:{{{1|}}}|get|true|<noinclude>*</noinclude>}}|full={{{remote|}}}|remote={{#ifeq:{{{1|set}}}|get|*}}|target=PRIM_ALPHA_MODE#Target}}


{{#ifeq:{{{1|}}}|none||
{{#vardefine:p_alpha_mode_rows|
 
!{{!}} {{LSLPT|alpha_mode}} Flags
{{#vardefine:facetable|{{#var:facetable}}
! title="value" {{!}} V
! colspan="3" {{!}} Description
! colspan="3" {{!}} Notes
{{!}}-
{{!}} {{LSL Const|PRIM_ALPHA_MODE_NONE|integer|0|c=Render the diffuse texture as though the alpha channel were nonexistent}}
{{!}} {{#var:value}}
{{!}} colspan="3" {{!}} {{#var:comment}}
{{!}} colspan="3" {{!}} The viewer’s build tool sets this by default when a face has a material and no alpha channel is present in the diffuse texture.
{{!}}-
{{!}} {{LSL Const|PRIM_ALPHA_MODE_BLEND|integer|1|c=Render the diffuse texture with alpha-blending.}}
{{!}} {{#var:value}}
{{!}} colspan="3" {{!}} {{#var:comment}}
{{!}} colspan="3" {{!}} This value is also used as the default to clear the materials settings from a prim face.
{{!}}-
{{!}} {{LSL Const|PRIM_ALPHA_MODE_MASK|integer|2|c=Render the prim face in alpha-masked mode.}}
{{!}} {{#var:value}}
{{!}} colspan="3" {{!}} {{#var:comment}}
{{!}} colspan="3" {{!}} Diffuse texture pixels which are more opaque than {{LSLP|mask_cutoff}} will be rendered as fully opaque, while the other pixels will be fully transparent.
{{!}}-
{{!}}-
}}
{{!}} {{LSL Const|PRIM_ALPHA_MODE_EMISSIVE|integer|3|c=Render the prim face in emissivity mode.}}
 
{{!}} {{#var:value}}
{{#vardefine:caveats_get|
{{!}} colspan="3" {{!}} {{#var:comment}}
*If {{LSLP|face}} indicates a face that exists but does not contain a material, the [[PRIM_ALPHA_MODE]] return is '''[ PRIM_ALPHA_MODE_BLEND, 0 ]''' }}
{{!}} colspan="3" {{!}} Diffuse texture pixels opacity maps to their emissivity when rendered.  Fully opaque pixels will effectively be rendered as ‘full bright’.
 
{{#vardefine:caveats_set|
*  To clear the custom alpha mode parameters from the face (and possibly remove the material), set  {{LSLP|alpha_mode}} to '''PRIM_ALPHA_MODE_BLEND'''.
{{LSLP|mask_cutoff}} is not stored unless {{LSLP|alpha_mode}} is '''PRIM_ALPHA_MODE_MASK'''.
*  Note that whenever any face in a linkset contains a material (i.e. has a non-default [[PRIM_NORMAL]], [[PRIM_SPECULAR]], or [[PRIM_ALPHA_MODE]]), the linkset will use the [http://community.secondlife.com/t5/English-Knowledge-Base/Calculating-land-impact/ta-p/974163 new accounting system]. }}
 
{{#ifeq:{{{1|}}}|get|
 
{{#vardefine:caveats|{{#var:caveats}}
{{#var:caveats_get}}
}}
 
|
 
}}
}}
}}
{{#vardefine:caveats|{{#var:caveats}}
{{#var:shared_caveat}}}}


}}</onlyinclude>{{#if:
}}</onlyinclude>{{#if:
{{#vardefine:caveats_set|{{#var:caveats}}{{#vardefine:caveats|}}}}
{{#vardefine:issues_set|{{#var:issues}}{{#vardefine:issues|}}}}
{{LSL_Function/face|face|{{#var:texture_const}}|!footer=*|return={{#var:texture_return}}}}
{{#vardefine:caveats_get|{{#var:caveats}}{{#vardefine:caveats|}}
{{#var:caveats_get}}
{{#var:shared_caveat}}}}
{{#vardefine:issues_get|{{#var:issues}}{{#vardefine:issues|}}}}


}}{{LSL Constant
}}{{LSL Constant
|inject-2={{LSL PrimitiveParam Categorize|Face}}
|name=PRIM_ALPHA_MODE
|name=PRIM_ALPHA_MODE
|type=integer
|type=integer
|value=38
|value=38
|desc=Used to get or set the diffuse texture alpha rendering mode of a prim's {{LSLP|face}}.
|desc=Used to specify how the alpha channel of the diffuse texture should affect rendering of a prim’s face.
|examples=
|examples
|pa={{LSL Constant/List|i_front=[&#32;{{#var:texture_const}},&#32;|i_end=&nbsp;]|
|constants
|inject-1={{#vardefine:p_texture_desc|}}
|notes=* Note that as with [[PRIM_NORMAL]] and [[PRIM_SPECULAR]], setting a custom (i.e. not [[PRIM_ALPHA_MODE_BLEND]]) alpha mode on a prim faces causes the linkset to use the  [http://community.secondlife.com/t5/English-Knowledge-Base/Calculating-land-impact/ta-p/974163 new prim accounting system].
{{#vardefine:p_texture_hover|}}
* {{LSLP|mask_cutoff}} is not used or stored unless the mode is set to [[PRIM_ALPHA_MODE_MASK]].
{{#vardefine:direction|_set}}
* To delete the material from {{LSLP|face}}, set the {{LSLP|alpha_mode}} to [[PRIM_ALPHA_MODE_BLEND]], in addition to clearing [[PRIM_NORMAL]] and [[PRIM_SPECULAR]]
{{LSL_Function/inventory|texture|uuid=true|type=texture}}
* If {{LSLP|face}} indicates a face that exists but does not contain a material, the [[PRIM_ALPHA_MODE]] return is '[ [[PRIM_ALPHA_MODE_BLEND]], 0 ]'
|text=Used with [[llSetPrimitiveParams]] & [[llSetLinkPrimitiveParams]].
|pa={{LSL Constant/List|i_front=[&#32;{{#var:alpha_mode_const}},&#32;|i_end=&nbsp;]
 
|text=When used with [[llSetPrimitiveParams]] & [[llSetLinkPrimitiveParams]]
{{LSL Generic/Caveats|issues={{#var:issues_set}}|title=*|h=4}}
 
====Examples====
<lsl>llSetPrimitiveParams([ PRIM_ALPHA_MODE, ALL_SIDES, PRIM_ALPHA_MODE_NONE, 0 ]);
llSetPrimitiveParams([ PRIM_ALPHA_MODE, ALL_SIDES, PRIM_ALPHA_MODE_MASK, 130 ]);</lsl>
 
|toc=llSetPrimitiveParams
|i1_type=integer|i1_name=face
|i1_type=integer|i1_name=face
|i2_type=integer|i2_name=alpha_mode
|i2_type=integer|i2_name=alpha_mode
|i3_type=integer|i3_name=mask_cutoff
|i3_type=integer|i3_name=mask_cutoff
|toc=llSetPrimitiveParams
}}
}}
|pb={{LSL Constant/List|i_front=[[llGetPrimitiveParams]]([&nbsp;{{#var:texture_const}},&#32;|i_end=&nbsp;]);|
|pb={{LSL Constant/List|i_front=[[llGetPrimitiveParams]]([&nbsp;{{#var:alpha_mode_const}},&#32;|i_end=&nbsp;]);
|inject-1={{#vardefine:p_texture_desc|}}
|r_front=Returns the [[list]] [&nbsp;|r_end=&nbsp;]
{{#vardefine:p_texture_hover|}}
|text
{{#vardefine:direction|_get}}
{{LSL_Function/inventory|texture|uuid=true|type=texture|no_caveat=true|full={{{remote|}}}|remote=*|target=#Target}}
{{LSL Function/link|link|nogroup=*|nocaveats=*}}
|r_front=Returns the list [&nbsp;|r_end=&nbsp;]
|text=
{{LSL Generic/Caveats|caveats={{#var:caveats_get}}{{#vardefine:caveats_get}}|issues={{#var:issues_get}}|title=*|h=4}}
====Target====
In the case of llGetPrimitiveParams is either the prim the script resides in, or the prim specified by the immediately prior [[PRIM_LINK_TARGET]] call. However in the case of llGetLinkPrimitiveParams, it is either the value of the {{LSLP|link}} parameter, or the prim specified by the immediately prior [[PRIM_LINK_TARGET]] call.
|toc=llGetPrimitiveParams
|toc=llGetPrimitiveParams
|i1_type=integer|i1_name=face
|i1_type=integer|i1_name=face
|r1_type=integer|r1_name=alpha_mode
|r1_type=integer|r1_name=alpha_mode
|r2_type=integer|r2_name=mask_cutoff
|r2_type=integer|r2_name=mask_cutoff
}}
}}
|pc=
{{{!}} class="sortable" {{Prettytable|style=margin-top:0;}}
{{!}}- {{Hl2}}
{{#var:p_alpha_mode_rows}}
{{!}}}
|articles
|functions=
|functions=
{{LSL DefineRow||[[llGetPrimitiveParams]]|}}
{{LSL DefineRow||[[llGetLinkPrimitiveParams]]|}}
{{LSL DefineRow||[[llSetPrimitiveParams]]|}}
{{LSL DefineRow||[[llSetPrimitiveParams]]|}}
{{LSL DefineRow||[[llSetLinkPrimitiveParams]]|}}
{{LSL DefineRow||[[llSetLinkPrimitiveParams]]|}}
{{LSL DefineRow||[[llGetPrimitiveParams]]|}}
{{LSL DefineRow||[[llSetLinkPrimitiveParamsFast]]|}}
|events=
|events
|examples=<source lang="lsl2">llSetPrimitiveParams([ PRIM_ALPHA_MODE, ALL_SIDES, PRIM_ALPHA_MODE_NONE, 0 ]);
llSetPrimitiveParams([ PRIM_ALPHA_MODE, ALL_SIDES, PRIM_ALPHA_MODE_MASK, 130 ]);</source>
|location
|location
|notes
|history
|cat1=Texture
|cat1=Texture
|cat2
|cat2
|cat3
|cat4
}}
}}

Latest revision as of 16:25, 23 January 2015

Description

Constant: integer PRIM_ALPHA_MODE = 38;

The integer constant PRIM_ALPHA_MODE has the value 38

Used to specify how the alpha channel of the diffuse texture should affect rendering of a prim’s face.

llSetPrimitiveParams

[ PRIM_ALPHA_MODE, integer face, integer alpha_mode, integer mask_cutoff ]
• integer face a face number or ALL_SIDES
• integer alpha_mode PRIM_ALPHA_MODE_* flag
• integer mask_cutoff when the alpha rendering mode is PRIM_ALPHA_MODE_MASK, sets the alpha value above which a pixel renders as fully opaque, in the range 0 to 255

When used with llSetPrimitiveParams & llSetLinkPrimitiveParams

llGetPrimitiveParams

llGetPrimitiveParams([ PRIM_ALPHA_MODE, integer face ]);

Returns the listinteger alpha_mode, integer mask_cutoff ]

• integer face a face number or ALL_SIDES

• integer alpha_mode PRIM_ALPHA_MODE_* flag
• integer mask_cutoff when the alpha rendering mode is PRIM_ALPHA_MODE_MASK, sets the alpha value above which a pixel renders as fully opaque, in the range 0 to 255
alpha_mode Flags V Description Notes
PRIM_ALPHA_MODE_NONE 0 Render the diffuse texture as though the alpha channel were nonexistent The viewer’s build tool sets this by default when a face has a material and no alpha channel is present in the diffuse texture.
PRIM_ALPHA_MODE_BLEND 1 Render the diffuse texture with alpha-blending. This value is also used as the default to clear the materials settings from a prim face.
PRIM_ALPHA_MODE_MASK 2 Render the prim face in alpha-masked mode. Diffuse texture pixels which are more opaque than mask_cutoff will be rendered as fully opaque, while the other pixels will be fully transparent.
PRIM_ALPHA_MODE_EMISSIVE 3 Render the prim face in emissivity mode. Diffuse texture pixels opacity maps to their emissivity when rendered. Fully opaque pixels will effectively be rendered as ‘full bright’.

Caveats

Important Issues

~ All Issues ~ Search JIRA for related Bugs
   We need PRIM_ALPHA_MODE_DEFAULT to revert alpha to old "if the texture has an alpha mask, use alpha. If not, don't" behavior.

Examples

llSetPrimitiveParams([ PRIM_ALPHA_MODE, ALL_SIDES, PRIM_ALPHA_MODE_NONE, 0 ]);
llSetPrimitiveParams([ PRIM_ALPHA_MODE, ALL_SIDES, PRIM_ALPHA_MODE_MASK, 130 ]);

Notes

Deep Notes

All Issues

~ Search JIRA for related Issues
   We need PRIM_ALPHA_MODE_DEFAULT to revert alpha to old "if the texture has an alpha mask, use alpha. If not, don't" behavior.

Signature

integer PRIM_ALPHA_MODE = 38;