View Full Version : New MaxScript, input requested
12-01-2004, 11:30 PM
After being inspired by the topology brush in Silo, and the model rig in the Zbrush previews, I started working on a script to do something similar in Max. I found a script called Spline Pencil that let's you draw splines on a model, and then took that and heavily modified it to get to where it's at now.
I guess I should say what I'm going for. Basically, it's a tool to draw splines over a model, which you can then use to add a Surface Modifier to and convert to polys. The most obvious use would be to take a high res model and draw out the low res model on top of it. You then have a nice setup for normal mapping or using the new Skin Wrap modifier.
There are other scripts for drawing splines on models, but this is specifically for creating a spline cage to use with the Surface modifier.
So what I would like is for people who are familiar with spline modeling and using MaxScripts to give it a whirl and let me know if it seems useful, and what other features you might like to see. Right now I plan to implement some sort of preview so you can see what the poly model will look like while you're creating the splines, and the ability to come back to an existing spline model and add to it. The way it is now, you'd have to complete the model in one go, or start a new spline model after you've stopped working on the current one. That's not too big of a deal though, you just do the model in sections.
Here's the script: drawModel.zip (http://jhaywood.com/pics/drawModel.zip)
Here's how it works...
1) Run the script from Max (it's been tested with version 5 and 7, and so should work with 6 also).
2) Click the "Pick Surface" button, and then click on the high res model (for example).
3) Click "Draw".
4) Start clicking on the high res model. Every time you click on the model a spline vertex will be placed. Keep clicking to define your edge loops and whatnot. This is the "cage" that will make up the final model.
Shift-click to start a new spline within the current spline object.
Alt-click to remove a vertex from an existing spline.
Keep in mind that to use the Surface modifier, all splines must connect to form three or four sides.
Right-click to stop drawing.
As you're clicking, spheres will be added to each vertex position to help see where they are since they don't show up if you're not in sub-object mode. The spheres are also there to indicate the snap threshold. Increase or decrease the snap threshold to automatically snap new verts onto old ones. This helps make the Surface modifier work properly.
Set the options to automatically add a Surface modifier and a Meshsmooth/Turbosmooth modifier when you're done.
5) Right-click to stop drawing.
6) If you added a Surface modifier and the geometry is not showing up, try checking the "Flip Normals" option, or changin the threshold in the modifier.
That's it. You can either collapse it to a poly object, or go in and tweak the splines. You can also add a Symmetry modifier if you're just working on half the model.
I'd really like to know if anyone finds this useful. I think it could come in handy, especially if you don't have access to Silo or the new version of Zbrush when it comes out.
12-02-2004, 09:12 AM
This is a cool idea.
Using Max 5.1, when I Alt-Click to remove a vertex from the spline, it kicks me out of Draw mode, and I can't re-enter the same spline.
Looks like Undo isn't available yet. Would help avoid the need to Alt-click.
Overall though it seems like an unweildy modeling process. It's pretty click-heavy, meaning I have to click for every vertex, or really I'm clicking some verts multiple times since I'm basically drawing faces.
From what I've seen of the Silo method, the spline is painted dynamically while you mouse over the surface, rather than click-by-click.
I wonder if you could get the script to auto-generate verts for you, based on some kind of distance- or curvature-based metric.
Besides that basic workflow issue, the script is pretty cool. It seems like a good approach if you want to make a hand-controlled quad-based low-poly version of a high-poly model.
Sorry I'm not script-savvy so I can't comment on the coding itself. One thing I would improve though is to make it a MCR file so it can be easily loaded into a button or hotkey (I did this myself manually).
Thanks for sharing! I'd love to see more.
12-02-2004, 11:17 AM
Hey Eric, thanks for checking it out. It's still a work in progress so your comments are very helpful.
Does it kick you out of draw mode every time you alt-click? It does seem really sensitive if things aren't done exactly just so, but I thought I caught all the errors. It shouldn't be too tough to make an undo button, and to let the user go back to an existing spline model.
I thought of doing it more like what you're saying with laying down verts as you're drawing. The problem I found though is that you end up with splines with a ton of vertices, and the Surface modifier won't be able to construct a surface because some verts won't overlap and none of the splines will create three or four sides shapes. I'll look into it further though. I might be able to do some sort of optimize function on the entire spline model to get rid of verts that don't lie next to each other, and to snap them together.
From what I've seen of the Silo method, it's actually painting lines on the model, kind of like using DeepPaint or BodyPaint. It's not generating splines. It then goes in and generates geometry based on the painted lines. I think this might actually be doable in Max since I've seen a script that lets you paint on models, but also think this would be beyond my scripting skills. I'm sure Bobo or some other MaxScripting god could create something if they were so inclined. /images/graemlins/smile.gif
I'm going to keep working on it and I'll post updates as I finish them. I'd really like this to become something useable in a production environment to save modelling time. So any other comments/suggestions would be much appreciated.
And about making it a macroscript, I actually have an .mcr version for myself but I thought it would be easier for people who just wanted to try it out to not have to install a macroscript.
12-02-2004, 12:06 PM
Kicks me out every time. Might be a 5.1 thing.
Yeah, creating verts automatically from a drawn line would be difficult, and on top of that you would have to match the 3- or 4-sided topology issue.
But is this tool really faster than manually removing edgeloops? I'd be curious if you've compared the methods. Seems like all the clicking would drive me insane, vs. selecting edge loops and removing them (while also removing their verts of course).
BTW, Polyboost looks like it might improve the edgeloop method some.
12-02-2004, 12:58 PM
[ QUOTE ]
But is this tool really faster than manually removing edgeloops?
[/ QUOTE ]
That assumes that you've modeled the character (or whatever) using proper edgeloops to begin with. Plus, you could say the same thing about the Silo topology brush. I think the point is that some poeple like to model without worrying about edgeloops and then go back and draw proper topology on top of the model. Or if you had a super high res model detailed in Zbrush it would be very time consuming to manually remove the edges necessary to take it from a 20k model to a 2k model, for example.
But your point is valid if the modeler is careful while creating the model and keeping the edgeloops in tact. Like any tool, it comes down to your own personal work flow and whether or not the tool really helps in your particalur case.
I've used the tool myself to create a simple volume of a shirt using a cylinder, and then going back with the script and drawing edges where I want the folds to go and how I want them to flow. It worked faster than trying to cut edges and reflow the existing geometry of the cylinder.
And about all the clicking, I didn't find it insanity inducing at all. /images/graemlins/smile.gif Modeling in general requires a lot of clicking, and with the adjustable snap threshold I found it pretty quick to create splines. The time saver is in not having to create a vert and then move it into place.
I think fixing the bug, and with the addition of undo and being able to go back to an existing spline object you might find it more useful. Another addition I thought of that would save clicking and time would be to select two or more spline edge rings and then automatically create the bridging splines between them. This would be the same as using the "Cross Section" button in the Editable Spline modifier, but one click instead of multiple clicks.
I don't see this as being used to create the finished low poly model, but as the first step in creating the bulk of the geometry and then going in after converting to polys and finalizing it from there. I can also see it being useful to create lods for terrain quickly where you don't even have to worry about edgeloops. And there are probably other uses that I haven't thought of.
The Polyboost set of tools looks interesting. I've created some of the same ones, like edge and loop select for verts and faces, for myself. I'd be interested in seeing how well the script works with a complicated character as opposed the nice gridded geometry he's using in the examples. And also how well it sells, seeing as how there are so many free tools out there. But it's cool to see people extending the Max toolset in creative ways.
12-02-2004, 03:10 PM
I like the Cross Section idea. Playing with your tool it seems like I waste some time redirecting the flow to make sure the next spline sprouts out of the last-clicked vertex.
But if instead I focus on making the sections and not on connecting them, that'd probably save a lot of time.
The things I liked in the Polyboost vids were the StepMode tool, the pole-fixers, and the PaintConnect and FlowConnect tools. The rest of it seems like a lot of fluff, at least for my workflow.
12-02-2004, 03:38 PM
It would be nice to have a way to re-grab the first spline again, to add onto it, instead of creating a new spline. This would help when I want to traverse the model to start on the other side.
Have you tried just using Editable Spline's "Create Line" with snap set to vertices, Show End Result on, with a Surface mod on top? If I turn on the Shade Selected toggle, then it is a very similar workflow, except this way I can see the new surface updated as I work. One bummer is the incessant "Close Spline?" dialogs. But I like seeing the surface update as I go.
12-02-2004, 04:36 PM
Thanks for all the responses Eric. I have tried using create spline with 3d snap on, but I kind of like being able to add verts anywhere on the model and not just existing geometry verts. Plus, there's some issues with 3d snap in Max 7. I don't know what they did to it, but I have to reset it to verts every time I reopen Max, and I have to turn off "Show End Result" or it doesn't work. I never had a problem with it in older versions. I expect new features in new versions of Max to not work quite right, but for old features to become worse really sucks. /images/graemlins/smile.gif
It may well end up that this script isn't any more useful than the stock Max tools. But it's been a while since I've done any scripting and it's nice to get back into it. So I'll keep at it until I figure out that it's either not worth the trouble or it actually becomes useful. /images/graemlins/smile.gif
Look for an update soon.
12-02-2004, 07:44 PM
Here's an updated version: drawModel.zip (http://jhaywood.com/pics/drawModel.zip)
Here's what's new:
- Preview button to see the model as you're working on it. Just turn it on and off while you're working.
- Added the ability to continue with a previous spline object. Just have it selected before you click Draw.
- Hopefully squashed the alt-click bug in Max 5.1. It works on my end anyway.
- Oh, and it's now a macroscript and can be found in the Haywood Tools category after installation.
12-03-2004, 07:30 AM
Awesome. I'll play with it some more. Thanks for the update.
12-04-2004, 02:22 PM
I like where this is going. An option to set the scale of the spheres the script creates would be useful, they were pretty big on the object I was testing it on. And maybe an option to make them See-Through would be handy too.
Seems to work pretty well, although I agree with Eric, having a "drawing" style thing would be better (similar to Silo), although I appreciate how difficult that would be to get working properly (if at all!)
Some way to make the splines display "thicker" too might be cool, although I dunno if you can do that.
Keep it up, I look forward to updates!
12-04-2004, 03:14 PM
The Snap Threshold value actually controls the sphere size. Just change the spinner value. Adding an option to make them see-through is easy enough, and I can use the rendering options of the splines to be able to adjust their thickness. Another option would be to make the surface you're drawing on see-through, which helps with being able to see the splines better.
I agree that a more draw based approach would be better in the long run, so that's the next evolutionary step planned.
About screenshots, it easier to see exactly what this does if you try it out, but I'll put together a few progress shots of the script in use.
12-05-2004, 06:58 AM
In my tests I set the polygonal model to Xray mode, that helped a lot. You could try setting the Editable Spline to be renderable and show the render mesh in the viewport... that way it can be as "thick" as you want.
vBulletin® v3.8.4, Copyright ©2000-2013, Jelsoft Enterprises Ltd.