Highlighting only 1 meshInstance

hi,
is it possible to highlight only 1 meshInstance of a model?
I tried using model-outline example(it puts the outline to an entire model). how can we highlight only one meshInstance(only a portion) of a model.

Hi @savyashree_a,

That’s possible yes, the outline effect is being rendered on a specific scene layer. So instead of adding a model component to that layer you can go the other way and specific mesh instances to the layer.

Something like this:

outlineLayer.addMeshInstances([meshInstance]);
2 Likes

Thank you @Leonidas

Hi @Leonidas
when we applied this highlighting concept in our project for particular meshes, we are facing an issue.
when we launch the project from the editor, highlighting is working fine But when we create a build, highlighting is either duplicating(like image 1 ) or the region getting highlighted is larger than the mesh
image image 1

Hi @savyashree_a,

You need to resize the effect render target each time the window is resized. Which I think is the case on start with the iframe approach.

I’ve done that here, on an editor based example:

https://playcanvas.com/project/682988/overview/model-outline

1 Like

@Leonidas
i have used the same code
but instead of entire model we have applied it on a particular mesh

Not sure what’s the issue, on the project I’ve posted I’ve tried a build and it works as expected. Can you try posting a sample project that reproduces the issue to take a look?