xeokit / xeokit-sdk

Open source JavaScript SDK for viewing high-detail, full-precision 3D BIM and AEC models in the Web browser.
https://xeokit.io
Other
714 stars 286 forks source link

Setting opacity for selected elements does not make them see through #1320

Open hamza-hajji opened 8 months ago

hamza-hajji commented 8 months ago

Describe the bug

If I set an element as selected and set its opactiy, it is not see through

To Reproduce Steps to reproduce the behavior:

  1. Go to https://xeokit.github.io/xeokit-sdk/examples/buildings/#xkt_vbo_Duplex
  2. Set an element as selected entity.selected = true
  3. Set is opacity to 0.5
  4. It's opaque

Expected behavior

In 2.4.x, it is see through, but that behavior changed in 2.5.x

image

Screenshots

viewer.scene.input.on("mousedown", (coords) => {
  const hit = viewer.scene.pick({
    pickSurface: true,
    canvasPos: coords,
  });

  if (hit) {
    hit.entity.selected = true;
    hit.entity.opacity = 0.5;
  }
});

image

xeolabs commented 8 months ago

This is a duplicate of https://github.com/xeokit/xeokit-sdk/issues/1335

It's only happening for batched triangle geometries using VBO scene representation.

A workaround for now is to enable data textures, for which this does not happen - see this example: https://xeokit.github.io/xeokit-sdk/examples/buildings/#xkt_dtx_RACHouse