Settings

Theme

Show HN: Reverse perspective camera for OpenGL (Three.js)

github.com

52 points by bntr 2 months ago · 9 comments · 1 min read

Reader

I've extended the standard OpenGL camera to allow smooth transition between normal perspective, orthographic, and reverse perspective projection. To demonstrate the effect, I built a demo using Three.js.

Reverse perspective can feel a bit disorienting at first, but this demo is meant to highlight a few of its interesting advantages:

1. An extended Dolly zoom effect. https://en.wikipedia.org/wiki/Dolly_zoom

You can think of it as an extrapolation of the classic Dolly zoom into negative space. It produces a cinematic sense of vertigo or sudden insight, and also lets you pull the camera back from an object without distracting the viewer with surrounding geometry.

2. A wider and more complete spatial view.

Near objects no longer obscure distant ones; the viewer can see both the façade of a building and what’s happening on its roof, or even behind it.

Code and details: https://github.com/bntre/reverse-perspective-threejs

tobyhinloopen 2 months ago

Link to live demo linked on the github -> https://bntre.github.io/reverse-perspective-threejs/

Well that is just the right amount of nauseating, trippy and interesting

JayStavis 2 months ago

this is really neat. going to try it out with a creative coding tool I've been playing with.

are there any performance considerations to consider here relative to standard three cameras (either perspective or orthographic) ?

  • bntrOP 2 months ago

    No performance hit - it's just a custom projection matrix. The rest of the rendering pipeline works exactly the same as with a normal camera.

msk-lywenn 2 months ago

Makes me feel the z-test should be reversed in reverse perspective mode but maybe it would just be even weirder?

  • recursive 2 months ago

    That seems like it's just normal perspective from the opposite direction.

    • bntrOP 2 months ago

      Exactly. Reversing the z-test is one way to get a reverse-perspective effect, but it doesn't allow for a smooth transition between projections (like dolly zoom).

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection