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

Regression of selected object's color when its opacity is 0 #1270

Open hamza-hajji opened 9 months ago

hamza-hajji commented 9 months ago

Describe the bug New version 2.4.2-beta-14 has different behavior than 2.3.x when setting a 0 opacity entity to selected

To Reproduce Steps to reproduce the behavior:

  1. Use the xkt_dtx_Schependomlaan example
  2. Set IfcSpace default opacity to 0
   const sceneModel = xktLoader.load({
      id: "myModel",
      src: "../../assets/models/xkt/v8/ifc/Schependomlaan.ifc.xkt",
      saoEnabled: true,
      edges: false,
      dtxEnabled: true,
      objectDefaults: {
        IfcSpace: {
          opacity: 0,
        },
      },
    });
  1. Select the Ifc spaces and select them

image

The material is deifferent from 2.3.9 behavior

Expected behavior

This is a screenshot after using the 2.3.9 build, using the same script as above

image

xeolabs commented 9 months ago

Seems OK in @xeokit/xeokit-sdk 2.4.2-beta-20 .. could you try again with this version?

hamza-hajji commented 9 months ago

I used 2.4.2-beta-20, now they have white borders

image

xeolabs commented 9 months ago

That's intentional (see https://github.com/xeokit/xeokit-sdk/pull/1253).

Note that the appearance of the selected objects, including the white borders, is configurable, eg:

  const viewer = new Viewer({
        canvasId: "myCanvas",
        transparent: true
    });

 viewer.scene.selectedMaterial.fillColor = [0.0, 1.0, 0.0];
 viewer.scene.selectedMaterial.fillAlpha= 0.5;
 viewer.scene.selectedMaterial.edges = true;
 viewer.scene.selectedMaterial.edgeColor = [1.0, 1.0, 1.0];
 viewer.scene.selectedMaterial.edgeAlpha= 1.0;
 viewer.scene.selectedMaterial.edgeWidth= 1;
 viewer.scene.selectedMaterial.glowThrough = true;
hamza-hajji commented 9 months ago

@xeolabs the original issue wasn't with the edges, it's about entities with opacity=0 not being filled when selected, it actually used to be filled in version 2.3.9

image