Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [NGRM] - Strange artefacts in 2D maps #2134 #2135

Merged
merged 20 commits into from
Jul 8, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added tolerances back in.
  • Loading branch information
nilscb committed Jul 4, 2024
commit afa824bf1cfb17faa0c738a2cea8aaf879bce7f0
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,8 @@ vec4 getContinuousPropertyColor (float propertyValue) {

vec4 color = vec4(1.0, 1.0, 1.0, 1.0);

// This may happen due to GPU interpolation precision causing color artifacts.
propertyValue = clamp(propertyValue, valueRangeMin, valueRangeMax);

float x = (propertyValue - colorMapRangeMin) / (colorMapRangeMax - colorMapRangeMin);
if (x < 0.0 || x > 1.0) {
if (x < 0.0 - 1e-4 || x > 1.0 + 1e-4) {
w1nklr marked this conversation as resolved.
Show resolved Hide resolved
// Out of range. Use clampcolor.
if (isClampColor) {
color = vec4(colorMapClampColor.rgb, 1.0);
Expand All @@ -58,8 +55,9 @@ vec4 getContinuousPropertyColor (float propertyValue) {
vec4 getDiscretePropertyColor (float propertyValue) {

vec4 color = vec4(1.0, 1.0, 1.0, 1.0);

if (propertyValue < colorMapRangeMin || propertyValue > colorMapRangeMax) {
float tolerance = (1.0 / colorMapSize) * 0.5;

if (propertyValue < colorMapRangeMin - tolerance || propertyValue > colorMapRangeMax + tolerance) {
// Out of range. Use clampcolor.
if (isClampColor) {
color = vec4(colorMapClampColor.rgb, 1.0);
Expand All @@ -77,7 +75,7 @@ vec4 getDiscretePropertyColor (float propertyValue) {
}
else {
float x = propertyValue / colorMapSize;
color = texture2D(colormap, vec2(x, 0.5));
color = texture2D(colormap, vec2(x + tolerance, 0.5));
}
return color;
}
Expand Down
Loading