master
Ansariel 2021-01-26 09:34:58 +01:00
commit 3b3dc83edc
6 changed files with 53 additions and 14 deletions

View File

@ -1361,6 +1361,8 @@ Sovereign Engineer
OPEN-343
SL-11625
BUG-229030
SL-14705
SL-14707
SpacedOut Frye
VWR-34
VWR-45

View File

@ -1477,24 +1477,30 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
LL_INFOS("Window") << "pixel formats done." << LL_ENDL ;
S32 swap_method = 0;
S32 cur_format = num_formats-1;
GLint swap_query = WGL_SWAP_METHOD_ARB;
S32 swap_method = 0;
S32 cur_format = 0;
const S32 max_format = (S32)num_formats - 1;
GLint swap_query = WGL_SWAP_METHOD_ARB;
BOOL found_format = FALSE;
while (!found_format && wglGetPixelFormatAttribivARB(mhDC, pixel_format, 0, 1, &swap_query, &swap_method))
// SL-14705 Fix name tags showing in front of objects with AMD GPUs.
// On AMD hardware we need to iterate from the first pixel format to the end.
// Spec:
// https://www.khronos.org/registry/OpenGL/extensions/ARB/WGL_ARB_pixel_format.txt
while (wglGetPixelFormatAttribivARB(mhDC, pixel_formats[cur_format], 0, 1, &swap_query, &swap_method))
{
if (swap_method == WGL_SWAP_UNDEFINED_ARB || cur_format <= 0)
if (swap_method == WGL_SWAP_UNDEFINED_ARB)
{
found_format = TRUE;
break;
}
else
else if (cur_format >= max_format)
{
--cur_format;
cur_format = 0;
break;
}
++cur_format;
}
pixel_format = pixel_formats[cur_format];
if (mhDC != 0) // Does The Window Have A Device Context?

View File

@ -166,6 +166,7 @@ void main()
(blue_horizon * blue_weight * (sunlight + tmpAmbient) + (haze_horizon * haze_weight) * (sunlight * haze_glow + tmpAmbient));
// CLOUDS
sunlight = sunlight_color; // SL-14707 reset color -- Clouds are unusually dim in EEP
off_axis = 1.0 / max(1e-6, lightnorm.y * 2.);
sunlight *= exp(-light_atten * off_axis);

View File

@ -73,7 +73,21 @@ uniform float ice_level;
vec3 rainbow(float d)
{
d = clamp(d, -1.0, 0.0);
// d is the dot product of view and sun directions, so ranging -1.0..1.0
// 'interesting' values of d are the range -0.75..-0.825, when view is nearly opposite of sun vec
// Rainbox texture mode is GL_REPEAT, so tc of -.75 is equiv to 0.25, -0.825 equiv to 0.175.
// SL-13629 Rainbow texture has colors within the correct .175...250 range, but order is inverted.
// Rather than replace the texture, we mirror and translate the y tc to keep the colors within the
// interesting range, but in reversed order: i.e. d = (1 - d) - 1.575
d = clamp(-0.575 - d, 0.0, 1.0);
// With the colors in the lower 1/4 of the texture, inverting the coords leaves most of it inaccessible.
// So, we can stretch the texcoord above the colors (ie > 0.25) to fill the entire remaining coordinate
// space. This improves gradation, reduces banding within the rainbow interior. (1-0.25) / (0.425/0.25) = 4.2857
float interior_coord = max(0.0, d - 0.25) * 4.2857;
d = clamp(d, 0.0, 0.25) + interior_coord;
float rad = (droplet_radius - 5.0f) / 1024.0f;
return pow(texture2D(rainbow_map, vec2(rad, d)).rgb, vec3(1.8)) * moisture_level;
}

View File

@ -166,6 +166,7 @@ void main()
(blue_horizon * blue_weight * (sunlight + tmpAmbient) + (haze_horizon * haze_weight) * (sunlight * haze_glow + tmpAmbient));
// CLOUDS
sunlight = sunlight_color; // SL-14707 reset color -- Clouds are unusually dim in EEP
off_axis = 1.0 / max(1e-6, lightnorm.y * 2.);
sunlight *= exp(-light_atten * off_axis);

View File

@ -56,8 +56,23 @@ vec3 GetSkyLuminanceToPoint(vec3 camPos, vec3 pos, float shadow_length, vec3 dir
vec3 ColorFromRadiance(vec3 radiance);
vec3 rainbow(float d)
{
float rad = (droplet_radius - 5.0f) / 1024.0f;
return pow(texture2D(rainbow_map, vec2(rad, d)).rgb, vec3(1.8)) * moisture_level;
// d is the dot product of view and sun directions, so ranging -1.0..1.0
// 'interesting' values of d are the range -0.75..-0.825, when view is nearly opposite of sun vec
// Rainbox texture mode is GL_REPEAT, so tc of -.75 is equiv to 0.25, -0.825 equiv to 0.175.
// SL-13629 Rainbow texture has colors within the correct .175...250 range, but order is inverted.
// Rather than replace the texture, we mirror and translate the y tc to keep the colors within the
// interesting range, but in reversed order: i.e. d = (1 - d) - 1.575
d = clamp(-0.575 - d, 0.0, 1.0);
// With the colors in the lower 1/4 of the texture, inverting the coords leaves most of it inaccessible.
// So, we can stretch the texcoord above the colors (ie > 0.25) to fill the entire remaining coordinate
// space. This improves gradation, reduces banding within the rainbow interior. (1-0.25) / (0.425/0.25) = 4.2857
float interior_coord = max(0.0, d - 0.25) * 4.2857;
d = clamp(d, 0.0, 0.25) + interior_coord;
float rad = (droplet_radius - 5.0f) / 1024.0f;
return pow(texture2D(rainbow_map, vec2(rad, d)).rgb, vec3(1.8)) * moisture_level;
}
vec3 halo22(float d)