Sorry Michael for my typo. Correct your name.
On May 18, 10:48 am, Cong Danh Pham <[email protected]> wrote: > Thanks for your supports Michael and Fabrice. > > I tried to load obj file. It cans appear but the color is still random? > The attached files was exported from 3D Max. > It seems that was lost name of object3d in away3d. ??? --> I need the name > of these. > khoi2.obj & khoi2.mtl is the same folder. > > This is my code: > loader = Obj.load("presentation/assets/khoi2.obj", { scaling:10, > bothsides:true }); > loader.addOnSuccess(onSuccess); > > private function onSuccess(event:Loader3DEvent):void > { > if (loader) { > var objContainer3D:ObjectContainer3D = > event.loader.handle as ObjectContainer3D; > for (var i:int=objContainer3D.children.length-1; i>=0;) > { > // NAME IS NULL HERE > //var meshObject:Mesh = > ObjectContainer3D(event.loader.handle).getChildByName(objContainer3D.children[i].name) > as Mesh; > > HOW TO GET ORIGINAL COLOR IN ".mtl file" TO SET TO THESE OBJECT3D? > > group.addChild(objContainer3D.children[i]); > i--; > } > } > } > > Regards, > danhpc > > > > > > > > On Tue, May 17, 2011 at 7:28 PM, Fabrice3D <[email protected]> wrote: > > loading another file(.dae, .obj...) in away3d that cans show > >> original color of object? > > > ObjParser does support file based color objects. > > The .mtl parser reads the following tags for color objects definitions: > > > "Ka": ambientColor > > "Ks": specularColor > > "Ns": specular value > > "Kd": diffuseColor > > Transparency is supported by "tr": or "d" tags > > > Fabrice > > > On May 17, 2011, at 12:54 PM, Michael Iv wrote: > > > In such a case I would suggest you a workaround. The simpliest is to append > > to each model's file name a prefix or suffix holding the color value.Then > > when loading the model you can read the file name and parse its > > suffix/prefix to the color flag then using simple "swtich()" or "if" assign > > the matching colors during the runtime. The more complex way is to hack the > > exporter and parser . > > > On Tue, May 17, 2011 at 1:49 PM, danhpc > > <[email protected]>wrote: > > >> Thanks for your quickly answer. > >> But I don't want to assign my own color to those object. Because I > >> have a lot of 3ds file. Each one has object3ds with different color. I > >> don't want to hard code to assign this. It's not accord with my > >> business. > >> If I use loading another file(.dae, .obj...) in away3d that cans show > >> original color of object? > > >> Do you have any way to do this? > > >> Regards, > >> danhpc > > >> On May 17, 5:22 pm, Michael Iv <[email protected]> wrote: > >> > You can't.Away3D assigns usually by default a random ColorMaterial to > >> the > >> > objects that have no texture supplied.But you can always assign your own > >> > color inside Away3D :) > > >> > On Tue, May 17, 2011 at 1:16 PM, danhpc <[email protected] > >> >wrote: > > >> > > Hi all, > > >> > > I'm newbie in away3d. I have a problem that is loading original color > >> > > of object3d which was made from 3DS MAX. > >> > > I have a model 3d without material (because some model don't have > >> > > material, it just have color). I have just assined color to it then > >> > > export it to 3ds file. I want to load that model with assigned > >> > > color. > >> > > Because I have yet to set the material property on any of our meshes. > >> > > They are all displayed using the default material type - a > >> > > WireColorMaterial object with a random color defined for the surface > >> > > fill. --> That I don't want. > > >> > > How can I load my model with assigned color like the model which I > >> > > drew from beginning in .max file? > > >> > > ex: > >> > > I have Box, I set green color to box and then export to 3ds file. Then > >> > > show that model with that color without mesh type. > > >> > > Could you please help me out? > > >> > -- > >> > Michael Ivanov ,Programmer > >> > Neurotech Solutions Ltd. > >> > Flex|Air |3D|Unity|www.neurotechresearch.comhttp://blog.alladvanced.net > >> > Tel:054-4962254 > >> > [email protected] > >> > [email protected] > > > -- > > Michael Ivanov ,Programmer > > Neurotech Solutions Ltd. > > Flex|Air |3D|Unity| > >www.neurotechresearch.com > >http://blog.alladvanced.net > > Tel:054-4962254 > > [email protected] > > [email protected] > > > > khoi2.mtl > < 1KViewDownload > > khoi2.obj > 42KViewDownload
