Jump to content

Recommended Posts

I have not had time to test this out yet, but when I do I will post some screenshots (assuming I get it working).

Share this post


Link to post
Share on other sites

Goofed around a bit with @bad bensons snippet, this is what I came up with:

 

 


//grab nearby trees
_referencePos = getPosATL player;
_trees = nearestTerrainObjects [_referencePos, ["Tree"], 25];
//filter trees to only get one tree every 7m because something something arma dynamic lights
_finalTrees = [];

while {count _trees > 0} do {
	_rndTree = selectRandom _trees;
	_trees = _trees select {_x distance2d _rndTree >= 7};
	_finalTrees pushback _rndTree;
};

_colorIntensity = 0.3;//play around with this, with multiple light sources this value should be kept rather low
GOM_fnc_treeLights = [];
{

	_lightAmbient = [_colorIntensity, 0, _colorIntensity];//tweak here

	_pos = getposATL _x;
	_light = "#lightpoint" createVehicleLocal _pos;
	_light setLightBrightness 0.75;
	_light setLightAmbient _lightAmbient;
	_light setLightColor _lightAmbient;
	_light setLightDayLight true;
	_light setLightUseFlare false;
	_light setLightFlareSize 5;
	_light setLightFlareMaxDistance 500;
	_light setLightAttenuation [2,4,4,0,9,10];

	GOM_fnc_treeLights pushBack [_light,_lightAmbient];

} forEach _finalTrees;


//fade colors over time
GOM_fnc_changeColors = {
	params ["_light","_currentColor","_colors","_duration"];

	_color = selectRandom _colors;
	_currentColor params ["_initR","_initG","_initB"];
	_color params ["_targetR","_targetG","_targetB"];
	_endTime = time + random [_duration / 2,_duration,_duration * 2];
	_initTime = time;
	_finalColor = [];
	waitUntil {
		_finalColor = [
		linearConversion [_initTime,_endTime,time,_initR,_targetR,true],
		linearConversion [_initTime,_endTime,time,_initG,_targetG,true],
		linearConversion [_initTime,_endTime,time,_initB,_targetB,true]
		];
		_light setLightAmbient _finalColor;
		time > _endTime
	};//pretty fluid for slow color transitions

_recursionisonehelluvadrug = [_light,_finalColor,_colors,_duration] spawn GOM_fnc_changeColors;

};

_colors = [[0.5,0,0.5],[0.3,0,0.3],[0,0.3,0],[0.3,0,0],[0,0,0.3]];//add or adjust the colors that will be used

{

	_x params ["_light","_color"];
	_change = [_light,_color,_colors,10] spawn GOM_fnc_changeColors;//color will change over the duration from 5 to 20 seconds randomly

} forEach GOM_fnc_treeLights;

Play with the according values, duration and colors should be clear.

 

Arma does handle lots of dynamic lights rather poorly, you'll soon run into flickering with more than 10 lights, even on ultra settings.

Probably also depends on other lights that are present within the mission.

 

If wanted you can also add a sine function and make the lights pulsate, or even better, have each light pulse out of sync and let them run into sync every n seconds, if that's what you want.

 

Cheers

 

  • Like 6

Share this post


Link to post
Share on other sites

@Grumpy Old Man Thanks for posting, I will look into it when I get time.  Just need to finish my current two missions for this Saturday and Sunday then I will be working on the forest mission :D

  • Like 1

Share this post


Link to post
Share on other sites

I wish all gaming communities were this helpful.

  • Like 2

Share this post


Link to post
Share on other sites

@TPM_Aus i honestly think that post process effects will probably get you closer to your target picture. the lighting in arma is pretty basic so it will mostly look like a rave party in the woods with set up lights. particles help but i dunno. just imho.

 

i love those scripted monsters you made. really cool stuff. i'll try to make a concept for a blending ppeffects based on an area. see where it goes. could be useful for other stuff like enhancing underwater effects maybe.

Share this post


Link to post
Share on other sites

ok here's a basic example of lerping post process effects based on distance to a position or being inside of one or more marker areas.

 

this function is needed for both examples

bb_fnc_lerpnestedarray =
{
	params ["_default", "_target", "_per"];
	
	private _lerpedarray = [];
	{
		if (_x isEqualType []) then
		{
			_lerpedarray pushBack ([_x, _target select _forEachIndex, _per] call bb_fnc_lerpnestedarray);
		} else
		{
			_lerpedarray pushBack ([_x, _target select _forEachIndex, _per] call BIS_fnc_lerp)
		};
	} foreach _default;
	_lerpedarray
};

it's used to smoothly fade between the effects.

 

to do it based on a center postion use this:

"filmGrain" ppEffectEnable true;
"colorCorrections" ppEffectEnable true;

