0

Im currently trying to put textures on my obj object, but it's not working, Im getting this errormessage:

THREE.WebGLRenderer: image is not power of two (284x177). Resized to 256x128

This is the code:

var textureLoader = new THREE.TextureLoader();
var map = textureLoader.load('img/3.jpg');
var material = new THREE.MeshPhysicalMaterial({map: map});

var loader = new THREE.OBJLoader( loadingManager );


loader.load( 'models/cool.obj', function ( object ) {
    object.traverse( function ( child ) {
                    if ( child instanceof THREE.Mesh ) {
                        child.material = gemBackMaterial;

                        child.material = material;

                        var second = child.clone();
                        second.material = gemFrontMaterial;
                        var parent = new THREE.Group();
                        parent.add( second );
                        parent.add( child );
                        scene.add( parent );
                        objects.push( parent );

I already tried something like this:

function ( texture ) {

        var material = new THREE.MeshBasicMaterial( {
            map: texture
         } );
    },

    function ( err ) {
        console.error( 'An error happened.' );
    }

);

And then adding the texture to the obj:

child.material.map = texture;

But that's not working, what do you think?

Boby
  • 77
  • 3
  • 10

0 Answers0