Difference between revisions of "EffectShader"

7,823 bytes added ,  12:06, 17 October 2018
→‎Notes: bad command names
imported>Tox2ik
(moved "color" further down, added checkboxes Ignore Alpha - Grayscale to palette, added color keys.)
imported>DavidJCobb
(→‎Notes: bad command names)
 
(31 intermediate revisions by 4 users not shown)
Line 3: Line 3:
The shader can consist of two components, a Membrane Shader and a Particle Shader.
The shader can consist of two components, a Membrane Shader and a Particle Shader.


[[File:EffectShaderWindow.png|900px]]


==Membrane Shader==
==Membrane Shader==
Line 8: Line 9:
The Membrane Shader is applied directly to the mesh of a target object. How the shader interacts with the mesh's base texture is determined in large part by the Source and Dest Blend Modes.
The Membrane Shader is applied directly to the mesh of a target object. How the shader interacts with the mesh's base texture is determined in large part by the Source and Dest Blend Modes.


''Ignore Base Geometry Texture Alpha''
:: Check this box to ?
''Affect Skin Only''
:: Check this box to make the Membrane Shader only affect NPC's exposed skin and not any apparel that is being worn. E.g. the effectSunDamage shader uses this.


'''Source and Dest Blend Mode'''
'''Source and Dest Blend Mode'''
Line 14: Line 20:


''Zero''
''Zero''
:: Uses 0 as its pixel value
:: Uses 0 as its pixel value. (All channels of the color are multiplied by zero)


''One''
''One''
:: Uses 1 as its pixel value
:: Uses 1 as its pixel value. (Multiplies each component by one)


''Source Alpha''
''Source Alpha''
:: RGB components of source pixel multiplied by alpha
:: RGB components of source pixel multiplied by alpha. (Multiplies all channels with the source alpha)


''Source Inverted Alpha''
''Source Inverted Alpha''
:: RGB components of source pixel multiplied by 1 - alpha
:: RGB components of source pixel multiplied by 1 - alpha. (Multiplies all channels with one minus the source alpha)


''Source Color''
''Source Color''
:: Color of source pixel
:: Color of source pixel. (Multiplies each component with the respective component in the source color)


''Source Inverse Color''
''Source Inverse Color''
:: Color of source pixel subtracted per component from white
:: Color of source pixel subtracted per component from white. (Multiplies each component with one minus the respective component in the source color)


''Dest Alpha''
''Dest Alpha''
:: RGB components of destination pixel multiplied by alpha
:: RGB components of destination pixel multiplied by alpha. (Multiplies all channels with the destination alpha)


''Dest Inverted Alpha''
''Dest Inverted Alpha''
:: RGB components of destination pixel multiplied by 1 - alpha
:: RGB components of destination pixel multiplied by 1 - alpha. (Multiplies all channels with one minus the destination alpha)


''Dest Color''
''Dest Color''
:: Color of destination pixel
:: Color of destination pixel. (Multiplies each component with the respective component in the destination color)


''Dest Inverse Color''
''Dest Inverse Color''
:: Color of destination pixel subtracted per component from white
:: Color of destination pixel subtracted per component from white. (Multiplies each component with one minus the respective component in the destination color)


''Source Alpha SAT''
''Source Alpha SAT''
:: Takes the lesser of the source pixel's alpha or one minus the destination pixel's alpha and places it in the red, green, and blue fields of the specified pixel. This mode sets the specified pixel's alpha to be 1.
:: Takes the lesser of the source pixel's alpha or one minus the destination pixel's alpha and places it in the red, green, and blue fields of the specified pixel. This mode sets the specified pixel's alpha to be 1. (The red, green and blue channel are multiplied with the min(alpha_source, 1 - alpha_destination), alpha is multiplied by one. This can only be used for Source and will override the value set in Destination.)




'''Blend Operation'''
'''Blend Operation'''


This option determines how the source and destination functions are combined.
This section determines how the source and destination functions are combined. Options are as follows:
 
''Add'' - (Result = Source + Destination) (This blend mode simply adds pixel values of one layer with the other. In case of values above 1 (in the case of RGB), white is displayed.)
 
