Camera Shader with a specific shape

I want to create such shader which creates “frame” around scene. The problem is in creating shape of camera. Do u have any ideas?

Hi @sAp and welcome,

If the effect is meant to be static then you don’t need to use a shader. You can achieve the same effect by:

  1. Overlaying a full sized image element with a material mask in a 2D screen.

  1. Add a custom material and use your black/white mask in the Opacity channel:

image

Now the black parts of the mask will not be rendered allowing your game to render through.

The problem is that mask should not exclude the game objects. It should outline them into white color as in the picture

Then yes, most likely you will need a post process effect, some sort of outline effect.

I don’t have in mind a certain effect, you can check these example projects on how to get started with post effects in PlayCanvas.

https://developer.playcanvas.com/en/tutorials/?tags=posteffects

I have the outline effect on the whole camera, but how to apply this effect on the specific mask only? Thanks for helping a lot:)

You can add your mask as a texture uniform to your shader and use it with your outline color with that.

Wherever the mask is black the outline can be 0.0 that way.

Though I am thinking if you use a UI image element with the same color as the outline, if they match the outline will be hidden. It depends on your setup I think.

2 Likes