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

[BUG - ColorLayer] ColorLayer rendering issue on firefox with planar view #2236

Closed
ketourneau opened this issue Dec 5, 2023 · 1 comment · Fixed by #2245
Closed

[BUG - ColorLayer] ColorLayer rendering issue on firefox with planar view #2236

ketourneau opened this issue Dec 5, 2023 · 1 comment · Fixed by #2245
Assignees

Comments

@ketourneau
Copy link
Contributor

ketourneau commented Dec 5, 2023

Your Environment

  • Version used: 120.0.1
  • Browser Name and version: Firefox
  • Operating System and version (desktop or mobile): macos (sonoma)
  • Link to your project: github source code

Context

We used a WMS source (to render a GeoTiff) with a ColorLayer and a PlanarView and with map background.
We want to replace white color of WMS source by transparency so we try to use effect type:2 on ColorLayer (applyWhiteToInvisibleEffect).
But it seems to render black color in firefox so we apply custom effect type.

Steps to Reproduce (for bugs)

online demo

  1. Use firefox and open online demo link
  2. Expand Color Layers and expand GeoTiff layer
  3. Set effect_type to 2 (applyWhiteToInvisibleEffect)

Expected Behavior

With effect_type:2 on ColorLayer => white color must be invisible (on all browsers).

firefox_effect_type_custom

Actual Behavior

With effect_type:2 on ColorLayer => white color is replaced by black color (only on firefox, it's working on chrome).

firefox_effect_type_2

Possible Cause/Fix/Solution

It seems it's caused by applyWhiteToInvisibleEffect.

I think we can replace line 29 by color.a = 0.0.

It's how we fix it in our demo.

@ketourneau ketourneau changed the title ColorLayer rendering issue on firefox with planar view [BUG - ColorLayer] ColorLayer rendering issue on firefox with planar view Dec 8, 2023
@Desplandis
Copy link
Contributor

Desplandis commented Dec 15, 2023

Hi and thanks for your detailed bug report!
I managed to easily reproduce this issue and agree with you on the cause of the bug.

The different type of effects on color layers are clearly not well-documented (especially the effect_parameter layer property which is passed to the shader as a per-layer uniform).

In the case where effect_type = 2, effect_parameter is passed as the intensity parameter of applyWhiteToInvisibleEffect and is used in line 29. Since we do not set a default value to effect_parameter it is passed as undefined to the shader (which could be implementation-defined behavior).

Moreover, I too question the need for line 29 since $a \in [0.99, 1.0]$ at this point. Since this is not documented, we could either:

  • set the opacity to 0.0
  • factor the opacity by the intensity

I'll open a PR fixing those three issues (documentation, undefined and shader code)!

Desplandis added a commit to Desplandis/itowns that referenced this issue Dec 20, 2023
Closes iTowns#2236:
- Fix undefined value passed to uniforms effect_type and
  effect_parameter
- Remove useless intensity parameter of applyWhiteToInvisibleEffect
  function
Desplandis added a commit that referenced this issue Dec 22, 2023
Closes #2236:
- Fix undefined value passed to uniforms effect_type and
  effect_parameter
- Remove useless intensity parameter of applyWhiteToInvisibleEffect
  function
AnthonyGlt pushed a commit to AnthonyGlt/itowns that referenced this issue Feb 22, 2024
Closes iTowns#2236:
- Fix undefined value passed to uniforms effect_type and
  effect_parameter
- Remove useless intensity parameter of applyWhiteToInvisibleEffect
  function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants