Adding ColorCorrect to a lot of diffuse maps and put them in a respective reflection map slot.

I have some photogrammetry scans of some buildings. I have a total of 128 diffuse maps, and I would like to have them all send to their own color correct node and put them in their own reflection map slot.

I have found this https://forums.cgsociety.org/t/adding-colorcorrect-to-diffuse-slot-on-many-objects/1467723 and tried many ways but I think the problem is that all of the VrayMtls are in one multi sub object. Can someone help me with this please?

You could also use multi texture for this without the randomisation. Although it’s not as tweakable as a colour correction…
oh I guess you need the textures on specific objects. So this doesn’t help..

Haha no indeed, I’ve been thinking about that too, but it’s actually one mesh with a lot of multisub objects materials. Because of the large amount of big textures.

Wouldnt assigning different mtl ids and using vraymultitsubex help?
I tested it out, and I hope I got it right what you want to achieve
I assigned 5 ids to different faces and applied a multi sub mtl to that object.
Then a color correction map, that is linked to each material. I figure you want to have different bump and different glossiness values and so on per mtl. otherwise just one material works.
into the color correction you plugin a vraymultisubtex and in each slot of that your textures. If set (as is the default) “get id from face id”, then you can adjust all of the textures in one go…
see here:
.

Thank you for your insight Manuel, the problem is that the material already is made and looks like this but then with 128 sub materials.

ok, its a little work but I would just create that multisubtex and then plug all the bitmaps in there and then into the color correction and plug that back into all 128 mtls.
you want to color correct all of them at once, right? not individually…

Indeed, but I’m a very lazy person and don’t have time to click that many times :wink: I always try the laziest fastest route and I’m quite certain this could be done with one line of code and the zorb modifier. So here’s to hoping some Maxscript wizard can help me out. @_Lele perhaps?

I see haha. totally get you, I am the same.
although most of the time I spend more time trying to automate something that I could do in less time manually for sure.

Sure but the next time you won’t take as long anymore :wink: And you get smarter every time you do.

did you find this?

Something like this?


multisub = $.material
for m in multisub.materialList do (
    cc = ColorCorrect()
    cc.src_tex = m.texmap_diffuse
    m.texmap_reflection = cc
)

Note it assumes that the material you want to modify is the one of the currently selected object, also it’s as simple as it gets, it can break in many ways if the material is not exactly what expects :slight_smile:

Thank you! I’m getting a syntax error though :confused:

-- Syntax error: at ), expected <factor>
--  In line: )

If you want to use Color_Correction instead as per MANUEL ScriptScpot link you could use this:```

multisub = $.material

for m in multisub.materialList do (
cc = Color_Correction map:m.texmap_diffuse
m.texmap_reflection = cc
)

Damn it! Still a syntax error :(:sweat_smile:

Mmm, how are you running it? you can go to “scripting/new script”, paste the script there and press Ctrl+e (evaluate all)

I’m sorry I just pasted it in my listener. If I create a new script it works! Awesome!!! Thank you so much. You saved me a 1000 clicks. :slight_smile:

You are welcome :slight_smile: