Masking a Render Texture?
Hello everybody!
I've been attempting to mask a render texture and I can't seem to get the hang of it.
I'm making a cheap re-make of Portal (the game by Valve) for a school project and I have a render texture that's being used to render the portals.
However, the render textures are square and the portals are egg-shaped.
This is why I need to figure out how to mask the edges.
First off: My unity version is 2017.1.2f1
I tried watching YouTube tutorials on this matter to no avail. One video showed right clicking on an image, going into "2D Objects" and clicking "Sprite Mask".
It sounded promising until I realized that:
Sprite Mask's only work on Sprite Renderers, and since I'm using render textures they are not sprites. I tried looking at the settings on the texture to see if I could make it into a sprite...
However, there is no option for it since these are render textures, not regular textures.
So my question is this.
Is it even possible to mask out a render texture?
If so then how do I do it?
If it's not possible then is there a workaround or a different approach you can recommend to me?
Thanks in advance for your help with this!
PS: Check my comment on this post to see what image I made for the mask.
I was limited to 2 images on this post. This is the mask I have created. It's just a white egg-shape, The black in the background has since been removed from the image since I learned that it wasn't needed. I'm only showing the black background version for display purposes on this website (since a white egg-shape on a white website background wouldn't show)
Answer by Darkforge317 · Dec 04, 2017 at 10:19 PM
My teacher figured out a good alternative...
Posting it here if others are having a similar problem.
I made a cylinder, gave it a rotation of 90 degrees on the x axis, and then scaled the Y axis down to 0.001.
This makes it so that the cylinder is basically a circle. So applying the render texture to this object gives me the same desired effect.
Your answer
![](https://koobas.hobune.stream/wayback/20220612143923im_/https://answers.unity.com/themes/thub/images/avi.jpg)