A "GPS" for exploring your planets

Started by AzurePlanet, November 05, 2007, 11:55:29 AM

Previous topic - Next topic

AzurePlanet

Hello, this is my first post here...  :)

I've made a spreadsheet for calculating the camera position (X, Y, and Z) and rotation at a given point expressed in altitude, longitude, latitude.
Let's say you want to know the X, Y, Z and rotation to look straight down on the planet surface at altitude 6000000 m, longitude 40° N, latitude 10° E.
Well, just type 6000000, 40, 170 (i.e. 180° - 10°, for East longitude) in the proper cells of the spreadsheet and you will get X, Y, Z and rotation to copy and paste in your camera and produce an image centred on that point in space.

In the attached zip file you will find these three files:
TG2-TP Positioning System.xls
GPS.tgd
earth grid small.jpg

Just a note on longitude and latitude to use in the spreadsheet.
According to a standard projected Earth map (i.e. North = Up, South = Down, West = Left, East = Right, and zero meridian in the centre), and how TG2-TP projects it using an "image map shader" with the default planet_01, you may use the following values.
Longitude: use values from 0 to 180 for East longitude westwards, and from 180 to 360 for West longitude westwards.
Latitude: use values from 0 to 90 for North latitude, and from 0 to -90 for South latitude.

I hope I'm quite clear in my explanation, however if you have any question just ask to me.

I've made an update...
Look further down for the updated file!

old_blaggard

Thanks for creating this!  I'm sure that this will be quite useful for people doing large-scale renders.
http://www.terragen.org - A great Terragen resource with models, contests, galleries, and forums.

Harvey Birdman

I haven't tried it, but it sounds pretty clever.
:)

rcallicotte

So this is Disney World.  Can we live here?

Will

The world is round... so you have to use spherical projection.

bigben

Thanks... This will be very useful for setting up camera positions for animations as well.

Another thing that would be useful is the calculation of the angle required to rotate the camera to level the horizon for a given X,Y,Z and camera heading. This can be a bit of a pain as well while you're exploring a long way from 0,0,0

AzurePlanet

I'm happy to see that my spreadsheet can be useful to other people...  :)

@ BigBen:
if you want to level horizon at a given X, Y, Z, just add 90° to the first rotation coordinate.
However, if you are at a very high altitude, you will look at open space doing this. So try adding a minor angle to see the planet.
Actually I haven't completely understood how to look left or right at a given point, but have some idea: while 1st rotation coordinate controls up/down camera movement, 2nd should control left/right and 3rd a twisting movement about its axis... I should experiment.  :-\
If I find the solution to this problem, I'll post an update.  ;)

A note about sunlight heading and elevation to use with my spreadsheet:
If your preview is black, probably it's because you are looking where it's night on the planet. This can be solved typing in sunlight heading the same value you use for longitude.
To get a realistic earthlike illumination, sunlight elevation should even vary from about -23° to 23°.

bigben

In the second scenario I mentioned, you could assume the camera is at the surface of the planet looking horizontally at a particular heading. I guess if your calculations position the camera so that it's looking at the centre of the globe with north to the top I could first roll the camera by it's final heading and then add 90 to the pitch.

AzurePlanet

I've tried to do some more calculation to achieve BigBen porpouse, but things become... very painful!  :'(
I was wrong about the meaning of camera rotation coordinates, they just look like pitch heading and twist, but only near origin point 0,0,0. More probably they are rotations about X,Y,Z axes.

bigben

I'm not complaining... I've considered this a few times, and it looked painful each time  ;)  Haven't sat down with enough paper to tackle it seriously yet. With a bit of luck someone with better math (than mine) will join in  ;)

Another useful thing would be a conversion to give an altitude from XYZ coordinates... as there's no roll/pitch angles involved this should be simpler.

AzurePlanet

Quote from: bigben on November 09, 2007, 05:39:36 AM
[...] Another useful thing would be a conversion to give an altitude from XYZ coordinates... [...]

I made a small update to my "GPS Calculator".
Now the file has two spreadsheets:

1. "Spherical to Cartesian"
1.1. You input your camera altitude, preview Vhight, latitude and longitude.
1.2. It outputs camera position (X,Y,Z), rotation to look straight down on the surface, and terrain altitude just below your camera.

2. "Cartesian to Spherical"
2.1. You input your camera position (X,Y,Z) and preview Vhight.
2.2. It outputs camera altitude, latitude, longitude, and terrain altitude just below your camera.

In the attached zipfile you'll find these files:
1. TG2-TP Positioning System 2.xls
2. Sea Colors.tgc
3. Land Colors.tgc
4. SF World Grid 2k color.png

You can use the two clips and the geographic grid texture if you want to colour your planets just like this one globe:
http://forums.planetside.co.uk/index.php?topic=2743.0

Arandil

#11
This is quite a nifty idea!  On a side note, there's folks on the Orbiter forums (http://orbit.m6.net/Forum/default.aspx) soaking in math like this, as they spend a great deal of time determining and managing orbital elements (especially the addon developers).   You might get a bite or two up there in the off-topic section.

EDIT:  Just put in the phrase "math question" alone and you'll get a significant number of the crowd to look that way.  ;D

EDIT: Looks like the Space maths and physics forum takes up more general questions too, just for fun:
http://orbit.m6.net/Forum/default.aspx?g=posts&t=16440

EDIT: I know there's some Terragen/etc. users on the forum there too.  I keep thinking there's got to be some interesting synergies to be found between the communities.

Cheers

bigben

This should also be helpful for calculating altitudes for the lake node... and cloud altitudes to place clouds at a specific height below/above the peak of a mountain.