Jump to content

[Release] different colorcorrections for day- and nighttime


Recommended Posts

Hello

I wrote this little script for my server which has some colorcorrection effects which are nice during the day, but at night not so much.

during the day it will look like this :

oMC3NIvl.jpg
during the night :

Y0lWhbil.jpg

how it should look at night :
j9BQLnzl.jpg



so I wrote this script :
graphics.sqf

// ventzer0 (c) 2013, leave the credit in!
// _sunrise & _sunset determine start and end of the effect based on time
private ["_sunrise", "_sunset","_loop"];
"filmGrain" ppEffectEnable true;
_hndl = ppEffectCreate ["colorCorrections", 1501];
_hndl ppEffectEnable true;
_daytime = daytime;
//time at which nighttime effect should kick in
_sunset = 18.5;
//time at which daytime effect should kick in
_sunrise = 7.0;
_loop = 0;
sleep 1;
while { _loop != 6} do {
  //night
  while { ( _daytime > _sunset ) and ( _daytime > _sunrise ) } do {
    _hndl ppEffectAdjust[1,1,0,[0,0.04,0,-0.01],[0,0,0,1.58],[-0.11,-0.11,-0.11,0]];
    _hndl ppEffectCommit 0;
    "filmGrain" ppEffectAdjust [0.01, 1, 1, 0.1, 1, true];
    "filmGrain" ppEffectCommit 0;
    sleep 1200;
    //check all x seconds
  };
  sleep 1;
  while { ( _daytime < _sunset ) and ( _daytime < _sunrise ) } do {
    _hndl ppEffectAdjust[1,1,0,[0,0.04,0,-0.01],[0,0,0,1.58],[-0.11,-0.11,-0.11,0]];
    _hndl ppEffectCommit 0;
    "filmGrain" ppEffectAdjust [0.01, 1, 1, 0.1, 1, true];
    "filmGrain" ppEffectCommit 0;

    sleep 1200;
    //check all x seconds
  };
  sleep 1;
  // day
  while { ( _daytime > _sunrise ) and ( _daytime < _sunset ) } do {
    _hndl ppEffectAdjust[1,1,0,[0,-0.12,0.05,0.03],[0,0,0,1.23],[-0.11,-0.11,-0.11,0]];
    _hndl ppEffectCommit 0;
    "filmGrain" ppEffectAdjust [0.0225, 1, 1, 0.1, 1, true];
    "filmGrain" ppEffectCommit 0;
    sleep 1200;
    //check all x seconds
  };
  sleep 1;
  _loop = _loop + 1;
};

put this code in a file called graphics.sqf and place it somewhere into your missionfile

to execute the script put this:

execVM "pathto\graphics.sqf";

after the

if (!isdedicated) {...};

part in your init.sqf

 

something like this:

if (!isDedicated) then {
       [... ect ... a lot of code which is not important for this]
};
execVM "pathto\graphics.sqf"; // different colorcorrection for day and night
[... etc ... left out the rest because not important]

I hope someone finds this useful :)

Link to comment
Share on other sites

thanks for this i played abit with a other CC script but it was nice in day time but in night it looked ugly.

so i got it installed dont see much off a diffrence tho i think the grass was a bit greener and i found this error in the RPT

 

11:36:01 Error in expression <ise ) and ( _daytime < _sunset ) } do {
_hndl ppEffectAdjust[1,1,0,[0,-0.12,0.05>
11:36:01   Error position: <_hndl ppEffectAdjust[1,1,0,[0,-0.12,0.05>
11:36:01   Error Undefined variable in expression: _hndl
11:36:01 File mpmissions\__cur_mp.Chernarus\addons\graphics.sqf, line 37
Link to comment
Share on other sites

After a server restart connect and then reconnect to it, the script doesnt get the time right if youre the first person on the server after a restart (always shows 12:30 for me, after a simple visit to the lobby its ok), you can change the colorcorrection effect itself of course, just adjust the variables 

ppEffectAdjust[1,1,0,[0,-0.12,0.05,0.03],[0,0,0,1.23],[-0.11,-0.11,-0.11,0]]

you could take them from wasteland, or theres a nice effect mission for arma 2 that lets you choose all that stuff and see how it looks: this one http://www.armaholic.com/page.php?id=10163

 

I get those errors too, but it works nevertheless. pulled the code for the ppeffects right off the BIS wiki, dont know why its showing that error though.

Link to comment
Share on other sites

After a server restart connect and then reconnect to it, the script doesnt get the time right if youre the first person on the server after a restart (always shows 12:30 for me, after a simple visit to the lobby its ok), you can change the colorcorrection effect itself of course, just adjust the variables 

ppEffectAdjust[1,1,0,[0,-0.12,0.05,0.03],[0,0,0,1.23],[-0.11,-0.11,-0.11,0]]

you could take them from wasteland, or theres a nice effect mission for arma 2 that lets you choose all that stuff and see how it looks: this one http://www.armaholic.com/page.php?id=10163

 

I get those errors too, but it works nevertheless. pulled the code for the ppeffects right off the BIS wiki, dont know why its showing that error though.

im almost done with work so im gonna test it out, i have noticed that this has changed automaticly

i put it in the init file like this

 

execVM ....... when i reopend the init file again it was like this [] execVM does that even matter ? (sorry solved lookded at the wrong line)

 

anyway thanks for sharing your stuff 

 

what do you mean with the time? do you mean like if its night and a server restart comes that it will be day 12:30 if so that isnt the case here.

problem is for some guys its a bit purple greenish for me it looks good at night just grayish better then stock

Link to comment
Share on other sites

i have it just as 'execVM' no [] infront of it, also putting it only on the client side in the !isdecidated block doesnt work, when i tested that i got stuck on loading ^^

sure thing its nice to know that my script serves purpose :)

ok this is how it works:

you join the server, the script runs and checks what time it is on your server (INGAME time) and depending on what time it is, the effect it switches on is different ...

nighttime colorcorrection is just a very pale purple, while the daytime is pretty heavy purple. see the difference in the pictures, the extreme purple looking is the effect from the daytime applied at nighttime. you cant see shit if its like that ^^

the thing I noticed when testing this on my server is, the script does not gets the time checking right for the very first person to join the server after a restart, it always thought it was 12:30 ... when you went back to the lobby and joined back in again, everything was fine and the correct time was returned when the script checked for it.

the script checks every 1200seconds what time it is, so if your server has a sunrise or sunset period during normal gameplay, you will actually see the colors change at some point, which you can define.

oh and btw you can customize the effect it has, if you dont like purple play around with the variables "ppEffectAdjust[1,1,0,[0,-0.12,0.05,0.03],[0,0,0,1.23],[-0.11,-0.11,-0.11,0]]" theres MUCH you can do with these numbers. for example the weird colors in the blowout effect in namalsk is done by adjusting these variables. you could even have the server looking like every body got predator view :D

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Discord

×
×
  • Create New...