Hi,
I have tried to include reflector on my viewer and I got the following strange behaviour :
the reflection on the ground has lost z-index amongst components and all components are transparent :
Here is the code I use :
createGroundMirror: function () {
if (this.BoundingBox === null) {
return;
}
this.scene.remove(this.groundMirror);
this.groundMirror = null;
var size, division;
if (Math.round(this.DiagonalLength / 2) === 0) {
size = 10;
}
else {
size = Math.round(5 * this.DiagonalLength);
}
var geometry = new THREE.PlaneBufferGeometry(size, size);
this.groundMirror = new CustomReflector(geometry, {
clipBias: 0.003,
textureWidth: this.Viewer.Config.CurrentWidth,
textureHeight: this.Viewer.Config.CurrentHeight,
color: this.Config.GroundColor,
recursion: 1
});
var minb = Math.abs(this.BoundingBox.box.min.x);
if (Math.abs(this.BoundingBox.box.min.y) < minb)
minb = Math.abs(this.BoundingBox.box.min.y);
if (Math.abs(this.BoundingBox.box.min.z) < minb)
minb = Math.abs(this.BoundingBox.box.min.z);
var pPosition = this.SceneCenter.clone();
var distance;
if (this.Viewer.Engine.Camera.Config.FieldApplicationViewMode === "Industry") {
distance = -(Math.abs(this.SceneSize.y / 2 + Math.min(this.SceneSize.y, this.SceneSize.x, this.SceneSize.z) / 8));
this.groundMirror.rotation.x -= Math.PI / 2;
pPosition.y += distance;
} else if (this.Viewer.Engine.Camera.Config.FieldApplicationViewMode === "Architecture") {
distance = -(Math.abs(this.SceneSize.z / 2 + Math.min(this.SceneSize.y, this.SceneSize.x, this.SceneSize.z) / 8));
pPosition.z += distance;
}
/////
this.groundMirror.position.copy(pPosition);
this.groundMirror.userData.initPosition = pPosition.clone();
this.scene.add(this.groundMirror);
this.groundMirror.material.needsUpdate = true;
}
I get the problem does not come from the reflector itself but another component on the scene, thus, does anyone have an idea what could be the source cause ? (light may be?)
Thanks for your help.