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]

Reply via email to