I am exploring the idea of creating portals using threejs by sketching an ellipse and then applying a WebGlRenderTarget texture mapping to its face. Currently, I have a function that partially works, but it attempts to stretch the large rectangular buffer from the render target onto the ellipse. What I am aiming for is to project the texture onto the ellipse in its original dimensions and remove any excess that does not align with the ellipse, as shown below:
Before Projection:
https://i.sstatic.net/3nSbp.jpg
After projection:
https://i.sstatic.net/UNDOG.png
I am seeking guidance on achieving this effect in threejs. I have explored texture coordinates, but I am unsure of how to implement them. Additionally, I came across a projection light PR in threejs that could potentially be useful?
Edit: I recently watched a video by Sebastian Lague on portals, where he utilized "screen space coordinates" for a similar effect. Any tips on using those effectively?
Thank you for your assistance!