Skip to content

Commit

Permalink
cCamera: Added exposure compensation range
Browse files Browse the repository at this point in the history
  • Loading branch information
papadanku committed Jul 10, 2024
1 parent 8a3c7e0 commit 587289e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions shaders/shared/cCamera.fxh
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,25 @@
ui_label = "Exposure Compensation";
ui_type = "slider";
ui_step = 0.001;
ui_min = -3.0;
ui_max = 3.0;
ui_min = -4.0;
ui_max = 4.0;
> = 0.0;

uniform float _CShadeExposureRange <
ui_category = "Output: AutoExposure";
ui_label = "Exposure Compensation Range";
ui_type = "slider";
ui_step = 0.001;
ui_min = 0.0;
ui_max = 4.0;
> = 1.0;

float3 ApplyAutoExposure(float3 Color, float Luma)
{
float LumaAverage = exp(Luma);
float Ev100 = log2(LumaAverage * 100.0 / 12.5);
Ev100 -= _CShadeExposureBias; // optional manual bias
Ev100 = clamp(Ev100, -_CShadeExposureRange, _CShadeExposureRange);
float Exposure = 1.0 / (1.2 * exp2(Ev100));
return Color * Exposure;
}
Expand Down

0 comments on commit 587289e

Please sign in to comment.