# Outerra forum

• July 05, 2022, 05:42:57 pm
• Welcome, Guest
Please login or register.

Login with username, password and session length

### News:

Outerra Tech Demo download. Help with graphics driver issues

Pages: [1]

### AuthorTopic: projection  (Read 4650 times)

#### knackered

• Jr. Member
• Posts: 26
##### projection
« on: September 21, 2011, 03:49:50 pm »

could you describe your algorithm for converting from a cylindrical projection to your quadrilateralized spherical cube please?
Logged

#### cameni

• Brano Kemen
• Outerra Administrator
• Hero Member
• Posts: 6718
• No sense of urgency.
##### Re: projection
« Reply #1 on: September 21, 2011, 04:48:06 pm »

The javascript code used in the Map for testing tile allocation contains the routines used for the conversion.

Here's the description of math for a basic version http://mathproofs.blogspot.com/2005/07/mapping-cube-to-sphere.html
Our version additionally tries to correct the uneven subdivision length along the cube face.
Logged

#### knackered

• Jr. Member
• Posts: 26
##### Re: projection
« Reply #2 on: September 21, 2011, 07:47:17 pm »

thanks, very generous of you.
Logged

#### knackered

• Jr. Member
• Posts: 26
##### Re: projection
« Reply #3 on: October 12, 2011, 05:59:02 am »

is your planetary model a sphere or an oblate spheroid?
Logged

#### cameni

• Brano Kemen
• Outerra Administrator
• Hero Member
• Posts: 6718
• No sense of urgency.
##### Re: projection
« Reply #4 on: October 12, 2011, 06:01:44 am »

A sphere, not doing the adjustment to spheroid yet.
Logged

#### knackered

• Jr. Member
• Posts: 26
##### Re: projection
« Reply #5 on: October 12, 2011, 12:28:29 pm »

thanks.
One more thing - do you convert from cube to sphere in the vertex shader? or do you generate patch vertices with this transformation already applied?
i'm having a hard time working out how to localise the patches while also applying this cube-to-sphere projection....i need to be working at the earths radius to get the correct deformation, but then i can't do double precision in the vertex shader....
Logged

#### cameni

• Brano Kemen
• Outerra Administrator
• Hero Member
• Posts: 6718
• No sense of urgency.
##### Re: projection
« Reply #6 on: October 12, 2011, 02:35:04 pm »

I'm generating all terrain meshes in shaders, but the algorithms change depending on the quad-tree depth, which is related to required precision. Up until a given level it generates the coordinates normally in a global coordinate system using floats, as the precision is satisfactory. From that level on it uses a local coordinate system, interpolating the vertices between tile corners linearly or with a curvature correction, but the curvature error is like 0.02m on 2km so it can be also neglected.

You may also want to check the 3D Engine Design for Virtual Globes book for other approaches.
Logged

#### knackered

• Jr. Member
• Posts: 26
##### Re: projection
« Reply #7 on: October 13, 2011, 12:49:14 pm »

oh i had an 'orrible feeling you were going to say that. Thought I'd missed something elegant.

i've read that book and it's terrible. There's absolutely nothing in it that's not already thoroughly covered in many articles and papers linked to from vterrain.org. I bought it online and consider it an expensive mistake.
Logged
Pages: [1]