PDA

View Full Version : Loading/unloading of objects per frame?


CiaranM
11-14-2008, 06:47 PM
Hi,
I'm not a Max user myself, so please bear with me.
I'm trying to transfer a simulated mesh from XSI to Max so that our Max user here can render the simulation on his side.

My first instinct was to export an OBJ sequence and import that into Max. Our Max guy found a nice script to do this and it works well. Unfortunately, the script loads the entire sequence into the scene and from what I gather it simply animates the visibility of each object. With the size of our final simulation approaching 75 Mb per OBJ, loading any decent length of animation will cause memory issues....
I was hoping there might be a straightforward or already existing solution (perhaps a script) to load objects into the scene on demand and delete them after the frame has progressed.

I'm totally unfamiliar with Max's SDK, but know this would be possible to script in XSI.

Any ideas how I might proceed with this, or recommendations that I can make for our Max guy?


Thanks!

P.S. point caches are not an option, since the mesh is not consistent between frames.

shibumenon
11-17-2008, 09:07 AM
you could use a callback (which basically means detecting any desired event and then executing a function when the event occurs. )
In this case you could use a preRender callback. Infact, if you look into the "How To" section in maxscript reference, you'd find a How To ... Change Objects At Render Time

CiaranM
11-17-2008, 06:34 PM
Well thanks for the effort. :wise:
Not quite what I was after, but it should give a lead to the Max guy here.

davestewart
11-17-2008, 06:51 PM
Is the vertex count / order of all the objects the same?

Perhaps you could import the first mesh, and with the subsequent meshes, animate their vertices to match the first using a simple looping expression.

EDIT: Just seen your note about point cache, so disregard. better to follow the callback route :)

CiaranM
11-17-2008, 07:55 PM
Unfortunately not. If so, I could even use a point cache. There is new geometry being created every frame, kind of like a fluid-sim.
I told our guy to see if he can have a look at frame-change callbacks or events and hopefully come up with something.

Thanks!

davestewart
11-17-2008, 07:56 PM
Ha! Posted at the same time ;)

LoneRobot
11-17-2008, 08:21 PM
hi ciaran,

i havent used it myself but there is an obj importer for blender fluid sims on http://www.scriptattack.com/

this apears to update per frame after it caches the obj data to text file so perhaps this could be used for what you have described.

CiaranM
11-17-2008, 09:26 PM
Excellent! We're trying it now...

Thanks!

CGTalk Moderation
11-17-2008, 09:26 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.