Hacking terrain shaders

Hey there, I’m doing planetary renderer. While I’m being stuck at quadtrees I’ve decided to try and reuse terrain shaders provided by jme3.

What I wanted to do is to map terrain to sphere, so I did this:

    inPosition = normalize(inPosition);
    inPosition *= 100;
    gl_Position = g_WorldViewProjectionMatrix * vec4(inPosition, 1.0);

And this was the result:

So my question is, can I somehow map 6 TerrainQuads to a Sphere or am I stuck writing everything from scratch?
And if so do you have any tips because I’m not doing too well so far. (got weirdly working quadtree so far)

Not the easiest thing in the world to do, but thankfully somebody already did it: Jmeplanet

How would you go about placing models on such planet? There is no heightmap to refer to, should I raycast to find positions?

It seems the most appropriate way all things considered, but there must be a heightmap generated at some point. It may just be that it isn’t exposed directly.

There is no heightmap, values are being taken directly from math function, ive tried exposing unit vectors of a sphere though but it didnt work

Well use the same math function to get your height values…