Resident Evil Revelations

Resident Evil Revelations

Visa statistik:
v00d00m4n 26 maj, 2013 @ 10:03
RER is too bright! Not callibrated for PC sRGB\2.2 gamma.
Look bellow for UPDATE part, if you want to FIX this until CAPCOM did this!
This issue applies to many console ports (all tomb raiders, deus ex human revolution and other ports by infamous nixxes), they ignore display ICC calibration profiles and sets their own gamma, it could be ok if game would be properly callibrated for standard non linear PC display sRGB gamma 2.2 (RGB 0.45 in Nvidia display settings) or at least 1.8 (RGB 0.55), since consoles and tvs usually has 2.2 or 2.0 ( 0.5), but the problem is, that instead of using non linear gamma curve many console ports has linear gamma 1.0.
And this issue applies to Resident Evil Revelations, RE 6 and other capcom PC games as well.

Could be done as simple as this in shader:

float4 color = colorInput;
color = pow (color, 2.2);
return color;

But better solution would be additional GAMMA (not britness!!!) slider in game options with proper numerical values that represent gamma from 0.0 up to 3.0.

Currently existing brigtness slider does not change gamma, and its range is toooo low, even on lowes values game is very bright.

What does it mean for horror game?

it mean that you can see monsters clear as during day light, they would not surprise or scare you, and this breaks resident evil immersion and atmoshpere, as game should be very dark to make people afraid of anything at distance and only hear it, instead of seeing it.

Also bright colors does not look natural.
However latent cheaters, who prefer to play at high brightness will stil excuse and protect this issue, simply because they dont like to play in realistic darkness where they cant see anything .

Capcom, please fix this issue for RE revelations and RE 6 as well!

How a bit more detailed description of problem with gamma correction and ways it could be handled:

http://www.princeton.edu/~achaney/tmve/wiki100k/docs/Gamma_correction.html
http://www.cambridgeincolour.com/tutorials/gamma-correction.htm




-----------------------------------------------------------------------------------------------

Update:

-----------------------------------------------------------------------------------------------

Temporary solution, until CAPCOM will fix it:
(Note: in next posts you will see dated methods i posted before this update, please ignore them, use this better method)

1) Download SweetFX 1.4 or later version (google for latest version) from here:
http://www.guru3d.com/files_details/sweetfx_shader_suite_download.html

2) Unpack into Resident Evil Revelations folder, best way to find it right click on RER in steam library > Properties> LOCAL FILES TAB > BROWSE LOCAL FILES ...

3) Edit SweetFX_settings.txt file:

Find section which looks almos like this (some items may change in future version)

/*-----------------------------------------------------------. / Choose effects / '-----------------------------------------------------------*/ // Set to 1 for ON or 0 for OFF #define USE_SMAA_ANTIALIASING 1 //[0 or 1] SMAA Anti-aliasing : Smoothens jagged lines using the SMAA technique. ... #define USE_SPLITSCREEN 0 //[0 or 1] Splitscreen : Enables the before-and-after splitscreen comparison mode.

add these to 2 lines after last line in section:

#define USE_XBOX360GAMMA 0 //[0 or 1] Xbox 360 gamma : Enables or disable X360 gamma mode. #define USE_SRGBGAMMA 0 //[0 or 1] sRGB gamma : Enables or disable sRGB gamma mode.

Set one of these lines to 1, SRGB for darker gamma equal to 2.2. XBOX360 for a little brighter close to 1.8-2.0 range.
Also set everything else (especially GAMM LIFT AND TONE MAPPING!) in section to 0, except for SMAA and SHARPENING, you dont want any of this to mess with your gamma or picture quality.

Save file and close it!

4) Edit SweetFX\Shaders\main.h file:

Find this section:

/*-------------------------------. | :: Xbox360 Gamma correction :: | '-------------------------------*/ /* I suspect that some games that ported to PC are such terrible ports that the developers forgot (or didn't bother) to do correct gamma correction for PC but just copied the Xbox360 code. If that is the case then I can probably correct for it, but I need to find some terrible ports and check for this first. Until then this code is not used. */ float XenonGammaToLinear(float val) { float ret; saturate(val); if (val < 0.25f) ret = 0.25f * val; else if (val < 0.375f) ret = (1.0f/16.0f) + 0.5f*(val-0.25f); else if (val < 0.75f) ret = 0.125f + 1.0f*(val-0.375f); else ret = 0.5f + 2.0f*(val-0.75f); return ret; } float LinearToXenonGamma(float val) { float ret; saturate(val); if (val < (1.0f/16.0f)) ret = 4.0f * val; else if (val < (1.0f/8.0f)) ret = (1.0f/4.0f) + 2.0f*(val-(1.0f/16.0f)); else if (val < 0.5f) ret = 0.375f + 1.0f*(val-0.125f); else ret = 0.75f + 0.5f*(val-0.50f); return ret; }

