Browse Source

Change layer thickness colormap to parula-like (https://es.mathworks.com/help/matlab/ref/parula.html)

Diego Prado Gesto 7 years ago
parent
commit
0328050548

+ 6 - 6
plugins/SimulationView/SimulationView.qml

@@ -485,7 +485,7 @@ Item
                 }
             }
 
-            // Gradient colors for layer thickness
+            // Gradient colors for layer thickness (similar to parula colormap)
             Rectangle { // In QML 5.9 can be changed by LinearGradient
                 // Invert values because then the bar is rotated 90 degrees
                 id: thicknessGradient
@@ -499,23 +499,23 @@ Item
                 gradient: Gradient {
                     GradientStop {
                         position: 0.000
-                        color: Qt.rgba(1, 0, 0, 1)
+                        color: Qt.rgba(1, 1, 0, 1)
                     }
                     GradientStop {
                         position: 0.25
-                        color: Qt.rgba(0.5, 0.5, 0, 1)
+                        color: Qt.rgba(1, 0.75, 0.25, 1)
                     }
                     GradientStop {
                         position: 0.5
-                        color: Qt.rgba(0, 1, 0, 1)
+                        color: Qt.rgba(0, 0.75, 0.5, 1)
                     }
                     GradientStop {
                         position: 0.75
-                        color: Qt.rgba(0, 0.5, 0.5, 1)
+                        color: Qt.rgba(0, 0.375, 0.75, 1)
                     }
                     GradientStop {
                         position: 1.0
-                        color: Qt.rgba(0, 0, 1, 1)
+                        color: Qt.rgba(0, 0, 0.5, 1)
                     }
                 }
             }

+ 7 - 3
plugins/SimulationView/layers3d.shader

@@ -54,9 +54,13 @@ vertex41core =
     vec4 layerThicknessGradientColor(float abs_value, float min_value, float max_value)
     {
         float value = (abs_value - min_value)/(max_value - min_value);
-        float red = max(2*value-1, 0);
-        float green = 1-abs(1-2*value);
-        float blue = max(1-2*value, 0);
+        float red = min(max(4*value-2, 0), 1);
+        float green = min(1.5*value, 0.75);
+        if (value > 0.75)
+        {
+            green = value;
+        }
+        float blue = 0.75-abs(0.25-value);
         return vec4(red, green, blue, 1.0);
     }