Changed rendering order back for orbits and other improvements.

This commit is contained in:
Jonathas Costa
2019-08-01 12:20:36 -04:00
parent 482631aa54
commit 3a0b5f0c15
6 changed files with 22 additions and 21 deletions

View File

@@ -535,7 +535,7 @@ vec3 sunColor(const vec3 x, const float t, const vec3 v, const vec3 s, const flo
float sunFinalColor = smoothstep(cos(M_PI / 500.0f), cos(M_PI / 900.0f), dot(v, s)) *
sunRadiance * (1.0f - irradianceFactor);
return transmittance * sunFinalColor;
return transmittance * sunFinalColor;
}
void main() {
@@ -559,14 +559,8 @@ void main() {
}
nSamples = complex ? nAaSamples / 2 : 1;
// Performance variables:
//float Rt2 = Rt * Rt; // in Km
//float Rg2 = Rg * Rg; // in Km
for (int i = 0; i < nSamples; i++) {
// Color from G-Buffer
//vec4 color = texelFetch(mainColorTexture, fragCoords, i);
//vec4 color = vec4(-log2(vec3(1.0) - colorArray[i].rgb), colorArray[i].a);
vec4 color = colorArray[i];
// Ray in object space
dRay ray;
@@ -701,7 +695,6 @@ void main() {
bColor += texelFetch(mainColorTexture, fragCoords, f);
}
bColor /= float(nAaSamples);
//renderTarget = vec4(-log2(vec3(1.0) - bColor.rgb), bColor.a);
renderTarget = bColor;
}
}

View File

@@ -179,7 +179,7 @@ RenderableTrail::RenderableTrail(const ghoul::Dictionary& dictionary)
)
{
setRenderBin(RenderBin::Overlay);
setRenderBin(RenderBin::Transparent);
addProperty(_opacity);
//registerUpdateRenderBinFromOpacity();

View File

@@ -192,7 +192,7 @@ RenderableTrailOrbit::RenderableTrailOrbit(const ghoul::Dictionary& dictionary)
}
}
else {
setRenderBin(Renderable::RenderBin::Overlay);
setRenderBin(Renderable::RenderBin::Transparent);
}
}

View File

@@ -60,9 +60,11 @@ Fragment getFragment() {
}
frag.color.a = transparencyCorrection;
}
}
if (frag.color.a < 0.2f)
discard;
// G-Buffer
// JCC: The depthCorrection here is a temporary tweak
// to fix precision problems.

View File

@@ -84,16 +84,16 @@ void main() {
if (colorSpace == HSL_COLOR) {
vec3 hslColor = rgb2hsl(tColor);
hslColor.x *= Hue;
hslColor.y *= Saturation;
hslColor.z *= Lightness;
hslColor.x = (hslColor.x * Hue) > 360.f ? 360.f : (hslColor.x * Hue);
hslColor.y = (hslColor.y * Saturation) > 1.f ? 1.f : (hslColor.y * Saturation);
hslColor.z = (hslColor.z * Lightness) > 1.f ? 1.f : (hslColor.z * Lightness);
finalColor = vec4(gammaCorrection(hsl2rgb(hslColor), gamma), color.a);
} else if (colorSpace == HSV_COLOR) {
vec3 hsvColor = rgb2hsv(tColor);
hsvColor.x *= Hue;
hsvColor.y *= Saturation;
hsvColor.z *= Value;
hsvColor.x = (hsvColor.x * Hue) > 360.f ? 360.f : (hsvColor.x * Hue);
hsvColor.y = (hsvColor.y * Saturation) > 1.f ? 1.f : (hsvColor.y * Saturation);
hsvColor.z = (hsvColor.z * Value) > 1.f ? 1.f : (hsvColor.z * Value);
finalColor = vec4(gammaCorrection(hsv2rgb(hsvColor), gamma), color.a);
}

View File

@@ -26,7 +26,8 @@
#include <#{fragmentPath}>
#define exposure #{rendererData.hdrExposure}
#define deltaError 0.013
#define DeltaError 0.013f
#define MaxValueColorBuffer 1E10
layout(location = 0) out vec4 _out_color_;
layout(location = 1) out vec4 gPosition;
@@ -34,8 +35,13 @@ layout(location = 2) out vec4 gNormal;
layout(location = 3) out vec4 filterBuffer;
void main() {
Fragment f = getFragment();
_out_color_ = vec4((log2(vec3(1.0) - (f.color.rgb - vec3(deltaError)))/(-exposure)), f.color.a);
Fragment f = getFragment();
_out_color_ = vec4((log2(vec3(1.0) - (f.color.rgb - vec3(DeltaError)))/(-exposure)), f.color.a);
_out_color_.x = isnan(_out_color_.x) ? MaxValueColorBuffer : _out_color_.x;
_out_color_.y = isnan(_out_color_.y) ? MaxValueColorBuffer : _out_color_.y;
_out_color_.z = isnan(_out_color_.z) ? MaxValueColorBuffer : _out_color_.z;
gPosition = f.gPosition;
gNormal = f.gNormal;