add these 2 extra functions bellow it:
float LinearToSrgb(float val) { float ret; if (val <= 0.0) ret = 0.0f; else if (val <= 0.0031308f) ret = 12.92f*val; else if (val <= 1.0f) ret = (pow(val, 0.41666)*1.055f)-0.055f; else ret = 1.0f; return ret; } float SrgbToLinear(float val) { float ret; if (val <= 0.0f) ret = 0; else if (val <= 0.04045f) ret = val / 12.92f; else if (val <= 1.0f) ret = pow((val + 0.055f)/1.055f,2.4f); else ret = 1.0f; return ret; }

now look for this section of code:

/*--------------------------------------. | :: Linear to sRGB Gamma correction :: | '--------------------------------------*/ // Linear to sRGB Gamma correction. Needed here because SMAA uses linear for it's final step while the other shaders use SRGB. #if (USE_SMAA_ANTIALIASING == 1) FinalColor.rgb = (FinalColor.rgb <= 0.00304) ? saturate(FinalColor.rgb) * 12.92 : 1.055 * pow( saturate(FinalColor.rgb), 1.0/2.4 ) - 0.055; // Linear to SRGB #endif #if (Xbox360gamma == 1) FinalColor.r = LinearToXenonGamma(FinalColor.r); // Linear to Xbox360 Gamma space (R) FinalColor.g = LinearToXenonGamma(FinalColor.g); // Linear to Xbox360 Gamma space (G) FinalColor.b = LinearToXenonGamma(FinalColor.b); // Linear to Xbox360 Gamma space (B) #endif

Put this code right bellow it:

#if (USE_XBOX360GAMMA == 1) FinalColor.r = XenonGammaToLinear(FinalColor.r); FinalColor.g = XenonGammaToLinear(FinalColor.g); FinalColor.b = XenonGammaToLinear(FinalColor.b); #endif #if (USE_SRGBGAMMA == 1) FinalColor.r = SrgbToLinear(FinalColor.r); FinalColor.g = SrgbToLinear(FinalColor.g); FinalColor.b = SrgbToLinear(FinalColor.b); #endif

save file and close it!

5) Start game and enjoy your darkness and atmosphere!

Troubleshooting:

if its toooooooooo dark for you (as side effect menues and text also darkened and sometimes it hard to read) - set in-game brightness as you want, and remember that game means to be dark, but depending on display result can be different.

If game crashes - disable any overlays, except for Steam overlay (it works fine with injectors), such as Xfire, Raptr, MSI, EVGA and other overlays which conflicts with dll proxies.
Also if i made some typo or you did something wrong game may crash on shader compilation.
To find mistake look for LOG.TXT file in game folder and paste log here if you cant understand what does it mean and how to fix it.

Oh yeah, this also works quite well with RE6, RE5 and RE4 which all has same problems with gamma.

Now see the difference:
Default linear gamma;
http://steamcommunity.com/sharedfiles/filedetails/?id=148254202

Xbox 360 correct gamma:
http://steamcommunity.com/sharedfiles/filedetails/?id=148254364

PC sRGB 2.2 correct gamma:
http://steamcommunity.com/sharedfiles/filedetails/?id=148254465
Senast ändrad av v00d00m4n; 27 maj, 2013 @ 6:24
< >
Visar 1-14 av 14 kommentarer
Astro-rjs 26 maj, 2013 @ 10:10 
Interesting, I noticed the 360 version of Resident Evil 6 looked darker than the PC version.

Is there anyway to fix this in driver settings or anything?
In RER the problem is very visible, and I mentioned it before that contrast seems low, especially for a supposedly horror kinda game. The game has a drab look to it because of that as well.
Dunno about RE6 though. It's pitch black during most of leon's campaign. I can only play that game at night, any hint of daylight and I can't see anything. I did enable AO with inspector from the beginning however, maybe it does help.
v00d00m4n 26 maj, 2013 @ 12:07 
At the moment you can use temporary fix (well i use it for most of games that has such problems, including Deus Ex HT and all tomb raiders) use FXAA or SMAA injector or better sweet FX - but with any of it game will crash with Xfire\Raptr, EVGA and MSI and other overlay tools, which dont like d3d9 \ dxgi injectors in game folders, also this hit a little of performance

