buenos dias, he visto su mensaje, y le cuento que yo tuve el mismo
problema antes, pero creo que es el metodo como lo esta haciendo,
primero que todo, cambiaremos el metodo, y los materiales, los vamos a
guardar como JPEG, y usaremos la siguiente forma para poder cargar el
objeto y los materiales de forma correcta, lo mejor esque en 3DMax
Studio, se haga el objeto como un objeto con textura mapeada. asi que
quede una sola imagen jpeg y esto haga que funcione y cargue mejor, el
codigo es el siguiente.


import away3d.containers.ObjectContainer3D;
//este para el contenedor
import away3d.loaders.Loader3D;
import away3d.core.base.Object3D;
// estos para los objetos3d de su interior
import away3d.loaders.Max3DS;
import away3d.loaders.utils.TextureLoader;
//estos que cargan la extension 3ds y sus texturas
import away3d.core.base.*;
import away3d.core.utils.Cast;
import away3d.core.render.*;

//declaramos las variables
var loader:Loader3D;
var obj3D:Object3D = new Object3D();


//con este lo cargamos despues de poner todas las camaras y los
enterFrame
//assets es la carpeta donde esta tambien la textura que traemos desde
3dmax

loader= Max3DS.load("assets/vwc.3ds",
{texturePath:"assets/",name:"logo3D",loadersize:100});
obj3D = logo.handle;

// con esta la agregamos a la vista, pero ya depende del lugar donde
lo halla cargado.
View.scene.addChild(obj3D);

amigo cualquier cosa me pregunta de nuevo, y le envio una muestra
funcional del tema por ahora espero que esto sirva de ayuda





