@webviz/subsurface-viewer 0.30.1 → 0.30.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- declare const fsShader = "#version 300 es\n#define SHADER_NAME grid3d-fragment-shader\n\nprecision highp float;\n\nin vec3 cameraPosition;\nin vec4 position_commonspace;\nflat in float property;\nin float property_interpolated;\n\nflat in vec3 normal;\nflat in int vertexIndex;\n\nout vec4 fragColor;\n\nuniform sampler2D colormap;\n\nuniform float valueRangeMin;\nuniform float valueRangeMax;\nuniform float colorMapRangeMin;\nuniform float colorMapRangeMax;\n\nuniform bool isColoringDiscrete;\nuniform float colorMapSize;\nuniform lowp int coloringMode;\n\nuniform vec3 colorMapClampColor;\nuniform vec3 undefinedPropertyColor;\nuniform bool isClampColor;\nuniform bool isColorMapClampColorTransparent;\n\nvec4 getContinuousPropertyColor (float propertyValue) {\n \n vec4 color = vec4(1.0, 1.0, 1.0, 1.0);\n float x = (propertyValue - colorMapRangeMin) / (colorMapRangeMax - colorMapRangeMin);\n if (x < 0.0 || x > 1.0) {\n // Out of range. Use clampcolor.\n if (isClampColor) {\n color = vec4(colorMapClampColor.rgb, 1.0);\n\n }\n else if (isColorMapClampColorTransparent) {\n discard;\n }\n else {\n // Use min/max color to clamp.\n x = clamp (x, 0.0, 1.0); \n color = texture(colormap, vec2(x, 0.5));\n }\n }\n else {\n color = texture(colormap, vec2(x, 0.5));\n }\n return color;\n}\n\n// Calculate color from propertyValue using discrete colormap.\nvec4 getDiscretePropertyColor (float propertyValue) {\n\n vec4 color = vec4(1.0, 1.0, 1.0, 1.0);\n float tolerance = (1.0 / colorMapSize) * 0.5;\n\n if (propertyValue < colorMapRangeMin - tolerance || propertyValue > colorMapRangeMax + tolerance) {\n // Out of range. Use clampcolor.\n if (isClampColor) {\n color = vec4(colorMapClampColor.rgb, 1.0);\n\n }\n else if (isColorMapClampColorTransparent) {\n discard;\n }\n else {\n // Use min/max color to clamp.\n float p = clamp (propertyValue, colorMapRangeMin, colorMapRangeMax);\n float x = p / colorMapSize;\n color = texture(colormap, vec2(x, 0.5));\n }\n }\n else {\n float x = propertyValue / colorMapSize;\n color = texture(colormap, vec2(x + tolerance, 0.5));\n }\n return color;\n}\n\nvec4 getPropertyColor (float propertyValue) {\n if(isColoringDiscrete) {\n return getDiscretePropertyColor (propertyValue);\n }\n return getContinuousPropertyColor (propertyValue);\n}\n\nvoid main(void) {\n\n if (picking.isActive > 0.5 && !(picking.isAttribute > 0.5)) {\n fragColor = encodeVertexIndexToRGB(vertexIndex); \n return;\n }\n\n if (coloringMode == 0 && isnan(property)) {\n fragColor = vec4(undefinedPropertyColor.rgb, 1.0); \n return;\n } \n \n // Property values other than X,Y or Z are passed as \"flat\" i.e. constant over faces.\n float propertyValue = coloringMode == 0 ? property : property_interpolated;\n propertyValue = clamp(propertyValue, valueRangeMin, valueRangeMax);\n\n vec4 color = getPropertyColor(propertyValue);\n\n // Use two sided phong lighting. This has no effect if \"material\" property is not set.\n vec3 lightColor = getPhongLightColor(color.rgb, cameraPosition, position_commonspace.xyz, normal);\n fragColor = vec4(lightColor, 1.0);\n DECKGL_FILTER_COLOR(fragColor, geometry);\n}\n";
1
+ declare const fsShader = "#version 300 es\n#define SHADER_NAME grid3d-fragment-shader\n\nprecision highp float;\n\nin vec3 cameraPosition;\nin vec4 position_commonspace;\nflat in float property;\nin float property_interpolated;\n\nflat in vec3 normal;\nflat in int vertexIndex;\n\nout vec4 fragColor;\n\nuniform sampler2D colormap;\n\nuniform float valueRangeMin;\nuniform float valueRangeMax;\nuniform float colorMapRangeMin;\nuniform float colorMapRangeMax;\n\nuniform bool isColoringDiscrete;\nuniform float colorMapSize;\nuniform lowp int coloringMode;\n\nuniform vec3 colorMapClampColor;\nuniform vec3 undefinedPropertyColor;\nuniform bool isClampColor;\nuniform bool isColorMapClampColorTransparent;\n\nvec4 getContinuousPropertyColor (float propertyValue) {\n \n vec4 color = vec4(1.0, 1.0, 1.0, 1.0);\n float x = (propertyValue - colorMapRangeMin) / (colorMapRangeMax - colorMapRangeMin);\n if (x < 0.0 || x > 1.0) {\n // Out of range. Use clampcolor.\n if (isClampColor) {\n color = vec4(colorMapClampColor.rgb, 1.0);\n\n }\n else if (isColorMapClampColorTransparent) {\n discard;\n }\n else {\n // Use min/max color to clamp.\n x = clamp (x, 0.0, 1.0); \n color = texture(colormap, vec2(x, 0.5));\n }\n }\n else {\n color = texture(colormap, vec2(x, 0.5));\n }\n return color;\n}\n\n// Calculate color from propertyValue using discrete colormap.\nvec4 getDiscretePropertyColor (float propertyValue) {\n\n vec4 color = vec4(1.0, 1.0, 1.0, 1.0);\n float tolerance = (1.0 / colorMapSize) * 0.5;\n\n if (propertyValue < colorMapRangeMin - tolerance || propertyValue > colorMapRangeMax + tolerance) {\n // Out of range. Use clampcolor.\n if (isClampColor) {\n color = vec4(colorMapClampColor.rgb, 1.0);\n\n }\n else if (isColorMapClampColorTransparent) {\n discard;\n }\n else {\n // Use min/max color to clamp.\n float p = clamp (propertyValue, colorMapRangeMin, colorMapRangeMax);\n float x = p / colorMapSize;\n color = texture(colormap, vec2(x, 0.5));\n }\n }\n else {\n float x = propertyValue / colorMapSize;\n color = texture(colormap, vec2(x + tolerance, 0.5));\n }\n return color;\n}\n\nvec4 getPropertyColor (float propertyValue) {\n if(isColoringDiscrete) {\n return getDiscretePropertyColor (propertyValue);\n }\n return getContinuousPropertyColor (propertyValue);\n}\n\nvoid main(void) {\n\n if (picking.isActive > 0.5 && !(picking.isAttribute > 0.5)) {\n fragColor = encodeVertexIndexToRGB(vertexIndex); \n return;\n }\n\n if (coloringMode == 0 && isnan(property)) {\n vec3 lightColor = getPhongLightColor(undefinedPropertyColor.rgb, cameraPosition, position_commonspace.xyz, normal);\n fragColor = vec4(lightColor, 1.0); \n return;\n } \n \n // Property values other than X,Y or Z are passed as \"flat\" i.e. constant over faces.\n float propertyValue = coloringMode == 0 ? property : property_interpolated;\n propertyValue = clamp(propertyValue, valueRangeMin, valueRangeMax);\n\n vec4 color = getPropertyColor(propertyValue);\n\n // Use two sided phong lighting. This has no effect if \"material\" property is not set.\n vec3 lightColor = getPhongLightColor(color.rgb, cameraPosition, position_commonspace.xyz, normal);\n fragColor = vec4(lightColor, 1.0);\n DECKGL_FILTER_COLOR(fragColor, geometry);\n}\n";
2
2
  export default fsShader;
@@ -98,7 +98,8 @@ void main(void) {
98
98
  }
99
99
 
100
100
  if (coloringMode == 0 && isnan(property)) {
101
- fragColor = vec4(undefinedPropertyColor.rgb, 1.0);
101
+ vec3 lightColor = getPhongLightColor(undefinedPropertyColor.rgb, cameraPosition, position_commonspace.xyz, normal);
102
+ fragColor = vec4(lightColor, 1.0);
102
103
  return;
103
104
  }
104
105
 
@@ -1 +1 @@
1
- {"version":3,"file":"fragment.fs.glsl.js","sourceRoot":"","sources":["../../../src/layers/grid3d/fragment.fs.glsl.ts"],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmHhB,CAAC;AAEF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"fragment.fs.glsl.js","sourceRoot":"","sources":["../../../src/layers/grid3d/fragment.fs.glsl.ts"],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoHhB,CAAC;AAEF,eAAe,QAAQ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webviz/subsurface-viewer",
3
- "version": "0.30.1",
3
+ "version": "0.30.2",
4
4
  "description": "3D visualization component for subsurface reservoir data",
5
5
  "keywords": [
6
6
  "subsurface",