["bb_ppFX", "onEachFrame", 
{
	params ["_center", "_range"];
	
	_dist = (player distance _center) min _range;
	_per = 1-(_dist/_range);
	
	"filmGrain" ppEffectAdjust [_per min 0.15, -1, 0.1, 0.05, 2, false];  
	"filmGrain" ppEffectCommit 0; 
	_targetcolors =		
	[
		1,
		1,
		0,
		[0.77,1.25,0,0],
		[2.83,5,0.73,1.29],
		[0.33,0.33,0.33,0],
		[0,0,0,0,0,0,4]
	];

	_defaultcolors = 
	[
		1,
		1,
		0,
		[0,0,0,0],
		[1,1,1,1],
		[0.33,0.33,0.33,0],
		[0,0,0,0,0,0,4]
	];	
	
	_result = ([_defaultcolors, _targetcolors, _per] call bb_fnc_lerpnestedarray);
	
	"colorCorrections" ppEffectAdjust _result;
	"colorCorrections" ppEffectCommit 0; 

}, [getpos player, 50]] call BIS_fnc_addStackedEventHandler;

 

the last line has the input position and the radius which is used to fade in/out the effects.

 

_________________________________________________

 

alternatively one could use an array of markers and have the effect fade in/out quickly when crossing a border into one of them.

 

"filmGrain" ppEffectEnable true;
"colorCorrections" ppEffectEnable true;

player setVariable ["ppFX", [time, false]];

["bb_ppFX", "onEachFrame", 
{
	params ["_time", "_mkrs"];
	
	_inarea = !(({player inArea _x} count _mkrs) isEqualTo 0);

	(player getVariable "ppFX") params ["_stamp", "_active"];
	if ((_inarea && !_active) or (!_inarea && _active)) then
	{
		player setVariable ["ppFX", [time, 
			if _active then {false} else {true}
		]];		
	};
	
	_per = if _active then
	{
		((time - _stamp)/_time) min 1;
	} else
	{
		(1 - ((time - _stamp)/_time)) max 0;
	};
	
	"filmGrain" ppEffectAdjust [_per *0.5, -1, 0.1, 0.05, 2, false];  
	"filmGrain" ppEffectCommit 0; 
	_targetcolors =		
	[
		1,
		1,
		0,
		[0.77,1.25,0,0],
		[2.83,5,0.73,1.29],
		[0.33,0.33,0.33,0],
		[0,0,0,0,0,0,4]
	];

	_defaultcolors = 
	[
		1,
		1,
		0,
		[0,0,0,0],
		[1,1,1,1],
		[0.33,0.33,0.33,0],
		[0,0,0,0,0,0,4]
	];	
	
	_result = ([_defaultcolors, _targetcolors, _per] call bb_fnc_lerpnestedarray);
	
	"colorCorrections" ppEffectAdjust _result;
	"colorCorrections" ppEffectCommit 0; 

}, [5, ["area1", "area2"]]] call BIS_fnc_addStackedEventHandler;

 

here the parameters are duration of the fade transition and an array of the markers.

 

it's a bit unsmooth when you go in and out quickly. i'll fix that later.

  • Like 4

Share this post


Link to post
Share on other sites
On 7/19/2018 at 6:33 AM, bad benson said:

@TPM_Aus i honestly think that post process effects will probably get you closer to your target picture. the lighting in arma is pretty basic so it will mostly look like a rave party in the woods with set up lights. particles help but i dunno. just imho.

 

i love those scripted monsters you made. really cool stuff. i'll try to make a concept for a blending ppeffects based on an area. see where it goes. could be useful for other stuff like enhancing underwater effects maybe.


I will have a look at post processing effects as well, lol.

I did not make the monsters or the anomalies.
Screamer: https://steamcommunity.com/sharedfiles/filedetails/?id=1266606112&searchtext=screamer
Anomalies : https://steamcommunity.com/sharedfiles/filedetails/?id=1383903166&searchtext=stalker

Share this post


Link to post
Share on other sites

fixed the transition being instant when moving in and out of the marker area too fast.

 

note that the effects themselves are just to test the code. i know it isn't pretty :f:

i also made it only do what it needs to but i'm sure this can be optimised a lot more. i just made it work.

 

bb_fnc_lerpnestedarray =
{
	params ["_default", "_target", "_per"];
	
	private _lerpedarray = [];
	{
		if (_x isEqualType []) then
		{
			_lerpedarray pushBack ([_x, _target select _forEachIndex, _per] call bb_fnc_lerpnestedarray);
		} else
		{
			_lerpedarray pushBack ([_x, _target select _forEachIndex, _per] call BIS_fnc_lerp)
		};
	} foreach _default;
	_lerpedarray
};




"filmGrain" ppEffectEnable true;
"colorCorrections" ppEffectEnable true;

player setVariable ["ppFX", [time, 0, false]];

["bb_ppFX", "onEachFrame", 
{
	params ["_time", "_mkrs"];

	(player getVariable "ppFX") params ["_stamp", "_oldper", "_state"];
	
	_inarea = !(({player inArea _x} count _mkrs) isEqualTo 0);

	_per = if _inarea then
	{
		(_oldper + (time - _stamp)/_time) min 1
	} else
	{
		(_oldper - (time - _stamp)/_time) max 0
	};
	
	player setVariable ["ppFX", [time,  _per, _inarea]];
	
	if (_inarea isEqualTo _state && {_per isEqualTo _oldper}) exitwith 
	{
		//hintsilent "handled"
	};
	
	//hintsilent str _per;
	
	"filmGrain" ppEffectAdjust [_per *0.5, -1, 0.1, 0.05, 2, false];  
	"filmGrain" ppEffectCommit 0; 
	_targetcolors =		
	[
		1,
		1,
		0,
		[0.77,1.25,0,0],
		[2.83,5,0.73,1.29],
		[0.33,0.33,0.33,0],
		[0,0,0,0,0,0,4]
	];

	_defaultcolors = 
	[
		1,
		1,
		0,
		[0,0,0,0],
		[1,1,1,1],
		[0.33,0.33,0.33,0],
		[0,0,0,0,0,0,4]
	];	
	
	_result = ([_defaultcolors, _targetcolors, _per] call bb_fnc_lerpnestedarray);
	
	"colorCorrections" ppEffectAdjust _result;
	"colorCorrections" ppEffectCommit 0; 

}, [5, ["area1", "area2"]]] call BIS_fnc_addStackedEventHandler;

 

  • Like 4

Share this post


Link to post
Share on other sites

As stated in my previous post, goofed around some more and added a simple FM sine function so the lights will now periodically begin to pulse, values can be adjusted as you seem fit.

Should be pretty self explanatory with the comments.

Looks pretty trippy, adding some particle effects to it like some fog dripping down from the treetops could be a next step, depending on how you want it to look like.

 

 


_referencePos = getPosATL player;
_trees = nearestTerrainObjects [_referencePos, ["Tree"], 25];
//filter trees to only get one tree every 7m because something something arma dynamic lights
_finalTrees = [];

while {count _trees > 0} do {
	_rndTree = selectRandom _trees;
	_trees = _trees select {_x distance2d _rndTree >= 7};
	_finalTrees pushback _rndTree;
};

_colorIntensity = 0.3;//play around with this, with multiple light sources this value should be kept rather low
GOM_fnc_treeLights = [];
{

	_lightAmbient = [_colorIntensity, 0, _colorIntensity];//tweak here

	_pos = getposATL _x;
	_light = "#lightpoint" createVehicleLocal _pos;
	_light setLightBrightness 0.75;
	_light setLightAmbient _lightAmbient;
	_light setLightColor _lightAmbient;
	_light setLightDayLight true;
	_light setLightUseFlare false;
	_light setLightFlareSize 5;
	_light setLightFlareMaxDistance 500;
	_light setLightAttenuation [2,4,4,0,9,10];

	GOM_fnc_treeLights pushBack [_light,_lightAmbient];

} forEach _finalTrees;


//fade colors over time
GOM_fnc_changeColors = {
	params ["_light","_currentColor","_colors","_duration"];

	_color = selectRandom _colors;
	_currentColor params ["_initR","_initG","_initB"];
	_color params ["_targetR","_targetG","_targetB"];
	_endTime = time + random [_duration / 2,_duration,_duration * 2];
	_initTime = time;
	_finalColor = [];
	waitUntil {
		_finalColor = [
		linearConversion [_initTime,_endTime,time,_initR,_targetR,true],
		linearConversion [_initTime,_endTime,time,_initG,_targetG,true],
		linearConversion [_initTime,_endTime,time,_initB,_targetB,true]
		];
		_light setLightAmbient _finalColor;
		time > _endTime
	};//pretty fluid for slow color transitions

_recursionisonehelluvadrug = [_light,_finalColor,_colors,_duration] spawn GOM_fnc_changeColors;

};

_colors = [[0.5,0,0.5],[0.3,0,0.3],[0,0.3,0],[0.3,0,0],[0,0,0.3]];//add or adjust the colors that will be used

{

	_x params ["_light","_color"];
	_change = [_light,_color,_colors,10] spawn GOM_fnc_changeColors;//color will change over the duration from 5 to 20 seconds randomly

} forEach GOM_fnc_treeLights;


GOM_fnc_2dWalker = {
	params ["_input","_change","_minValue","_maxValue"];

	(_input + selectRandom [_change,- _change]) min _maxValue max _minValue;//stole this from a c++ project of mine
};