''Subtract'' - (Result = Source - Destination) (This blend mode simply subtracts pixel values of one layer with the other. In case of negative values, black is displayed.)
 
''Reverse Subtract'' - (Result = Destination - Source) (Difference subtracts the top layer from the bottom layer or the other way round, to always get a positive value. Blending with black produces no change, as values for all colors are 0. (The RGB value for black is 0,0,0). Blending with white inverts the picture.)
 
''Minimum'' - (Result = MIN(Source, Destination)) (Creates a resultant pixel that retains the smallest components of the foreground and background pixels.)
 
''Maximum'' - (Result = MAX(Source, Destination)) (Selects the maximum of each component from the foreground and background pixels.)
 
 
The default setting should work for most shaders, as it resembles typical alpha blending.


The default setting should work for most shaders, as it resembles typical alpha blending;
* Source Blend Mode:'' Source Alpha ''
* Source Blend Mode:'' Source Alpha ''
* Dest Blend Mode:'' Source Inverted Alpha ''
* Dest Blend Mode:'' Source Inverted Alpha ''
Line 69: Line 87:
'''Z Test Function'''
'''Z Test Function'''


Defaults to Equal To. If changed to Greater Than or Greater Than or Equal To, the membrane shader will be displayed on top of other geometry and will be visible through walls (unconfirmed).
This value defaults to Equal To. The "Greater Than" and "Greater Than or Equal To" values are supposed to change the depth of the shader effects, allowing it to show through walls; however, this behavior is broken in Skyrim.
 
(The z-buffer, or depth buffer, is used to ensure that objects are displayed according to their depth. During rendering of a triangle, the Z-value of a given pixel is compared to the value stored in the Z-Buffer. Based on the Z-testing function, the triangle either is allowed to overdraw the pixel or not. The default behavior is to accept pixel that have a Z-value that is smaller or the same as the value in the Z-Buffer, making objects closer to the camera occlude objects which are farther away.)
 


==== Fill / Texture Effect ====  
==== Fill / Texture Effect ====  
Determines the properties of the fill color or texture. All time values in this frame are in seconds.
Determines the properties of the fill color or texture. All time values in this frame are in seconds.
''Affect Skin Only''
:: Check this box to make the Membrane Shader only affect NPC's exposed skin. E.g. the effectSunDamage shader uses this.


''Alpha Fade In Time''
''Alpha Fade In Time''
Line 93: Line 111:


''Alpha Pulse Amplitude''
''Alpha Pulse Amplitude''
:: How noticeable the pulsation of the shader is. Relevant only when one of the blend modes has been set to Source (inverted) Alpha.
:: How noticeable the pulsation of the shader is; a multiplier applied to the ''Full'' or ''Persistent Alpha Ratio''. Relevant only when one of the blend modes has been set to Source (inverted) Alpha.


''Alpha Pulse Frequency''
''Alpha Pulse Frequency''
:: How often the shader exhibits a pulse. It may be easier to consider that the period of any given pulse would be 1 second divided by the frequency of the pulses (i.e. larger values give shorter pulses, decimal values below 1 give longer pulses).  
:: How often the shader exhibits a pulse. It may be easier to consider that the period of any given pulse would be 1 second divided by the frequency of the pulses (i.e. larger values give shorter pulses, decimal values below 1 give longer pulses).
 
''Texture Animation Speed (U, V)''
:: If a texture is selected, it can be animated across the U (horizontal) and V (vertical) texture coordinates using these speed values. Make the value negative to get movement in the opposite direction.
 
''Texture Scale (U, V)''
:: A larger value will repeat the texture more frequently on the surface of the target object.


