- Home /
dynamic hole in layer / texture / camera
To simplify this issue:
i have two layers, each containing multiple gameobjects. One layer (without the playercharacter) should be rendered on top of the other (with the playercharacter) with a hole (transparent spot) over the playercharacter, which also moves with the playercharacter. (note that not whole gameobjects on the top layer should be invisible just parts of gameobjects near the playercharacter)
Attempts to solve it:
render the top layer on an own camera with a higher depth value, then add a shader which creates a transparent spot over the playercharacter (the cameras would be locked over the playercharacter, but that is acceptable) to the camera on top of it with a script which postprocessed the output (Graphics.Blit in OnRenderImage). Unfortunately the shader draws it's output on top of the output of the top-layer-camera which makes the added transparency irrelevant and it seams like the shader gets the output of both cameras.
render the top-layer-camera image to a rendertexture and only Graphics.Blit the postprocessed graphic on the screen doesn't seem to work.
adding a rendertexture with a shader for the hole in front of the lower-layer-camera which is the target for the top-layer-camera would be an option, but i would need to change the size of the rendertexture depending on the screensize and it feels like there could be a better option.
Your answer
Follow this Question
Related Questions
How to use Camera.RenderWithShader() to modify rendered image? 0 Answers
Complex Depth Shader 0 Answers
Rendering a screen aligned quad with Graphics.blit - not working? 0 Answers
Save a texture after a pass in shader 0 Answers
Scissor test/early rejection 2 Answers