Difference between revisions of "PRIM ALPHA MODE"

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


{{#vardefine:p_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.}}}}
{{Issues/BUG-7306}}
 
{{#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_face_desc|a [[face]] number or [[ALL_SIDES]]}}
{{#vardefine:p_face_desc|a [[face]] number or [[ALL_SIDES]]}}
{{#vardefine:p_alpha_mode_desc|PRIM_ALPHA_MODE_* flag}}
{{#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}}




Line 48: Line 51:
* 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]]
* 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]]
* 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 ]'
* 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 ]'
|pa={{LSL Constant/List|i_front=[&#32;{{#var:p_alpha_mode_const}},&#32;|i_end=&nbsp;]
|pa={{LSL Constant/List|i_front=[&#32;{{#var:alpha_mode_const}},&#32;|i_end=&nbsp;]
|text=When used with [[llSetPrimitiveParams]] & [[llSetLinkPrimitiveParams]]
|text=When used with [[llSetPrimitiveParams]] & [[llSetLinkPrimitiveParams]]
|i1_type=integer|i1_name=face
|i1_type=integer|i1_name=face
Line 55: Line 58:
|toc=llSetPrimitiveParams
|toc=llSetPrimitiveParams
}}
}}
|pb={{LSL Constant/List|i_front=[[llGetPrimitiveParams]]([&nbsp;{{#var:p_alpha_mode_const}}&nbsp;]);|
|pb={{LSL Constant/List|i_front=[[llGetPrimitiveParams]]([&nbsp;{{#var:alpha_mode_const}},&#32;|i_end=&nbsp;]);
|r_front=Returns the [[list]] [&nbsp;|r_end=&nbsp;]
|r_front=Returns the [[list]] [&nbsp;|r_end=&nbsp;]
|text
|text
Line 77: Line 80:
{{LSL DefineRow||[[llSetLinkPrimitiveParamsFast]]|}}
{{LSL DefineRow||[[llSetLinkPrimitiveParamsFast]]|}}
|events
|events
|examples=<lsl>llSetPrimitiveParams([ PRIM_ALPHA_MODE, ALL_SIDES, PRIM_ALPHA_MODE_NONE, 0 ]);
|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 ]);</lsl>
llSetPrimitiveParams([ PRIM_ALPHA_MODE, ALL_SIDES, PRIM_ALPHA_MODE_MASK, 130 ]);</source>
|location
|location
|history
|history

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;