Camera texture fit to square


Im working on this ‘Spotify track’ filter. I am using the frame that has to stay in those proportions, and then the background. In between Im using Gallery Texture (changes on tap from square and rectangle in case people upload square image or 9x16) but I also wanted to add an option for people to use camera texture. Now this needs to fit into rectangle but the patch didn’t work for me correctly. What should I do? I’d really appreciate your help.

I have an example project that should help you. There’s some more info in this post, as well as a link to the project Detecting gallery texture state changes

1 Like

Another way would be to run the cameraTexture through a 2d Transform pack + Texture transform combo. You’ll find more details on this approach here :

Hi Josh,

I’m trying to fit camera texture again intro square but it ends up being distorted again. I tried using camera texture on the project file you shared here and same thing happens.

How can I create a square that won’t deform camera texture?
Here’s test link to the filter:

I’ve also tried. the method that Boris recommended but same thing happens :frowning:

Thank you!!

1 Like

Instead of setting scale, maybe just try setting the rect size to be relative to the screen.

Thank you! I may have to do that instead of using fit3Rect patch.

I think you’ll still need fit2rect, but I’m saying leave scale at 1 and only change the rect pixel size. What does your scene panel and rect props look like?

I just added orange background to the phone itself, so it covers any edges of the camera texture and mate the rectangle with camera texture smaller size . I couldn’t make it work so it only fits into square without any distortion so in this case this was my solution.