Dear Away3D.dev,

As this is my first post I wanna start with thanking you for this
great library.

Now my question:

I am having some problems with a model loaded from 3DSMax. When I use
BitmapFileMaterail the max3ds.repeat = true causes the image to tile
the model as expected. However, in the PhongBitmapMaterail it seem to
be not working. It places the image at the center of the model (which
is a bar-of-soap like box) and it kind of copies the last pixels on
the sides of the image and stretches them on the surface.

Please let me know if there is anything wrong with my code. And/Or
anything that I have to be careful  about while exporting from 3D
Studio Max.

Here is the code:

...

// loading the image using the BitmapFileMaterial instead of Loader

private function initMaterials():void{
        myBitmapMaterial = new BitmapFileMaterial('assets/l2.jpg');
        
myBitmapMaterial.addEventListener(MaterialEvent.LOAD_SUCCESS,initObjects);
}

// when the image is loaded initObjects function is called
// all the variables are defined prior to the function with the
correct data types

private function initObjects(e:Event):void {
        // creating the PhongBitmapMaterial using the bitmap data of
the previously loaded btimap
        myMaterial = new PhongBitmapMaterial(myBitmapMaterial.bitmap);

        // setting the repeat property to true, because I want the
image to tile the entire model
        myMaterial.repeat = true;
        myMaterial.smooth = true;

        // creating the Max3DS object
        max3ds = new Max3DS();

        // setting the material of the object as the phong material
        max3ds.material = myMaterial;

        loader = new Loader3D();
        loader.addEventListener(Loader3DEvent.LOAD_SUCCESS, onSuccess); //
onSuccess basically renders the view

        // loading the external 3DS model using a Loader3D
        loader.loadGeometry("assets/doruk1.3DS", max3ds);

        // scaling the loader and positioning it
        loader.x = 0;
        loader.y = 0;
        loader.z = 0;
        loader.scale(5);

        scene.addChild(loader);
}

...

Reply via email to