Skip to content

Commit

Permalink
feat(tonemap): add aces fitted sdr
Browse files Browse the repository at this point in the history
  • Loading branch information
clshortfuse committed Aug 12, 2024
1 parent e148255 commit e2635b2
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/shaders/tonemap.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ float SmoothClamp(float x) {
return (abs(1.0 - x) < u) ? q : saturate(x);
}

float3 Reinhard(float x) {
return x / (1.0f + x);
}

float3 Reinhard(float3 color) {
return color / (1.0f + color);
}
Expand All @@ -34,6 +38,17 @@ float3 ReinhardExtended(float3 color, float max_white = 1000.f / 203.f) {
/ (1.0f + color);
}

// Narkowicz
float3 ACESFittedSDR(float3 color) {
color *= 0.6f;
const float a = 2.51f;
const float b = 0.03f;
const float c = 2.43f;
const float d = 0.59f;
const float e = 0.14f;
return clamp((color * (a * color + b)) / (color * (c * color + d) + e), 0.0f, 1.0f);
}

// https://www.slideshare.net/ozlael/hable-john-uncharted2-hdr-lighting
// http://filmicworlds.com/blog/filmic-tonemapping-operators/

Expand Down

0 comments on commit e2635b2

Please sign in to comment.