GOM_fnc_sine = {

	params ["_amplitude","_frequency","_phase"];

	_amplitude * sin (2*3.14159265359*_frequency*time+_phase);

};

//this handles the color changing for every individual tree
addmissionEventhandler ["EachFrame",{

	//simple pulsating effect of all lights
	_globalModulation = 1.15;//will pulse with 15% intensity
	GOM_globalFrequency = ([_globalModulation,2.5,0] call GOM_fnc_sine) + _globalModulation;

	{
		if (diag_frameno % 2 == 0) then {
			_x params ["_light","_lightAmbient"];
			_lightAmbient params ["_r","_g","_b"];
				_new = [
					[_r,0.005,0.1,0.76] call GOM_fnc_2dWalker,
					0,
					[_b,0.005,0.1,0.76] call GOM_fnc_2dWalker
				];
				_light setLightAmbient _new;
				_light setLightColor _new;

				_x set [1,_new];

		};
	} forEach GOM_fnc_treeLights;
}];


//this handles pulsating effect of every tree

{

	_x params ["_light"];

	//randomize pulsating parameters
	_frequency = 2 + random 2;


	_pulsate = [_light,_frequency] spawn {
		params ["_light","_frequency"];
		_maxBright = 0.3;
		_second = false;
		waitUntil {

			_sine = ([_maxBright,(_frequency / 2) * GOM_globalFrequency,0] call GOM_fnc_sine) + (_frequency / 2);
			_light setLightBrightness _sine;
			if (round _sine isEqualTo 0 AND _second) then {_reset = true;_frequency = 2 + random 10};
			!alive _light

		};


	};

} forEach GOM_fnc_treeLights;

Cheers

  • Like 8

Share this post


Link to post
Share on other sites

Looks great, GOM! You might want to play around with attenuation range (the last two values in setLightAttenuation) as the default [...,9,10] in the BI example creates a hard "edge." Using values that aren't as close to each other will soften the edge and help all of the lights blend a bit better. I was placing lightpoints pretty far apart and 30 meters ATL, with those values at [...,30,40], which created a nice fade between lights while providing maximum ambient light at ground level, and no "hot spots."

  • Like 3

Share this post


Link to post
Share on other sites

 

 

Might take a few minutes for HQ to process.

I made a few tweaks to GOM's code, just values and spawning the lightpoints at altitude. You probably want something in-between, but Grumpy has made it easy to play around with.

 

Spoiler

_referencePos = getPosATL player;
_trees = nearestTerrainObjects [_referencePos, ["Tree"], 50]; //increased area

_finalTrees = [];

while {count _trees > 0} do {
	_rndTree = selectRandom _trees;
	_trees = _trees select {_x distance2d _rndTree >= 15};  //increased distance between trees
	_finalTrees pushback _rndTree;
};

_colorIntensity = 0.3;
GOM_fnc_treeLights = [];
{

	_lightAmbient = [_colorIntensity, 0, _colorIntensity];//tweak here

	_pos = getposATL _x;
	_light = "#lightpoint" createVehicleLocal [(_pos select 0),(_pos select 1), 30];  //spawned lightpoints at 30M ATL
	_light setLightBrightness 0.75;
	_light setLightAmbient _lightAmbient;
	_light setLightColor _lightAmbient;
	_light setLightDayLight true;
	_light setLightUseFlare false;
	_light setLightFlareSize 5;
	_light setLightFlareMaxDistance 500;
	_light setLightAttenuation [2,4,4,0,30,40];  //pushed attenuation range out to 30M with full fade at 40M

	GOM_fnc_treeLights pushBack [_light,_lightAmbient];

} forEach _finalTrees;


GOM_fnc_changeColors = {
	params ["_light","_currentColor","_colors","_duration"];

	_color = selectRandom _colors;
	_currentColor params ["_initR","_initG","_initB"];
	_color params ["_targetR","_targetG","_targetB"];
	_endTime = time + random [_duration / 2,_duration,_duration * 2];
	_initTime = time;
	_finalColor = [];
	waitUntil {
		_finalColor = [
		linearConversion [_initTime,_endTime,time,_initR,_targetR,true],
		linearConversion [_initTime,_endTime,time,_initG,_targetG,true],
		linearConversion [_initTime,_endTime,time,_initB,_targetB,true]
		];
		_light setLightAmbient _finalColor;
		time > _endTime
	};

_recursionisonehelluvadrug = [_light,_finalColor,_colors,_duration] spawn GOM_fnc_changeColors;

};

_colors = [[1,0,0],[0,0,1],[1,0,1],[0,1,1]];  //simple color palette of red, blue, magenta, cyan, which yields other colors during color change
{

	_x params ["_light","_color"];
	_change = [_light,_color,_colors,10] spawn GOM_fnc_changeColors;

} forEach GOM_fnc_treeLights;


