oppenheimer's Forum Posts

  • i won't forget your solution and ideas newt, it might come in handy in the future.

    with lucids help in the chat it turned out out that some sort of cosp plays a role in this matter:

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

    which is this:

    cosp(0,IM.GetImageHeight,LoopIndex("j")/IM.GetImageHeight)

    but it exaggerates the distortion i tried to work against.

    i can imagine that a sine-interpolation would be needed here.

    something like this:

    Lerp(0,IM.GetImageHeight, Sin(LoopIndex("j")/IM.GetImageHeight))

    But it's just a pixel mess.

  • OK, i almost got it.. long story short:

    "Lambert cylindrical equal-area projection"

    The technique seems to do the job, hopefully.

    The X-pixels are untouched and Y-pixels get compressed towards the poles via Sin... But as you can see there is still something wrong with the formula. My guess is that there is some PI missing somewhere:

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

    Please have a look at the cap: sphereTex2.cap

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey Arsonide <img src="smileys/smiley1.gif" border="0" align="middle" />

    I think that Noise V2 does it's job pretty well, thx for that! Of course it might be easier to further post process an image than to recode that plugin once more for C1. I can imagine this sort of update for a potential C2 plugin if you're into that one day.

    Edit:

    Then again you could also use color filters on the distort map.

    I didn't get that. Do You think that this is a benefit over meshes?

    Edit2:

    This whole thing is driving me mad. <img src="smileys/smiley11.gif" border="0" align="middle" /> It seems that there isn't a 'perfect' mapping solution, because the poles consist of 1 point each; which is impossible to map.

    Buuut i think your canvas/sprite distortion solution is more elegant. With a little effort i might change your example to have pitch/yaw/roll.

    One more question though:

    Is it possible to increase the distortion mesh quality? I tried to double the X/Y values but it gave me weird effects like little white dots and a whole different "tiling" of the texture. Multisampling is a showstopper also.

    Edit3:

    It's me again... Sadly, distorting a sprite/canvas does not solve the problem of mangled poles. Seems like i have to dive in a bit further and search for some other solutions.

  • Thanks alot for your replies!

    I agree, Rojo, the formula i googled all day long does not look promising enough. Maybe i was confused by all the mapping techniques that are availabe. Another formula i stumbled upon was the Mercator Projection

    Perhaps this is the place to be.. dunno i'm confused..

    In general you're right newt, but i wanted to physically distort the sprite (texture) because it should be mapped onto a real 3d sphere (via textureSetter). And the whole point of this tool i'm developing is to output an INI which is then loaded into my space-game which should work procedurally. The containg planets/suns consist of 3d-meshes, because i find them easier to handle (e.g. roll, pitch, yaw right away).

    So any ideas on how to push those damn pixels in an appropriate way are more than welcome.

    EDIT:

    I like to illustrate that thing a bit further by pointing to the follow article which shows the progress in photoshop (sigh..)

    spherical mapping

    Basically it's just:

    1) Rectangular to Polar

    2) Polar to Rectangular

    3) Flip Image / Rotate 180 degr.

    4) Rectangular to Polar

    5) Polar to Rectangular

  • Hi folks!

    Currently I'm coding a GUI-frontend for the Noise Plugin, which i really like to share with you once it's finished. One cool feature I had in mind was to prepare (polar distort) a texture to be correctly mapped on a 3D sphere. My ingredients are a Image Manipulator to read the original pixels from the generated noise and an Array in 2:1 dimension to process the fancy math. Sadly, I can't figure out how to port the following code into construct. Maybe you can help me. <img src="smileys/smiley19.gif" border="0" align="middle">

    This is what I've done so far:

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

    This is the code I'm trying to translate:

    for (j=0;j<image.height;j++) {
         theta = PI * (j - (image.height-1)/2.0) / (double)(image.height-1);
         for (i=0;i<image.width;i++) {
              phi  = TWOPI * (i - image.width/2.0) / (double)image.width;
              phi2 = phi * cos(theta);
              i2  = phi2 * image.width / TWOPI + image.width/2;
              if (i2 < 0 || i2 > image.width-1) {
                  ?newpixel = red;                         /* Should not happen */
              } else {
                  ?newpixel = imagein[j*image.width+i2];
              }
              imageout[j*image.width+i] = image.newpixel;
         }
    }

    I got it from here:

    http://local.wasp.uwa.edu.au/~pbourke/texture_colour/texturemap

    (Texture map correction for spherical mapping)

    Edit:

    To show you what I'm aiming for:

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

    The texture on the sphere looks distorted on its poles.

    Maybe I don't necessarily have to go the Get/Set-pixel way and there are other solutions like mesh-distortion a sprite which i copy into a canvas or something like that. I just want to produce neat looking planets <img src="smileys/smiley2.gif" border="0" align="middle">

  • hi there =D

    my ideas for c2 would be flowless usability in the first place.

    in detail:

    • tab stops should function like one expects
    • mass alt-tags as user guide or context sensitive help where it's reasonable
    • node-based editing as an optional way of editing events/dependencies etc.

    furthermore:

    • some licence model that makes the community coders happy as well
    • ... there might be more ideas in my head, but currently i'm too lazy to write them all down ;)