Is there a way to do multiple shader passes?

Hi,

I’m currently trying to implement an outline shader as the one we currently use is too performance intensive on Retina screens!

I found a shader on the web that does not need to read a fullscreen texture multiple times per frame but simply displace the model by its normals along with front face culling and some other stuff. I assume this would yield better performance.

Alas, this shader requires two passes, one rendering the model and one displacing it to draw the outline, and I don’t see how I could do this in Playcanvas so any help would be appreciated!

Thanks in advance!

I think your best bet here would be to create an additional camera with higher priority, so that it renders on top. Disable any clears on it. Meshes that you need outlines on would be in the main camera, but additional add them to this camera. I think you’d need to clone the entities and change their materials to the outline pass material.

1 Like

Actually, if you clone the entities as I suggested, you don’t need additional camera. Just have additional layer on the same camera that renders perhaps after all opaque layers. And add those cloned entities with outline hull shader to it.

2 Likes

Yes, I managed to make it work, thanks a lot !

1 Like