summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2019-06-19 13:01:06 -0700
committerGraham Linden <graham@lindenlab.com>2019-06-19 13:01:06 -0700
commitc1d1d7968325403a8033fa79567f07345c49b0a8 (patch)
treeb9a6b2998ea741724d3c58dbc498dad8848de9f1 /indra
parent7f24395889832c9ce51bae69054c7d081d77f65a (diff)
Sky fixes.
Make class1 sky use pre-projection pos to get proper distances for attenuation. Make all sky shaders use the dist_mul again. Revert to using old sky tessellation logic (may regress bugs addressed by new tess code).
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/skyF.glsl1
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/skyV.glsl11
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/skyF.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/skyV.glsl2
-rw-r--r--indra/newview/llvowlsky.cpp23
5 files changed, 29 insertions, 11 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
index 7d4d9eb49f..65e4fdf17f 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
@@ -41,6 +41,7 @@ uniform vec4 gamma;
/// Soft clips the light with a gamma correction
vec3 scaleSoftClip(vec3 light);
+vec3 srgb_to_linear(vec3 c);
void main()
{
diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl
index 45e79f36ea..b30651351d 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl
@@ -66,7 +66,7 @@ void main()
gl_Position = pos;
// Get relative position
- vec3 P = pos.xyz - camPosLocal.xyz + vec3(0,50,0);
+ vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0);
// Set altitude
if (P.y > 0.)
@@ -81,7 +81,7 @@ void main()
// Can normalize then
vec3 Pn = normalize(P);
- float Plen = length(P);
+ float Plen = length(P);
// Initialize temp variables
vec4 temp1 = vec4(0.);
@@ -114,9 +114,7 @@ void main()
// Transparency (-> temp1)
// ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati
// compiler gets confused.
- //temp1 = exp(-temp1 * temp2.z * dist_mul);
- temp1 = exp(-temp1 * dist_mul);
-
+ temp1 = exp(-temp1 * temp2.z * dist_mul);
// Compute haze glow
temp2.x = dot(Pn, lightnorm.xyz);
@@ -132,12 +130,13 @@ void main()
// Add "minimum anti-solar illumination"
temp2.x += .25;
- temp2.x *= sun_moon_glow_factor;
+ //temp2.x *= sun_moon_glow_factor;
vec4 color = ( blue_horizon * blue_weight * (sunlight + ambient_color)
+ (haze_horizon * haze_weight) * (sunlight * temp2.x + ambient_color)
);
+
// Final atmosphere additive
color *= (1. - temp1);
diff --git a/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl
index 889a989985..3bdcf28363 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl
@@ -141,8 +141,7 @@ void main()
// Transparency (-> temp1)
// ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati
// compiler gets confused.
- //temp1 = exp(-temp1 * temp2.z * dist_mul);
- temp1 = exp(-temp1 * dist_mul);
+ temp1 = exp(-temp1 * temp2.z * dist_mul);
// Compute haze glow
temp2.x = dot(Pn, lightnorm.xyz);
diff --git a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl
index eb5ab0f012..e6a4f3833c 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl
@@ -111,7 +111,7 @@ void main()
// Transparency (-> temp1)
// ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati
// compiler gets confused.
- temp1 = exp(-temp1 * dist_mul);
+ temp1 = exp(-temp1 * temp2.z * dist_mul);
// Compute haze glow
temp2.x = dot(Pn, lightnorm.xyz);
diff --git a/indra/newview/llvowlsky.cpp b/indra/newview/llvowlsky.cpp
index df2cc3ad91..620367228f 100644
--- a/indra/newview/llvowlsky.cpp
+++ b/indra/newview/llvowlsky.cpp
@@ -111,7 +111,7 @@ inline F32 LLVOWLSky::calcPhi(U32 i)
t = t*t;
t = 1.f - t;
- return F_PI * t;
+ return (F_PI / 8.f) * t;
}
void LLVOWLSky::resetVertexBuffers()
@@ -382,7 +382,11 @@ void LLVOWLSky::buildStripsBuffer(U32 begin_stack,
llassert(end_stack <= num_stacks);
// stacks are iterated one-indexed since phi(0) was handled by the fan above
+#if NEW_TESS
for(i = begin_stack; i <= end_stack; ++i)
+#else
+ for(i = begin_stack + 1; i <= end_stack+1; ++i)
+#endif
{
phi0 = calcPhi(i);
@@ -396,7 +400,22 @@ void LLVOWLSky::buildStripsBuffer(U32 begin_stack,
y0 = cos(phi0);
z0 = sin(phi0) * sin(theta);
+#if NEW_TESS
*vertices++ = LLVector3(x0 * RADIUS, y0 * RADIUS, z0 * RADIUS);
+#else
+ if (i == num_stacks-2)
+ {
+ *vertices++ = LLVector3(x0*RADIUS, y0*RADIUS-1024.f*2.f, z0*RADIUS);
+ }
+ else if (i == num_stacks-1)
+ {
+ *vertices++ = LLVector3(0, y0*RADIUS-1024.f*2.f, 0);
+ }
+ else
+ {
+ *vertices++ = LLVector3(x0 * RADIUS, y0 * RADIUS, z0 * RADIUS);
+ }
+#endif
++count_verts;
@@ -404,7 +423,7 @@ void LLVOWLSky::buildStripsBuffer(U32 begin_stack,
// note: x and z are transposed in order for things to animate
// correctly in the global coordinate system where +x is east and
// +y is north
- *texCoords++ = LLVector2((-z0 + 1.f) / 2.f, (-x0 + 1.f) / 2.f);
+ *texCoords++ = LLVector2((-z0 + 1.f) / 2.f, (-x0 + 1.f) / 2.f);
}
}