''Texture Animation Speed''
{{InDepth|Here's an explanation of the alpha/opacity values for those who find prose easier to understand:
:: If a texture is selected, it can be animated across the U (horizontal) and V (vertical) texture coordinates using these speed values.


''Texture Scale''
When a shader is first applied, it immediately uses ''Full Alpha Ratio'' as its opacity for ''Full Alpha Time''; after that, the shader fades in from ''Full Alpha Ratio'' to ''Persistent Alpha Ratio'' over ''Alpha Fade Out Time''. Over the course of the shader's lifetime (including during fades), the opacity will vary by up to ''Alpha Pulse Ratio'' (multiplied by the ''Full'' or ''Persistent Alpha Ratio'') at a rate of ''Alpha Pulse Frequency'' times per second. When the shader is removed from a reference, it will always fade out from its current opacity to zero over ''Alpha Fade Out Time''.
:: A larger value will repeat the texture more frequently on the surface of the target object.  


The fade-in behavior changes if the ''Persistent Alpha Ratio'' is greater than the ''Full Alpha Ratio'': in this case, the shader will instantly switch from ''Full Alpha Ratio'' to ''Persistent Alpha Ratio'' at the end of the ''Full Alpha Time''. This is implied by the names of the settings -- "full," as in "maximum," alpha ratio -- but it's still not necessarily what one might expect, and it's definitely the less useful behavior.}}


''Texture''
 
''Fill Texture''
:: Press the Edit button to add a texture instead of using a solid color. To remove an image file, press this button and cancel the dialogue window that appears.
:: Press the Edit button to add a texture instead of using a solid color. To remove an image file, press this button and cancel the dialogue window that appears.
 
''Palette Texture''
''Color Key 1-3''
:: Press the Edit button to define a palette texture. The exact function of this texture is unknown, but if one isn't defined, your shader ''may'' not work.
:: Only the level of white / black seems relevant when a texture has been selected. The color keys are ignored (true for all blend modes?) when no texture is selected. The scale represents intencity or the brightness. Time is given in seconds since the shader started.  


''Ignore Alpha''
''Ignore Alpha''
:: ?
:: Check this box to ?


''Projected UVs''
''Projected UVs''
:: ?
:: Textures appear to be projected behind the membrane instead of sticking the textures onto the membrane.


''Lighting''
''Lighting''
Line 121: Line 144:


''No Wpns''
''No Wpns''
:: ?
:: Checking this box makes it so the effects are not applied to weapons.


''Grayscale To Palette - Color''
''Grayscale To Palette - Color''
:: Texture is ignored when this is off.  
:: Uses the colors from the Palette Texture.  


''Grayscale To Palette - Alpha''
''Grayscale To Palette - Alpha''
:: Texture alpha is ignored when this is off (Palette opaque)
:: Texture alpha is ignored when this is off (Palette opaque).


''Color Key 1-3''
:: Only the level of white / black seems relevant when a texture has been selected. The color keys are ignored (true for all blend modes?) when no texture is selected. The scale represents intensity/brightness or in some cases the size/thickness of the effect. Time is given in seconds since the shader started.


==== Edge Effect ====
==== Edge Effect ====
Applies a light rim of sorts to the outer edge of the mesh. Refer to the Fill / Texture Effect section for the majority of the settings.
Applies a light rim of sorts to the outer edge of the mesh. Refer to the Fill / Texture Effect section for the majority of the settings. The pulsation settings in these two sections are independent of each other making it possible to create a shader that pulsates between the (animated) texture membrane and a (pulsating) edge effect.  


''Fall Off''  
''Fall Off''  
::This value represents the bias of the rim lighting. A higher value will cause the rim effect to fall off quicker, giving it a sharper outline.
::This value represents the bias of the rim lighting. Higher values will cause the rim effect to fall off quicker, giving it a sharper outline. A value below one makes the edge (texture) more visible and it will appear "solid" if this value is set to 0.


''Inverse''
''Inverse''
Line 140: Line 165:


''Color''
''Color''
:: The color of the fill effect if a texture is not selected.
:: The color of the edge effect.


==== Holes ====
==== Holes ====
Line 163: Line 188:


== Particle Shader ==
== Particle Shader ==
Use the Particle Shader section to create particles that will emit from the target object.
Use the Particle Shader section to create particles that will emit from the target object. These effects are limited to ObjectReferences that are also Actors; trying to emit particles from a piece of armor or another inanimate object will prove fruitless.
These effects are limited to ObjectReferences that are also Actors.
Trying to emit particles from a piece of armor or another inanimate object will prove fruitless.  


The method of particle alpha blending is determined by the Source and Dest Blend Modes.
The method of particle alpha blending is determined by the Source and Dest Blend Modes. Refer to the Membrane Shader section.
Refer to the Membrane Shader section.


