Jump to content

New Feature : Side UVs


jerome
 Share

Recommended Posts


For any mesh supporting the parameter sideOrientation, we can now pass two extra parameters frontUVs and backUVs both Vector4. These values are taken in account only for double-sided meshes.
They allow to declare what part of the image to crop and stick respectively on the mesh front and back faces.

// set the rectangle coordinates (u0,v0) and (u1,v1) from where to crop the image as a Vector4(u0,v0,u1,v1)
  
var f = new BABYLON.Vector4(0,0, 0.5, 1); // front image = half the whole image along the width 
var b = new BABYLON.Vector4(0.5,0, 1, 1); // back image = second half along the width 

var options = {sideOrientation: BABYLON.Mesh.DOUBLESIDE, frontUVs: f, backUVs: b}; 

// this plane has half the image on the front side and the next half on the back side 
var plane = BABYLON.MeshBuilder.CreatePlane("p", options, scene); 

// this sphere has half the image on the external side and the next half on the inside side 
var sphere = BABYLON.MeshBuilder.CreateSphere("s", options, scene); 

 

A single texture/material but the ability to display different images on each mesh side.

Default values if not passed for both : (0,0, 1,1)

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