Make a custom shader in a shader folder, call it for example gamma.h

put this simple display gamma correction code (well, any injectors has similar code with different settings, but they are way to complex for such a simple operation, so i made most simple display gamma correction shader code;

float4 GammaPass(float4 colorInput, float2 tex) { float4 color = colorInput; color = pow (color, DisplayGamma); return color; }

Add this somewhere in the end of settings.h (or name like this) of injector (for example SweetFX_settings.txt )
#define DisplayGamma 2.2 //i suggest to use 1.8 - 2.2 non less, no more)

Look for main.h or post.h (depending on injector it could be different), add GammaPass there,
for this you will need to find section which include code that looks almost like this:

#if (USE_SOMESHADER == 1) #include "SweetFX\Shaders\Someshader.h" #endif

When you will see a lot of lF ENDIFs like this with includ of H file in a middle, put
#include "RelativePathToOurShader\Gamma.h"
before 1st IF or after last ENDIF

Then find something like this
#if (USE_SOMESHADER == 1) FinalColor = SomeShaderPass(FinalColor,tex); #endif
Note the difference, instead of including H files it has SomePasses

Now add gamma pass code 1st or last in such section befor any IF or after any ENDIF (just dont put it in a middle of IF conditition)

FinalColor = GammaPass(FinalColor,tex);
This will do the trick and will make game with proper sRGB 2.2 gamma.

Method works like charm with SweetFX, other injectors may have different functions, so i suggest to stick with SweetFX, also i suggest to disable other post process effects to keep performance good and dont waste it on unncessary PostProcessing, except for sharpening, as it makes textures a little bit better and crips.

Also im not sure if this works, but SweetFX 1.4 includes Xenon gamma correction code which is disabled,. try adding in the end SweetFX_settings.txt
this line
#define Xbox360gamma 1

maybe it will work, but im not sure, have not tested it yet.

Update, just found better and more detailed instruction of adding custom shader to SweetFX, use it with my code from above, here the copy-pasted text:

I was asked in a PM by Nexus user "CassyCade" how one made new shaders for SweetFX.
I thought I'd share my reply with you guys too as there might be someone here that wanted to try their hand at making a shader.

Quote:
The way SweetFX work is the dlls each call their own .fx file which sets up code specific to them , then the main.h file is called which loads each shader if it has been enabled in the settings, and then later in the file calls it if it's been enabled.

I suggest that you start by going into the SweetFX/Shaders/ folder and make a copy of another shader .h file like splitscreen.h and name your copy what you will.
Then go to the main.h file and copy the code that loads splitscreen.h and paste it in again and change the USE_SPLITSCREEN to USE_YOURSHADERNAME and point it to your shader file.
Next find the section that runs the splitscreen pass and change it to run your shader.
Code:

// Splitscreen
#if (USE_CADERSHADER == 1)
FinalColor = CaderShaderPass(FinalColor,tex);
#endif

Then open the SweetFX_settings.txt file and create a new option to enable or disable your shader at the top and create a new section later in the file to set it's settings (you can copy the section for another shader again - just make sure you don't use the same #define constant names.

You now have a copy of the splitscreen shader.

Now edit the new shader so the function name matches the name you called earlier in main.h and remove the body of the shader function and write your own code here.
Code:

/*-----------------------------------------------------------.
/ CaderShader /
'-----------------------------------------------------------*/
/*
Awesome shader by cassycade

- Does this and a little bit of that.
*/

float4 CaderShaderPass( float4 colorInput, float2 tex )
{
//your code here



//return something; //must be a float4

//I usually do :
//colorInput.rgb = my_awesome_output;

//return colorInput;
}

You can write hlsl shaders in whatever editor you like.
I use Notepad2, but Notepad++ is also a good text editor.

I also use GPU ShaderAnalyzer to profile the shaders and get a better insight into how the hlsl code translates into assembler.
I also test using a dx9 demo by Humus to profile the speed of the shader in a real environment rather than just guess based on how many assembler instructions it compiles to.
You can use any dx9, dx10 or dx11 program, but I suggest a simple one that runs at a great frame rate and displays the fps so you can easily tell how much your shader affects performance.

Other useful tools are :
Graphtoy to visualize graphs in a shader language - do note that Graphtoy uses glsl which is very similar but not identical to hlsl.
And WolframAlpha to help you reduce or plot (both reduce and plot are wolframalpha keywords .. try them) your algoritms and to doublecheck your math. Simply entering in your formula (in a syntax that wolframalpha understands) can yield you hints on how you can rephrase your algorithm, which may or may not get it to run faster - remember to benchmark your code changes .. never assume that it runs better/faster - check.

The log.log file and GPU ShaderAnalyzer will both give you hints when something goes wrong and it won't compile right.
I often forget an ; or forget to close a ( with a )

The official list of HLSL intrinsic functions is also an important reference. Remember than for the most part you can ignore intrinsics for shader model 4 and 5 since DX 9 only supports up to shader model 3.

Also if you find yourself needing the tex2D function (very likely) then I've written a alias function called myTex2D that calls the correct function for dx9 when using that and call the correct function for dx10/11 when using that.
I suggest you use it.
Senast ändrad av v00d00m4n; 26 maj, 2013 @ 12:11
Astro-rjs 26 maj, 2013 @ 12:27 
#define Xbox360gamma 1

Tried that and it made the game way too bright.

v00d00m4n 26 maj, 2013 @ 18:55 
yeah i already tested, it actually inverted final gamma value, and i found the way to fix it already, getting really good looking gamma which looks like console version to my eyes (not 2.2 however, seems like something near 1.8-2.0 with better tweaks for some specific color values, which is even better, i know for sure that this code came from ex Naughty Dog programmer from article "Xbox vs PS3 gamma"):

1Same thing 1st in SweetFX_settings.txt add as last line
#define Xbox360gamma 1

Next edit SweetFX\Shaders\Main.h

Search for this

#if (Xbox360gamma == 1) FinalColor.r = LinearToXenonGamma(FinalColor.r); // Linear to Xbox360 Gamma space (R) FinalColor.g = LinearToXenonGamma(FinalColor.g); // Linear to Xbox360 Gamma space (G) FinalColor.b = LinearToXenonGamma(FinalColor.b); // Linear to Xbox360 Gamma space (B) #endif

Now replace 3 instances of LinearToXenonGamma with XenonGammaToLinear, to make code look like this:

#if (Xbox360gamma == 1) FinalColor.r = XenonGammaToLinear(FinalColor.r); // Linear to Xbox360 Gamma space (R) FinalColor.g = XenonGammaToLinear(FinalColor.g); // Linear to Xbox360 Gamma space (G) FinalColor.b = XenonGammaToLinear(FinalColor.b); // Linear to Xbox360 Gamma space (B) #endif

Save and enjoy!

Now it works like sharm, with this you dont need my custom gamma shader, only need to mod SweetFX 1.4 like i described.

But it would be good idea to improve this by using extra 2 functions (just add them after xenon to linear and linear to xenons functions);

float LinearToSrgb(float val) { float ret; if (val <= 0.0) ret = 0.0f; else if (val <= 0.0031308f) ret = 12.92f*val; else if (val <= 1.0f) ret = (pow(val, 0.41666)*1.055f)-0.055f; else ret = 1.0f; return ret; } float SrgbToLinear(float val) { float ret; if (val <= 0.0f) ret = 0; else if (val <= 0.04045f) ret = val / 12.92f; else if (val <= 1.0f) ret = pow((val + 0.055f)/1.055f,2.4f); else ret = 1.0f; return ret; }

and by using these 3 lines instead of previously described, this will be more like 2.2 sRGB gamma and will give game darker scarier look:

FinalColor.r = SrgbToLinear(FinalColor.r); FinalColor.g = SrgbToLinear(FinalColor.g); FinalColor.b = SrgbToLinear(FinalColor.b);


Also you can use alternate functions

just copy this function:

#if (Xbox360gamma == 1) FinalColor.r = XenonGammaToLinear(FinalColor.r); // Xbox360 to Linear Gamma space (R) FinalColor.g = XenonGammaToLinear(FinalColor.g); // Xbox360 to LinearGamma space (G) FinalColor.b = XenonGammaToLinear(FinalColor.b); // Xbox360 to LinearGamma space (B) #endif

and paste copy right after it, also rename Xbox360gamma to sRGBgamma in this copy:

#if (sRGBgamma == 1) FinalColor.r = SrgbToLinear(FinalColor.r); // Linear to Xbox360 Gamma space (R) FinalColor.g = SrgbToLinear(FinalColor.g); // Linear to Xbox360 Gamma space (G) FinalColor.b = SrgbToLinear(FinalColor.b); // Linear to Xbox360 Gamma space (B) #endif

now add last line to SweetFX_settings:
#define sRGBgamma 1
and font fogret to change
#define Xbox360gamma 1
to
#define Xbox360gamma 0

otherwise 2 passed of gamma corrections will be used and they will double the darkness above desired value.

Now you can switch betwee xbox gamma (a little brigther, like 1.9 - 2.0 - good for balance balance) and sRGB pc gamma (darker, like 2.2 - good for atmosphere and more chellenge).
Oh yeah, since sRGB is darker it would be good idea to set in-game brightness to maximum, while with xbox360 gamme its good to play with minimal or middle brightness.
BONKERS 27 maj, 2013 @ 0:41 
Sticky this damn thread!

Will come in great handy when I buy the game later this year.
v00d00m4n 27 maj, 2013 @ 5:02 
Made few comparision screenshots (before watching them, set your display gamma to linear default 1.0 or screens will be darker than they really are):


Default linear gamma;
http://steamcommunity.com/sharedfiles/filedetails/?id=148254202

Xbox 360 correct gamma:
http://steamcommunity.com/sharedfiles/filedetails/?id=148254364

PC sRGB 2.2 correct gamma:
http://steamcommunity.com/sharedfiles/filedetails/?id=148254465

You can also see texture sharpening and extra SMAA above in-game FXAA, which makes game gfx a little less blury and a little more detailed.
BONKERS 27 maj, 2013 @ 15:56 
Any chance you could upload your SweetFX settings/shader in a .rar that people can just drag an drop to use in the game. (Because you had to add a gamma shader or something didn't you?)
MaverickHL 27 maj, 2013 @ 16:18 
Added the gamma settings with Omnipotus' SweetFX settings and it look fabulous.

http://gsngaming.com/topic/9710-resident-evil-revelations-sweetfx-v14/

I took the vibrant version and applied the settings on this thread.
Senast ändrad av MaverickHL; 27 maj, 2013 @ 16:19
Astro-rjs 27 maj, 2013 @ 18:06 
There should be an option in video settings for PC monitor gamma or TV gamma.
Astro-rjs 27 maj, 2013 @ 19:00 
Ursprungligen skrivet av Voodooman:
Same thing 1st in SweetFX_settings.txt add as last line
#define Xbox360gamma 1

Next edit SweetFX\Shaders\Main.h

This will fix other games with wrong gamma?

Like RE6 PC?
v00d00m4n 28 maj, 2013 @ 2:43 
look at 1st post of thread, i updated it with more detaild and better method.
It will fix every 32 bit (64 bit version of DLL in alpha stage, you can find it in SweetFX official tread) dx9\10\11 game gamma. But you should be careful with anti-cheat protected games such as Resident Evil 6 - as VAC or PunkBuster have tendency to detect injectors and proxy dlls like this as cheats, this does not happen every time, but there is still some a risk of anti-cheat ban (it means you would not be able to connect to any protected game session).

RE revelations however not protected by anticheat, so its safe to use. But as anticheat was recently added to RE6 it may be added to RER as well, so before you start game after next update read update log and if you will see that anticheat was added better not risk with proxy dlls\injectors.
Senast ändrad av v00d00m4n; 28 maj, 2013 @ 2:44
MaverickHL 28 maj, 2013 @ 9:52 
According to this topic SweetFX is ok with VAC:

http://forums.steampowered.com/forums/showthread.php?t=3115136

Also @ Voodooman do you know if your gamma fix is a generic fix or does this apply to any game if we use SweetFX outside of the RE series?
Senast ändrad av MaverickHL; 28 maj, 2013 @ 9:54
Contact Mike 28 maj, 2013 @ 10:34 
This just goes to show you should always wait a few months before playing a port. What would we do without smart people willing to patch up our games after the fact?
< >
Visar 1-14 av 14 kommentarer
Per sida: 1530 50

Datum skrivet: 26 maj, 2013 @ 10:03
Inlägg: 14