mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 07:12:02 +00:00
Make sure tonemap shader never takes the sqrt of a negative number
Fix bug where the old hardcoded exposure bias was still being used in the uncharted2 tonemap
This commit is contained in:
parent
a8d1197ea7
commit
0e2d9affb2
1 changed files with 3 additions and 2 deletions
|
@ -7,12 +7,14 @@ uniform float ExposureAdjustment;
|
|||
|
||||
vec3 Linear(vec3 c)
|
||||
{
|
||||
//c = max(c, vec3(0.0));
|
||||
//return pow(c, 2.2);
|
||||
return c * c; // cheaper, but assuming gamma of 2.0 instead of 2.2
|
||||
}
|
||||
|
||||
vec3 sRGB(vec3 c)
|
||||
{
|
||||
c = max(c, vec3(0.0));
|
||||
//return pow(c, vec3(1.0 / 2.2));
|
||||
return sqrt(c); // cheaper, but assuming gamma of 2.0 instead of 2.2
|
||||
}
|
||||
|
@ -56,8 +58,7 @@ vec3 Uncharted2Tonemap(vec3 x)
|
|||
vec3 Tonemap(vec3 color)
|
||||
{
|
||||
float W = 11.2;
|
||||
float ExposureBias = 2.0;
|
||||
vec3 curr = Uncharted2Tonemap(ExposureBias * color);
|
||||
vec3 curr = Uncharted2Tonemap(color);
|
||||
vec3 whiteScale = vec3(1) / Uncharted2Tonemap(vec3(W));
|
||||
return sRGB(curr * whiteScale);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue