Hi David,
if your model if not uvmapped, the obj parser generates a default
mapping (0,0.5,1) on each faces by default.
you can see this if you apply a bitmapmaterial to your loaded object.
Also in the near future there may be a chance Away3D has the ability
to map your object for you if the UV isn't present, from different
angles, (in your case top down), but you didn't hear that from me :)
Actually, you already can use the Projector class added just before my
vacation
located in materials/utils.
its very easy:
import away3d.materials.utils;
[..]
Projector.project("top", Object3D);
Note that second param is Object3D typed, so you can pass
ObjectContainer3D or a Mesh
then you need to apply a Material if not set yet.
Fabrice
On Jul 27, 2009, at 5:48 PM, Peter Kapelyan wrote:
If your object doesn't have UV mapping, maybe try to load it into
another program and apply a top down projection UV mapping to it.
UV maps are triangles which tell you what part of the JPG or image
to use for which triangles on the mesh.
If the UV mapping isnt present, then Away3D will not know where to
apply the jpg on your mesh.
Being that it's a terrain you can get away easily by mapping it
staright down from the top.
If you have trouble applying a UV map to it, or checking if it
exists in the first place, I do you the favor and check , and/or
apply the UV map for you, but of course it would be better for you
to find an app or process to apply the UV mapping to your models
yourself.
Also in the near future there may be a chance Away3D has the ability
to map your object for you if the UV isn't present, from different
angles, (in your case top down), but you didn't hear that from me :)
-Pete
On Mon, Jul 27, 2009 at 11:41 AM, David Parks
<[email protected]> wrote:
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:away3d-
[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
--
___________________
Actionscript 3.0 Flash 3D Graphics Engine
HTTP://AWAY3D.COM