GOM_fnc_2dWalker = {
	params ["_input","_change","_minValue","_maxValue"];

	(_input + selectRandom [_change,- _change]) min _maxValue max _minValue;
};


GOM_fnc_sine = {

	params ["_amplitude","_frequency","_phase"];

	_amplitude * sin (2*3.14159265359*_frequency*time+_phase);

};

addmissionEventhandler ["EachFrame",{

	_globalModulation = 1.15;
	GOM_globalFrequency = ([_globalModulation,2.5,0] call GOM_fnc_sine) + _globalModulation;

	{
		if (diag_frameno % 2 == 0) then {
			_x params ["_light","_lightAmbient"];
			_lightAmbient params ["_r","_g","_b"];
				_new = [
					[_r,0.005,0.1,0.76] call GOM_fnc_2dWalker,
					0,
					[_b,0.005,0.1,0.76] call GOM_fnc_2dWalker
				];
				_light setLightAmbient _new;
				_light setLightColor _new;

				_x set [1,_new];

		};
	} forEach GOM_fnc_treeLights;
}];

{

	_x params ["_light"];

	_frequency = 2 + random 2;


	_pulsate = [_light,_frequency] spawn {
		params ["_light","_frequency"];
		_maxBright = 0.3;
		_second = false;
		waitUntil {

			_sine = ([_maxBright,(_frequency / 2) * GOM_globalFrequency,0] call GOM_fnc_sine) + (_frequency / 2);
			_light setLightBrightness _sine;
			if (round _sine isEqualTo 0 AND _second) then {_reset = true;_frequency = 2 + random 10};
			!alive _light

		};


	};

} forEach GOM_fnc_treeLights;

 

 

  • Like 6

Share this post


Link to post
Share on other sites

Awesome gents.  Everyone who has posted in this thread has been so helpful, thank you so much.  Now to make the time to start testing everything. :D

Share this post


Link to post
Share on other sites

Hey gents,

 

Ok so I have some time to have a look at the ambient colour scripts you guys have provided.  I won't be running with the magic/haunted forest yet as the last mission was in the jungle so I will be making this mission in the desert.

 

For the desert mission I want to use @bad benson post processing idea to provide a a different colour sky affect during an alien invasion, as seen in the example link ----> Example

 

Now my question, using @Bad benson post processing idea, how would I:

  • set an area to where the post processing affect would take place, so that players could go into an area and leave the area changing from normal to post processing?
    • Would this use markers/triggers? or
    • Would this use markers/triggers along with a sqf file?
    • How would I just set a red post process affect?
    • (I know that Bad Benson did post his script above, but I am still trying to understand how it works)
  • if it is even possible, change the sky colour only?

Thanks in advance gents.

TPM

Share this post


Link to post
Share on other sites
2 hours ago, bad benson said:

check this out. https://steamcommunity.com/sharedfiles/filedetails/?id=350606620

 

once you have a fitting effect i can help you modify my code. byou could try it yourself too since you just need to remove everything that's filmgrain related.

That looks pretty cool, I will give that a go.

Share this post


Link to post
Share on other sites
4 hours ago, TPM_Aus said:
  • set an area to where the post processing affect would take place, so that players could go into an area and leave the area changing from normal to post processing?

 

I think this is possible, it was tried and tested during the early stages of the Contamination Zone mod, but ultimately ditched as it's very difficult to create a smooth transition from normal>postprocess>normal. 

 

4 hours ago, TPM_Aus said:
    • How would I just set a red post process affect?

 

This any good?.....It's made with the same mod BB suggested. :f:

  • Like 2

Share this post


Link to post
Share on other sites
12 hours ago, EO said:

 

I think this is possible, it was tried and tested during the early stages of the Contamination Zone mod, but ultimately ditched as it's very difficult to create a smooth transition from normal>postprocess>normal.

 

i posted code to do this exact thing in this thread already. if something is unclear i need specific questions though since i already wrote some explaination when i posted it.

 

@TPM_Aus

"filmGrain" ppEffectEnable true;
"colorCorrections" ppEffectEnable true;
"filmGrain" ppEffectAdjust [0, -1, 0.1, 0.05, 2, false];  
"filmGrain" ppEffectCommit 0; 

"colorCorrections" ppEffectAdjust [
	1,
	1,
	0,
	[0,0,0,0],
	[1,1,1,1],
	[0.33,0.33,0.33,0],
	[0,0,0,0,0,0,4]
];
"colorCorrections" ppEffectCommit 0; 

player setVariable ["ppFX", [time, 0, false]];

