Create a ticket
Follow

Q100407: Blend Mode caching in Mari 3.4v1 and 4.1v1

SUMMARY

In Mari 3.3v1 and earlier, changing the Blend Mode of a layer could sometimes be quite an arduous process as the shader would need to be recompiled. This article explains how you can use Blend Mode caching in Mari 3.4v1 / 4.1v1 to improve performance and reduce the number of shader recompilations needed in Dynamic mode.

 

MORE INFORMATION

The Dynamic Shader Compilation mode, introduced in Mari 3.3v1, improves shader compilation speeds at the cost of being a rather heavy shader. Whilst this Dynamic mode cuts down compilation rates by caching multiple operations, some artists still regularly encounter shader recompilation when switching between different Blend Modes of a layer.

As of Mari 3.4v1, Blend Modes are now included within the Dynamic caching system in order to reduce the number of recompilations taking place. Now, if a user changes the Blend Mode of a layer, Merge node, or of the Paint Buffer, there should be an immediate change rather than having to wait for the spinning wheel to complete in the viewport.

The caching system supports a ‘history’ of five Blend Modes that the artist is able to use without running into recompilation. 

NOTE: For more information on Blend Modes please see the Paint Blending Modes section from our Mari Online Help.

HOW TO ADJUST CUSTOM NODES TO BENEFIT FROM BLEND MODE CACHE STATES

Developers who are using Blend Mode attributes within their custom nodes may have the following, or similar in their custom node XML:
 
<Attribute Name="BlendMode" PrettyName="Mode" Group="" Type="userenum">Dynamic:MriBlendMode:Comp_Default</Attribute>
 
In order to use Blend Modes, a developer has two possible options:
  1. Dynamic:MriBlendMode:Comp_Default - for normal blend mode type (all modes).

  2. Dynamic:MriBlendModeNoAlpha:Comp_Default - for type that does not contain any alpha blend modes.
In order to add support for the quicker compilation Blend Modes, the XML file will need to be modified to enable these changes, like so:
 
Before:

Output = $BlendMode(_Base, _Over, #Mask.r * AdvancedBlendAmount);
 
After:
 
#if defined(MRI_GENERAL_COMPOSITION)
Output = Comp_General($BlendMode, _Base, _Over, #Mask.r * AdvancedBlendAmount);
#else
Output = $BlendMode(_Base, _Over, #Mask.r * AdvancedBlendAmount);
#endif // defined(MRI_GENERAL_COMPOSITION)
Was this article helpful?
/

We're sorry to hear that!

Please tell us why.
2 out of 2 found this helpful

Comments