Sphere Mapping Textures

This forum is currently in read-only mode.
From the Asset Store
A template which allows you to customise the controls of your game.
  • Sorry, but I'm not totally following your thinking. If you apply the Lambert cylindrical equal-area projection in that rectangular texture you will only get some distortion near the equator line.

    And that's the whole point: 'some' distortion. I'm trying to minimize the polar distortion as seen in unprocessed textures. And therefore the pixels towards the poles have to shrink. I know that it will still look distorted, but way less.

    Pretty interesting that we get an almost undistorted projection when we first do the sinusodial prjection and afterwards the "rhombic" one. But as we found out, there is too much loss of texture quality (especially with no supersampling at all).

    Something that came into my mind while reading your last paragraph is that the original output from Noise2 is a square image. And thinking over this whole subject i realized that we've been working with rectangles the whole time. "Reconstructing" an imaginary square is impossible, too. Now what happens if we shrink down the square to half its height, but not dividing it by 2. Instead a sine-function comes into play. What do you think of this?

    something like this:

    <img src="http://dl.dropbox.com/u/6200498/moon.jpg" border="0" />

    polar distortion is there, but less than with an unprocessed texture.

    furthermore... thanks again for your time, and sorry for me being so neurotic on this topic <img src="smileys/smiley23.gif" border="0" align="middle" />

  • Ok, now is clear what you are trying to achieve.

    I made an example that halfs the height using a sine function. I think this is what you are looking for:

    Sphere-mapping-03

  • yo Animmaniac, thanks alot for your example. It shows the effect pretty well with the contained texture, but it does not work with with other textures.

    prr-sphere-mapping-03b.cap

    I get the feeling that canvas is not as reliable as it should be. If i change to different textures the processed output looks different everytime. It's odd...

    Maybe it's best to wait for an update of Noise2 with integrated distortion.

  • You could always design a sphere in say Wings 3d, wrap it there, and export the texture, and model to use with the 3d object.

    You could then use R0j0hounds texture switcher to swap the image.

    No idea if the textures would match up, but it might not be real bad if there's not a lot of detail.

  • yeah, that's a good technique newt. the point of this whole matter though was to use procedurally generated textures (noise2). generating random planets is pretty easy. fire up noise2 a couple of times, load it into a sprite's animation. for every planet, set animation & texure to the 3dobject like you said.

  • Here is Animmaniac's method tweaked to work with any sized texture. Also fixed an issue with my first example where a seam would show up from the Image manipulator being 0 based and the canvas being 1 based.

    http://dl.dropbox.com/u/5426011/examples10/sphereTex3.cap

  • sry to be so picky, but this can't be right. first, the aspcet ratio does not end up in 2:1. i think that's important for a sphere. second, the equator-pixels are distorted, too.

    let me illustrate what i mean:

    <img src="http://dl.dropbox.com/u/6200498/dist.jpg" border="0" />

    in addition, it should look something like this qarp, although the poles (top and bottom) have to be shrunk instead of stretched:

    <img src="http://dl.dropbox.com/u/6200498/cosp.jpg" border="0" />

    i discovered this when using a non pow2, 400px by 400px bitmap in the source-sprite:

    <img src="http://dl.dropbox.com/u/6200498/noise.jpg" border="0" />

    the effect gets more the bigger the image gets. pow2 is ok, but non pow2 not.

  • Fixed it some more:

    http://dl.dropbox.com/u/5426011/examples10/sphereTex3b.cap

    wow Rojo, you're the greatest! i could never have figured out that formular by myself, thank you so much =)

    can you briefly explain why you divided the 2nd loop and the first Y by 0.6? my (noobish) guess is that it has something to do with angles.

  • 0.6 is just a scaling factor. It's used in 4 places in events 3 and 4. If you change 0.6 to 1 the image won't cover the entire canvas.

  • and you found 0.6 by trial and error, or is it just pure knowledge? ;)

    my thanks also go to Animmaniac and newt, of course.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It was trial and error. I initially thought the height needed to be doubled or 0.5 but part of the image was cut off, so I tweaked it till I found a value that was close enough to look right.

  • How does this work with 360 HDR images?

    hdrmill.com/Freebies.htm

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)