Skip to content

Commit

Permalink
feat(cloud-picture): fix glsl: add inv gamma correction for specific …
Browse files Browse the repository at this point in the history
…color defined in shader
  • Loading branch information
yyc-git committed Sep 27, 2020
1 parent 5561a6f commit 17ed877
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ HitShadingData getHitShadingData(uint instanceIndex, uint primitiveIndex) {
texture(sampler2DArray(textureArray, textureSampler),
vec3(uv * mat.diffuseMapScale, diffuseMapLayerIndex))
.rgb +
vec3(mat.diffuse);
invGammaCorrectionForSpecificColorDefinedInShader(vec3(mat.diffuse));
} else {
data.materialDiffuse = vec3(mat.diffuse);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@

#include "raycommon.glsl"

#include "utils.glsl"

layout(location = 0) rayPayloadInEXT hitPayload prd;

void main() {
prd.throughput = vec3(0);
prd.radiance = vec3(0.15);
prd.radiance = invGammaCorrectionForSpecificColorDefinedInShader(vec3(0.15));
prd.t = -1.0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@ vec2 gammaCorrection(vec2 colorInLinearSpace) {

vec3 gammaCorrection(vec3 colorInLinearSpace) {
return pow(colorInLinearSpace, vec3(1.0 / 2.2));
}
}

vec3 invGammaCorrectionForSpecificColorDefinedInShader(
vec3 specificColorDefinedInShader) {
return pow(specificColorDefinedInShader, vec3(2.2));
}

0 comments on commit 17ed877

Please sign in to comment.