diff --git a/shaders/star_frag.glsl b/shaders/star_frag.glsl index 84ddbb359c..68e7b05e36 100644 --- a/shaders/star_frag.glsl +++ b/shaders/star_frag.glsl @@ -44,5 +44,5 @@ void main(void) // in fragment shader all points have virtual dimension 1x1, so gl_PointCoord has a value from [0; 1] float offset = length((gl_PointCoord.xy - vec2(0.5)) * pointSize); float point = (max_theta == -1.0) ? psf_core(offset) : psf_glow(offset); - gl_FragColor = vec4(v_color * point, 1.0); // + vec4(0.1, 0.0, 0.0, 0.0); // square for debugging + gl_FragColor = vec4(v_color * point, 1.0); // + vec4(0.1, 0.0, 0.0, 0.0); // red square for debugging } diff --git a/shaders/star_vert.glsl b/shaders/star_vert.glsl index e71c10bed3..803ee16921 100644 --- a/shaders/star_vert.glsl +++ b/shaders/star_vert.glsl @@ -9,11 +9,10 @@ // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. -const float a = 0.123; // empirical constant - const float degree_per_px = 0.01; // higher value causes blinking due to optimizations in the psf_glow() -const float max_square_size = 256.0; // px -const float max_irradiation = pow((degree_per_px * max_square_size / a), 2.0) / (2.0 * 3.141592653); +const float max_square_size = 512.0; // px +const float glow_scale = 0.123; // empirical constant, deg (not to change) +const float max_irradiation = pow((degree_per_px * max_square_size / glow_scale), 2.0) / (2.0 * 3.141592653); varying vec3 v_color; varying float max_theta; @@ -25,7 +24,7 @@ attribute float in_PointSize; const float color_saturation_limit = 0.1; // the ratio of the minimum color component to the maximum -//! Normalizes the color by its green value and corrects extreme saturation +// Normalizes the color by its green value and corrects extreme saturation vec3 green_normalization(vec3 color) { // color /= max(color.r, max(color.g, color.b)); // we do this in XYZRGBConverter::convertUnnormalized() @@ -54,8 +53,8 @@ void main(void) else { // Bright light source (glow mode) - float irradiation = atan(in_PointSize / max_irradiation) * max_irradiation; // dimmed brightness - max_theta = 0.123 * sqrt(irradiation); // emperical glow radius + float irradiation = atan(in_PointSize / max_irradiation) * max_irradiation; // dimming + max_theta = glow_scale * sqrt(irradiation); float half_sq = max_theta / degree_per_px; pointSize = 2.0 * half_sq - 1.0; v_color = color; diff --git a/src/celengine/dsorenderer.cpp b/src/celengine/dsorenderer.cpp index 886bbb474a..d77e657549 100644 --- a/src/celengine/dsorenderer.cpp +++ b/src/celengine/dsorenderer.cpp @@ -190,7 +190,7 @@ void DSORenderer::process(DeepSkyObject* const &dso, float irradiationEff = astro::magToIrradiance(appMagEff) * exposure; if (irradiationEff > labelLowestIrradiation) { - float distr = irradiationEff / labelLowestIrradiation; + float distr = 1.0f - irradiationEff / labelLowestIrradiation; labelColor.alpha(distr * labelColor.alpha()); renderer->addBackgroundAnnotation(rep, diff --git a/src/celengine/starrenderer.cpp b/src/celengine/starrenderer.cpp index ad83bfe21f..1f6d2fdf48 100644 --- a/src/celengine/starrenderer.cpp +++ b/src/celengine/starrenderer.cpp @@ -108,7 +108,7 @@ void StarRenderer::process(const Star& star, float distance, float irradiance) Vector3f starDir = relPos.normalized(); if (starDir.dot(viewNormal) > cosFOV) { - float distr = labelLowestIrradiation / irradiation; + float distr = 1.0f - labelLowestIrradiation / irradiation; Color color = Color(Renderer::StarLabelColor, distr * Renderer::StarLabelColor.alpha()); renderer->addBackgroundAnnotation(nullptr, starDB->getStarName(star, true),