nickponline
nickponline

Reputation: 25914

How do I fit a textured quad to fill entire frustum of orthographic camera in threejs?

I would like to fill the frustum seen by an orthographic camera with a texture quad. What is the easiest way to do that so I don't get gaps on the sides or above where the scene background (GREEN) appears.

enter image description here

Upvotes: 0

Views: 102

Answers (1)

M -
M -

Reputation: 28462

The x-scale of your square should match the ratio between viewport width / height. You didn't post a single line of code, so I'm just going to assume you're using a regular plane and the window object for your canvas sizing:

const ratio = window.innerWidth / window.innerHeight;
plane.scale.x = ratio;

Upvotes: 1

Related Questions