Skip to content

fix: Multiple layers not including default shaderModules and layer.opacity not used in fragment shader #2572

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

Merged

Conversation

rubenthoms
Copy link
Collaborator

@rubenthoms rubenthoms commented Jun 5, 2025

Using super.getShaderModules({}) injects the default layer modules, e.g. layerUniforms which is required to access props.opacity in the fragment shader via layer.opacity.

References:

Layers changed:

  • Axes2D
  • GridLayer3D
  • Hillshading2D
  • NorthArrow
  • Map
  • PieChart
  • Colormap
  • Triangle
  • WellMarkers

Using `super.getShaderModules({})` injects the default layer modules, e.g. `layerUniforms` which is required to access `props.opacity` in the fragment shader via `layer.opacity`
@rubenthoms rubenthoms requested review from hkfb and w1nklr June 5, 2025 13:12
@rubenthoms rubenthoms self-assigned this Jun 5, 2025
@rubenthoms rubenthoms added the bug Something isn't working label Jun 5, 2025
Copy link
Collaborator

@w1nklr w1nklr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good to me.
Waiting for the upload for other layers, as discussed.

@w1nklr
Copy link
Collaborator

w1nklr commented Jun 5, 2025

BTW, shouldn't the 2 last lines of cellProperty.vs.glsl.ts and nodeProperty.vs.glsl.ts be removed ?

   vec4 color = vec4(0.0);
   DECKGL_FILTER_COLOR(color, geometry);

This should not be part of a vertex shader, right ?

@rubenthoms rubenthoms changed the title fix: Grid3DLayer not including default shaderModules and layer.opacity not used in fragment shader fix: Multiple layer not including default shaderModules and layer.opacity not used in fragment shader Jun 5, 2025
@rubenthoms rubenthoms changed the title fix: Multiple layer not including default shaderModules and layer.opacity not used in fragment shader fix: Multiple layers not including default shaderModules and layer.opacity not used in fragment shader Jun 5, 2025
@rubenthoms
Copy link
Collaborator Author

rubenthoms commented Jun 5, 2025

BTW, shouldn't the 2 last lines of cellProperty.vs.glsl.ts and nodeProperty.vs.glsl.ts be removed ?

   vec4 color = vec4(0.0);
   DECKGL_FILTER_COLOR(color, geometry);

This should not be part of a vertex shader, right ?

Good question. This seems to apply a highlighting to entities. In deck.gl layers, this is also called within the vertex shader. So either we are doing it right or they are doing it wrong. I suggest we look at this later and not as part of this PR.

@rubenthoms rubenthoms requested a review from w1nklr June 5, 2025 19:54
@w1nklr
Copy link
Collaborator

w1nklr commented Jun 6, 2025

BTW, shouldn't the 2 last lines of cellProperty.vs.glsl.ts and nodeProperty.vs.glsl.ts be removed ?

   vec4 color = vec4(0.0);
   DECKGL_FILTER_COLOR(color, geometry);

This should not be part of a vertex shader, right ?

Good question. This seems to apply a highlighting to entities. In deck.gl layers, this is also called within the vertex shader. So either we are doing it right or they are doing it wrong. I suggest we look at this later and not as part of this PR.

I gave a look and understand better.
These DECKGL_FILTER_COLOR, be it in vertex or fragment shader, allow users of the layer to inject custom behavior.
In particular, this is used by deck.gl for picking !
This mean that DECKGL_FILTER_COLOR should be in (nearly) each and every shader file.

I counted 14 shader files without DECKGL_FILTER_COLOR.
We probably don't want to apply that on the 4 axes2D shaders (axis2d is not really meant to display data and should be eventually be implemented not as a layer).
For other shaders (like for the north arrow or piechart ?), it is not sure that we want to pick them.

In any case, all (most) of them should apply the layer.opacity.

Here is the list:

# should support layer.alpha and picking (thus DECKGL_FILTER_COLOR)
src/layers/axes/box.fs.glsl.ts
src/layers/axes/box.vs.glsl.ts
src/layers/gpglLayers/triangleLine.fs.glsl.ts
src/layers/gpglLayers/triangleLine.vs.glsl.ts
src/layers/grid3d/line.vs.glsl.ts
src/layers/map/line.vs.glsl.ts
src/layers/triangle/line.fs.glsl.ts
src/layers/triangle/line.vs.glsl.ts
# should support layer.alpha
# and probably also not picking (thus no DECKGL_FILTER_COLOR)
src/layers/northarrow/northarrow.fs.glsl.ts
src/layers/northarrow/northarrow.vs.glsl.ts
src/layers/piechart/piechart.fs.glsl.ts
src/layers/piechart/piechart.vs.glsl.ts
# should not support picking (thus no DECKGL_FILTER_COLOR)
# and probably no layer.alpha (should be considered like the distance ruler)
src/layers/axes2d/label.fs.glsl.ts
src/layers/axes2d/label.vs.glsl.ts
src/layers/axes2d/line.fs.glsl.ts
src/layers/axes2d/line.vs.glsl.ts
# utility, should not be changed at all
src/layers/shader_modules/decoder.fs.glsl.ts

Do you feel to handle that in this PR, or do you prefer to handle that appart ?

@rubenthoms rubenthoms merged commit 7083782 into equinor:master Jun 12, 2025
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants