I'll be honest, I'm pretty new at everything 3D, so I'm not sure how to verify that my object "has UV mapping", I understand UV mapping, but don't follow what you are asking, or how to verify.
I used a terrain generation app called L3DT which builds a terrain map & heightmap, and can export a mesh from the heightmap. I started by importing that mesh into blender, then loaded the JPG texture and applied it to the object in Blender. Everything looked perfect there, but not so good yet in the Away3D environment. Since writing this I did get the texture to apply to the mesh using the BitmapFileMaterial (code below), but the entire JPG image is applied to each face independently rather than stretched smoothly across all faces. Mesh(my3DLoaderObj.handle).material = myBitmapFileMaterial; I'm not clear if that's really the best approach (or even the right approach at all), and I must be doing something reasonably simple wrong to have the image apply independently to each face rather than across the entire mesh. Thanks! Dave From: [email protected] [mailto:[email protected]] On Behalf Of Peter Kapelyan Sent: Monday, July 27, 2009 7:45 PM To: [email protected] Subject: [away3d] Re: Newbie question: how to apply a texture to a mesh Are you sure your object has UV mapping? If so, a simple apply of any material would suffice. -Pete On Mon, Jul 27, 2009 at 3:30 AM, David Parks <[email protected]> wrote: Hi, I hate to ask simple questions, but, well, here goes. I have an OBJ mesh generated by the terrain generated L3DT, and I have a separate JPG texture map it generated. It does not generate an MRT file (I'm not familiar with what that is, but I have seen it mentioned in relation to OBJ files). As far as I can see the OBJ file has no reference to the JPG. I can import the OBJ mesh just fine, but I haven't found a good example of how to apply the texture. I just need to load the mesh and materials from a URL at runtime. But the Object3D provided by the loader only has a null-value MaterialsLibrary object which I haven't been able to work out how to use. Other examples only apply textures to primitives which all have a primObj.material attribute - unlike the Object3D in which the mesh is stored. Also I notice there's a TextureLoader class as well as a BitmapMaterialFile class. I don't understand if one is better to use over the other, or even if they do similar or different things (I haven't noticed any docs for TextureLoader). I have loaded the material into the BitmapFileMaterial class successfully, but haven't gotten that to apply to my Object3D mesh yet. If there's a document or tutorial that I missed I would love to know about it. I've been through the code examples and tutorials on away3d.com site so far and am still scratching my head. Thanks as always! David -- ___________________ Actionscript 3.0 Flash 3D Graphics Engine HTTP://AWAY3D.COM
