mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 15:43:50 +02:00
Add sRGB conversions to shaders.
This commit is contained in:
parent
a2142646bb
commit
d6ee569963
1 changed files with 7 additions and 2 deletions
|
@ -11,9 +11,14 @@
|
|||
<@if not GPU_COLOR_SLH@>
|
||||
<@def GPU_COLOR_SLH@>
|
||||
|
||||
float sRGBFloatToLinear(float value) {
|
||||
const float SRGB_ELBOW = 0.04045;
|
||||
|
||||
return (value <= SRGB_ELBOW) ? value / 12.92 : pow((value + 0.055) / 1.055, 2.4);
|
||||
}
|
||||
|
||||
vec3 colorToLinearRGB(vec3 srgb) {
|
||||
const float GAMMA_22 = 2.2;
|
||||
return pow(srgb, vec3(GAMMA_22));
|
||||
return vec3(sRGBFloatToLinear(srgb.r), sRGBFloatToLinear(srgb.g), sRGBFloatToLinear(srgb.b));
|
||||
}
|
||||
|
||||
vec4 colorToLinearRGBA(vec4 srgba) {
|
||||
|
|
Loading…
Reference in a new issue