Hello folks,
I have an ifc model with 43 material on it:
When I place a clipping plane, the viewer decrease in performance. It takes 30 seconds to orbit the camera in some direction then another 30 seconds to rotate camera again
Is there any setup I should activate in order to clip tons of materials?
Best regards,
Miguel G
Can you please share more information how you define clipping planes in your application? Are you defining them on material or renderer level?
My bad, I’m using the IFC.js library to create IFCclipping planes:
const clipperIfc = ifcviewer.clipper;
clipperIfc.active = true;
const upsidePlaneIFC = clipperIfc.createFromNormalAndCoplanarPoint(
new Vector3(0, -1, 0),
new Vector3(
(box.min.x + box.max.x) / 2,
box.max.y,
(box.min.z + box.max.z) / 2
)
);
//1.b) ifcplaneMesh:turn off material
const mesh = upsidePlaneIFC.planeMesh;
mesh.material.opacity = 0.0;
and here you can find the source code:
}
createPlane = () => {
if (!this.enabled) return;
const intersects = this.context.castRayIfc();
if (!intersects) return;
this.createPlaneFromIntersection(intersects);
this.intersection = undefined;
};
createFromNormalAndCoplanarPoint = (normal: Vector3, point: Vector3, isPlan = false) => {
const plane = new IfcPlane(
this.context,
point,
normal,
this.activateDragging,
this.deactivateDragging,
this.planeSize,
this.edgesEnabled
);
plane.isPlan = isPlan;
which use an IfcPlane class:
Object3D,
Plane,
PlaneGeometry,
Vector3
} from 'three';
import { TransformControls } from 'three/examples/jsm/controls/TransformControls';
import { IfcComponent } from '../../../base-types';
import { ClippingEdges } from './clipping-edges';
import { IfcContext } from '../../context';
export class IfcPlane extends IfcComponent {
static planeMaterial = IfcPlane.getPlaneMaterial();
private static hiddenMaterial = IfcPlane.getHiddenMaterial();
readonly arrowBoundingBox = new Mesh();
readonly plane: Plane;
readonly planeMesh: Mesh;
isVisible = true;
enabled = true;
edgesActive = true;
which have a “plane” from Three js as props
Since you are using an IFC component for clipping, you might want to report this performance issue directly at the respective web-ifc repository.
Indeed, I tried the rough three js library, and works well in my Architecture models (+100 materials). Apparently, the issue comes from the IFC clipping commands. Going to report that
Thanks Mugen!