{| class="wikitable"
|+ Particle Shader Parameters


''Z Test Function''
| width="200px" style="padding:13px;text-align:right"  | ''Z Test Function''
:: Default is Normal. When set to Always Show, the particles will draw on top of all other meshes, making particles visible through walls. The Detect Life shader uses this effect.
| width="650px" style="padding:13px;                "  |  Default is Normal. When set to Always Show, the particles will draw on top of all other meshes, making particles visible through walls. The Detect Life shader uses this effect.


''Particle Birth Ramp Up Time''
|-
:: The time for the particle to reach its Full Particle Birth Ratio


''Full Particle Birth Time''
| width="200px" style="padding:13px;text-align:right"  | ''Particle Birth Ramp Up Time''  
:: The duration that particles emit at the system's Full Particle Birth Ratio.
| width="650px" style="padding:13px;                "  |  The time for the particle to reach its Full Particle Birth Ratio


''Particle Birth Ramp Down''
|-
:: The time for the particle system to go from the Full Particle Birth Ratio to the Persistent Particle Birth Ratio.


''Full Particle Birth Ratio''
| width="200px" style="padding:13px;text-align:right"  | ''Full Particle Birth Time''  
:: The amount of particles that spawn. A value of 1 will cause the maximum amount of particles to spawn.
| width="650px" style="padding:13px;                "  |  The duration that particles emit at the system's Full Particle Birth Ratio.


''Persistent Particle Birth Ratio''
|-
:: The amount of particles that during the persistent effect phase of the effect shader.


''Particle Lifetime''
| width="200px" style="padding:13px;text-align:right"  | ''Particle Birth Ramp Down''  
:: How long a particle will exist in the world. Adjust the +/- value to provide variability to this value.
| width="650px" style="padding:13px;                "  |  The time for the particle system to go from the Full Particle Birth Ratio to the Persistent Particle Birth Ratio.


''Initial Speed Along Normal''
|-
:: The initial speed assigned to a particle when it is spawned. The normal should be considered the mostly random direction that a particle is given when it is spawned. Thus, this value controls the explosiveness of the particle effect.


''Acceleration Along Normal''
| width="200px" style="padding:13px;text-align:right"  | ''Full Particle Birth Ratio''  
:: The amount of acceleration (or deceleration if negative values are used) applied to a particle.
| width="650px" style="padding:13px;                "  | The amount of particles that spawn. A value of 1 will cause the maximum amount of particles to spawn.


''Initial Velocity XYZ''
|-
:: The amount of velocity applied to a particle in world coordinates. To make particles drift upwards, apply a positive velocity to the Z axis.


''Acceleration XYZ''
| width="200px" style="padding:13px;text-align:right"  | ''Persistent Particle Birth Ratio''
:: The amount of acceleration applied to a particle in world coordinates. As an example, you can make a particle float back down after a time by making the absolute value of a negative Z acceleration greater than the initial velocity divided by the particle lifetime, or |-ZAcceleration| > ZVelocity / Particle Lifetime.
| width="650px" style="padding:13px;                "  | The amount of particles that during the persistent effect phase of the effect shader.  


''Initial Rotation''
|-
:: The initial rotation assigned to a particle when it is spawned.


''Rotation Speed''
| width="200px" style="padding:13px;text-align:right"  | ''Particle Lifetime''
:: How fast the particles will rotate after spawning.  
| width="650px" style="padding:13px;                "  | How long a particle will exist in the world. Adjust the +/- value to provide variability to this value.


|-


The Time component in the following options is not in seconds, but rather a value in the 0 - 1 range. This decimal value represents the percentage of a particle's life.
| width="200px" style="padding:13px;text-align:right"  | ''Initial Speed Along Normal''
| width="650px" style="padding:13px;                "  | The initial speed assigned to a particle when it is spawned. The normal should be considered the mostly random direction that a particle is given when it is spawned. Thus, this value controls the explosiveness of the particle effect.  


''Scale Key 1''
|-
:: The first value represents the scale of a particle, the Time value determines when that scale is reached. All particles are spawned with a scale of 0 and increase in size until they reach this scale.


''Scale Key 2''
| width="200px" style="padding:13px;text-align:right"  | ''Acceleration Along Normal''  
:: Second scale and time component of the particle.
| width="650px" style="padding:13px;                "  | The amount of acceleration (or deceleration if negative values are used) applied to a particle. The normal is on the shaded object (such as the player) and negative acceleration values will pull the particles towards the object.  


''Texture''
|-
:: Press the Edit button to determine what texture the particle will use. It will appear as a sprite.


'''Color Keys'''
| width="200px" style="padding:13px;text-align:right"  | ''Initial Velocity XYZ''  
| width="650px" style="padding:13px;                "  | The amount of velocity applied to a particle in world coordinates. To make particles drift upwards, apply a positive velocity to the Z axis.


''Color''
|-
:: The tint of the particle at that time
 
| width="200px" style="padding:13px;text-align:right"  | ''Acceleration XYZ''
| width="650px" style="padding:13px;                "  | The amount of acceleration applied to a particle in world coordinates. As an example, you can make a particle float back down after a time by making the absolute value of a negative Z acceleration greater than the initial velocity divided by the particle lifetime, or |-ZAcceleration| > ZVelocity / Particle Lifetime.
 
|-
 
| width="200px" style="padding:13px;text-align:right"  | ''Initial Rotation''
| width="650px" style="padding:13px;                "  | The initial rotation assigned to a particle when it is spawned.
 
|-
 
| width="200px" style="padding:13px;text-align:right"  | ''Rotation Speed''
| width="650px" style="padding:13px;                "  | How fast the particles will rotate after spawning.
 
|}
 
