Basically what I need is script which groups lowpoly parts with their corresponding highpoly
parts and scatter all groups in the viewport for easy texture baking of normal and AO maps.
Right now I do that manually by linking lowpoly and highpoly pieces to different help objects and moving them around.
So if someone of you masterminds of game art can help here it will be awesome!
Here is a gif illustrating what I'm talking about:
Replies
Anyways, did you try scriptspot?
I found this one there, and it appears if you use only the 3rd dial it might give you what your after. http://scriptspot.com/3ds-max/the-bm-breaker
Frame 0 = all parts together.
Frame 1 = exploded.
Vig, I actually do it this way ,but when the pieces are too many it is annoying to group/link/move all pieces by hand(sometimes I forget to link some part to its corresponding group and I get even more pissed). What I was thinking of was to automate the process.
My workflow right now goes like this: I create a helper object for each group(like the pants group, or shoulder piece group or whatever), then link the lowpoly and all corresponding highpoly objects to their helper; move all pieces away from each other far enough.Then I apply a projection modifier to each lowpoly object and render out normal and AO maps.I then combine all separate normal maps in one map into photoshop using a custom action,I do the same with the AO maps.
So I was thinking of automating the first part, the "whole linking/moving pieces all around" stuff (and even setting projection settings,that will be even better).
Yes, Lamont, I was thinking about naming conventions too but I have no experience in MaxScript. It will be really helpful if you provide some sort of algorithm, what are the general steps in your Mel script?
Brad, thanks, I'll give it a try
- Type in the name of the target mesh (or select).
- Set your options (AO/Normal Map image size)
- Hit the render button.
Maya selects the correct mesh, and uses that as the source. I am not doing any kind of tricky math with this one, all I do is take the functions of Maya, wrap them in a UI with options and pass the data along. Streamline an otherwise PITA workflow for hundreds of meshes.
If I know I will have AO maps a certain size, I will bind this to a key. So select the mesh, hit the key, and it kicks out the image.
Isolation is a good idea! This way it will even cut down the render time of each map , because the groups(LPs + HPs) will be considered in the baking process one at a time, instead of loading all objects at once.
So bassicaly the script should :
1)group coresponding parts into different selection sets
based on naming conventions, for instance:
LP_ShoulderPart (the LowPoly object)
HP_ShoulderPart (HighPoly object)
ZB_ShoulderPart (HighPoly object imported from Zbrush)
...this should be grouped into one selection set called "ShoulderPart"
2)iterate a render to texture for every selection set in isolation mode
...by the way, "the bm-breaker" doesn't work, it only detaches a selected object to its consisting sub-objects
Yes, in the end there should be one AO texture.Right now I use a custom photoshop action to combine the multiple AO parts in one final AO map
The Explode baker:
Step a) Link LPs to their corresponding HPs:
- must provide flexible options such as smart sorting of names
(even if some of the names are miswritten the script tries to find
their best match).
- linking by relative distance and positions.Even if there is no naming
conventions and organization in the scene, the scripts pairs objects together
by their relative pivot position( I saw smth like this at scriptspot.com, called
"DistanceLinker" or smth similar.) It's not a perfect solution, can produce mistakes.
- or the two methods could be combined together. First the script tries to
group objects using naming convention and if miswritten object is present in
the scene , groups it to the nearest object if there is any.
- also option to link object by other criteries , like material IDs or
smth is a plus.
Step b) A projection modifier is applied to all LPs(with predefined settings),
or it would be better if it preserves the settings avaible prior the linkage.
Notice that a link hierarchy can't be created when a projection modifier is
applied to some of the objects, so the modifier should be removed prior the
linkage and applied back after.
Step c) Exploded all linked groups using a unique vector so there are no
overlapping groups of objects and there is enough space between them.
Step d) Render all required maps on one pass using RTT.
Step e) Revert the original position of the linked groups. That can be done by
simple animation.At frame 0 all pieces are together, at frame 1 they are exploded.
First of all sorry for my English, I hope you've understand the idea. Second, I'll be highly appreciative if someone in this community finds this script idea for interesting and wish to help. I think something like automated RTT will have a great value when it comes to cutting down production time. Tell me what you think, Cheers!
Explode bake for your normals/high ao detail
Simple AO bake from just the lowpoly mesh(projecting onto itself, no HP source)
combine high + low ao!
There you go, done! You have your highres ao detail, and the low freq. detail from various parts intersecting etc.
In maya you can select multiple LP sources, which is very usefull. In max, i guess just combine your exploded objects before baking into one mesh, it really seems like you guys are trying to make this a lot more complicated than it is. =D
EarthQuake, my current workflow is exactly like you've discribed it ( + additional step : layering two more "fake AOs" generated in photoshop from the normal maps). Max is also capable of selecting multiple LP sources, that is what I always do, but the thing is that they render to separate maps, and should be combined in one map later in photoshop( I automated this with an action so it's not time consuming at all). If I want to bake all parts in one map in max, I should attach all LP objects together loosing their pivots,etc. And it's pain in the ass when it comes to fine tuning the projection cage or the parameters of only one part, if something goes wrong with that part, you'll waist time to render the whole thing again.
What I want to do, is automate all the hand work . You click a button - your character or whatever , explodes to pieces. Click another button - all LP pieces are now with a projection modifier in their stack and with the correct parameters, click one more button - the RTT begins, etc. I'm not sure if this is posible but would be nice to have such tool, especialy when you're dealing with tons of objects to render out.
Jerry, you're great man ! If you need some more information just ask, I'm glad someone took this siriously. I'm looking forward to it!
So when you talk about the explode bake, do you work with the keyframe method, or just save before, move everything, bake and then reload from your save file?
The next part i'm gonna be working on is matching the high with the lowpoly. I would let you guys test the current version but it's way too buggy :poly127:
Edit: I just browsed the plugins thread and see three people have actually written the detach by element part :poly124:. It didn't take me very long to write but it's pretty stupid three people wrote the same thing and then i write it the fourth time. Oh well. If anyone cares for just the detaching part (matID smthGrp) i can probably release it separately later, we'll see.
Yeah the keyframe method is best. Anything that means you end up with multiple copies of the mesh is a bad idea, incase you need to go back and make changes.
Also saving, moving etc assumes your bake is going to be perfect on the first try, which is pretty wishful thinking . When you inevitably need to rebake, you'll be glad its set up as simple keyframes.
i was taught this recently, way easier than exploding imo.
http://www.scriptspot.com/forums/3ds-max/scripts-wanted/script-auto-baker-automated-rtt
yesterday, and something else:
another way to isolate, meshes before baking is to set parameter in th rendering command: and use select #{baseObj, pairObj} before that
Ive been putting a modifier on top of the stack of edit mesh that I can turn on/off. On = Height and NM. Off = AO. In high rez, just below mesh smooth.
Why would you bake an AO of your low rez and do you multiply it on top of the high rez one?
I usually collapse my exploded high/low mesh for the AO.
Is a limitation of max/maya? I know in xnormal you can choose a variety of high PC files to combine on final. Maybe thus far my polycounts just haven't been big enough to encounter what you mention?
I guess Im asking. Is this just a workaround? Or part of the standard process to get AO to look correct?
I'll upload it later today when I get home and post the link (if I remember!)
Here's some pics of how it works.
http://bayimg.com/image/paelcaacc.jpg
http://bayimg.com/image/paeldaacc.jpg
It works with object names... LOW_objname and HIGH_objname are clearly buddies, and will stick together during explode/implode.
For things you don't want to move, you don't give them the LOW_ prefix
If you want only the low to move, give it the LOW_ prefix, but no matching HIGH_ buddy, and he will be a loner.
Also less buttons is always a winner - so maybe you can combine some functionality into a few or just 1 button instead of several.
I'm all for UI ideas, like I said, really just hacked together. Even in its sloppy form right now I find it to be a big time saver. I have no patience for separating things manually for bakes. :P
Now I want to write one for Maya
I was thinking of something like this:
having 1 part of the GUI generating and controlling the pair list (using a multilist element). Double clicking on one would let you select that particular pair so you can check them out if the automatic pairings went ok.
Finally a single render button that then in the end would loop through the pairs, isolate them - > bake them and store them to some specified folder.
@Electro, we're waiting man, would you post it soon, I'm eager to try it out.
@renderhjs , that is a nice mockup ! Maybe a drop down menu with render presets will be handy too.
http://richsunproductions.info/vsfx705/modelingsuite.html
Can't wait to try it out! Thanks man!
I gotsta try this! Does it mean you sort the pairs out by giving high and low (sub)objects matching material ID's ? So you can just keep everything clumped together, but correctly setting up ID's will leave you with no messy ray intersections?
You can set up subobjects in the projection modifier to only hit specified sourceobjects. Renders separate maps though.
I do it like earthquake, just that I have set up animated dummies and link parts of the mesh and the corresponding sourceobjects via selection modifier and linked xform to them. Often you want to decide which parts of the mesh get separated and which stay together for baking. But an automated approach would come in handy, too, I'm sure.
http://dl.dropbox.com/u/2298918/explosivo_02.mzp
Here ye go everyone...
Don't really expect much if you go looking in the maxscript "code". It's really messily slapped together and I didn't even go back and make things functions that should be... I really didn't care or expect to be releasing it when I made it... I just made it because of my bike model with 300+ pieces that I didn't want to keyframe by hand or whatever.
Usage:
Name your low poly objects with the prefix LOW_
Name your high poly objects with the prefix HIGH_
The rest of the name following the prefixes needs to be identical. Currently this script works off of names alone, I didn't get to making anything kind of automated like I would if I were to take the time when making it again. I may look at revising this if there's enough demand for it. In general however, I think using the naming convention kind of forces people into good habits in being able to manage their scenes better... not that I would be enforcing that onto anyone
Best of luck, and happy baking!
Dude, this script is great, I've been waiting for someone to write this for long time!
I've just tested it out and it works great! The only request I would have to make is to add an option to choose different naming conventions.I like to use
LP_" instead of "LOW_" and "HP_" instead of "HIGH_",etc. It would be even better if its possible to define more than one prefix, for example, HP_ and ZB_(ZBrush imports) to be recognized both as HIGH_ objects.So some text fields in the interface where I can put my own conventions would be really nice !
I would test it in production soon, thank you once again
Glad you like it so far!
thank you VERY much!