Texture mapping 4.X?

Software: Away3D 4.x

steros, Newbie
Posted: 05 November 2011 01:24 PM   Total Posts: 19

Hey guys!

I’m getting used to Away3D and am happy about the engine so far :).
Just now I was following one of the tutorials provided on this website: http://blog.tartiflop.com/2008/11/first-steps-in-away3d-part-3-texture-mapping/ .

One of the lines that I wanted to use was the following:
var tiledAway3DMaterial:TransformBitmapMaterial = new TransformBitmapMaterial(Cast.bitmap(away3DBitmap), {repeat:true, scaleX:.5, scaleY:.5});

But I run in to multiple problems: TransformBitmapMaterial can’t be found and Cast doesn’t exist.

I guess this is because I’m working with Away3D 4?
In that case are there any up to date tutorials any of you knows of?

Thanks in advance
Stefan

 

   

kornwaretm, Newbie
Posted: 06 November 2011 04:29 AM   Total Posts: 21   [ # 1 ]

use this
yourMesh.geometry.scaleUV(5,5);

   

steros, Newbie
Posted: 06 November 2011 08:07 AM   Total Posts: 19   [ # 2 ]

Thanks for the reply!

I’m very interested to know where did you find out? is there a tutorial or some place where it states what the changes are between Away 3 and 4?

For me it trows an error though:
Error #1063: Argument count mismatch on away3d.core.base::Geometry/scaleUV(). Expected 1, got 2.

So you can only scaleX and Y at the same time I guess… Next to that; Than how do you set the repeat?

   

kornwaretm, Newbie
Posted: 06 November 2011 10:54 AM   Total Posts: 21   [ # 3 ]

1. i explore 4.0’s code. Because tutorial are rare…

2. the old version of 4.0 use 1 parameter. the new one from the svn uses 2 parameters.

3. to use the repeat use the material property. yourBitmapMaterial.repeat = true;

   

Avatar
Fabrice Closier, Administrator
Posted: 06 November 2011 09:08 PM   Total Posts: 1265   [ # 4 ]

Indeed, in early alpha version, scaling uv’s was tiling along u and v axis using the same multiplier. You can now define a different multiplier for u and v.

   

steros, Newbie
Posted: 07 November 2011 02:02 PM   Total Posts: 19   [ # 5 ]

Thanks guys!
This helps a lot already smile

Now I’m trying to position this bitmapMaterial nicely on my object but am having a hard time… can’t I just do something like:
myBitmapMatrial.x -= 50; ?

:D this away thing is fun!

   

steros, Newbie
Posted: 07 November 2011 02:30 PM   Total Posts: 19   [ # 6 ]

In 3.6 you could do that through the TransformBitmapMaterial. change the offsetX or Y…

I’m a bit frustrated that there are no tutorials but I guess there is being worked hard by some people to get some tutorials available.

do you guys know of something like the offsetX anywhere?

   

kornwaretm, Newbie
Posted: 07 November 2011 02:57 PM   Total Posts: 21   [ # 7 ]

i don`t think that is possible for now. the UVs are protected attribute of SubGeometry. UV editing usually done using 3D modeling software.  it`s much easier to do.

   

Avatar
Fabrice Closier, Administrator
Posted: 07 November 2011 03:17 PM   Total Posts: 1265   [ # 8 ]

of course you can, simply access the subgeom.getUVData vector, change as you please and updateUVdata again. If you end up with values lower than 0 or exceeding 1, don’t forget set repeat to true.

For uv’s projection, you also can use Projector in tools package

   

kornwaretm, Newbie
Posted: 07 November 2011 04:28 PM   Total Posts: 21   [ # 9 ]

red face ow it use getter . i did not notice that red face . so ..
myMesh.geometry.subGeometries[0].UVData;

and the Projector are awesome too. now I’m curious what away3D doesn’t have LOL

   

steros, Newbie
Posted: 09 November 2011 09:07 AM   Total Posts: 19   [ # 10 ]

Awesome! I’m gonna have some fun with that.

I found some helpfull functions here: http://markmail.org/message/jq6how5zz2vfgr76

Now another related question arises:
If I have a cube and I use a BitmapMaterial which I fit nicely on one face. Are the other faces filled with repeated border pixels? What happens to the other faces?
Is it possible to make a Bitmap that wraps around the cube automatically?

Thanks for al the help so far guys. Without you I had been stuck :D

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X