I hope I’m explaining this correctly, but what I’d like to do is figure out a way to render a camera onto a scene such that parts of the camera (for example, the edges) can be rendered clear and semi-transparent. An example would be if the camera view had a border that gradually faded out to the edge, so that the main camera view was opaque, but near the edge it would gradient from opaque to completely transparent. I can do that fine with a texture WITHIN a scene, but not with a camera rendering above another camera. Let me try to illustrate it with this image:
So the view in the upper-right camera shows whatever the camera’s seeing, but the edges of the camera are semi-transparent and you can see the main camera view behind it. Does anyone know how to do this, or if it’s even possible? I imagine it’d require some kind of shader that works like a transparent shader, but instead of rendering the texture, it would render the camera’s clear color?
So I assume you’re rendering the second camera through a viewport that only shows it in that upper right area of the screen.
Instead, have your second camera render to a RenderTexture (which you create inside your asset folder… Right-click → Create → Render Texture). Now display that texture on a quad attached to your main camera using a material that uses a mask to soften the edges. Let me know if you’d like me to get into a little more detail.
Skimming through the built-in shaders, I don’t see any that take a mask, so you’ll probably need to make a custom shader to do this.
So basically you need a shader that takes in two images: one of them is your RenderTexture from the secondary camera, and the other is your mask. The mask image should basically be like the fuzzy green square in your screenshot. When you go to output the final color in your frag program (or surface output in a surface shader), you set the RGB to the RGB from your camera render texture, and your alpha to the alpha from your mask texture. This way, you’ll have the image from your secondary camera, but it will have the alpha fuzziness of your mask image.
Let me know if you need help with any of that or if that was too confusing.