hey Away3dfan (i like that nickname :)) )
You just need to follow some rules...
A very important rule: you need to work clockwize for your vertices.
same rule for the uv's.
the UV spread is simple
imagine a quad face, say a square:
top/left = 0,1
top/right = 1,1
down/left = 0,0
down/right = 1,0
u = 1 = width source.
v = 1 = height source.
now only thing you need is choose a projection
you have more options
if you choose for a flat projection, you need to work with the max and
min values of your mesh.
then in between its all a matter 0/1 in of percentage. In case of 2
faces that forms a square, its the exact values
shown above.
if you choose for "bending" where the texture is distorted according
to mesh, you can use division of
vertices per axe
if you choose for distances from side, you need to choose one vertice,
and the furthest for both u and v.
Its handy for irregular shapes like a road, and is mostly used for 2
plans covering.
the third plan shows elongated pixels at edges, you can see this in a
UV editor if you say for instance, project form left
on a cube, the middle faces are just a series of pixels stretched.
there are like hundreds of ways to project, but these are the mostly
used.
take a look at the way PathExtrude does: there is distance and
percentage
In roundedcube you also have an example of a 6map
n Sphere or irregular polygon, you can see circular projection.
In Lathe you have a regular circular projection...
Enough examples to look at I think :)
Fabrice
On Jul 4, 2009, at 10:09 AM, away3dfan wrote:
I was unable to post images directly. Here are the links without
leading http so as to confuse google enough to let me post them:
UV Error: img30 . imageshack . us / img30 / 4274 / uverror . png
Original desired image: eclecti.cc / files / 2008/03 / face . jpg
(no w w w in prefix)
Thanks once again.
On Jul 4, 4:02 am, away3dfan <[email protected]> wrote:
So that's what UVs are for!
I don't necessarily need a bitmap data if there's something easier,
that's just all I found in the documentation.
In any case, the screen is no longer black on view (infact it's quite
a pretty render of a texture) however the alignments are still off.
The second face aligns correctly it seems, but I don't totally
understand what to do with the first face to get it to align
properly. See screenshots below if interested.
Here is my updated code:
// In class
[Embed(source="C:/pic.jpg")]
public var faceBitmap:Class;
// In function
var texturedShape:Mesh = new Mesh();
var f:Face = new Face( 0:0:0, 100:0:0, 100:100:0, null, new UV(0,
0),
new UV(1, 1), new UV(0, 1 ) );
var f2:Face = new Face( 0:100:0, 100:0:0, 100:100:0, null, new UV(0,
0), new UV(1, 1), new UV(0, 1 ) );
texturedShape.addFace(f);
texturedShape.addFace(f2);
texturedShape.material = new PhongBitmapMaterial( Cast.bitmap
(faceBitmap) );
_scene.addChild( texturedShape );
Please note: vertex assignments would be in the form new Vertex( 0,
0,
0 ), etc. I'm using the above for clarity in troubleshooting.
Can someone please explain to me how the UV assignments can be made
to
spread an image evenly across multiple faces? Any help is greatly
appreciated!
On Jul 3, 9:00 am, Rob Bateman <[email protected]> wrote:
Hey away3dfan
if you want to texture a mesh with a bitmapmaterial, you will need
to set uv
coordinates on each face object to allow teh mesh to 'skin' itself
with the
bitmapdata you use in any bitmapmaterial. Have a closer look at
any of the
primitive classes like sphere or plane to see how you create and
apply these
uv coordinates
cheers
Rob
On Fri, Jul 3, 2009 at 8:36 AM, away3dfan <[email protected]>
wrote:
In my last post here I was working with the assignment of dynamic
materials to custom-defined objects, but I think this was a bit
premature for my understanding, so here I'm asking a question about
only one piece of my problem:
I would like to create a custom mesh (a flat plane cutout,
really) and
apply *one* material stretched across all the faces in the cutout
(the
way it is when a texture is applied to a sphere for example).
This is
what I tried:
// In class
[Embed(source="C:/pic.jpg")]
public var earthBitmap:Class;
// In function
var texturedShape:Mesh = new Mesh();
var f:Face = new Face( v1a, v2a, v3a );
var f2:Face = new Face( v1b, v2b, v3b );
texturedShape.addFace(f);
texturedShape.addFace(f2);
texturedShape.material = new PhongBitmapMaterial( Cast.bitmap
(earthBitmap) );
_scene.addChild( texturedShape );
However, this results in the entire screen going black when the
face
is in view of the camera. The problem also occurs when only one
face
is used. Please can you tell me what is the correct way to apply
an
embedded texture to one face, or across multiple faces of a single
mesh? This will help me very much.
Thank you!
PS: Ideally I would have created only one surface with slanted
edges
to create the shape I want, but I believe the only way to do it is
with individual faces, so this is the method that I'm currently
using
even though it results in tiny spaces between a couple of the faces
which I have not found a way to get rid of yet.
--
Rob Bateman
Flash Development & Consultancy
[email protected]