- Home /
Apply Shader to overlay GUI
Maybe dumb question but i have stumbled around for over an hour now so i think it's fair to ask now.
I have two cameras. One for the game and one for a GUI overlay (which is made of 3d objects) I want to apply a shader only everything the GUI overlay camera's view but when i try to do so it applies the shader to the whole screen.
ClearFlag is Depth Only for the GUI camera and codesnippet is the script.
public class pixelate : MonoBehaviour
{
public Material effectMaterial;
private void PreRenderImage(RenderTexture source,RenderTexture destination) {
Graphics.Blit(source,destination,effectMaterial);
}
}
Comment
What exactly is the PreRenderImage method and how is it being called? Ordinarily, post effects are just done through OnRenderImage, so I'm interested to know how you're implementing filters.
Your answer
![](https://koobas.hobune.stream/wayback/20220612205954im_/https://answers.unity.com/themes/thub/images/avi.jpg)