Stroke/ outline on selected mesh with an Alt text

How do we give stroke/ outline effect on a particular mesh with an Alt text, on mouse hover?

var OutlineLayer = pc.createScript('outlineLayer');

// initialize code called once per entity
OutlineLayer.prototype.initialize = function() {
    
};

// update code called every frame
OutlineLayer.prototype.update = function(dt) {
    
    var outlineSelector = this.app.root.findByTag('meshMito');
        outlineSelector.forEach(function (node){
            node.enabled = true;
                const outline = new OutlineEffect(app.graphicsDevice, 3);
            
                    outline.color = new pc.Color(0, 13, 5, 1);
                    outline.texture = texture;
                    camera.camera.postEffects.addEffect(outline);
        });
    

    
};

Hi @devstu,

The way the outline post effect works is you initialize it once and then you add a custom pc.Layer from any model you would like the effect to render on.

Check this engine example on how that works:

https://playcanvas.github.io/#/graphics/model-outline

3 Likes

I’ll check this out.