PDA

View Full Version : REQ - Condense Shader in the MEdit!


cecofuli
07-11-2012, 08:03 PM
Hi all,
I don't know if this script exist. On scriptspot I had not luck. This is my problem. Sometimes, when I merge some models from different files, these models have the same shader. But the shaders have a different names!!! See the image (it's a sample) . What interests me is to find the way to have only one shader assigned to all the models. For now, we do this task manually, but when you have 300 models and 20 same shader with 100 different names it's a hell!!! Could you help me? I think this script must check the shader properties. When all the properties are the same, or the main propertires (color, glossy, diffuse maps etc..) the script condense all the shaders in only one material. Finally, it will assigns this material to the correct models. This script will be payed.
THANKS SO MUCH!

http://img204.imageshack.us/img204/896/condense.jpg

Pjanssen
07-11-2012, 08:48 PM
That should certainly be doable.

This script will be payed. That's interesting. What do you have in mind, or do you want a quote? ;)

cecofuli
07-11-2012, 08:51 PM
Hi Pjanssen, thanks for your attention.
Write me in PM for the quote. Thank you so much! :thumbsup:

denisT
07-11-2012, 10:04 PM
I don't know if this script exist... This script will be payed.

i already have this script... i can share it for free but if you want to pay... ;) let me know.

cecofuli
07-11-2012, 10:08 PM
Hi denisT, you have a PM =)

denisT
07-12-2012, 03:54 AM
first of all i don't want to eat anyone else's food. if someone wants to make some money by doing the REQ just go.
but the issue is very common. how do you get a difference (distance) of two nodes? what is a criterion of two materials equivalent?
it's a right matter to discuss. are you in?

lo
07-12-2012, 06:53 AM
how do you get a difference (distance) of two nodes? what is a criterion of two materials equivalent?
it's a right matter to discuss. are you in?

I also did this a while back, and it was not as trivial as I first anticipated. There are many edge cases to check.

cecofuli
07-12-2012, 07:18 AM
Yes, you are right! In our office, usually we work 99% with VRay. So, the subject is all VRayMat (VRayCarPaint, VRayFastSSS etc...) . When we have shader like Standard, MR etc... the first step is convert to VRayMat with the "VRay scene Converted" from Chaosgroup.

About difference (distance) of two nodes. I think, when the first 5-6 shader's properties are the same (see the image) IMO it's enough to say "hey, these two shader, with different name, are the same! Please, condense!" But, I don't know if there is the possibility to say to 3ds max: when the first 10 shader properties, for all shaders, are the same, condense the material, create only one shader and apply to the correct geometry. Independently for the renderer, shader etc... is not necessary to check all the properties. When the main 10 properties are equal, means that the shader, 90%, is equal.

http://img24.imageshack.us/img24/3329/checkwc.jpg

lo
07-12-2012, 07:23 AM
About difference (distance) of two nodes. I think, when the first 5-6 shader's properties are the same (see the image) IMO it's enough to say "hey, these two shader, with different name, are the same! Please, condense!"

This is a great way to be right 90% of the time and utterly screwed for the other 10% :)

cecofuli
07-12-2012, 07:29 AM
Yes! I think the same. If I can save 90% of my time, it's enough! Just to know, the image is the real scene sample! As you can see, I have many identical shader (by eyes you can see) but with different name and combination! And all the shader are very simple. Sometime they are only a metal glossy material, or only with diffuse map inside and a little reflaction, or simple glass etc...

http://img855.imageshack.us/img855/986/sampleuo.jpg

lo
07-12-2012, 07:32 AM
Yes! I think the same. If I can save 90% of my time, it's enough!

My point is that you will save time on 90% of the materials, but it will generate mistakes in your scene for the other 10% - some different materials will also be merged and you will render to find some objects have a very wrong material.

Ideally, this tool would allow you to set thresholds for similarity. For example, using a threshold of 0.05 for reflection glossiness will merge all materials whose ref. glossiness is in the range of the threshold set, thus simplifying your material set.

cecofuli
07-12-2012, 07:36 AM
We need this script for our library creation. We do a lot of test rendering for every geometry. So, If there is some wrong shader, I can found it. Save the 90% of my time is good start! But some other guy can have some different usage for this script.

denisT
07-12-2012, 07:53 AM
My point is that you will save time on 90% of the materials, but it will generate mistakes in your scene for the other 10% ...
exactly... the problem is how to find the shaders those look the same. we can use the binary comparison, but in this case the difference of colors 127-127-127 and 128-128-128 makes these two materials different.
textures... some materials can be referred to different textures (by path) but to identical by essence.
in general case to find an identical or close nodes we have to know the way how they were created.

