Jump to content

Texture "curvature".


Recommended Posts

Hello everyone!

I'm currently coding something to generate random planet textures at runtime in KSP.

So far, so good, the main problem is, textures are meant to be used on flat surfaces, and need to be distorded at the poles.

Is anyone aware of an algorithm to do this? Computation speed is not an issue.

Thanks in advance!

Link to comment
Share on other sites

At least on the navball, squad used an equirectangular projection during uv mapping. So its rather likely they did it on the planets, too, especially as the equirectangular projection gives the distortion in width of texture vs width of area covered by the texture when moving from the equator to the poles.

So it depends from where your internal data model starts. If you starting with a sperical model on where you generate yur data you have to apply an equirectangular projection. If you generating data directly on a plane than you need something of a negative equirectangular projection. (or nothing at all if you can live with the fact that the generated data will be a bit distorted on the poles.)

Edited by InsaneDruid
Link to comment
Share on other sites

Thanks. Textures are generated for a plane shape, so I need to distord them as a "second pass".

Note that textures are created by a fragment shader, and converted to a texture2D via a rendertexture. I can probably write it to map the texture to a sphere directly, but I'm not that good with shaders yet.

If I trust this website http://paulbourke.net/geometry/transformationprojection/ , the solution is to "simply use the polar angles directly as the horizontal and vertical coordinates".

Doesn't seems too complicated, I'll see how it turns out.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...