How to animate texture in maxscript?

So I have a file containing a list of frames to animate a texture and reading that file is no problem, buthow to add that animation frames to a textureß

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jahman's picture

.

.

tripathisansar's picture

With animate on

You can use

with animate on
(
at time frame expression
)

for eg:

meditmaterials[1]=noise()

with animate on
(
at time 1 meditmaterials[1].phase=0
at time 100 meditmaterials[1].phase=50
)
Hope that helps

gtafan's picture

My fault, have not really

My fault, have not really good specified what I want. I have an array of frames:
frames=#()
and every element of that array look like this:
frame=#(time, uOffset, vOffset, wRotation)
Now I want to add all the frames from that array to the map. That stuff about animate on I know and I need a for loop to go through the array and to do something like:
at time frames[i][1]...
but thats all I know.

jahman's picture

.

here's the bitmaptexture example since you didn't specify what type of map you try to animate

frames = #(#(0,0.2,0.2,45.0),#(22,0.66,0.66,127.0),#(44,0.33,0.33,263.0))
bmap = bitmaptexture()
meditMaterials[1].diffuseMap = bmap
animate on (
  for f in frames do (
 
    at time f[1] (
      bmap.coords.U_offset = f[2]
      bmap.coords.V_offset = f[3]
      bmap.coords.W_Angle  = f[4]
    )
 
  )
)
gtafan's picture

Don´t really know any other

Don´t really know any other maps than bitamaps, so for me it´s more or les the same. So thanks, it looks like exactly what I need. However have some questions:
1. Would it worck with a custom bitmap? I mean own plugin having bitmap as superklass.
2. Is the way to write the frames later back to the array also as simple?

jahman's picture

.

1. It depends. But it will work for any map that has Coords property that is StandardUVGen class.
2. Example below assumes that all of the properties has equal keys count and are animated at same time.

animate on (
    at time 66 (
      bmap.coords.U_offset = 0.66
      bmap.coords.V_offset = 0.33
      bmap.coords.W_Angle  = 42
    )
)
 
keysCount = bmap.coords.U_offset.keys.count
writeFrames = for i=1 to keysCount collect (
 
	#(  bmap.coords.U_offset.keys[i].time, 
	    bmap.coords.U_offset.keys[i].value, 
	    bmap.coords.V_offset.keys[i].value, 
	    bmap.coords.W_Angle.keys[i].value 
	 )	
)
gtafan's picture

Thanks again. At least for

Thanks again. At least for the stuff imported with your previous script properties should always have equal keys count, or am I wrong? Is there really cases, when properties don´t have equal keys count?

jahman's picture

.

Yes, in your case all the properties will have equal keys count. But in general there could be any arbitrary or zero keys for for the property you may wish to export.

gtafan's picture

What you mean with zero keys?

What you mean with zero keys? Values of 0 or just undefined?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.