I have created a semi transparent cube(opacity 0.5) which acts as a pointer. When the user taps the screen, the cube and the material are cloned and the opacity is set to 1. I’m using blendType pc.BLEND_NORMAL.
After placing a cube, when I move the pointer around the placed cube sometimes gets occluded. When the pointer is infront of the cube, it works as expected, but when the pointer is halfway through the cube, it gets occluded.
Hmm, not sure if it’s a bug with a blending mode and the transparent canvas … what are your camera’s near/far planes? Try narrowing their margin (increase near plane / decrease far plane) just in case it’s a sorting issue.
does the other opaque cube has any transparency set?
if one is opaque, and one transparent, opaque should always render first and so should never be occluded. Do you have a simple repro to try?
This is how I’m creating the semi-transparent pointer:
var material = cube.model.meshInstances[0].material;
material.opacity = 0.5;
material.blendType = pc.BLEND_NORMAL;
material.update();
And this is how I’m creating the opaque cube:
var cubeclone = this.object.clone(); //this.object is the original cube
var materialclone = this.object.model.material.clone();
cubeclone.model.meshInstances[0].material = materialclone;
materialclone.opacity = 1;
materialclone.update();
Unfortunately, it seems the issue still persists. Now whenever I hover the semi-transparent pointer over the opaque cube, the opaque cube also becomes semi transparent. You can see the wooden floor when my pointer is over the opaque cube.