문제

I've searched the internet and I didn't find a proper answer for this question. I've noticed lots of people asking the same thinkg.

I have a JSON file exported from 3D max which contains UV information. I'm trying to load the JSON file with a DDS image applied into Three.js. (using THREE.ImageUtils.loadCompressedTexture) The DDS image was exported from Photoshop.

The image is being loaded onto the object but it's being stretched (I assume this is caused by the fact that the DDS file is not a rectangle anymore as it contains several mipmaps).

How can I tell three.js that the image used is a DDS file?

Thank you in advance.

I have put together a live demo. Here's the link: http://aeche.eu/DDS/DDS.html You can see the JPG file used properly on the Left side, and the DDS file on the right side.

Here's the original JPG image: http://aeche.eu/DDS/art/cubeJPG.jpg

Here's the code for the cube using DDS file:

var map1 = new THREE.ImageUtils.loadCompressedTexture('art/cubeDDS.dds');
    {
  jsonLoader.load( "art/cube2.js", addCubeDDS );
  function addCubeDDS( geometry, materials ) {
  var material = new THREE.MeshPhongMaterial( {map: map1} );
  cube1 = new THREE.Mesh( geometry, material );
  cube1.position.x = 66;
  scene.add( cube1 );
}
도움이 되었습니까?

해결책

Thank you all for your answers. I figured it out. Before exporting the image to DDS I have to flip it vertically and it works

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top