["bb_ppFX", "onEachFrame", 
{
	params ["_time", "_mkrs"];
	
	_lerpnestedarray =
	{
		params ["_default", "_target", "_per"];
		
		private _lerpedarray = [];
		{
			if (_x isEqualType []) then
			{
				_lerpedarray pushBack ([_x, _target select _forEachIndex, _per] call _lerpnestedarray);
			} else
			{
				_lerpedarray pushBack ([_x, _target select _forEachIndex, _per] call BIS_fnc_lerp)
			};
		} foreach _default;
		_lerpedarray
	};


	(player getVariable "ppFX") params ["_stamp", "_oldper", "_state"];
	
	_inarea = !(({player inArea _x} count _mkrs) isEqualTo 0);

	_per = if _inarea then
	{
		(_oldper + (time - _stamp)/_time) min 1
	} else
	{
		(_oldper - (time - _stamp)/_time) max 0
	};
	
	player setVariable ["ppFX", [time,  _per, _inarea]];
	
	if (_inarea isEqualTo _state && {_per isEqualTo _oldper}) exitwith 
	{

	};
	
	
	"filmGrain" ppEffectAdjust [_per *0.1, -1, 0.1, 0.05, 2, false];  
	"filmGrain" ppEffectCommit 0; 
	_targetcolors =		
	[
		1,
		1,
		0,
		[0.77,1.25,0,0],
		[2.83,5,0.73,1.29],
		[0.33,0.33,0.33,0],
		[0,0,0,0,0,0,4]
	];

	_defaultcolors = 
	[
		1,
		1,
		0,
		[0,0,0,0],
		[1,1,1,1],
		[0.33,0.33,0.33,0],
		[0,0,0,0,0,0,4]
	];	
	
	_result = ([_defaultcolors, _targetcolors, _per] call _lerpnestedarray);
	
	"colorCorrections" ppEffectAdjust _result;
	"colorCorrections" ppEffectCommit 0; 

}, 
[
	5, //transition duration
	[
		"marker_0", //markers to use
		"marker_1"
	]
]] call BIS_fnc_addStackedEventHandler;

Example mission:

https://drive.google.com/file/d/1srkjgqcDJwMgWSaeXnZQRC8GCgg0UHZ_/view?usp=sharing

Share this post


Link to post
Share on other sites

@bad benson, nothing is unclear, I merely committed a forum faux pas of answering the most recent post without looking back through previous posts. :dummy:

 

 

  • Like 1

Share this post


Link to post
Share on other sites

@bad benson Got some time to look at this again and I just noticed the test mission download link.  That is awesome and what I am after :D Thanks so much.  Just need to get the colour right now.  Then after this Event I will be working on the magical forest event.

Share this post


Link to post
Share on other sites

Ok, so another noob question.  I was looking at what EO linked earlier which referenced his Dune Red Zone PP affect as seen below:
 

PP_chrom = ppEffectCreate ["ChromAberration",200];
PP_chrom ppEffectEnable true;
PP_chrom ppEffectAdjust [0,-0.01,true];
PP_chrom ppEffectCommit 0;
PP_wetD = ppEffectCreate ["WetDistortion",300];
PP_wetD ppEffectEnable true;
PP_wetD ppEffectAdjust [-1.29,0.01,0.01,5,0.98,5,-2.48,-0.08,-0.08,0.02,-0.16,-0.15,0.04,0.2,0.2];
PP_wetD ppEffectCommit 0;
PP_colorC = ppEffectCreate ["ColorCorrections",1500];
PP_colorC ppEffectEnable true;
PP_colorC ppEffectAdjust [0.63,0.81,-0.01,[-2,2,2,-0.06],[1.27,-0.27,-5,0.9],[0.21,0.07,0.68,0.75],[0,1,-0.06,0.02,0,1,5]];
PP_colorC ppEffectCommit 0;
PP_film = ppEffectCreate ["FilmGrain",2000];
PP_film ppEffectEnable true;
PP_film ppEffectAdjust [0.45,2.88,1.58,2,2,true];
PP_film ppEffectCommit 0;


My question is, how would I add the above code to bad bensons below code? I don't fully understand the code and therefore I cant get my head around it.

"filmGrain" ppEffectEnable true;
"colorCorrections" ppEffectEnable true;
"filmGrain" ppEffectAdjust [0, -1, 0.1, 0.05, 2, false];  
"filmGrain" ppEffectCommit 0; 

"colorCorrections" ppEffectAdjust [
	1,
	1,
	0,
	[0,0,0,0],
	[1,1,1,1],
	[0.33,0.33,0.33,0],
	[0,0,0,0,0,0,4]
];
"colorCorrections" ppEffectCommit 0; 

player setVariable ["ppFX", [time, 0, false]];

