Jump to content

Orientation of a texture w.r.t. a sphere


jkidd08
 Share

Recommended Posts

I am attempting to apply a texture of a diffuse image of the Earth to a sphere and have the scene render with the Earth's north pole aligned with the body/local +Z axis. However, I can't seem to implement this. Below is a playground scenario I put together for the scene.

I've attempted to achieve this with the following lines (26 - 33 of the playground scene). 

    earthSurface.diffuseTexture.uAng = 0;
    earthSurface.diffuseTexture.vAng = 0;
    earthSurface.diffuseTexture.wAng = 0;
    earthSurface.diffuseTexture.uScale = 1.0;
    earthSurface.diffuseTexture.vScale = 1.0;
    earthSurface.diffuseTexture.wScale = 1.0;

http://www.babylonjs-playground.com/#634KR1

Link to comment
Share on other sites

Hi @jkidd08, welcome to the forum.

https://www.babylonjs-playground.com/#634KR1#1

I don't know if that is what you wanted, but its a try.  I didn't do any texture-shifting.  Instead, in lines 39/40, I rotated the sphere, and then "baked" that rotation into the mesh.  BakeCurrentTransformIntoVerticies() sort-of "naturalizes" the mesh to that orientation.  Rotation, position, and scaling values get re-initialized. 

I hope this helps.  Other forumers, with other ideas, are nearby.  Stay tuned. 

And thx for providing a playground demo scene.  Cool!

Link to comment
Share on other sites

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.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...