View Full Version : Beyond Maxscript?
12-10-2010, 11:58 AM
I've been working on a project recently where we've had a triangulated mesh which starts off with one single triangle and out of that triangle unfolds the 3 adjacent triangles.... and so on.... until we have our revealled piece of geometry. The speed/rate and direction/pattern of unfolding was determined by an animated mask that told the triangles when they could unfold.
It was made slightly more complicated by the fact the unfolding triangles had to conform to the underlying mesh animation. I managed to script controllers to keep the triangles unfold and aligned the to mesh and created a bake script to make sure there was no gaps or overlaps due to the triangles stretching and squashing during animation.
This mesh then had various modifiers applied on top so the base mesh kept it's vertex animation and the triangles could then look bevelled.
So... everything worked... Project sucessful, client happy... excellent... (will try link to it as soon as it's online). Running through the process would take about 2 hours.
But what I'm left with is 5000 individual objects each with just one tri in, with a modifier stack of 5 above it. Each object has 2 helpers. 15,000 objects in one max file is... as I'm sure you all know a giant pain in the a**e to work with, even if it does give us plenty of ability to tweak and adjust.
We've been doing several projects with this client and probably looking forward going to be doing more, so I'm investigating better ways to work on this in the future. Given that the designs keep becoming more complex I want to be able to do this unfolding animation with more triangles but my current pipeline causes max to be extremely sluggish.
Does anyone have any suggestions on what could be a better option for doing this sort of animation. Is it looking more like I need to get into the SDK and develope a plugin, or is Thinking Particles a better options, or am I stuck using my maxscript approach.
TP might be a solution or just props and max script. I can see where allthe objects are a problem, how about a scripted modifier that replaces the five you are currently using. C++ would the the fastest and most stable solution.
Scripted modifiers are doable don't know how they will hold up with so many polygons though. I have made a scripted modifier that could make all independent/disconnected faces lookat a null. It's like a lookat controller for every element in a mesh, it was reasonably fast, but I haven't thrown loads of polygons against it...
12-10-2010, 02:52 PM
The best solution I found was to bake it all back to one mesh and just have a lot of vertex animation
information. Unfortunetly with having to animate visibilities as well it got a bit messy as if the tri wasn't
visible I had to put all verts for the tri at point 0,0,0 until needed.
The bigger problem however was the vertex ordering as it was quite difficult to keep track of what vert on an individual triangle related to which vert in the base mesh. Especially as the mesh was one continuous mesh so had a lot less verts. I did manage to get it working but I had massive problems with flipped normals. I wrote a test to check the normal against the original mesh and flip it if necessary which i got working on a simple object but unfortunetly with a more complex mesh it failed and I didn't have time to fix.
So that was my solution. I agree with Paul that C++ is the best solution but I'm just a maxscripter at the moment. Going to start looking at Thinkingparticles as well at some point. The whole project has been a massive headache, getting the triangles to unfold logically from their appropriate edge was a nightmare when there's open edges, multiple elements inside the mesh. Glad to hear I haven't missed a simple solution!
What about a scripted geometry plugin? Place everything in it and have it build tris as time changes. Never tried to see if that would work but it sounds possible. Don't know how well a scripted geo plugin would handle that much geo.
12-11-2010, 12:59 AM
I managed to script controllers to keep the triangles unfold and ...
This mesh then had various modifiers applied on top ...
Running through the process would take about 2 hours...
5000 individual objects each with just one tri in, with a modifier stack of 5 above it. Each object has 2 helpers...
1. What do you mean by script controllers? How many nodes do use script controllers? Are they float, point3, or matrix3 based?
2. What class or superclass of modifiers are assigned?
3. Does it take 2 hours to setup or to initialize?
4. Could you name those 5 modifiers, and tell how those 2 helpers are used for?
So, I don't know details but my simple expertise says that your solution looks too heavy for max scripting. To be confident you have to go with SDK, or to change the basic idea of your setup (look at particles or simpleMod IMHO)
12-13-2010, 01:03 PM
I've attached a simple demonstration of what I'm actually doing...
1. Each Triangle has 2 helpers, one that does the rotation for 'unfolding' the triangle, and one that has a Transform script controller, matrix 3. This can be baked which speeds things up.
2. 1 Shell, 2x Face Extrude, 1 x Material (id) and then an Edit Poly on top, then 1 UVW_unwrap and 1 UVW_mapping.
3. If we need to change the underlaying map that drives the speed of the unfolding it'll take about 2 hours to run through all the steps to get to a render-ready setup. (typically we have clients who like to change their mind every single day.....)
4. See point 2....
So it's a lot for maxscript to deal with I know, It is working and thankfully the next 3 projects don't have deforming mesh so that cuts out a huge amount of overhead, but there are more triangles.
I'm interested to hear any other suggestions as to how to achieve the same result using TP or anything else.
12-13-2010, 01:03 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.