I actually want to outline an object from the beginning to the end of the game so I don’t need any extra functions, because otherwise it get too complicated.
I thought in the latest version of PlayCanvas there was the option to simply outline an object, but it looks like I misunderstood that.
Add or remove the OutlineLayer layer to any model.
Sadly no, without extending the post process effect to run once for each color. This is quite advanced and will also have a performance hit per color added.
I’ve extended the shader to use the alpha color value:
That’s the actual post process effect (shader) rendering the outline.
The applyOutline.js script is responsible for feeding data to the effect.
I really want to give my enemies a different outline color than my player. Is there really no way to do this? Is it even possible to outline multiple objects at once or will this also cause performance problems?
Adjusting the alpha color does not seem to have any effect in my game.
You need to fork again my project, I’ve made changes/extended the shader (posteffect-outline.js).
You can outline as many models as you like with the same color with the current script.
Sadly not with the current implementation. Someone will have to extend the postprocess effect to run one pass for each different color.
Or find a different technique to create an outline effect. The Playcanvas editor uses a different methodology, extending the material/shader for each model. Not easy to implement but you can study the Playcanvas editor source code, it isn’t minified.
Unfortunately, the outline is also not displayed properly on a mobile device.
Hopefully there will be an update in which this has been solved and also several colors can be used.
This is strange, not sure why you are getting this.
Usually it’s something with the project render settings that can mess up post process effects. I’ve tried all the combinations for the following flags, but the outline behaves and it’s placed correctly:
Have you also figured how to hide the outline behind certain mesh?
I would like the outline to appear only if not occluded.
Like the exemple shown here on the right:
I have checked everything again but cannot find any differences in project settings and so on.
Camera has the apply and click script.
Light and entity has the OutlineLayer layer.
The only thing I notice is that when I launch my project for the first time it starts in portrait and yours in landscape. When I change the orientation of the device to landscape everything works fine. However, when I change your project to portrait it still works well.