Set camera viewport to match plane

Hello,

If I have a png of resolution 1920 x 1080, and I want to display that pixel-perfect on a plane of width:1920 height:1080, how do I best set up a camera that will display this to fill the viewport perfectly?

I am planning on creating a parallax style application, with several planes distributed in the z axes.

hi change your viewport size and try run after you change it
this system depend to camera.fov and camera.position

https://playground.babylonjs.com/#A0C3XV

Thanks for that.

Do you know what the formula might be for setting the camera fov and position or how they should be decided?

it is mathematical formula but how that calculated

AF = 2 * atan ( HF / 2 * D ) ;

HF = 2* WD * tan ( AF / 2.0 )

1 Like