Hey guys,
I’m working on a project for a 3D Viewer on which I create a ground with a PBRMaterial with a Mirror Texture to reflect a 3D model on it.
I was working on Babylon 4.2 and the MirrorTexture was working fine, but I just upgrade to the 5.02 version and after that, I had a bug on the reflextion, like if now is reflecting on the wrong axis.
After some research, I get into the line of code that I needed to solve the problem and it was the useRightHandedSystem = true flag, if I change it to false, the reflection work perfectly. However, all the textures get mirrored. The licence plate should show 3DC.
I also found that almost all the test are made in Babylon left handed system, so it is usual to have some bugs on the right one.
This is my code for creating the MirrorTexture for the ground:
public createGroundDark(model: any) {
this.groundDark = MeshBuilder.CreateBox("mirror", { height: 100, width: 100, depth: 0.01 }, this.scene)
this.groundDark.rotation.x = Math.PI / 2;
this.groundDark.position.y = -3.5;
this.groundDark.isPickable = false;
const renderList = model.meshes;
this.groundDark.material = new PBRMaterial("mirrorMat", this.scene);
this.groundDark.material.diffuseColor = new Color3(0.25,0.25,0.25);
this.groundDark.material.emissiveColor = new Color3(0.1,0.1,0.1);
this.groundDark.material.reflectionTexture = new MirrorTexture("mirrorTex", 2048, this.scene, true);
this.groundDark.material.reflectionTexture.mirrorPlane = new Plane(0,-1,0,-3.5);
this.groundDark.material.reflectionTexture.renderList = renderList;
this.groundDark.material.reflectionFresnel = true;
this.groundDark.material.reflectionStandardFresnelWeight = 0.5;
this.groundDark.material.reflectionTexture.level = 0.5;
this.groundDark.material.reflectionTexture.adaptiveBlurKernel = 8;
}
Where model.meshes are all the bike parts. The 3D model get imported with ImportMeshAsync function that loads a .glb file.
Could you please check?