denisT
07-12-2012, 08:05 AM
the easiest way is compare all material properties for identity. but i don't see the workflow that allows to make identical materials named differently.
i think that the first step must be the grouping of all materials by their identical texture using.

lo
07-12-2012, 08:29 AM
If there was a way to get the material sample as a bitmap, we could have some fun by just comparing the pixels of the bitmap to determine if two materials "look the same" :)

Pjanssen
07-12-2012, 08:41 AM
If there was a way to get the material sample as a bitmap, we could have some fun by just comparing the pixels of the bitmap to determine if two materials "look the same" :)
I was just thinking the same. :) It may be a naive way, but it could be fun. You could do a material preview render and set a threshold on what rate of pixel difference would be considered as 'equal'. You could then also look at average difference, maximum local differences, etc.

lo
07-12-2012, 08:47 AM
now all that's left is to write some awful disgusting hack to get the material preview :)

cecofuli
07-12-2012, 10:51 AM
Ehy guy, I did not think it was so complicated! :sad:
About the texture path. Usually, when we import some models from some library, we copy all the textures in our network drive (Z:\texture for example) . Than, with Colin relink script, we relink all the bitmap.
Sorry, I don't thave any good suggestion for compare two shader. Unfortunately, my idea to check some shader propertires was wrong ^__^

cecofuli
07-12-2012, 07:55 PM
Hi all,

HERE (http://www.francescolegrenzi.com/Temp/95_CONDENSE.rar)

one sample scene, if you need it!
Thanks

denisT
07-12-2012, 09:27 PM
HERE (http://www.francescolegrenzi.com/Temp/95_CONDENSE.rar)
one sample scene, if you need it!

do you think many people have VRay?
well...

my tool found 16 VRayMtl materials and 4 unique.

cecofuli
07-13-2012, 07:17 AM
Hi denisT (http://forums.cgsociety.org/member.php?u=384956), ehehe :) for us, we use only VRay. I don't know if someone else uses some different renderer :)
Anyway, I update the scene, with different VRay shader and one standard material.

groutcho
07-13-2012, 02:04 PM
I did the same thing with standard materials, it's pretty easy. If you're interested...

cecofuli
07-15-2012, 04:45 PM
Hi groutcho (http://forums.cgsociety.org/member.php?u=176287), your script work with all the VRay material? You can test it with my scene sample.

groutcho
07-15-2012, 08:06 PM
I made it for standard materials, but it can easily be adapted for any class of material I guess.

Klunk
07-15-2012, 08:23 PM
think i'd ask for better workflow discipline from my art team ;)

cecofuli
07-15-2012, 09:58 PM
Hi groutcho (http://forums.cgsociety.org/member.php?u=176287), if you can, it's would be very very nice =) You can check your script with my sample see. Thank you!!!

denisT
07-15-2012, 11:17 PM
think i'd ask for better workflow discipline from my art team ;)
it might a result of merging files into one. i met the similar problem in one of projects that worked for. sometimes is very hard to discipline big team of artists.

groutcho
07-30-2012, 10:07 AM
If you have any maxscript skill, you can do it yourself, I don't have a Vray licence here, so i won't be able to know the properties to be compared.

The principle is simple : compare every properties attached to your class of material, included every property of every map in the maps channel, then create clusters of materials that share the same properties, then instantiate all materials in a cluster to the first material of the cluster.

cecofuli
07-30-2012, 10:42 AM
I'm sorry groutcho , but I havn't any MAXScript skill :)
But you can download the VRay DEMO (30 days)

http://www.chaosgroup.com/en/2/downloads.html

Raytracer05
07-30-2012, 01:33 PM
I have a VRay license and could have a look if it helps...

Pjanssen
07-30-2012, 01:43 PM
Are you looking for exactly identical materials, or similar materials though? From the earlier discussions I got the impression it's the latter.

cecofuli
07-30-2012, 03:33 PM
For my personal job (see the old LINK (http://forums.cgsociety.org/showpost.php?p=7363848&postcount=10)): i have, for example, 100 shader, 50 shaders are unique. Inside the other 50, there are some IDENTICAL shaders, but with different names. For example, I've one green glossy glass. The same shader has different names: Glass001, Glass002, VRayshaderGlass003, but the shader properties are identical, same RGB colour, same glossy, same maps. I think the easy way is to check the most important properties (diffuse, reflection refraction colour, reflection refraction glossy value, reflect and refract colour, fog, maps type for example) if there properties are the same, condense the two (or more shaders) into one, unique material. This is my idea.

CGTalk Moderation
07-30-2012, 03:33 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.