-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into gsterbrant_degamma_specular_fix
- Loading branch information
Showing
16 changed files
with
101 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,17 @@ | ||
export default /* glsl */` | ||
vec4 texture2DSRGB(sampler2D tex, vec2 uv) { | ||
return texture2D(tex, uv); | ||
} | ||
vec4 texture2DSRGB(sampler2D tex, vec2 uv, float bias) { | ||
return texture2D(tex, uv, bias); | ||
} | ||
vec4 textureCubeSRGB(samplerCube tex, vec3 uvw) { | ||
return textureCube(tex, uvw); | ||
} | ||
vec3 gammaCorrectOutput(vec3 color) { | ||
float gammaCorrectInput(float color) { | ||
return color; | ||
} | ||
vec3 gammaCorrectInput(vec3 color) { | ||
return color; | ||
} | ||
float gammaCorrectInput(float color) { | ||
vec4 gammaCorrectInput(vec4 color) { | ||
return color; | ||
} | ||
vec4 gammaCorrectInput(vec4 color) { | ||
vec3 gammaCorrectOutput(vec3 color) { | ||
return color; | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,21 @@ | ||
export default /* glsl */` | ||
vec3 gammaCorrectInput(vec3 color) { | ||
return pow(color, vec3(2.2)); | ||
} | ||
float gammaCorrectInput(float color) { | ||
return pow(color, 2.2); | ||
} | ||
vec4 gammaCorrectInput(vec4 color) { | ||
return vec4(pow(color.rgb, vec3(2.2)), color.a); | ||
} | ||
vec4 texture2DSRGB(sampler2D tex, vec2 uv) { | ||
vec4 rgba = texture2D(tex, uv); | ||
rgba.rgb = gammaCorrectInput(rgba.rgb); | ||
return rgba; | ||
return decodeGamma(color); | ||
} | ||
vec4 texture2DSRGB(sampler2D tex, vec2 uv, float bias) { | ||
vec4 rgba = texture2D(tex, uv, bias); | ||
rgba.rgb = gammaCorrectInput(rgba.rgb); | ||
return rgba; | ||
vec3 gammaCorrectInput(vec3 color) { | ||
return decodeGamma(color); | ||
} | ||
vec4 textureCubeSRGB(samplerCube tex, vec3 uvw) { | ||
vec4 rgba = textureCube(tex, uvw); | ||
rgba.rgb = gammaCorrectInput(rgba.rgb); | ||
return rgba; | ||
vec4 gammaCorrectInput(vec4 color) { | ||
return vec4(decodeGamma(color.xyz), color.w); | ||
} | ||
vec3 gammaCorrectOutput(vec3 color) { | ||
#ifdef HDR | ||
#ifdef HDR | ||
return color; | ||
#else | ||
color += vec3(0.0000001); | ||
return pow(color, vec3(0.45)); | ||
#endif | ||
#else | ||
return pow(color + 0.0000001, vec3(1.0 / 2.2)); | ||
#endif | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
export default /* glsl */` | ||
void addLightMap() { | ||
if (dot(dLightmapDir, vec3(1.0)) < 0.00001) { | ||
if (dot(dLightmapDir, dLightmapDir) < 0.0001) { | ||
dDiffuseLight += dLightmap; | ||
} else { | ||
dLightDirNormW = normalize(dLightmapDir * 2.0 - vec3(1.0)); | ||
dLightDirNormW = dLightmapDir; | ||
float vlight = saturate(dot(dLightDirNormW, -dVertexNormalW)); | ||
float flight = saturate(dot(dLightDirNormW, -dNormalW)); | ||
float nlight = (flight / max(vlight, 0.01)) * 0.5; | ||
dDiffuseLight += dLightmap * nlight * 2.0; | ||
dSpecularLight += dLightmap * getLightSpecular(normalize(-dLightmapDir + dViewDirW)); | ||
} | ||
dSpecularLight += dLightmap * getLightSpecular(); | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
export default /* glsl */` | ||
vec4 texture2DSRGB(sampler2D tex, vec2 uv) { | ||
return gammaCorrectInput(texture2D(tex, uv)); | ||
} | ||
vec4 texture2DSRGB(sampler2D tex, vec2 uv, float bias) { | ||
return gammaCorrectInput(texture2D(tex, uv, bias)); | ||
} | ||
vec3 texture2DRGBM(sampler2D tex, vec2 uv) { | ||
return decodeRGBM(texture2D(tex, uv)); | ||
} | ||
vec3 texture2DRGBM(sampler2D tex, vec2 uv, float bias) { | ||
return decodeRGBM(texture2D(tex, uv, bias)); | ||
} | ||
vec3 texture2DRGBE(sampler2D tex, vec2 uv) { | ||
return decodeRGBM(texture2D(tex, uv)); | ||
} | ||
vec3 texture2DRGBE(sampler2D tex, vec2 uv, float bias) { | ||
return decodeRGBM(texture2D(tex, uv, bias)); | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters