# \[SOLVED\] How do we size something using screen pixels

**URL:** https://discourse.threejs.org/t/solved-how-do-we-size-something-using-screen-pixels/1177
**Category:** Questions
**Tags:** coordinate-system
**Created:** [November 9, 2017, 10:42pm UTC](https://discourse.threejs.org/t/solved-how-do-we-size-something-using-screen-pixels/1177 "2017-11-09T22:42:20Z")
**Posts on this page:** 1
**Showing post:** 7

<div class="post-metadata">

### Author: ![trusktr](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/trusktr/32/13726_2.png) [@trusktr](https://discourse.threejs.org/u/trusktr)
#### Post date: [December 23, 2017, 5:15am UTC](https://discourse.threejs.org/t/solved-how-do-we-size-something-using-screen-pixels/1177/7 "2017-12-23T05:15:13Z")

</div>

I _was_ missing some basics, but since posting my last comment in this thread, I figured out the simple formula after doing some basic geometry with the frustum on paper:

> [@Functions to calculate the visible width / height at a given z-depth from a perspective camera](https://discourse.threejs.org/t/functions-to-calculate-the-visible-width-height-at-a-given-z-depth-from-a-perspective-camera/269/19):
>
> Aha! After taking a look at this again, I realized that instead of using these functions and a binary search, matching the Three.js perspective to CSS3d perspective boils down to a short equation: const perspective = 800 // this equation const fov = 180 \* ( 2 \* Math.atan( innerHeight / 2 / perspective ) ) / Math.PI // then align the Three.js perspective with the CSS3D perspective: camera = new THREE.PerspectiveCamera( fov, window.innerWidth / window.innerHeight, 1, 10000 ); camera.position.se…

Its a fun satisfying process. 😊

---

_[View the full topic](https://discourse.threejs.org/t/solved-how-do-we-size-something-using-screen-pixels/1177)._
