2d-pixel-perfect icon indicating copy to clipboard operation
2d-pixel-perfect copied to clipboard

Stretching pixel-perfect viewport by 1.2 vertically?

Open elvisish opened this issue 7 years ago • 1 comments

I'm looking through PixelPerfectCameraInternal trying to find the right place to stretch the viewport height by 1.2, so effectively every pixel appears to be 1/5 taller than it is wide, to emulate the old 320x200 to 320x240 CRT aspect ratio correction. I understand the viewport will render outside of the screen, which is fine since I'll be designing everything to fit in the section that is within the screen. Which part of the script/class should I modify to allow this? Here's an example: image The left is square pixels, the middle is what would happen if the rendertexture at the reference size were stretched, and the right image is what would happen if the upscaled rendertexture were stretched. You end up with nice, 1:1.2 width/height pixels, whereby the width of the pixel is the same, but the height is now 1.2, as it has been stretched after the upscale, which is allowing this.

elvisish avatar Sep 12 '18 16:09 elvisish

I'm still trying to figure this out. Camera mainCamera = GetComponent<Camera>(); mainCamera.aspect = mainCamera.pixelRect.width / (mainCamera.pixelRect.height * 1.2f); doesnt work, if i try this in start, it appears within the viewport rather than exceeding the screen height as it should, creating mushed looking pixels. if i put it in update, the screen keeps squashing until it disappears to black anyone that knows about this, i'd be very grateful for any help; ive been trying on and off with this for three months.

elvisish avatar Dec 01 '18 19:12 elvisish