Improved memory consumption and performance. Added default parameters.

This commit is contained in:
Jonathas Costa
2019-02-25 10:02:25 -05:00
parent 72ca49e43d
commit 0502197336
6 changed files with 34 additions and 25 deletions
+7 -2
View File
@@ -104,8 +104,13 @@ asset.onInitialize(function ()
openspace.globebrowsing.goToGeo(58.5877, 16.1924, 20000000)
-- HDR / Image options:
openspace.setPropertyValueSingle('RenderEngine.Gamma', 1.8);
openspace.setPropertyValueSingle('RenderEngine.Gamma', 0.47);
openspace.setPropertyValueSingle('RenderEngine.HDRExposure', 0.47);
openspace.setPropertyValueSingle('RenderEngine.Background Exposure', 7.85);
openspace.setPropertyValueSingle('RenderEngine.ToneMapOperator', 8);
openspace.setPropertyValueSingle('RenderEngine.Lightness', 0.995);
openspace.setPropertyValueSingle('RenderEngine.BloomNewColorFactor', 9.0);
--openspace.setPropertyValueSingle('RenderEngine.', );
end)
@@ -211,7 +211,7 @@ private:
float _bloomThresholdMax = 1.0;
float _bloomOrigFactor = 1.0;
float _bloomNewFactor = 1.0;
int _toneMapOperator = 0;
int _toneMapOperator = 8; // JCC TODO: temporarilly set to 8 because setProperty seems not to be working for OptionProperty
bool _histogramEnabled = false;
int _numberOfBins = 1024; // JCC TODO: Add a parameter control for this.
float _tmoKey = 0.18f;
+12 -12
View File
@@ -68,18 +68,18 @@ public:
// defines in hdr.glsl file.
enum class ToneMapOperators {
EXPONENTIAL = 0,
LINEAR,
SIMPLE_REINHARD,
LUM_BASED_REINHARD,
WHITE_PRESERVING,
ROM_BIN_DA_HOUSE,
FILMIC,
UNCHARTED,
COSTA,
ADAPTIVE,
GLOBAL,
PHOTOGRAPHIC_REINHARD,
MIPMAPPING
LINEAR, //1
SIMPLE_REINHARD, //2
LUM_BASED_REINHARD, //3
WHITE_PRESERVING, //4
ROM_BIN_DA_HOUSE, //5
FILMIC, //6
UNCHARTED, //7
COSTA, //8
ADAPTIVE, //8
GLOBAL, //9
PHOTOGRAPHIC_REINHARD, //10
MIPMAPPING //11
};
enum class COLORSPACE {
@@ -422,6 +422,7 @@ vec3 inscatterRadiance(inout vec3 x, inout float t, inout float irradianceFactor
// we can change it on the fly with no precomputations)
// return radiance * sunRadiance;
vec3 finalScatteringRadiance = radiance * sunIntensity;
if (groundHit) {
return finalScatteringRadiance;
} else {
@@ -542,6 +543,7 @@ void main() {
if (cullAtmosphere == 0) {
vec4 atmosphereFinalColor = vec4(0.0f);
vec4 backgroundFinalColor = vec4(0.0f);
int nSamples = 1;
// First we determine if the pixel is complex (different fragments on it)
@@ -691,14 +693,18 @@ void main() {
}
else { // no intersection
//atmosphereFinalColor += vec4(HDR(color.xyz * backgroundConstant, atmExposure), color.a);
atmosphereFinalColor += vec4(color.xyz * backgroundConstant, color.a);
//atmosphereFinalColor += vec4(color.xyz * backgroundConstant, color.a);
//backgroundFinalColor += color;
discard;
}
}
renderTarget = atmosphereFinalColor / float(nSamples);
renderTarget = atmosphereFinalColor / float(nSamples);
// if (complex)
// renderTarget = vec4(1.0, 0.0, 0.0, 1.0);
// renderTarget = vec4(
// (atmosphereFinalColor.xyz + (backgroundFinalColor.xyz * backgroundConstant)) / float(nSamples),
// (atmosphereFinalColor.a + backgroundFinalColor.a) / float(nSamples)
// );
}
else { // culling
if (firstPaint) {
@@ -714,8 +720,6 @@ void main() {
else {
discard;
}
//renderTarget = vec4(1.0, 0.0, 0.0, 1.0);
}
}
+1 -1
View File
@@ -119,7 +119,7 @@ void main() {
}
if (colorSpace == HSL_COLOR) {
vec3 hslColor = rgb2hsl(tColor);
vec3 hslColor = rgb2hsl(tColor);
hslColor.x *= Hue;
hslColor.y *= Saturation;
hslColor.z *= Lightness;
+3 -3
View File
@@ -855,7 +855,7 @@ void FramebufferRenderer::updateResolution() {
glTexImage2DMultisample(
GL_TEXTURE_2D_MULTISAMPLE,
_nAaSamples,
GL_RGBA32F,
GL_RGBA16F,
_resolution.x,
_resolution.y,
true
@@ -866,7 +866,7 @@ void FramebufferRenderer::updateResolution() {
glTexImage2DMultisample(
GL_TEXTURE_2D_MULTISAMPLE,
_nAaSamples,
GL_RGBA32F,
GL_RGBA16F,
_resolution.x,
_resolution.y,
true
@@ -878,7 +878,7 @@ void FramebufferRenderer::updateResolution() {
glTexImage2D(
GL_TEXTURE_2D,
0,
GL_RGBA32F,
GL_RGBA16F,
_resolution.x,
_resolution.y,
0,