SCRIPT: "Auto-Baker" (automated RTT)

The short version:

Basically what I need is script which groups lowpoly parts with their corresponding highpoly
parts and scatters all groups in the viewport for easy texture baking of normal and AO maps.
See the attachment, it is a gif animation illustrating what I'm talking about.

The long version:
Method1: 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 here, 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.

Guys, first of all sorry for my English, I hope you've understand the idea.I just want to accelerate the process , especially for models containing a lot of small parts, write now my workflow is the same illustrated in the gif animation, with the difference that I separate the objects by hand(I move all groups, lowpolys + highpolys by hand).I know it's a strange way to do things, but that's how I work and I find this way giving the best possible quality, especially when dealing with very complex characters, containing lots of sub-objects.

I'll be highly appreciative if someone finds this request interesting and wish to help.


ExpodeAnim.gif42.79 KB


Comment viewing options

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

Ok, if "isolation mode"

Ok, if "isolation mode" works well for you, ie return correct texture, then use it. And I personally do not see with what helps you the script here...

my recent MAXScripts RSS (archive here)

CodeFather's picture

Hi, Anubis, thank you for

Hi, Anubis, thank you for your reply. The Highpoly objects and their corresponding lowpoly objects are aligned from the start, there is no need to align them.
I was thinking of, rather than saving tones of files for the separate groups like you offer, why not get advantage of the "isolation mode" feature in 3dsmax, so basicly the steps should look more like this:

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, one by one.

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(like the case of the "explode" algorithm).

I have to mention that I have no MaxScript experience, and I was hoping someone in this community to give me a hand, everything from ideas to simple source code I could use for reference will be highly appreciated.

Anubis's picture

Here's an idea from me (you

Here's an idea from me (you choose):
1. Align your LP to HP (if not already done)
2. Select them (2 objects)
3. Use "Save Selected"
4. Load saved file and RTT.
5. Load your preview working file and use Merge with Replace option.
6. 1st object is done, go to the next and repeat steps from 1 to 5.

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.