pex-gl / pex-cam

Cameras models and controllers for 3D rendering in PEX.
MIT License
2 stars 3 forks source link

Agree on orbiter orientation #22

Open vorg opened 5 years ago

vorg commented 5 years ago

Currently orbiter is using latlon-to-xyz and xyz-to-latlon to convert spherical coordinates to xyz position. How those 2 relate to each other is matter of convention. The convention assumed in the current implementation assumes that lat:0, lon:0 is point [0, 0, 1] therefore orbiter is located at +X axis looking towards -X axis. This is to make it compatible with lat/lon coordinates of a textured sphere from https://github.com/glo-js/primitive-sphere often used for globe rendering. The problem is that this is agains default OpenGL convention where default camera is positioned +Z axis looking towards -Z axis.

vorg commented 5 years ago

What can we do:

  1. nothing, just add docs and use orbiter.set({ position: [x, y, z] }) for orienting the camera.
    • Problem: expected minLon, maxLon is from e.g. -PI/2, PI/2 but in this case the correct values are -PI, 0
  2. change pex-renderer Orbiter only but adding +-PI/2 to all xyz2latlon transformations
    • Problem: now orbiter lat/lon doesn't match geo position (gps) lat/lon
  3. Add new theta/phi parameters that behave in "WebGL way" (0 deg is +Z)
    • Problem: conflicting set of constrains would be possible if we add minTheta/maxTheta on top of minLon/maxLon
vorg commented 5 years ago
screenshot 2019-01-31 at 14 31 11

Current pex-renderer behaviour. Longitute 0 is on the right +X to make it match longitue 0 on a equirectangular earth texture (given primitive-sphere uv coords)

iu-2

vorg commented 5 years ago

Three JS

screenshot 2019-01-31 at 14 36 11
vorg commented 5 years ago

The conclusion is not to touch lon and lat and introduce theta = lon - 90deg and phi = lat

dmnsgn commented 1 year ago

v4: move this to pex-cam