Jump to content

Texturing specific mesh - issues


Pawel W
 Share

Recommended Posts

Hello there,

 

I'm trying to create placeholder editor (svg), where users can edit photo on the left and they get 3d preview of it on the right.

So far so good, but I'm having problems with texturing mesh.

 

Here is a screen how it looks:

post-10944-0-19208800-1412335111_thumb.j


And function how I update texture:

 

//get texture url and create material:


var textureUrl = "http://localhost/FotoEditor/app/php/" + response +"?"+new Date().getTime();   

var materialTest = new BABYLON.StandardMaterial("texture", $scope.babylon.sceneVars.scene); 

materialTest.diffuseTexture = new BABYLON.Texture(textureUrl, $scope.babylon.sceneVars.scene);

           

 //scale it somehow, dont know is it good or not, but without it texture is strongly zoomed:

materialTest.diffuseTexture.uScale = 5; 

materialTest.diffuseTexture.vScale = 5;  

   

 //assign material to mesh:

$scope.babylon.sceneVars.scene.meshes[0].material = materialTest;

 


Issues:

1. Why is texture initially rotated? Object is in 0,0,0 position and it's not turned around...

2. Is there any way I can make sure proportions from what user create on the left are exact on 3d model? In SVG users create in editor on the left I have all dimensions I need, but I'm not sure how can i connect them with those on 3d model (model is created in blender with metrics dimensions)

3. How can I turn off texture repetition? If user pan out image it should not repeat on 3d object and leave white space instead.

post-10944-0-19208800-1412335111_thumb.j

Link to comment
Share on other sites

Hi Pawel :)

 

How can I turn off texture repetition? If user pan out image it should not repeat on 3d object and leave white space instead.

 

I took a look at your blend file and the UV map for the "placeholder" object (what appears to be the label). Your map is marked A below.

 

Try remapping the UVs so that they look like B in image below.

 

cheers, gryff :)

 

 

 

post-7026-0-32021900-1412340834_thumb.jp

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