Hi All,
I’m having extreme difficulty get this to work.
I am attempting to do post processing by implementing OnRenderImage on the camera gameobject
The post processing idea is to simply overlay an additional image (Texture2D) over top of the source and then to Blit the changed source onto the destination.
Here is code:
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
Graphics.Blit(tex2D,source);
Graphics.Blit(source,destination);
}
tex2D is my external Texture2D (Note that I can encode it to png and save it, and it appears valid in the saved file)
The problem is that no matter what I do I get a gray screen in the window. I have tried everything!!
A few things:
- OnRenderImage IS being called, this is not a pipeline issue. In fact I have two other post processing effects that work perfectly
- I realized I have to take the imported image file (I’ve tried both png and jpg, dragged into my Unity project), and make the “Texture type” (Sprite (2D and UI)) - Until I did that, the texture would not encode to PNG and appeared to be invalid.
3). I’ve tried creating a RenderTexture and Blitting my text2D into that, no help there
- If it matters this implementation is using the VideoPlayer to display the Skybox
- when I stop PlayMode, the screen flashes momentarily with what I WANT !!! It’s like the gray screen is hiding my results and somehow they appear very briefly as the playmode is shutting down
and probably others.
Does anyone know why I would be getting a gray screen simply by attempting blit a Texture2D into the source and then blitting the source into the destination ?
Any help is hugely appreciated