Merge branch 'feature/stars' into plutoViz

This commit is contained in:
Alexander Bock
2015-02-20 14:00:19 +01:00
6 changed files with 104 additions and 34 deletions

View File

@@ -31,7 +31,7 @@ return {
LogLevel = "Debug",
ImmediateFlush = true,
Logs = {
{ Type = "HTML", FileName = "${BASE_PATH}/log.html", Append = false }
-- { Type = "HTML", FileName = "${BASE_PATH}/log.html", Append = false }
}
},
LuaDocumentationFile = {
@@ -42,5 +42,5 @@ return {
--SGCTConfig = "${SGCT}/single_fisheye.xml",
--SGCTConfig = "${SGCT}/two_nodes.xml",
--SGCTConfig = "${SGCT}/single_sbs_stereo.xml",
Scene = "${OPENSPACE_DATA}/scene/default_michal.scene",
Scene = "${OPENSPACE_DATA}/scene/default.scene",
}

View File

@@ -2,9 +2,9 @@ openspace.printInfo("Setting default values");
openspace.setPropertyValue("Constellation Bounds.renderable.enabled", false);
openspace.setPropertyValue("Stars.renderable.magnitudeClamp", {0.941, 4.191});
openspace.setPropertyValue("Stars.renderable.exponentialOffset", 6.180);
openspace.setPropertyValue("Stars.renderable.exponentialDampening", 0.838);
openspace.setPropertyValue("Stars.renderable.scaleFactor", 0.563);
openspace.setPropertyValue("Stars.renderable.exponentialOffset", 10);
openspace.setPropertyValue("Stars.renderable.exponentialDampening", 0.598);
openspace.setPropertyValue("Stars.renderable.scaleFactor", 0.54);
openspace.setPropertyValue("MilkyWay.renderable.transparency", 0.65);
openspace.setPropertyValue("MilkyWay.renderable.segments", 50);

View File

@@ -40,11 +40,14 @@ layout(location = 1) in vec3 ge_brightness;
layout(location = 2) in vec3 ge_velocity;
layout(location = 3) in float ge_speed;
layout(location = 4) in vec2 texCoord;
layout(location = 5) in float size;
#include "ABuffer/abufferStruct.hglsl"
#include "ABuffer/abufferAddToBuffer.hglsl"
#include "PowerScaling/powerScaling_fs.hglsl"
uniform vec2 magnitudeClamp;
//---------------------------------------------------------------------------
vec4 bv2rgb(float bv) {
@@ -76,30 +79,41 @@ void main() {
// textureColor.a = (textureColor.a - 0.25) / (0.85);
vec4 fullColor = vec4(color.rgb, textureColor.a);
// if (size < 7.5) {
// fullColor.a *= ((size - 2) / 6.5);
// discard;
// }
// if (size < 5)
// discard;
// fullColor.a *= min(size, 1.0);
// vec4 fullColor = textureColor * color;
// if (fullColor.a <= 0.125)
// discard;
float M = ge_brightness.z;
// if (M > 10)
// discard;
float targetM = 6;
float maxM = 14.0;
if (M > targetM) {
float alpha = (M - targetM) / (maxM - targetM);
fullColor.a *= alpha;
// float M = ge_brightness.z;
// // if (M > 10)
// // discard;
// float targetM = 7;
// float maxM = magnitudeClamp.x;
// if (M > targetM) {
// float alpha = (M - targetM) / (maxM - targetM);
// fullColor.a *= alpha;
}
// }
// if (ge_brightness.z > 7.0)
// discard;
vec4 position = vs_position;
// This has to be fixed when the scale graph is in place ---abock
float depth = pscDepth(position) + 1000;
float depth = pscDepth(position) + 1;
// float depth = 10000.0;
// gl_FragDepth = depth;
// fullColor = vec4(1.0);
ABufferStruct_t frag = createGeometryFragment(fullColor, position, depth);
addToBuffer(frag);
// discard;

View File

@@ -32,7 +32,7 @@ const vec2 corners[4] = vec2[4](
);
#include "PowerScaling/powerScalingMath.hglsl"
#include <${SHADERS_GENERATED}/constants.hglsl>:notrack
layout(points) in;
layout(triangle_strip, max_vertices = 4) out;
@@ -48,6 +48,7 @@ layout(location = 1) out vec3 ge_brightness;
layout(location = 2) out vec3 ge_velocity;
layout(location = 3) out float ge_speed;
layout(location = 4) out vec2 texCoord;
layout(location = 5) out float size;
uniform mat4 projection;
@@ -56,7 +57,6 @@ uniform float exponentialOffset;
uniform float exponentialDampening;
uniform float scaleFactor;
// As soon as the scalegraph is in place, replace this by a dynamic calculation
// of apparent magnitude in relation to the camera position ---abock
void main() {
@@ -71,17 +71,72 @@ void main() {
float M = vs_brightness[0].z;
// M = clamp(M, 1.0, 4.0);
M = clamp(M, magnitudeClamp[0], magnitudeClamp[1]);
// M = clamp(M, magnitudeClamp[0], magnitudeClamp[1]);
// float modifiedSpriteSize = exp((-5 - M) * 0.871);
float modifiedSpriteSize = exp((-exponentialOffset - M) * exponentialDampening) * scaleFactor;
for(int i = 0; i < 4; i++){
vec4 projPos[4];
for (int i = 0; i < 4; ++i) {
vec4 p1 = gl_in[0].gl_Position;
p1.xy += vec2(modifiedSpriteSize * (corners[i] - vec2(0.5)));
projPos[i] = projection * p1;
}
vec2 screenSize =vec2(SCREEN_WIDTH, SCREEN_HEIGHT);
vec2 ll = (((projPos[1].xy / projPos[1].w) + 1) / 2) * screenSize;
vec2 ur = (((projPos[2].xy / projPos[2].w) + 1) / 2) * screenSize;
vec2 d = abs(ll - ur);
// d *= screenSize;
// ll *= screenSize;
// if (ll.y > 600)
// return;
if (length(d) < 7.5)
return;
// float size = max(SCREEN_HEIGHT, SCREEN_WIDTH);
// vec2 screenSize = vec2(SCREEN_HEIGHT, SCREEN_WIDTH);
// d.x *= SCREEN_WIDTH;
// d.y *= SCREEN_HEIGHT;
// d *= screenSize;
// if (length(d * size) < 1)
// return;
// float distance = length(ll - ur);
// vec2 llNDC = ((projPos[1].xy / projPos[1].w) + 1) / 2;
// vec2 urNDC = ((projPos[2].xy / projPos[2].w) + 1) / 2;
// float distanceNDC = length(llNDC - urNDC);
// if (distance < 0.02)
// return;
// vec2 llPixel = llNDC * screenSize;
// vec2 urPixel = urNDC * screenSize;
// float distancePixel = length(llPixel - urPixel);
// if (distancePixel < 5)
// return;
// float f = 0.015;
// if (length((projPos[1].xy / projPos[1].w) - (projPos[2].xy / projPos[2].w)) < f)
// return;
for(int i = 0; i < 4; i++){
vec4 p1 = gl_in[0].gl_Position;
// p1.xy += vec2(modifiedSpriteSize * (corners[i] - vec2(0.5)));
vs_position = p1;
gl_Position = projection * p1;
// gl_Position = z_normalization(projection * p1);
gl_Position = projPos[i];
// gl_Position = projection * p1;
// gl_Position = z_normalization(projPos[i]);
texCoord = corners[i];
size = length(d);
EmitVertex();
}
EndPrimitive();

View File

@@ -501,23 +501,24 @@ void RenderableStars::createDataSlice(ColorOption option) {
}
for (size_t i = 0; i < _fullData.size(); i+=_nValuesPerStar) {
glm::vec3 p = glm::vec3(_fullData[i + 0], _fullData[i + 1], _fullData[i + 2]);
// This is only temporary until the scalegraph is in place. It places all stars
// on a sphere with a small variation in the distance to account for blending
// issues ---abock
glm::vec3 p = glm::vec3(_fullData[i + 0], _fullData[i + 1], _fullData[i + 2]);
if (p != glm::vec3(0.f))
p = glm::normalize(p);
//if (p != glm::vec3(0.f))
// p = glm::normalize(p);
float distLy = _fullData[i + 6];
float normalizedDist = (distLy - minDistance) / (maxDistance - minDistance);
float distance = 18.f - normalizedDist / 1.f ;
//float distLy = _fullData[i + 6];
//float normalizedDist = (distLy - minDistance) / (maxDistance - minDistance);
//float distance = 18.f - normalizedDist / 1.f ;
psc position = psc(glm::vec4(p, distance));
//psc position = psc(glm::vec4(p, distance));
// Convert parsecs -> meter
psc position = psc(glm::vec4(p * 0.308567756f, 17));
// Convert parsecs -> meter
//PowerScaledScalar parsecsToMetersFactor = PowerScaledScalar(0.308567758f, 17.f);
//position[0] *= parsecsToMetersFactor[0];
//position[1] *= parsecsToMetersFactor[0];
//position[2] *= parsecsToMetersFactor[0];
//position[3] += parsecsToMetersFactor[1];
@@ -536,8 +537,8 @@ void RenderableStars::createDataSlice(ColorOption option) {
layout.value.bvColor = _fullData[i + 3];
layout.value.luminance = _fullData[i + 4];
//layout.value.absoluteMagnitude = _fullData[i + 5];
layout.value.absoluteMagnitude = _fullData[i + 6];
layout.value.absoluteMagnitude = _fullData[i + 5];
//layout.value.absoluteMagnitude = _fullData[i + 6];
_slicedData.insert(_slicedData.end(),
layout.data.begin(),