@@ -72,9 +72,7 @@ fn fsMain(in: VertexOutput) -> @location(0) vec4f {
7272
7373 let tonemapFn = postProcessingParams.tonemapFn;
7474 let rgb = expose(tonemapFn, exposure * estimator);
75-
76- let srgb = pow(rgb, vec3(1f / 2.2f));
77- return vec4f(srgb, 1f);
75+ return vec4f(rgb, 1f);
7876}
7977
8078const EPSILON = 0.00001f;
@@ -551,8 +549,8 @@ const INT_SCALE = 256f;
551549
552550@must_use
553551fn offsetRay(p: vec3f, n: vec3f) -> vec3f {
554- // Source: A Fast and Robust Method fo )"
555- R"( r Avoiding Self-Intersection, Ray Tracing Gems
552+ // Source: A Fast and Robust Method for Avoiding Self-Intersection, Ray Tracing Ge )"
553+ R"( ms
556554 let offset = vec3i(i32(INT_SCALE * n.x), i32(INT_SCALE * n.y), i32(INT_SCALE * n.z));
557555 // Offset added straight into the mantissa bits to ensure the offset is scale-invariant,
558556 // except for when close to the origin, where we use FLOAT_SCALE as a small epsilon.
@@ -693,7 +691,9 @@ fn vsMain(in: VertexInput) -> VertexOutput {
693691
694692@fragment
695693fn fsMain(in: VertexOutput) -> @location(0) vec4f {
696- return textureSample(texture, textureSampler, in.texCoord);
694+ let c = textureSample(texture, textureSampler, in.texCoord);
695+ let srgb = pow(c.xyz, vec3(1f / 2.2f));
696+ return vec4f(srgb, 1f);
697697}
698698)" ;
699699
@@ -730,10 +730,8 @@ struct GbufferOutput {
730730
731731@fragment
732732fn fsMain(in: VertexOutput) -> GbufferOutput {
733- var out: GbufferOutput;
734- out.albedo = textureSample(texture, textureSampler, in.texCoord);
735- out.normal = vec4(normalize(in.normal.xyz), 1.0);
736- return out;
733+ var c = pow(textureSample(texture, textureSampler, in.texCoord).xyz, vec3(2.2f));
734+ return GbufferOutput(vec4(c, 1f), vec4(normalize(in.normal.xyz), 1f));
737735}
738736)" ;
739737
@@ -773,7 +771,7 @@ fn fsMain(in: VertexOutput) -> @location(0) vec4f {
773771 } else {
774772 let d = vec3(1.0) - textureLoad(gbufferDepth, idx, 0);
775773 let x = d;
776- let a = 0.05 ;
774+ let a = 0.1 ;
777775 return vec4((1.0 + a) * x / (x + vec3(a)), 1.0);
778776 }
779777}
0 commit comments