Tiling BitmapTexture

Software: Away3D 4.x

dmk, Jr. Member
Posted: 18 August 2013 03:06 PM   Total Posts: 32

First off- I just want to say this is my first post here, and I am new to Away3D… I’ve always been intimidated to jump into 3D.. Even though I’ve used a little 3dsMAX and stuff for video projects, it always seemed scary to do it from the programming side.

A few hours with Away3D, and I’ve got it up and running even with some interactivity. No doubt you guys are doing all the heavy lifting under the hood, and I can’t thank you enough for the hard work so I can get right into the content without breaking my head too much. My favorite thing about coding in Flash is that you can get to the fun stuff quickly. This is how it should be for 3D too… so thanks!

Ok, now my first question wink

I load in a material and create a cylinder like this:

poleMaterial = new TextureMaterial(new BitmapTexture(preExistingBitmapData),truetrue);
poleMaterial.repeat true;
poleMaterial.animateUVs true;

var 
cG:CylinderGeometry = new CylinderGeometry(1010400);
var 
mesh:Mesh = new Mesh(cGpoleMaterial);

cG.topClosed true;
cG.scaleUV(12);

addChild(mesh); 

the .scaleUV part and .animateUVs are just a guess to try and fix the problem…

which is that the bitmap is not tiling, though I want it to.

Any idea how to make the bitmap tile? When I leave out the scaleUV, it shows it once. when I put in the scaleUV(1,2) it does sort of tile, but at half the height and with gaps in between.

I just want it to tile smoothly. I can recreate the texture if necessary (right now it’s 64x64, but that’s arbitrary)

It also needs to tile smoothly even if the cylinderGeometry will change in height (this can happen as part of the game)


Thanks!

   

dmk, Jr. Member
Posted: 19 August 2013 06:46 AM   Total Posts: 32   [ # 1 ]

Followup question, what if I want the material to scale instead of tile? smile

   

elemmiki, Newbie
Posted: 01 September 2013 01:07 PM   Total Posts: 10   [ # 2 ]

scaleUV accepts two parameters, and they tell the function how many times to tile the bitmap. Try setting this:

   

elemmiki, Newbie
Posted: 01 September 2013 01:08 PM   Total Posts: 10   [ # 3 ]

scaleUV accepts two parameters, and they tell the function how many times to tile the bitmap. Try setting this: cG.scaleUV(15, 15); and see if that tiles it nicely.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X