How to manually define texture coordinates

Software: Away3D 4.x

aeki, Member
Posted: 30 April 2013 08:16 AM   Total Posts: 73

Hi all,

I have 3D models that are mainly boxes. Instead of loading them via an AWD file, I’m thinking about creating them directly in Away3D by instanciating meshes with CubeGeometry.

However, I need to applied a MaterialTexture on these meshes. I have some baked maps for each of my box.

How can I define texture coordinates in Away3D so that my maps will fit my mesh manually instanciated?

   

aeki, Member
Posted: 30 April 2013 11:58 AM   Total Posts: 73   [ # 1 ]

In fact, I need a way to export UV coordinates from a 3D program in order to import and apply them in my away3D code.

Does Prefab has such a feature? It seems to me that it is not the case.

Correct me if I am wrong.

   

Avatar
Fabrice Closier, Administrator
Posted: 30 April 2013 02:07 PM   Total Posts: 1265   [ # 2 ]

Prefab 1.x has a UVEditor, v2 stil misses it badly, hence why its high on my todo wink
That having said, if you use CubeGeometry, it comes already mapped. The sequence is same as a skybox, 3 cols, 2 rows. Composing your map to meet this uv map is more easy than remapping the uvs by hand, as the cubeGeometry is not as simple as it may look. Because of gpu requirements, to obtain a nice flat surface once lighted, there are more uv’s in there than the “expected” 8 (in case of a 2 faces per side).

   

aeki, Member
Posted: 01 May 2013 03:46 PM   Total Posts: 73   [ # 3 ]

Thanks for the tip, but I don’t understand it!

What do you mean by

The sequence is same as a skybox, 3 cols, 2 rows.

??

   

aeki, Member
Posted: 01 May 2013 03:52 PM   Total Posts: 73   [ # 4 ]

ah did you mean I could use a BitmapCubeTexture in a TextureMaterial for my boxes?

   

Avatar
Fabrice Closier, Administrator
Posted: 01 May 2013 07:58 PM   Total Posts: 1265   [ # 5 ]

we were talking uv’s. So if you know that a cube is mapped as 3 cols 2 row, you now can extrapolate the uv values, which need to be between 0 and 1.
So 0, 0.333, 0.6666, 0 for the u’s 0, 0.5 and 1 for the v’s.

Now as said, to alter geometry with propper uvs, this requires some experience and work and you might be better off by redoing your maps.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X