Saving out ticks instead of frames?

Hi, i am trying to save out particles with krakatoa for my Bachelor Project.
Many times I have a particle simulation, that I need to timebend the animation, but i cannot animate it like this. Krakatoa has a built in time editor for the particles, so its easy to bend time, but it starts to stutter when it has to interpolate particles.

For a 2000 framerange animation, i would like to save out 8000 "frames".

Bobo has given me the following help

"MAXScript can render at sub-frames, so it would be possible to call the renderer at smaller steps, but the saving code does not handle sub-frames. So the script would have to:
*Loop from 1 to 2000 with a step of 0.25
*Call the renderer for the current frame to save a PRT
*Move that PRT file to a new directory and rename it based on a counter incremented once per sub-step so when you reach 2000, it would be at 8000
*Repeat
"

I am not sure where to begin. This script could be useful not just for saving particles, for rendering out other animations, which later need to be edited for slowmotion.

I guess the script hast two parts, incrementing ticks by 0.25 and saving that frame. And a renaming counter.

Any help is appreciated!

Comments

Comment viewing options

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

but thanks for you script as

but thanks for you script as well..

bobos script i can only use to save out particles--

can i use your script to save out subframes now?

Anubis's picture

RE: "can i use your script to

RE: "can i use your script to save out subframes now?"

- Yes, you can ;-)

my recent MAXScripts RSS (archive here)

W DIGITAL's picture

hi anubis, bobo had time to

hi anubis, bobo had time to do it, this is what he came up with

(
local start = 0.0 --this is the first frame
local end = 100.0 --this is the last frame
local step = 4 --this is the number of samples per frame
local cnt = start as integer --this is the counter for the current frame number
local theParticleFileName = (FranticParticles.GetProperty "ParticleFiles") --get the output PRT file name
FranticParticles.SetProperty "Presets:SaveRenderHistory" "false" --disable history saving

for t = start to end by (1.0/step) do --loop from start frame to end frame with the given step
(
local theFileName = FranticParticles.ReplaceSequenceNumber theParticleFileName ((floor t) as integer) --figure out what the saved file will be called
deleteFile theFileName --make sure it does not exist yet
render frame:t vfb:off --call the renderer at a sub-frame to save a PRT with full frame
if doesFileExist theFileName do --if it was found,
(
local theBaseFile = (getFileNameFile theFileName) --grab the base file name, then build the new file name with suffix SubFrame_
local targetFilename = getFileNamePath theFileName + substring theBaseFile 1 (theBaseFile.count-4) + "SubFrame_" + getFileNameType theFileName
targetFilename = FranticParticles.ReplaceSequenceNumber targetFilename cnt --set the target frame number based on the integer counter stored in cnt
deleteFile targetFilename --make sure it does not exist before saving over it
renameFile theFileName targetFilename --rename the saved file to the new file name
)
cnt+=1 --increment the integer frame counter by one
)--end t loop
)--end script

Anubis's picture

Well, I found solution

Well, I found solution ;-)

-- The classic theme like this would Not work:
dir = getdir #preview -- where to save
img = bitmap 300 200 filename:(getdir #preview + "\\file.jpg")
for t=0 to 2000 by 0.25 do ( -- will end with 2000 saved frames
	at time t (
		render to:img
		save img frame:t
	)
)
close img
-- will render 8000 frames but will save only 2000

And because I not catch the Bobo's idea, I was try this and it works:

dir = getDir #preview + "\\temp\\" -- where to save
if (getDirectories dir).count == 0 do makeDir dir
ext = ".jpg" -- bitmap file format (e.g. ".jpg", ".bmp", ".tga")
img = bitmap renderWidth renderHeight -- create bitmap in memory
for t=0.25 to 2000 by 0.25 do ( -- will end with 8000 saved frames
	--// The TRICK is in the next line: assign a new file name for each frame
	img.fileName = dir + (t as string) + ext
	at time t (
		render to:img
		save img --frame:t
	)
)
close img

Enjoy!

my recent MAXScripts RSS (archive here)

Anubis's picture

"MAXScript can render at

"MAXScript can render at sub-frames, so it would be possible to call the renderer at smaller steps" - this is sound strange to me. You can tell by MAXScript to render 5.75 (for example) but the Max itself will render the frame 5.0, i.e. all numbers after the comma are ignored, so never mind is it 5.25 or 5.99, for Max and both are 5f, that's all. In conclusion -- no way.

[edit] If you set your time display to FRAME:TICKS or MM:SS:TICKS, then Max will accept float frame values. but still this last step that Bobo suggest (moving/renaming) it's not clear to me.

my recent MAXScripts RSS (archive here)

Comment viewing options

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