Equipment preview - clipping texture

Hello, i am struggling with creating equipment preview. The setup i have is a viewport outputting this:


to a texture Texture2D equipmentPreviewTexture.

Texture2D equipmentPreviewTexture is then used as a background on a Lemur element. The issue i have is that the texture looks very squashed and stretched (due to mismatch in ratio of the texture and ratio of the Lemur element)

The 2 approaches i see here:
a) move the guy so that he is in the corner of the rendered scene and simply put a smaller resolution
b) set the Lemur element texture coordinates to match the rectangle (the rectangle would match the element ratio)


But i dont like this solution as i’d still need to render at screen resolution

Is there any elegant way to set the viewport to “see” only within this specific box? Any help would be greatly appreciated :smiley:

Nevermind, im painfully dumb:

        int width = 230;
        int height = 460;
        var equipmentShowcaseViewCamera = new Camera(width,height);

Resolved

1 Like

Curious: what kind of “Lemur element”?

And what component are you using to set the background texture? A QuadBackgroundComponent?

I know you already solved your problem but I also wanted to point out that a Label with an IconComponent in it would maintain the aspect ratio of the texture.

1 Like

As you mentioned, I am using a Label with an IconComponent, i think i described the issue wrong

1 Like