Skip to content

Commit 8ad98f1

Browse files
eaws: update gray overlay
1 parent 2f5abd5 commit 8ad98f1

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

gl_engine/shaders/eaws.frag

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ void main() {
113113
highp uint eawsRegionId = texelFetch(texture_sampler, ivec3(int(uv.x * float(512)), int(uv.y * float(512)) , texture_layer_f), 0).r;
114114
ivec4 report = eaws.reports[eawsRegionId];
115115
vec3 eaws_color = color_no_report_available;
116-
highp float mix_factor = 0.9; // Mix factor between eaws color and photo texture
117116

118117
// // debug output regions
119118
//eaws_color = vec3(float((eawsRegionId >> 8u) & 255u) / 256.0, float(eawsRegionId & 255u) / 256.0, float((eawsRegionId >> 16u) & 255u) / 256.0);
@@ -128,12 +127,9 @@ void main() {
128127
{
129128
// assign a color to slope angle obtained from (not normalized) normal
130129
eaws_color = slopeAngleColorFromNormal(fragNormal);
131-
mix_factor = 0.5;
132130
}
133-
else if(report.x >= 0) // avalanche report is available. report.x = -1 would mean no report available since .x stores the exposition as described in the Masters THesis of Joey which must be >=0
131+
else if(report.x >= 0) // avalanche report is available. report.x = < 0 would mean no report available since .x stores the exposition as described in the Masters THesis of Joey which must be >0
134132
{
135-
mix_factor = 0.5;
136-
137133
// get avalanche ratings for eaws region of current fragment
138134
int bound = report.y; // bound dividing moutain in Hi region and low region
139135
int ratingHi = report.a; // rating should be value in {0,1,2,3,4}
@@ -192,7 +188,9 @@ void main() {
192188

193189
// merge photo texture with eaws color
194190
if(eaws_color.r > 0.0 || eaws_color.g > 0.0 || eaws_color.b > 0.0)
195-
texout_albedo = mix(terrain_color, eaws_color, mix_factor);
191+
texout_albedo = mix(terrain_color, eaws_color, 0.5);
192+
else if(eaws_color.r < 0.0 ) // no report available or danger rating = 0: grey
193+
texout_albedo = mix(terrain_color, vec3(0.5,0.5,0.5), 0.9);
196194
else
197195
texout_albedo = terrain_color;
198196
}

gl_engine/shaders/eaws.glsl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,10 @@ layout (std140) uniform eaws_reports {
2626
} eaws;
2727

2828
// Color for areas where no report is available
29-
vec3 color_no_report_available = vec3(0.5,0.5,0.5);
29+
vec3 color_no_report_available = vec3(-1.0,-1.0,-1.0);
3030

3131
vec3 color_from_eaws_danger_rating(int rating)
3232
{
33-
if(0 == rating) return vec3(0.0,0.0,0.0); // no color for 0 = no snow
3433
if(1 == rating) return vec3(0.0,1.0,0.0); // green for 1 = low
3534
if(2 == rating) return vec3(1.0,1.0,0.0); // yellow for 2 = moderate
3635
if(3 == rating) return vec3(1.0,0.53f,0.0); // orange for 3 = considerable
@@ -113,6 +112,7 @@ vec3 color_from_snowCard_risk_parameters(int eaws_danger_rating, vec3 notNormali
113112
// pick unfavorable array according to eaws danger rating
114113
switch(eaws_danger_rating)
115114
{
115+
case 0: return color_no_report_available;
116116
case 1: return (1.0-a) * snowCardLevel[unfavorable1[idx]] + a * snowCardLevel[unfavorable1[nextIdx]];
117117
case 2: return (1.0-a) * snowCardLevel[unfavorable2[idx]] + a * snowCardLevel[unfavorable2[nextIdx]];
118118
case 3: return (1.0-a) * snowCardLevel[unfavorable3[idx]] + a * snowCardLevel[unfavorable3[nextIdx]];
@@ -125,6 +125,7 @@ vec3 color_from_snowCard_risk_parameters(int eaws_danger_rating, vec3 notNormali
125125
// pick favorable array according to eaws danger rating
126126
switch(eaws_danger_rating)
127127
{
128+
case 0: return color_no_report_available;
128129
case 1: return (1.0-a) * snowCardLevel[favorable1[idx]] + a * snowCardLevel[favorable1[nextIdx]];
129130
case 2: return (1.0-a) * snowCardLevel[favorable2[idx]] + a * snowCardLevel[favorable2[nextIdx]];
130131
case 3: return (1.0-a) * snowCardLevel[favorable3[idx]] + a * snowCardLevel[favorable3[nextIdx]];
@@ -143,7 +144,7 @@ bool goOver40[5] = bool[5](true, false, false, false, false);
143144
vec3 color_from_stop_or_go(vec3 notNormalizedNormal, int eaws_danger_rating)
144145
{
145146
// danger rating must be in [1,5]
146-
if(eaws_danger_rating < 1 || 5 < eaws_danger_rating) return vec3(0.0,0.0,0.0);
147+
if(eaws_danger_rating < 1 || 5 < eaws_danger_rating) return color_no_report_available;
147148
int idx = eaws_danger_rating -1;
148149

149150
// Calculte slope angle

0 commit comments

Comments
 (0)