Eevee shader variations and optimization?

Hello all. I have some question about shaders\materials and optimizing. I would like to use few characters in one scene, all of them should have same shader but with some variations in color for optimization purpose. Is it possible in blender? I don’t know much about how shaders is calculating so I just want to save some PC resources and compiling times. I am using eevee.
WHat I think to do is to pack my shader node tree inside group and use some input with RGB color node so I could use this node to adjust individual shader’s color. WIll it be more optimized than using separate shaders for each character? Or maybe there is other way to do what I want?

Peace to all.

Heres a simple randomise colour shader for Eevee,

Here, another way based off one colour.

I don’t know much about optimisation in Eevee, but one shader should compile quicker than individual shaders for each object.

In geonodes we have a compile timer, I think it maybe coming to material editor soon, it has I think been requested and the code is already there…

hope that helps.

2 Likes

Thank you for reply. So it’s only way to get different color for different objects from same material is to use random values without any control what object should get what color? That’s sad, but it’s better than nothing. All in all instead 10 shaders I will get only 1 for 10 characters. Theoretically it should compile and work 10 faster.

You can use object ID for more control.

3 Likes

No, not the only way, there are many, you could use object id, position, many options.

2 Likes

Oh, that’s better. Can you explain how to use object ID? Never done it…

Is the color linked to the object random or do you need to define it per object?

I need it per object not random. I use same base mesh for each character and using shapekeys to make their shapes different. So I need one shader for all of characters but I need control for each character’s diffuse color…

You need to set the pass index in object properties relations.

https://docs.blender.org/manual/en/latest/render/shader_nodes/input/object_info.html

1 Like

Thank you. Now I understand shader editor better. I will try to create some shader with color control for each object. :slight_smile:

1 Like

goodluck!

and some more words here…

1 Like

Studying object info node I’ve found out that color output will fit my needs. I can set for each character skin tint by object color (in object properties) and then just use object info color output as multiply value for mixRGB node so base skin will be multplied by objects color. At the end I will get 10 characters with one material but different colors. Thats great.

P.S. Also using object ID as factor for mix rgb I can control strenght of “overlay” skin tint.

1 Like