mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-22 11:18:22 -05:00
Added new tone mapping operator and enblead back the background color control.
This commit is contained in:
@@ -75,7 +75,8 @@ public:
|
||||
UNCHARTED,
|
||||
COSTA,
|
||||
ADAPTIVE,
|
||||
GLOBAL
|
||||
GLOBAL,
|
||||
PHOTOGRAPHIC_REINHARD
|
||||
};
|
||||
|
||||
RenderEngine();
|
||||
|
||||
@@ -708,8 +708,8 @@ void main() {
|
||||
}
|
||||
bColor /= float(nAaSamples);
|
||||
//renderTarget = vec4(HDR(bColor.xyz * backgroundConstant, atmExposure), bColor.a);
|
||||
//renderTarget = vec4(bColor.xyz * backgroundConstant, bColor.a);
|
||||
renderTarget = vec4(bColor.xyz , bColor.a);
|
||||
renderTarget = vec4(bColor.xyz * backgroundConstant, bColor.a);
|
||||
//renderTarget = vec4(bColor.xyz , bColor.a);
|
||||
}
|
||||
else {
|
||||
discard;
|
||||
|
||||
@@ -116,5 +116,8 @@ void main() {
|
||||
} else if (toneMapOperator == GLOBAL) {
|
||||
vec3 tColor = globalToneMappingOperatorRTR(color.rgb, backgroundExposure, maxWhite, aveLum);
|
||||
finalColor = vec4(gammaCorrection(tColor, gamma), color.a);
|
||||
} else if (toneMapOperator == PHOTOGRAPHIC_REINHARD) {
|
||||
vec3 tColor = photographicReinhardToneMapping(color.rgb, backgroundExposure);
|
||||
finalColor = vec4(gammaCorrection(tColor, gamma), color.a);
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,7 @@
|
||||
#define COSTA 8
|
||||
#define ADAPTIVE 9
|
||||
#define GLOBAL 10
|
||||
#define PHOTOGRAPHIC_REINHARD 11
|
||||
|
||||
const mat3 rgb2xyz = mat3(
|
||||
0.4124564, 0.2126729, 0.0193339,
|
||||
@@ -94,6 +95,10 @@ vec3 lumaBasedReinhardToneMapping(vec3 color, float exposure) {
|
||||
return color;
|
||||
}
|
||||
|
||||
vec3 photographicReinhardToneMapping(vec3 color, float exposure) {
|
||||
return color / (color + vec3(1.0));
|
||||
}
|
||||
|
||||
vec3 whitePreservingLumaBasedReinhardToneMapping(vec3 color, float exposure, float maxWhite) {
|
||||
//float luma = dot(color, vec3(0.2126f, 0.7152f, 0.0722f));
|
||||
float luma = dot(color, vec3(0.4126f, 0.9152f, 0.2722f));
|
||||
|
||||
@@ -323,6 +323,7 @@ RenderEngine::RenderEngine()
|
||||
_toneMapOperator.addOption(static_cast<int>(ToneMapOperators::COSTA), "Costa");
|
||||
_toneMapOperator.addOption(static_cast<int>(ToneMapOperators::ADAPTIVE), "Adaptive");
|
||||
_toneMapOperator.addOption(static_cast<int>(ToneMapOperators::GLOBAL), "Global");
|
||||
_toneMapOperator.addOption(static_cast<int>(ToneMapOperators::PHOTOGRAPHIC_REINHARD), "Photographic Reinhard");
|
||||
_toneMapOperator.set(8);
|
||||
|
||||
_toneMapOperator.onChange([this]() {
|
||||
|
||||
Reference in New Issue
Block a user