ZBrushCentral

Batch apply different material per POLYGROUP?

How to batch process assign different material to each PolyGroup?
It’s ok if the material is the same for identical polygroups.

Does it matter which materials or will any material do?

at this point any will do! lol, yea i polygrouped everything thinking drag drop in keyshot 7 would work but it;s not like that.

example: each polygroup
window, frame, upper glass, lower glass
the geo is one subtool, so I wanted all the windows to be combined yet have each polygroup be a diferent material. But KS7 only lets one material not based on the polygroups .

I was hoping for a ID set or clownpass where each material would be an obvious different color.

@marcus_civis do you know any different ways do it directly in the same tool ?
I would had :

  • copy the subtool
  • split group
  • apply materials in a loop
  • merge all
  • delete the original subtool
  • replace it with the new one

Nicolas

1 Like

@facelessmindz ,
Yes, I think that is the best way. It would be possible to export the tool and process the OBJ/GoZ file but there isn’t really any advantage and your way makes it easy to assign colored materials.

@sadicus ,
Here is a simple macro that I think will do what you want. It follows Nicolas’s suggestion but I have added in different colored materials. The zip file contains the macro text file and a material called “MatCapWhite.zmt”. Put both files in the ZStartup/Macros/Misc folder.

Note that I’ve left out replacing the original subtool, so you will end up with a copy.

Mats2Groups.zip (51.4 KB)

I’m not familiar with KeyShot so let me know if this works!

Marcus

2 Likes

Works Great! Do you happen to know the limit, How many Unique Materials can be created?

1 Like

The macro has a limit of 54. This is simply because I used colors exported from ZColor. But in theory you could go up to how ever many materials you have loaded into ZBrush (less one for the Flat Material). I don’t remember how any materials you can have loaded - perhaps 200?

Marcus

54 is more than enough for most situations but would be cool to have options depending an what needs a batch operation. is there a way to pick between multiples like 5, 10, 15 or min max range?
the project has 600 subtools, bot not all different materials. could be good to make variants of the same type of material.
Thanks for this macro!

You can edit the macro to do what you want. If you want more materials then you’d need to specify the colors and add them to the list, increase the list total, that’s all.

If you are working through 600 subtools though you might want to split the materials code to a separate macro from the “fill color 7 material” code, just so that you don’t keep copying the same materials.

Marcus

I have not looked at the code guts, #1 I’m sure I can figure out by following whatever pattern you have set.

  1. specify the colors and add them to the list, (

  2. split the materials code to a separate macro from the “fill color 7 material” code

#2 not so much.

Here you are:

ColorMats.txt (2.1 KB) Mats2Groups2.txt (781 Bytes)

-Marcus

2 Likes

Oh this is a nice thing to see today! Thank you for taking time to do this.

There is confusion between two different topics.
I forgot there is a public thread and asking for download of this script. what to do?
not sure what the correct thread protocol is,

“How to import 32bit TGA files without using fbx import?
FBX import has no problem importing 32bit.tga”

I really don’t remember why i needed a 32bit TGA but if you want to also post that script again.

also can macros go into folders in Misc?
C:\Program Files\Pixologic\ZBrush 2021\ZStartup\Macros\Misc\BatchMaterials
right now it’s just a long list of text files.

I’ve posted a new version of the TGA import to that thread.

I think if you can add folders to the ZBrush 2021\ZStartup\Macros folder and they will show up as sub-palettes, so you can organize your macros.

-Marcus

2 Likes