wip
parent
c5f40088d1
commit
3a9a19ca52
|
@ -11,7 +11,7 @@ varying highp float brightness;
|
|||
/*uniform highp*/ const float glareFalloff = 1.0 / 15.0;
|
||||
/*uniform highp*/ const float glareBrightness = 0.003;
|
||||
/*uniform*/ const float diffSpikeBrightness = 0.9;
|
||||
uniform /*const*/ float exposure/* = 21.72534925735687|74.430977*/;
|
||||
uniform float exposure;
|
||||
|
||||
mediump vec3 linearToSRGB(mediump vec3 c)
|
||||
{
|
||||
|
|
|
@ -11,12 +11,12 @@ attribute vec4 in_Color;
|
|||
uniform vec2 viewportSize;
|
||||
uniform vec2 viewportCoord;
|
||||
|
||||
uniform /*const*/ float magScale/* = 1.3369011415551906*/;
|
||||
uniform float magScale;
|
||||
/*uniform*/ const float sigma2 = 0.35;
|
||||
/*uniform highp*/ const float glareFalloff = 1.0 / 15.0;
|
||||
/*uniform highp*/ const float glareBrightness = 0.003;
|
||||
uniform /*const*/ float exposure /*= 21.72534925735687|74.430977*/;
|
||||
uniform /*const*/ float thresholdBrightness/* = 1.0 / 255.0*/;
|
||||
uniform float exposure;
|
||||
uniform float thresholdBrightness;
|
||||
|
||||
varying vec2 pointCenter;
|
||||
varying vec4 color;
|
||||
|
@ -26,14 +26,13 @@ varying float brightness;
|
|||
void main()
|
||||
{
|
||||
vec4 position = vec4(in_Position, 1.0);
|
||||
float appMag = /*position.z*/in_PointSize;
|
||||
/*position.z = sqrt(1.0 - dot(position.xy, position.xy)) * sign(in_Color.a - 0.5);*/
|
||||
float appMag = in_PointSize;
|
||||
|
||||
vec4 projectedPosition = MVPMatrix * position;
|
||||
vec2 devicePosition = projectedPosition.xy / projectedPosition.w;
|
||||
pointCenter = (devicePosition * 0.5 + vec2(0.5, 0.5)) * viewportSize + viewportCoord;
|
||||
color = in_Color;
|
||||
float b = pow(2.512, -appMag * magScale);
|
||||
float b = pow(2.512, min(-3.5, -appMag * magScale));
|
||||
float r2 = -log(thresholdBrightness / (exposure * b)) * 2.0 * sigma2;
|
||||
float rGlare2 = (exposure * glareBrightness * b / thresholdBrightness - 1.0) / glareFalloff;
|
||||
gl_PointSize = 2.0 * sqrt(max(r2, rGlare2));
|
||||
|
|
|
@ -69,7 +69,7 @@ void PointStarRenderer::process(const Star& star, float distance, float appMag)
|
|||
if (hasOrbit)
|
||||
orbitSizeInPixels = orbitalRadius / (distance * pixelSize);
|
||||
|
||||
// Special handling for stars less than one light year away . . .
|
||||
// Special handling for stars less than SolarSystemMaxDistance away
|
||||
// We can't just go ahead and render a nearby star in the usual way
|
||||
// for two reasons:
|
||||
// * It may be clipped by the near plane
|
||||
|
@ -79,7 +79,7 @@ void PointStarRenderer::process(const Star& star, float distance, float appMag)
|
|||
// further than one light year away if the star is huge, the fov is
|
||||
// very small and the resolution is high. We'll ignore this for now
|
||||
// and use the most inexpensive test possible . . .
|
||||
if (distance < 1.0f || orbitSizeInPixels > 1.0f)
|
||||
if (distance < SolarSystemMaxDistance || orbitSizeInPixels > 1.0f)
|
||||
{
|
||||
// Compute the position of the observer relative to the star.
|
||||
// This is a much more accurate (and expensive) distance
|
||||
|
@ -172,7 +172,7 @@ void PointStarRenderer::process(const Star& star, float distance, float appMag)
|
|||
maxSize = max(maxSize, 2.0f * discScale * size);
|
||||
#endif
|
||||
}
|
||||
starVertexBuffer->addStar(relPos, Color(starColor, alpha), /*size*/appMag);
|
||||
starVertexBuffer->addStar(relPos, Color(starColor, alpha), size);
|
||||
}
|
||||
|
||||
++nRendered;
|
||||
|
|
|
@ -85,7 +85,7 @@ void PointStarVertexBuffer::makeCurrent()
|
|||
program->vec2Param("viewportCoord") = Eigen::Vector2f(viewport[0], viewport[1]);
|
||||
float visibilityThreshold = 1.0f / 255.0f;
|
||||
float logMVisThreshold = log(visibilityThreshold) / log(2.512f);
|
||||
float saturationMag = limitingMagnitude - 4.5f; //+ logMVisThreshold;
|
||||
float saturationMag = limitingMagnitude - 4.5f/* + logMVisThreshold*/;
|
||||
float magScale = (logMVisThreshold) / (saturationMag - limitingMagnitude);
|
||||
program->floatParam("thresholdBrightness") = visibilityThreshold;
|
||||
program->floatParam("exposure") = pow(2.512f, magScale * saturationMag);
|
||||
|
|
Loading…
Reference in New Issue