Difference between revisions of "PRIM ALPHA MODE"

From Second Life Wiki
Jump to navigation Jump to search
m (<lsl> tag to <source>)
 
(15 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 texture alpha mode settings 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}}
{{#vardefine:p_face_desc|a [[face]] number or [[ALL_SIDES]]}}
{{#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_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_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.
{{!}}-
{{!}}-
{{!}} [ {{#var:texture_const}} ]
{{!}} {{LSL Const|PRIM_ALPHA_MODE_EMISSIVE|integer|3|c=Render the prim face in emissivity mode.}}
{{!}} {{#var:texture_return}} }}
{{!}} {{#var:value}}
 
{{!}} colspan="3" {{!}} {{#var:comment}}
{{#vardefine:caveats_get|
{{!}} colspan="3" {{!}} Diffuse texture pixels opacity maps to their emissivity when renderedFully opaque pixels will effectively be rendered as ‘full bright’.
*If face indicates a face that exists but does not contain a material, the [[PRIM_ALPHA_MODE]] return is '''[ [[PRIM_ALPHA_MODE_BLEND]], 0 ]''' }}
 
{{#vardefine:caveats_set|
* {{LSLP|repeats}} is not only used to set the number of repeats but the sign of the individual components is also used to set the "Flip" attribute.
*  To clear the normal map parameters from the face (and possibly remove the material), set  {{LSLP|texture}} to [[NULL_KEY]] (the other parameters must be supplied in this case but will be ignored).
* Note that whenever any face in a linkset contains a material (i.e. has a non-default [[PRIM_ALPHA_MODE]], [[PRIM_SPECULAR]], or [[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}}
}}
}}
|
{{Issues/SVC-914}}
{{#vardefine:caveats|{{#var:caveats}}
{{#var:caveats_set}}
}}
}}
<noinclude>
{{:PRIM TEXGEN|{{{1|}}}}}
</noinclude>
}}
{{#vardefine:shared_caveat|* In the [[PRIM_TEXGEN_DEFAULT|default]] [[PRIM_TEXGEN|texture mapping]] {{LSLP|tg_type|mode}} the [[PRIM_ALPHA_MODE|texture]] {{LSLP|repeats}} units are in texture repeats per face. In the [[PRIM_TEXGEN_PLANAR|planar]] texture mapping mode the texture {{LSLP|repeats}} units are in texture repeats per half meter. This is in contrast to the in-world editing tool, in which the planar texture scaling units are repeats per meter.}}
{{#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 normal map texture settings 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}}
|i1_type=integer|i1_name=face
 
|i2_type=integer|i2_name=alpha_mode
====Examples====
|i3_type=integer|i3_name=mask_cutoff
<lsl>llSetPrimitiveParams([ PRIM_ALPHA_MODE, ALL_SIDES, "1ece3148-6cea-f9eb-2152-9902944dbc3d", <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0 ]);
llSetPrimitiveParams([ PRIM_ALPHA_MODE, ALL_SIDES, llGetInventoryName(INVENTORY_TEXTURE, 0), <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0 ]);</lsl>
 
|toc=llSetPrimitiveParams
|toc=llSetPrimitiveParams
|i1_type=integer|i1_name=face
|i2_type=string|i2_name=texture
|i3_type=vector|i3_name=repeats
|i4_type=vector|i4_name=offsets
|i5_type=float|i5_name=rotation_in_radians|i5_disp=rot
}}
}}
|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=string|r1_name=texture
|r1_type=integer|r1_name=alpha_mode
|r2_type=vector|r2_name=repeats
|r2_type=integer|r2_name=mask_cutoff
|r3_type=vector|r3_name=offsets
 
|r4_type=float|r4_name=rotation_in_radians|r4_disp=rot
}}
}}
|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
{{LSL DefineRow||[[changed]]|}}
|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;