On 23 nov, 08:04, Daniel Griscom <[email protected]> wrote:
> I'm an Away3D beginner, developing in Flash CS4/AS3, and I'm trying
> to set up a simple movie to import and display a 3DS file. The
> importing works, but I can't get the materials to work. I just want
> your basic colored material with smooth shading, and I have this
> working for built-in primitives, but the imported only shows an
> unshaded solid color, with black lines for the edges. Strangely, the
> color is different each time the movie is loaded.
>
> I've posted a demo on my website 
> athttp://suitable.com/temp/away3d/PhongLoadedModel.html. The torus is
> built using the Torus primitive, and the cylinder is the imported 3DS
> file. Drag on the movie to navigate. Notice that the torus is
> properly shaded (including the moving light from the original Away3D
> demo) while the large cylinder is a flat color with black lines.
>
> My first guess was that there were materials specified in the
> imported 3DS file, but by tracing the Away3D import code I'm now 90+%
> sure that's not true. The other options seem to be pilot error (quite
> possible) or an Away3D bug (who knows).
>
> The code is below, or you can find the demo pieces here:
> FLA file:http://suitable.com/temp/away3d/PhongLoadedModel.fla
> 3DS file:http://suitable.com/temp/away3d/exporttest.3ds
>
> Thanks,
> Dan
>
> P.S. Here's the code:
>
> import away3d.cameras.*;
> import away3d.containers.*;
> import away3d.core.utils.Cast;
> import away3d.lights.*;
> import away3d.loaders.*;
> import away3d.materials.*;
> import away3d.primitives.*;
>
> //engine variables
> var scene:Scene3D;
> var camera:HoverCamera3D;
> var view:View3D;
>
> //material objects
> var material:PhongColorMaterial;
>
> //light objects
> var light1:DirectionalLight3D;
> var light2:DirectionalLight3D;
>
> //scene objects
> var max3ds:Max3DS;
> var loader:LoaderCube;
> var torus:Torus;
> var model:ObjectContainer3D;
>
> //navigation variables
> var move:Boolean = false;
> var lastPanAngle:Number;
> var lastTiltAngle:Number;
> var lastMouseX:Number;
> var lastMouseY:Number;
>
> stage.align = StageAlign.TOP_LEFT;
> stage.scaleMode = StageScaleMode.NO_SCALE;
>
> /**
>   * Global initialise function
>   */
> function init():void
> {
>         initEngine();
>         initMaterials();
>         initLights();
>         initObjects();
>         initListeners();
>
> }
>
> /**
>   * Initialise the engine
>   */
> function initEngine():void
> {
>         scene = new Scene3D();
>         //camera = new HoverCamera3D({focus:50, distance:1000,
> mintiltangle:0, maxtiltangle:90});
>         camera = new HoverCamera3D();
>         camera.focus = 50;
>         camera.distance = 1000;
>         camera.mintiltangle = -80;
>         camera.maxtiltangle = 80;
>
>         camera.targetpanangle = camera.panangle = 45;
>         camera.targettiltangle = camera.tiltangle = 20;
>
>         //view = new View3D({scene:scene, camera:camera});
>         view = new View3D();
>         view.scene = scene;
>         view.camera = camera;
>
>         addChild(view);
>
> }
>
> /**
>   * Initialise the materials
>   */
> function initMaterials():void
> {
>         material = new PhongColorMaterial(0x808080);
>         material.shininess = 20;
>         material.specular = 0.4;
>
> }
>
> /**
>   * Initialise the lights
>   */
> function initLights():void
> {
>         //light1 = new DirectionalLight3D({y:1, ambient:0.1, diffuse:0.7});
>         light1 = new DirectionalLight3D();
>         light1.y = 1;
>         light1.ambient = 0.1;
>         light1.diffuse = 0.7;
>
>         scene.addChild(light1);
>
>         //light2 = new DirectionalLight3D({y:1, color:0x00FFFF,
> ambient:0.1, diffuse:0.7});
>         light2 = new DirectionalLight3D();
>         light2.y = 1;
>         light2.color = 0x00FFFF;
>         light2.ambient = 0.1;
>         light2.diffuse = 0.7;
>
>         scene.addChild(light2);
>
> }
>
> /**
>   * Initialise the scene objects
>   */
> function initObjects():void {
>
>         max3ds = new Max3DS();
>         max3ds.centerMeshes = true;
>         max3ds.material = material;
>         loader = new LoaderCube();
>         loader.loadersize = 200;
>         loader.ownCanvas = true;
>         loader.addOnSuccess(onSuccess);
>         loader.loadGeometry("exporttest.3ds", max3ds);
>
>         scene.addChild(loader);
>
>         torus = new Torus();
>         torus.ownCanvas = true;
>         torus.material = material;
>         torus.radius = 150;
>         torus.tube = 60;
>         torus.x = 500;
>         torus.segmentsR = 12;
>         torus.segmentsT = 10;
>
>         scene.addChild(torus);
>
> }
>
> /**
>   * Listener function for loading complete event on loader
>   */
> function onSuccess(event:Event):void
> {
>         model = loader.handle as ObjectContainer3D;
>         model.scale(100);
>         model.rotationX = 90;
>
> }
>
> /**
>   * Initialise the listeners
>   */
> function initListeners():void
> {
>         addEventListener(Event.ENTER_FRAME, onEnterFrame);
>         stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
>         stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
>         stage.addEventListener(Event.RESIZE, onResize);
>         onResize();
>
> }
>
> /**
>   * Navigation and render loop
>   */
> function onEnterFrame(event:Event):void
> {
>         tick(getTimer());
>
>         if (move) {
>                 camera.targetpanangle = 0.3*(stage.mouseX -
> lastMouseX) + lastPanAngle;
>                 camera.targettiltangle = 0.3*(stage.mouseY -
> lastMouseY) + lastTiltAngle;
>         }
>
>         camera.hover();
>         view.render();
>
> }
>
> /**
>   * Mouse down listener for navigation
>   */
> function onMouseDown(event:MouseEvent):void
> {
>         lastPanAngle = camera.targetpanangle;
>         lastTiltAngle = camera.targettiltangle;
>         lastMouseX = stage.mouseX;
>         lastMouseY = stage.mouseY;
>         move = true;
>         stage.addEventListener(Event.MOUSE_LEAVE, onStageMouseLeave);
>
> }
>
> /**
>   * Mouse up listener for navigation
>   */
> function onMouseUp(event:MouseEvent):void
> {
>         move = false;
>         stage.removeEventListener(Event.MOUSE_LEAVE, onStageMouseLeave);
>
> }
>
> /**
>   * Mouse stage leave listener for navigation
>   */
> function onStageMouseLeave(event:Event):void
> {
>         move = false;
>         stage.removeEventListener(Event.MOUSE_LEAVE, onStageMouseLeave);
>
> }
>
> /**
>   * Stage listener for resize events
>   */
> function onResize(event:Event = null):void
> {
>         view.x = stage.stageWidth / 2;
>         view.y = stage.stageHeight / 2;
>
> }
>
> /**
> * Updates every frame
> */
> function tick(time:int):void
> {
>         light1.x = Math.cos(time/2000);
>         light1.z = Math.sin(time/2000);
>
> }
>
> init();
>
> stop();
>
> --
> Daniel T. Griscom             [email protected]
> Suitable Systems              http://www.suitable.com/
> 1 Centre Street, Suite 204    (781) 665-0053
> Wakefield, MA  01880-2400

Reply via email to