animate textures

Blitz3D Forums/Blitz3D Programming/animate textures

Amanda Dearheart(Posted May) [#1]
I'm looking for a program that if I had a single texture, it would make several frames of the texture, add user or procedural effects to the texture and then animate (make a filmstrip) them.


RemiD(Posted May) [#2]
if you already have a texture/image with frames you can extract each "frame" using blitz3d by using copyrect(), and then you can copy each frame to a "several frames texture" ( CreateTexture(width,height,flags,framescount) ), and then you can animate this "several frames texture" ( EntityTexture(Mesh,SeveralFramesTexture,FrameN-1) )

but if you don't have the frames, you will need to create them in some way...


steve_ancell(Posted May) [#3]
The same way you can use LoadAnimImage in the 2D command set there is LoadAnimTexture in the 3D command set, and then index them the way RemiD just stated. Assuming your frames don't need to be different sizes. Any user effects flags would need to be stored in arrays.


RemiD(Posted May) [#4]
And alternively you could store all the frames as separate textures in an array, and then use
EntityTexture(Mesh,Texture(I)) ;I being the current frame you need to display.

In any case, you will also need to use millisecs() to play the animation at the speed you want.

;before the mainloop
LastMs% = Millisecs()
TimeMs% = Millisecs() - LastMs%
FrameI% = 1
FramesCount% = 16


;during the mainloop
 TimeMs = Millisecs() - LastMs
 If( TimeMs > 100 ) ;for an animation speed of one frame each 100ms
  FrameI = FrameI + 1
  If( FrameI > FramesCount )
   FrameI = 1
  endif
  Entitytexture(Mesh,SeveralFramesTexture,FrameI-1) ;or EntityTexture(Mesh,Texture(FrameI))
  LastMs = Millisecs()
 endif



steve_ancell(Posted May) [#5]
Yeah, some programmers like doing it that way. I also used CopyRect to store image frames in arrays when I did a Mutant Monty remake a few years back. The array storage way does have its advantages. ;)


Amanda Dearheart(Posted May) [#6]
I'm trying to accomplish something similar to the background in this fellows post


click here


RemiD(Posted May) [#7]
the blue/black background ? Seeing how it behaves, i suppose that it is a procedural animation...


Amanda Dearheart(Posted May) [#8]
Well, do you know of any program that can create that kind of animation


Dan(Posted May) [#9]
The effect is called plasma

Plasma


RemiD(Posted May) [#10]
@Dan>>i have never seen this code, thanks for the link !