1

I create geometry in C4D; export OBJ, then convert using the threejs converter, import into three.js. Then I load in the image file I was using in C4D and it aligns properly; This works as expected.

Occasionally, i get coordinates from the OBJ that are [-1 to 1] instead of [0 to 1]. When this happens, the texture does not display properly (just shows a few pixels scaled up).

QUESTION(s):

  • is there a way to consistently get the coords exported into [0-1] scale (I know I can write some normalization code, but it seems like this only occasionally happens so I'd rather just fix the problem than create a workaround) - this may be a Cinema 4D question or general 3D question...

  • In three.js is there a way to get UV coords to display correctly if they're [-1 to 1]? I've read about setting .wrapS and .wrapT to THREE.RepeatWrapping but this doesn't seem to work.

jared
  • 652
  • 9
  • 19
  • 1
    To confirm: there is nothing wrong with UV coordinates in the [-1, 1] range, setting the texture wrapping correctly should fix this (by default they are set to *ClampToEdge*. There is of course the chance that your exported coordinates are not only in the [-1, 1] range, but actually -wrong-. Make sure to compare the coordinates before and after the conversion of OBJ to threejs, to pinpoint the source of the error. – Paul-Jan Jun 22 '17 at 07:06

1 Answers1

1

What format are you using to upload ThreeJS? if you have doubts about compiler, you may want to take a look to ObjLoader Demo

if values are not between 0 and 1, you should set texture's wrapS and wrapT properties as THREE.RepeatWrapping

var texture = new THREE.TextureLoader().load("texture.jpg");
texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
texture.needsUpdate = true; //  if texture is already initialized.
None
  • 330
  • 2
  • 16