I’ve got two THREE.Points objects with material.transparent = true and material.opacity = 0.8. There’s also a THREE.Raycaster that displays up to 3 THREE.Mesh at the points that you click on either of the objects. These marker should always be displayed on top of the two objects. If the “marker” option is disabled in the settings, then the marker objects are removed from the scene.
I know that object.renderOrder handles material.transparent = true objects separately from regular objects, so I can’t use it for this.
In another thread it was recommended to render the extra object(s) separately:
renderer.autoClear = false;
function animate(time) {
controls.update();
stats.begin();
if(markerEnabled) {
requestAnimationFrame(animate);
renderer.clear();
renderer.render(scene, camera);
renderer.clearDepth();
renderer.render(marker1, camera);
renderer.render(marker2, camera);
renderer.render(marker3, camera);
} else {
renderer.clear(); //Added by me, not sure if this is correct
renderer.render(scene, camera);
}
stats.end();
}
However, this creates a delay of about a second between when the user clicks and when the marker is actually displayed (this didn’t happen before). Plus, by doing this, you apparently have to handle the depth and color buffers yourself and I honestly don’t know how/when to do that.
Is there another way that always displays the markers on top?