Crop texture in Sprite3D?

Software: Away3D 4.x

Hector, Sr. Member
Posted: 28 June 2012 07:30 PM   Total Posts: 137

Hi all,
I have a Sprite3D of 20x32. I apply a texture of 32x32px (power of 2) and it is stretched to fit the sprite width.
How do I avoid that? I want the texture to be cropped if it’s bigger than the sprite.

   

Richard Olsson, Administrator
Posted: 29 June 2012 08:40 AM   Total Posts: 1192   [ # 1 ]

Either you modify the UV coordinates of the sprite, for example using a UV transform matrix, or you just make sure that your images always fills out the full 32x32 bitmap.

If I were you, I would just scale up the image (non-uniformly is fine) to match the 32x32 bitmap. Just use a matrix and draw() it while scaling it up. Once it’s applied to a sprite that is 20x32, it will be scaled down again on the X axis and the visual result will be identical to the original bitmap.

   

Hector, Sr. Member
Posted: 29 June 2012 06:04 PM   Total Posts: 137   [ # 2 ]

Thanks Richard, I will try that smile
I though there would be some property in the material to avoid that.

   

Avatar
kenjoseph, Newbie
Posted: 08 February 2013 06:31 AM   Total Posts: 1   [ # 3 ]

Sprite3D is measured with the help of the coordinated. So, you just need to adjust it accordingly, So that it remain fit.

http://www.lacoteimmo.com/

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X