Post Process Effects: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(→‎Dynamic Blur: example made pretty)
(→‎ColorInversion: universal example)
Line 263: Line 263:


Copypaste example:
Copypaste example:
<code>0 = ["ColorInversion", 2500] [[spawn]] {
<code>0 = ["ColorInversion", 2500, [0.5, 0.5, 0.5]] [[spawn]] {
[[params]] ["_name", "_priority", "_handle"];
[[params]] ["_name", "_priority", "_effect", "_handle"];
[[while]] {
[[while]] {
_handle = [[ppEffectCreate]] [_name, _priority];
_handle = [[ppEffectCreate]] [_name, _priority];
Line 272: Line 272:
};
};
_handle [[ppEffectEnable]] [[true]];
_handle [[ppEffectEnable]] [[true]];
_handle [[ppEffectAdjust]] [0.5, 0.5, 0.5];
_handle [[ppEffectAdjust]] _effect;
_handle [[ppEffectCommit]] 5;
_handle [[ppEffectCommit]] 5;
[[waitUntil]] {[[ppEffectCommitted]] _handle};
[[waitUntil]] {[[ppEffectCommitted]] _handle};

Revision as of 17:10, 16 August 2015

Scripting commands

Effect creation:

hndl = ppEffectCreate ["effect_type", priority]; hndls[] = ppEffectCreate [["effect_type0", priority0], ["effect_type1", priority1], ...];

Effect cancellation:

ppEffectDestroy hndl; ppEffectDestroy [hndl0, hndl1, ..., hndlN];

Parameter setup:

hndl ppEffectAdjust [par0, par1, .... , parN];

Parameter application:

hndl ppEffectCommit time; [hndl0, ..., hndlN] ppEffectCommit time;

Effect permission:

hndl ppEffectEnable [hndl0, ..., hndlN] ppEffectEnable OnOf;

Priority defines sequence in which are post effects applied.

Example

_hndl = ppEffectCreate ["colorCorrections", 1501]; _hndl ppEffectEnable true; _hndl ppEffectAdjust [1.0, 1.0, 0.0, [1.0, 0.1, 1.0, 0.75], [0.0, 1.0, 1.0, 1.0], [0.199, 0.587, 0.114, 0.0]]; _hndl ppEffectCommit 0; sleep 10; ppEffectDestroy _hndl;

Table of priorities

Priority PostEffect Popis
2050 FilmGrain CfgOpticsEffect::TankCommanderOptics1(2)
1550 ColorCorrections CfgOpticsEffect::TankGunnerOptics1(2)
450 DynamicBlur CfgOpticsEffect::OpticsBlur1(2,3)
250 Chromatic Aberration CfgOpticsEffect::OpticsCHAbera1(2,3)

Postprocess effects

  1. Radial Zoom Blur
  2. Chromatic Aberration
  3. Wet Distortion
  4. Color Corrections
  5. Dynamic Blur
  6. Film Grain
  7. Color Inversion

Parameters of individual effects

RadialBlur

Base priority 100

Title RadialBlur

hndRadBlur ppEffectAdjust [par0, par1, par2, par3];

Parameter Meaning Typ Range
par0 relative blur degree in axis X float [0,1]
par1 relative blur degree in axis Y float [0,1]
par2 relative size of un-blurred centre float [0,0.5]
par3 relative size of un-blurred centre float [0,0.5]


ChromAberration

Base priority 200

Title ChromAberration

hndlChromAberr ppEffectAdjust [par0, par1, par2];

Parameter Meaning Typ Range
par0 relative effect strength (sample spacing from each other) in axis X float
par1 relative effect strength (sample spacing from each other) in axis Y float
par2 correction according to screen aspect ratio bool

WetDistortion

Base priority 300

Title WetDistortion

hndlWetDist ppEffectAdjust [ value, top, bottom, horizontal1, horizontal2, vertical1, vertical2, horizontal1, horizontal2, vertical1, vertical2, randX, randY, posX, posY ];

//defaults hndlWetDist ppEffectAdjust [ 1, 1, 1, 4.10, 3.70, 2.50, 1.85, 0.0054, 0.0041, 0.0090, 0.0070, 0.5, 0.3, 10.0, 6.0 ];

Parameter Meaning Type Range
value effect blurriness (0 to 1, values above 1 cause unusual) float 0...1
top, bottom effect power (top/bottom of screen separately) float 0...1
horizontal1, horizontal2, vertical1, vertical2 waves speeds (frequency/PI) float
horizontal1, horizontal2, vertical1, vertical2 waves amplitudes float
randX, randY, posX, posY phase coefficients: random value influence coefficient inside vertex float

ColorCorrections

Base priority 1500

Title ColorCorrections

hndlClrCorr ppEffectAdjust [par0, apr1, par2, ..., par20, par21];

Parameter Meaning Typ Range
par0 brightness float [0,1]
par1 contrast float
par2 offset float
par3 - par6 blend color (R,G,B,A) float
par7 - par10 colorize color (R,G,B,A) float
par11 - par14 colorize color (R,G,B,A) float
par15 - par21 Vignette effect (Horizontal size, Vertical size, ?, Horizontal position, Vertical position, Vignette strength, Alpha?) float

Dynamic Blur

Title: "DynamicBlur"; Base Priority: 400

Parameter Meaning Type Range
value blurriness float 0...

Syntax: hndlDynBlur ppEffectAdjust [value];

Defaults: hndlDynBlur ppEffectAdjust [0];

Copypaste example: 0 = ["DynamicBlur", 400, [10]] spawn { params ["_name", "_priority", "_effect", "_handle"]; while { _handle = ppEffectCreate [_name, _priority]; _handle < 0 } do { _priority = _priority + 1; }; _handle ppEffectEnable true; _handle ppEffectAdjust _effect; _handle ppEffectCommit 5; waitUntil {ppEffectCommitted _handle}; uiSleep 3; comment "admire effect for a sec"; _handle ppEffectEnable false; ppEffectDestroy _handle; };

FilmGrain

Base priority 2000

Title FilmGrain

Number of parameters is flexible ... it may be defined 1 to 6 parameters, meaning of individual parameters is following:

hndlFilmGrain ppEffectAdjust [ intensity, sharpness, grainSize, intensityX0, intensityX1, monochromatic ];

//defaults hndlFilmGrain ppEffectAdjust [ 0.1, 1.5, 1.7, 0.2, 1.0, true ];

Parameter Meaning Type Range
intensity intensity float 0...1
sharpness sharpness float 0...20
grainSize grain size float 1...8
intensityX0 intensityX0 float
intensityX1 intensityX1 float
monochromatic monochromatic bool

ColorInversion

Title: "ColorInversion"; Base Priority: 2500

Parameter Meaning Type Range
Red Inversion of R channel float 0...2
Green Inversion of G channel float 0...2
Blue Inversion of B channel float 0...2

Syntax: hndlClrInversion ppEffectAdjust [Red, Green, Blue];

Defaults: hndlClrInversion ppEffectAdjust [0, 0, 0];

Copypaste example: 0 = ["ColorInversion", 2500, [0.5, 0.5, 0.5]] spawn { params ["_name", "_priority", "_effect", "_handle"]; while { _handle = ppEffectCreate [_name, _priority]; _handle < 0 } do { _priority = _priority + 1; }; _handle ppEffectEnable true; _handle ppEffectAdjust _effect; _handle ppEffectCommit 5; waitUntil {ppEffectCommitted _handle}; uiSleep 3; comment "admire effect for a sec"; _handle ppEffectEnable false; ppEffectDestroy _handle; };

Post process settings

Some of the post processing effects are affected by whether the client has post processing disabled or enabled (any other detail than off) in his graphic settings.
The following effects will not have any effect with PP set to disabled:

  • radialBlur
  • chromAberration
  • wetDistortion
  • filmGrain
  • DynamicBlur



See also: ppEffectAdjust, ppEffectCommit, ppEffectCommitted, ppEffectCreate, ppEffectDestroy, ppEffectEnable, ppEffectForceInNVG