Skip to content

Commit

Permalink
- Added Lucas Dworschak to about page
Browse files Browse the repository at this point in the history
- improved label fadeout
  • Loading branch information
LucasDworschak committed Jan 3, 2024
1 parent 0c439f5 commit 49ba057
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/About.qml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Rectangle {
+ "The source code is available on <a href=\"https://github.com/AlpineMapsOrg/renderer\">github.com/AlpineMapsOrg/renderer</a>.</p>"
+ "<p>The source of elevation and orthographic photo data is <a href=\"https://basemap.at\">basemap.at</a>, "
+ "it is licensed under the Open Government Data Austria license (CC-BY 4.0).</p>"
+ "<h3>Authors:</h3><p>Adam Celarek, Gerald Kimmersdorfer, Jakob Lindner<p>")
+ "<h3>Authors:</h3><p>Adam Celarek, Lucas Dworschak, Gerald Kimmersdorfer, Jakob Lindner<p>")
}
}
}
Expand Down
39 changes: 32 additions & 7 deletions gl_engine/shaders/labels.vert
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ const float nearLabel = 100.0;
const vec2 offset_mask[4] = vec2[4](vec2(0,0), vec2(0,1), vec2(1,1), vec2(1,0));

const int peak_visibilty_count = 4;
const float peak_visibilty_marker[peak_visibilty_count] = float[](400, 300, 200, 100);
const float peak_visibilty_weight[peak_visibilty_count] = float[](0.1, 0.2, 0.5, 0.2);
// const float peak_visibilty_marker_far[peak_visibilty_count] = float[](400, 300, 200, 100);
const float peak_visibilty_marker[peak_visibilty_count] = float[](0.06, 0.04, 0.02, 0);
const float peak_visibilty_weight[peak_visibilty_count] = float[](0.4, 0.2, 0.2, 0.4);

uniform highp mat4 inv_view_rot;
uniform bool label_dist_scaling;
Expand All @@ -48,21 +49,36 @@ float determineLabelOcclusionVisibilty(float dist)
opacity = 0.0;
for(lowp int i = 0; i < peak_visibilty_count; ++i)
{
vec3 peakLookup = ws_to_ndc((label_position - camera.position.xyz) + peak_visibilty_marker[i]);
vec3 peakLookup;
if(dist > 5000)
{
// case: peak is far away
// -> we prefer to look for obfuscation above the peak
// -> we still want to see where a peak is even if it is obfuscated a little bit
peakLookup = ws_to_ndc((label_position - camera.position.xyz)) + vec3(0, peak_visibilty_marker[i],0);
}
else
{
// case: near to the peak
// -> we prefer actual obfuscations of the peak (if we cant see the peak from the current location we dont want to show the label at all)
peakLookup = ws_to_ndc((label_position - camera.position.xyz)) - vec3(0, peak_visibilty_marker[peak_visibilty_count-i-1],0);
}

float depth = texture2D(texin_depth, peakLookup.xy).w;

// check if our distance is nearer than the depth test (we subtract a small number in order to prevent precision errors in the lookup
// depth == 0 if we hit the skybox -> we therefore test additionally if depth is smaller than a small epsilon
if(depth <= 0.001 || depth > (dist-1000.0))
if(depth <= 0.001 || depth > (dist-200.0))
{
// opacity = 1.0 - clamp(c.w/250000.0, 0.0, 1.0);
opacity += peak_visibilty_weight[i];
opacity += peak_visibilty_weight[peak_visibilty_count-i-1];
}
else if(i == 0)
{
// first marker is not visible -> discard it completely
return 0.0;
}

}

return opacity;
Expand Down Expand Up @@ -98,13 +114,22 @@ void main() {
opacity *= (distance_opacity*distance_opacity);

// discard this vertex if we are occluded by the terrain and or distance
if(opacity == 0)
if(opacity <= 0.37)
{
gl_Position = vec4(10.,10.,10.,1.0);
}
else if(opacity <= 0.57)
{
// fade only between opacity 0.37 to 0.57
opacity = (opacity-0.37) / 0.2;
}
else
{
opacity = 1.0;
}

// for visibilties sake we have a minimum opacity of 0.5
opacity = clamp(0.5 + opacity/0.5, 0.5, 1.0);
// opacity = clamp(0.4 + opacity, 0.3, 1.0);

// uv coordinates
texcoords = vtexcoords.xy + vtexcoords.zw * offset_mask[gl_VertexID];
Expand Down

0 comments on commit 49ba057

Please sign in to comment.