["bb_ppFX", "onEachFrame", 
{
	params ["_time", "_mkrs"];
	
	_lerpnestedarray =
	{
		params ["_default", "_target", "_per"];
		
		private _lerpedarray = [];
		{
			if (_x isEqualType []) then
			{
				_lerpedarray pushBack ([_x, _target select _forEachIndex, _per] call _lerpnestedarray);
			} else
			{
				_lerpedarray pushBack ([_x, _target select _forEachIndex, _per] call BIS_fnc_lerp)
			};
		} foreach _default;
		_lerpedarray
	};


	(player getVariable "ppFX") params ["_stamp", "_oldper", "_state"];
	
	_inarea = !(({player inArea _x} count _mkrs) isEqualTo 0);

	_per = if _inarea then
	{
		(_oldper + (time - _stamp)/_time) min 1
	} else
	{
		(_oldper - (time - _stamp)/_time) max 0
	};
	
	player setVariable ["ppFX", [time,  _per, _inarea]];
	
	if (_inarea isEqualTo _state && {_per isEqualTo _oldper}) exitwith 
	{

	};
	
	
	"filmGrain" ppEffectAdjust [_per *0.1, -1, 0.1, 0.05, 2, false];  
	"filmGrain" ppEffectCommit 0; 
	_targetcolors =		
	[
		1,
		1,
		0,
		[0.77,1.25,0,0],
		[2.83,5,0.73,1.29],
		[0.33,0.33,0.33,0],
		[0,0,0,0,0,0,4]
	];

	_defaultcolors = 
	[
		1,
		1,
		0,
		[0,0,0,0],
		[1,1,1,1],
		[0.33,0.33,0.33,0],
		[0,0,0,0,0,0,4]
	];	
	
	_result = ([_defaultcolors, _targetcolors, _per] call _lerpnestedarray);
	
	"colorCorrections" ppEffectAdjust _result;
	"colorCorrections" ppEffectCommit 0; 

}, 
[
	5, //transition duration
	[
		"marker_0", //markers to use
		"marker_1"
	]
]] call BIS_fnc_addStackedEventHandler;


 

Share this post


Link to post
Share on other sites

i know it's a bit messy to look at maybe but have you tried understanding it? and if so, what did you not understand? it would be great, if you'd ask specific questions and try to understand all this or the most important part of it in the process so you and other people who might read this later can learn something from it. it creates the ideal situation of you expanding your skills and maybe being able to help others later so we get a nice chain reaction going here.

 

i'd prefer that instead of making custom code for you for free. not trying to be rude. i will literally walk you through this step by step, if there is some willingness to be noticed. maybe we can make it leaner and more effective in the process too.

Share this post


Link to post
Share on other sites

Thats not being rude at all, I have gone over the code trying to understand what is going on.  I will go over it again and post exactly what I do and don't understand.  Most of my learning has simply been from reverse engineering what others have created to understand what is going on.  I don't like to take up community members time by asking lots of noob questions.  But if you are happy to help step-by-step I would greatly appreciate it.

Once I get all the information I am after and get it working I will edit my first post with all the relevant information, so that others my learn.  I do hate it when people figure out the solution to their problem, but don't share how it was solved.

 

Peace.

  • Like 1

Share this post


Link to post
Share on other sites

so what it does is simply take the default color settings and the target ones and then it smoothly transitions each value of those settings based on the condition. for the filgrain it only manipulates a single value the same way since you can show and hide the whole effect with that single value. so depending on how it works for each of the effects you posted one would have to adapt the whole thing. i can modify it a little later to make it more proper for more than those two effects i used in the example.

 

so maybe see if you can make it work with you own color correction effect for now. i named the variables pretty descriptive i think. don't worry too much about the top part of the function though. that handles the switch of being in hte zone and out of it itself. no need to explain that in detail unless you want me to.

 

the variable _per is the percentage you want to apply to all effects. ranging from 0 to 1. that is the main value that controls all teh lerping and stuff.

  • Thanks 1

Share this post


Link to post
Share on other sites

Ok, so I have made some notes on the below code of what I know (well what I think I know) and what I don't know.

 

Spoiler

"filmGrain" ppEffectEnable true;            // Enables FilmGrain PP
"colorCorrections" ppEffectEnable true;            //Enables Colour to be changed
"filmGrain" ppEffectAdjust [0, -1, 0.1, 0.05, 2, false];  // FilmGrain parameters     intensity, sharpness, grainSize, intensityX0 (Not sure what this is), intensityX1 (Not sure what this is), monochromatic.
"filmGrain" ppEffectCommit 0;    // I know this commits the affect, but unsure if the 0 = enable, disabled (which looks strange) or if this is time.  As in 0 seconds.

"colorCorrections" ppEffectAdjust [    // With line 2 enabling the colorCorrections pp, this is where you adjust the colorCorrections.
    1,
    1,
    0,
    [0,0,0,0],            //  Not 100% what each figure repesents, but I assume this gives you the RGB plus other corrections.
    [1,1,1,1],
    [0.33,0.33,0.33,0],
    [0,0,0,0,0,0,4]
];
"colorCorrections" ppEffectCommit 0;            //  Looks like after every colour corrections, you need to commit it by enabling or time.  Ref line 4 notes as I am unsure what the 0 represents.

