I’ve been wondering if Cycles and Eevee optimize shaders with NodeGroups in mind.
So if there is a NodeGroup used in tens of materials, is it compiled once and then reused or does it compile by ungrouping and then compiling with the rest of the material being compiled at that point.
I know that in Cycles updating shaders takes an instant but in Eevee it looks this is somewhat slower.
Could be because Eevee shaders are computationally harder or do they always need to recompile completely instead of updating? Or maybe Eevee recompiles entire NodeGroups again and again?
If there is anyone who could clear this up that would be great.
Both will expand the node groups and compile them again for every material. This is important for rendering performance, so optimizations like constant folding can work.
Sharing node groups between materials is probably not possible in an efficient and practical way. Graphics APIs and hardware are not designed to work like that. There are other optimizations possible for Eevee shader compilation that will help more.
The main slowness with Eevee shader compilation is inside the graphics driver, Cycles handles the compilation entirely by itself.
There are ways to improve shader compilation with Eevee, by giving the driver less to compile and making it work multithreaded. It could even be made to work like Cycles, but it wouldn’t be ideal for realtime performance.
Can something be done about the incredibly slow shader compilation? Switching from Solid mode to Material Preview mode in the demo classroom scene takes 55s. The Barbershop scenes takes almost two minutes. If you save a scene in material preview mode, it always locks up Blender when you load the scene.
I have a proper PC with a RTX 3060 and 64GB of RAM. OS is Windows 10.