The Time component in the following options is not specified in seconds, but rather a value in the 0 - 1 range. This decimal value represents the percentage of a particle's life.
 
{| class="wikitable"
|+ Particle Shader Parameters: Continued
 
| width="200px" style="padding:13px;text-align:right"  |
| width="650px" style="padding:13px;                "  |
 
|-
 
| width="200px" style="padding:13px;text-align:right"  | ''Scale Key 1''
| width="650px" style="padding:13px;                "  | The first value represents the scale of a particle, the Time value determines when that scale is reached. All particles are spawned with a scale of 0 and increase in size until they reach this scale.
 
|-
 
| width="200px" style="padding:13px;text-align:right"  | ''Scale Key 2''
| width="650px" style="padding:13px;                "  | Second scale and time component of the particle.
 
|-
 
| width="200px" style="padding:13px;text-align:right"  | ''Texture''
| width="650px" style="padding:13px;                "  | Press the Edit button to determine what texture the particle will use. It will appear as a sprite.
|}
 
{| class="wikitable"
|+ Particle Shader Parameters: Color Keys
 
| width="200px" style="padding:13px;text-align:right"  | ''Color''
| width="650px" style="padding:13px;                "  | The tint of the particle at that time
 
|-
 
| width="200px" style="padding:13px;text-align:right"  | ''Color Alpha''
| width="650px" style="padding:13px;                "  | The alpha amount of the particle


''Color Alpha''
|-
:: The alpha amount of the particle


''Color Key Time''
| width="200px" style="padding:13px;text-align:right"  | ''Color Key Time''
:: the time that the color and alpha settings occur
| width="650px" style="padding:13px;                "  | The time that the color and alpha settings occur
|}




Line 252: Line 320:


''Scale Out Time:'' The time it takes for the debris models to scale out (from End Scale to Start Scale).
''Scale Out Time:'' The time it takes for the debris models to scale out (from End Scale to Start Scale).
== Notes ==
* Remember that your shaders are (generally) triggered by spells; those spells can have unintuitive effects on how the shader behaves, breaking the behavior of the various fade options. It's best to test your EffectShaders independently by using the ''PlayMagicShaderVisuals'' (''PMS'') and ''StopMagicShaderVisuals'' (''SMS'') console commands; both run on an actor and take the form ID of a shader.
** In some particularly bizarre cases, magic effects that trigger on different conditions can break each other's shaders if they're part of the same spell; yet they and their shaders work perfectly fine if they're separated out into different spells.


[[Category:Object Classes]]
[[Category:Object Classes]]
[[Category:Special Effect]]
[[Category:Special Effect]]
Anonymous user