player setVariable ["ppFX", [time, 0, false]];            //Setting the variable to the player.  ppFx is the name for post processing effect, referenced further down in the code.  Time is the variable, 0 seconds, false would mean it is not always on

["bb_ppFX", "onEachFrame",            // I do not know what bb is, the only thing that comes to mind is your name bad benson, lol.  But it does look like it is placing the ppFX from above onto each frame.  
{
    params ["_time", "_mkrs"];                                    ///------------------
    
    _lerpnestedarray =
    {
        params ["_default", "_target", "_per"];
        
        private _lerpedarray = [];
        {
            if (_x isEqualType []) then
            {
                _lerpedarray pushBack ([_x, _target select _forEachIndex, _per] call _lerpnestedarray);
            } else
            {
                _lerpedarray pushBack ([_x, _target select _forEachIndex, _per] call BIS_fnc_lerp)
            };
        } foreach _default;
        _lerpedarray
    };
                                                                                                                            //Lost in here without googling it all.

    (player getVariable "ppFX") params ["_stamp", "_oldper", "_state"];
    
    _inarea = !(({player inArea _x} count _mkrs) isEqualTo 0);

    _per = if _inarea then
    {
        (_oldper + (time - _stamp)/_time) min 1
    } else
    {
        (_oldper - (time - _stamp)/_time) max 0
    };
    
    player setVariable ["ppFX", [time,  _per, _inarea]];
    
    if (_inarea isEqualTo _state && {_per isEqualTo _oldper}) exitwith
    {

    };                                                                                        ----------//
    
    
    "filmGrain" ppEffectAdjust [_per *0.1, -1, 0.1, 0.05, 2, false];  
    "filmGrain" ppEffectCommit 0;
    _targetcolors =        
    [
        1,
        1,                                //Similar to line 6 to 13, possible the second areas colour
        0,
        [0.77,1.25,0,0],
        [2.83,5,0.73,1.29],
        [0.33,0.33,0.33,0],
        [0,0,0,0,0,0,4]
    ];

    _defaultcolors =
    [
        1,
        1,
        0,
        [0,0,0,0],                // When leaving the area markers, the would restore you back to default colours.
        [1,1,1,1],
        [0.33,0.33,0.33,0],
        [0,0,0,0,0,0,4]
    ];    
    
    _result = ([_defaultcolors, _targetcolors, _per] call _lerpnestedarray);        //Unsure
    
    "colorCorrections" ppEffectAdjust _result;        //Looks like it sets the new colorCorrection from the line 85 result.
    "colorCorrections" ppEffectCommit 0;   //As per Line 4 notes.

},
[
    5, //transition duration  // Time it takes to transition when moving in and out of the area markers.
    [
        "marker_0",         //markers to be placed in the eden editor
        "marker_1"            //markers to be placed in the eden editor
    ]
]] call BIS_fnc_addStackedEventHandler;            // I should know this but I dont.


What is with the PP at the start of every line in EOs code.  You don't have PP in yours? (Just realised this sounds a little weird when I read it out lout, lol)

PP_chrom = ppEffectCreate ["ChromAberration",200];
PP_chrom ppEffectEnable true;
PP_chrom ppEffectAdjust [0,-0.01,true];
PP_chrom ppEffectCommit 0;
PP_wetD = ppEffectCreate ["WetDistortion",300];
PP_wetD ppEffectEnable true;
PP_wetD ppEffectAdjust [-1.29,0.01,0.01,5,0.98,5,-2.48,-0.08,-0.08,0.02,-0.16,-0.15,0.04,0.2,0.2];
PP_wetD ppEffectCommit 0;
PP_colorC = ppEffectCreate ["ColorCorrections",1500];
PP_colorC ppEffectEnable true;
PP_colorC ppEffectAdjust [0.63,0.81,-0.01,[-2,2,2,-0.06],[1.27,-0.27,-5,0.9],[0.21,0.07,0.68,0.75],[0,1,-0.06,0.02,0,1,5]];
PP_colorC ppEffectCommit 0;
PP_film = ppEffectCreate ["FilmGrain",2000];
PP_film ppEffectEnable true;
PP_film ppEffectAdjust [0.45,2.88,1.58,2,2,true];
PP_film ppEffectCommit 0;

 

Share this post


Link to post
Share on other sites
19 minutes ago, TPM_Aus said:

You don't have PP in yours? (Just realised this sounds a little weird when I read it out lout, lol)

:tounge2:

 

The code i posted is generated from Greenfist's Post Process Editor, when you create an effect this is what's copied to clipboard.   

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×