Highlight Layer Doubling Indices, lowers FPS

Is it normal that a highlight layer would double the active indices, faces, and draw calls (but not mesh) in a scene when enabled? This dramatically lowers FPS.

I have a simple mouse over action controlling this turning on, and my mouseout is almost identical except I removeMesh instead of addMesh to the highlight layer.

function projectOnMouseOver(node: any){
            let targetUID = parseInt(pwtHelp.findTransformParent(node));
            let targetNode = pwt.nodes[targetUID].stage.stageRoot;
            let theChildren = targetNode.getChildMeshes(false, (mesh:any) => {
           //Filters out Instanced Meshes since they cause the highlight performance and console spam
                if(mesh.getClassName() === "Mesh"){
                    return true;
                return false;
            for(var child of theChildren){
                pwtControlActions.highlightLayer.addMesh(child, Color3.Blue());

It is expected to have more draw calls as meshes in the highlight layer will be drawn in a offline buffer in addition to their regular rendering.

However, a repro in the playground would help having a better view of the problem.

Seeing this as well.

We have a hint system which highlights items the user should interact with. Whenever it blinks on the draw calls/indices/faces all double.

I don’t really have an appetite to write a custom shader. Are there alternatives to cut down on the overdraw being done here? Seems like the entire scene is being redrawn rather than just the area involved with the highlight. Can I set things like the outside room/walls to not interact with this feature?

Note the highlight is blinking on/off and there is a delay so I think the stats are reversed. The white highlight image should have double draw calls/faces/indices while the one without the white highlight on the valve on top of the tank should have half. So flip flop the stat screens on these images.

Think I found the answer:

I just looped through our imported scene and added that to each mesh and it now is much much better.

Annnnd I take that back. That may have helped but I still saw a spike when multiple hints triggered. I think the real issue was that I had multiple highlight layers.

Maybe the two issues combined doubled up.

Yes, multiple highlight layers means multiple additional passes, so you should try to use a single layer if possible. And addExcludedMesh is indeed the way to avoid some meshes being added to the layer and saving some perf.

1 Like