Jump to content

multimaterial textures rotated on cube faces


valepu
 Share

Recommended Posts

Hello,

I have started using Babylon.js yesterday and i was playing around a bit, i wanted to make a cube with different textures for each face (well, to be precise it will have a different texture for top and bottom, then the same texture for all the sides) but when i do that with some code i found on this forum ( http://www.html5gamedevs.com/topic/12392-having-different-textures-for-each-face-on-a-cube/ ), the textures are rotated into different directions for each couple of faces (top-bottom, front-back, left-right).

 

You can see that here:  http://www.babylonjs-playground.com/index.html#1QKKTU#2 the texture is supposed to have the yellow lines at the sides, the black thingie on the left and the blue dot in the bottom-right corner http://www.babylonjs-playground.com/textures/misc.jpg (used the one from materials playground sample).

I have also noticed that when using the the "invertY" parameter on front and back this happens:

 

- No parameters set

Front flipped horizonatlly and vertically, back normal

 

- Front: false Back: false

Front flipped horizontally, back flipped vertically

 

- Front: true Back: false

Front flipped horizonatlly and vertically, back normal

 

- Front: false Back: true

Front flipped horizonatlly, back flipped vertically

 

- Front: true Back: true

Front flipped horizonatlly and vertically, back normal

 

 

Now, did I do something wrong/didn't understand how it works (I admit i just copy/pasted the code for multimaterial texture) or is this the expected behavior? 

Link to comment
Share on other sites

Other than changing UV for every vertex you can also use the wAng property to rotate a texture. This is an example where all the textures are shown to the camera in the same direction as if you were watching the 2d image from which the texture is generated (black thingie on the left, blue dot bottom right) : http://www.babylonjs-playground.com/index.html#1QKKTU#4

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...