Custom projections

Hello all,

I have tried experimenting with providing a custom projection using a custom project and unproject function.

It seems to work more or less as i expected the issue is it seems it does the projection only for the corner of the tiles (so when zoomed out project function is called somewhere around 8 tiles * 4 (corners)).
This only works for projections aligned to latitude and longitude (both available projections Web Mercator and Geographic Projection).

Would it be possible to somehow apply the project method to all vertices? Even more ideally in the vertex shader? Is this even feasible? Would other things still work like picking or similar?

Thank you for your thoughts and inputs!
Kind regards!

Hi,

It sounds like you’re trying to use a custom projection with a Cesium imagery provider? If so, you’re right: that isn’t going to work well unless the projection is aligned with latitude and longitude.

Extending it to support arbitrary projections would likely be quite complicated, and have significant performance implications. If at all possible, you should let a server do the reprojection instead. There is no shortage of servers that can do this, and the reprojected results can be cached.

Kevin

Hello Kevin,

thanks for your feedback. I was not thinking of a projection for an imagery provider but instead the mapProjection of the viewer new (The map projection to use in 2D and Columbus View modes) to actually modify how the vertices are mapped to 2D space.

I tested it a little and it kind of works for other projections with the limitation that it only does the projection function for the corners of the tiles and not for all vertices.

Maybe there is a way around?

Thanks again for your help and any comments and thoughts.

KR

Oh, ok, in that case you may be able to modify the vertex shader to do the projection on the GPU. See Source/Shaders/GlobeVS.glsl. Specifically, see getPositionPlanarEarth.

Kevin

Hello Kevin,
sounds interesting! Thank you for pointing me in the right direction!

I’m not sure when i will be able to get deeper into this, but if i can i will post some results if i get anything of interest.

Hey Daniel,

I’m in need of a similar feature. I’ve actually created the projections already, then hit a road block the same place you did… cesium doesn’t actually USE the projections to project the tiles. That’s done in the shader as Kevin mentions.

Are you interested in collaborating to get this done?

  • Dave

Hello Dave,

it has been some time, i actually tried to fiddle around with the shader and i got some interesting results (but i kind of forgot what i did, not sure if i have some code lying around) i remember the issue being that the shader applied the transformation function on each tile in local coordinates (so lets say between 0 and 1) and i did not find out how to get the global coordinate, meaning all tiles got the same transformation.
Not sure how you would like to approach collaboration, i'm happy to help where i can but i'm also swamped with work :slight_smile:

Hi Daniel,

Thanks for getting back to me so quickly, and sorry it took me so long to reply.

What I’m thinking of doing is creating a branch on my own fork of Cesium to work on this, then maybe have you work on that branch with me?

Once I get this setup and start working on it (which admittedly might be a while) I’ll ping you again to see if you’d still like to contribute.

- Dave