animated textureMaterial

Software: Away3D 4.x

pool338, Jr. Member
Posted: 17 July 2012 08:57 AM   Total Posts: 37

Hi,
I want to use an animated gif as textureMaterial for a Cube. The gif is displayed correctly but not animated.

Anyone has an idea?

   

Babylon, Jr. Member
Posted: 17 July 2012 09:14 AM   Total Posts: 39   [ # 1 ]

I’m not too sure honestly, but I’d suggest breaking the gif into single images and have some sort of timer loop through changing it.

   

Richard Olsson, Administrator
Posted: 17 July 2012 09:56 AM   Total Posts: 1192   [ # 2 ]

Either use separate images and replace the texture frame by frame, or better yet, render the separate frames of the GIF into a texture atlas and use UV transforms to “mask” out the right part of the atlas each frame.

   

pool338, Jr. Member
Posted: 17 July 2012 10:00 AM   Total Posts: 37   [ # 3 ]

@Richard: This sounds great, but as I’m still a noog at this, I didn’t understand a word. Could you explain it in more detail, please?

   

Richard Olsson, Administrator
Posted: 17 July 2012 10:11 AM   Total Posts: 1192   [ # 4 ]

Well, the easiest method then would be to use separate images. Split up your GIF into separate bitmaps, one for each frame. Either do it in Photoshop, or do it programmatically in your ActionScript code.

Then create a BitmapTexture for each bitmap and store these in an array or vector, and set the material of your 3D object to a TextureMaterial.

Finally, every frame, change the texture used by the texture material to the next one, effectively animating using a flip book approach.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X