Skip to content

VfxMaterialRenderComponent

15.15

Inheritance 2 ancestors · 2 siblings

Class Documentation

Edit documentation

A render component that draws the particles with a material, the one in MaterialContainer. The other render state of the component is a short list of values: the render phase, the draw-order key, the blend mode and the stencil use. The particle colour, the flipbook frame and any extra shader values come from driver values (see IVfxBaseDriver).

When the system is prepared, the component:

  1. Runs the driver setup over Color, UvAnimation and Drivers.
  2. Copies the material. Each emitter draws with its own copy, named after the material with the suffix particleClone.
  3. Adds a shadow-map technique to the copy if CastShadow is set or RenderPhase is 1.
  4. Adds the techniques of the render phases that the emitter draws in. The techniques of phases 2-4 get the define DISTORTION.
  5. Applies stencilMode and StencilReferenceId to every pass of the copy.

At spawn, it evaluates Color.InitialColor, the flipbook range of UvAnimation and the InitialParameters of Drivers.DynamicParticleParameter for each new particle.

In each update, it evaluates Color.ColorOverLife, the flipbook frame and the KeyedParameters of Drivers.DynamicParticleParameter for each particle.

On each draw, it sets the material parameters of Drivers.materialDrivers, DYNAMIC_PARTICLE_ENABLE_MASK and EMITTER_DEPTH_PUSH_PULL.

Draw order

Inside one render phase, component emitters are ordered by RenderOrder, then by the blend rank of blendMode, then by distance. Which end of each key draws first, and which distance the last key measures, is not established.

Properties

ApplyTeamColorCorrection

Flag = false
Removed in 16.1
Add documentation

No documentation available yet. Click "Add documentation" to contribute!

CastShadow

Flag = false
Edit documentation

Also draws the emitter in the Shadow phase. The client adds a shadow-map technique to the emitter's material for it.

Color

Embed<VfxColorContainer>
15.23
Default value
{
  "InitialColor": { "Vector4": {} },
  "CensoredColorModulate": [1, 1, 1, 1],
  "ColorOverLife": { "Vector4": {} }
}
Edit documentation

The particle colour, see VfxColorContainer. The colour that reaches the shader is the container's colour with the premultiply of blendMode.

DepthPushPull

F32 = 0
16.6
Edit documentation

Set on every draw as the shader parameter EMITTER_DEPTH_PUSH_PULL. What it does depends on the material's shader.

Material

Link<IMaterialDef> = "0x0"
Removed in 15.22
Add documentation

No documentation available yet. Click "Add documentation" to contribute!

RenderOrder

I16 = 0
16.7
Edit documentation

The first key of the draw order inside a render phase, see Draw order above. It takes the place of pass on VfxEmitterDefinitionData, but it does not choose the render phase.

RenderPhase

U8 = 4
Edit documentation

The render phase that the emitter draws in. The phases and their order are the ones that renderPhaseOverride on VfxEmitterDefinitionData lists.

Value Phase
0 Default
1 Shadow
2 DistortionNoCharacter
3 DistortionAll
4 PostDistortion
5 GroundLayer
6 HudLayer

The emitter draws only in this phase, and in Shadow too if CastShadow is set. An emitter of a HUD-layer system draws only in HudLayer, whatever this value is. A value above 6 matches no phase.

StencilReferenceId

Hash = "0x0"
16.18
Edit documentation

A name hash that replaces the stencil reference of every pass of the material. The client applies it only if stencilMode is not 0 and the hash is not zero. It works like StencilReferenceId on VfxEmitterDefinitionData.

blendMode

U8 = 3
15.23
Edit documentation

The blend mode of the particles. It sets the second key of the draw order and the premultiply of the particle colour.

Value Name Blend rank Particle colour
0 Add 1 RGB multiplied by alpha, alpha set to 1
1 Alpha 2 unchanged
2 Subtract 1 RGB multiplied by alpha, alpha set to 1
3 None 0 unchanged
4 AlphaAdd 2 unchanged
5 PremultipliedAlpha 2 unchanged
6 Min 2 unchanged
7 Max 2 unchanged
8 TargetAlpha 3 unchanged

stencilMode

U8 = 0
16.18
Edit documentation

How the emitter uses the stencil buffer. The client applies it to every pass of the emitter's material.

Value Name Test Writes
0 Disabled off no
1 WriteMask always passes the reference where it draws
2 TestEqual draws only where the stencil equals the reference no
3 TestNotEqual draws only where the stencil differs from the reference no
4 WriteMaskIfTestNotEqual draws only where the stencil differs the reference where it draws

The reference is the one that the material's passes set, unless StencilReferenceId replaces it.