Eevee Shader Compilation

Hi guys,

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.

1 Like

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.

2 Likes

I see thank you for the reply!

It’s nothing too major just noticed it takes a lot longer in Eevee.

It takes a long time in Unreal Engine too though once you save the material to recompute the shader so not really sure if this can improve much tbh.

The main slowness with Eevee shader compilation is inside the graphics driver, Cycles handles the compilation entirely by itself.

What would that mean? Eevee’s slowness is caused by graphics driver and therefore can’t be improved by Blender itself?.
Thanks

1 Like

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.

1 Like

Is it planned for a near future?
Thanks

There is no concrete plan for when this will be worked on.

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.

This is a real bottleneck for working with Eevee… Makes me want to use some other renderer.

1 Like