As said in previous mail, you have to look at the way its done.
then simply sort on same way you sort now to build the trapeze,
meaning here you isolate all faces sharing same x and z until you have whole side
and use same code as in this class to project the way you want.
In the projector class there is all the stuff you need
Just hack it just a little so it accepts a series of faces instead of parsing the mesh.faces array...

Fabrice





On Nov 4, 2009, at 6:18 PM, jordi monty wrote:

Hi again. I'm developing an application to do photoframing. So, I've
four cube/trapezoids that frames a picture:

http://marcosamedida.tecnopixel.com/paint.jpg

I need to apply the texture without deformation, simulating a real
wood piece, And ideally, i would use TransformBitmapMaterial for
tiling.

I've added Projector.project('left',cube) to my code, but it doesn't
look well.

Thanks for expend your time to help a newbie...



On 4 nov, 12:15, Fabrice3D <[email protected]> wrote:
well, if you want your texture projected on the trapeze sides 1/1 as
your texture
Take a look at Projector.as in away3d.materials.utils
all you need is in there.

The only thing you need to do is like in previous code, sort on sides,
and alter the faces uv's sharing same plan.

btw note that in my previous code, you can get rid of dictionary
check, I was busy with other similar code where
vertexes were not unique. in your case they are are since its the
vertices list...

Fabrice

On Nov 4, 2009, at 11:52 AM, Makc wrote:



I do not understand this problem. Is it not exactly what is supposed
to happen? See, for example, attached picture - suppose you move the
vertex of left-bottom face - why would there be any reason for texture
in top-right face to change? So, naturally there is texture break at
the edge after vertex is moved.

The simple way to "fix" this is to split the face in the net of small faces (increase cube subdivisions) and move all of them in proportion.
This can be done with as3dmod, for example. Alternatively, you can
write clever material utilizing t-s in uvt data to change distortion,
or pixel bender shader (neither is easy).
<trapezoid.gif>

Reply via email to