Addon for Cycles Blender Material Generation

Good afternoon, dear habravchane. Some time ago I made the Shader Generator plugin - an addon that implements the idea of ​​parametric generation and editing of shaders (materials) of the Cycles built-in render.

Why is it needed

Using the plugin, the user, having minimal modeling skills, can create and configure realistic materials himself. Each material and texture can be used repeatedly and transferred from scene to scene. Presets can be saved, deleted, added.

How it works

The principle of the addon is to import into the working scene a tree of all the nodes necessary for generating the shader, combined into a universal group (Node Group). Further editing takes place using the traditional controls in the material properties panel. The advantages of this approach are the intuitiveness of the method for the user who did not have experience with the nodal architecture of the Cycles shader. A distinctive feature of the add-on is the original system for saving user presets of materials to the hard drive via JSON.

A group of nodes, containing all the nodes that determine the final form of the shader, is located in a separate .blend file, in the addon folder. This allows not only significantly reducing the amount of code, but also as quickly as possible, without programming, to make changes and additions to the shader itself.

How does it work

  • Put the plugin in the Addons folder
  • Put a daw in UserPreferences
  • Choose BlenderRender / Cycles
  • Select an object
  • Go to the Materials tab
  • Click GenerateShader
  • Done!

5 categories of materials are predefined: metal, glass, translucent, stone, snow

A few screenshots of the interface

Received materials

Here, it should be noted that I am not a modeller and renderer Cycles how to set up the best way I STILL do not know.


The addon structure is typical of Blender.
There are several classes that implement the operators called by the user from the graphical interface. They inherit these classes from bpy.types.Operator and have a typical structure of operator description properties and most often one execute method that executes the embedded functionality. In several statements, the invoke method is also called, which is called before execute and allows the user to specify the settings of the statement before execution.
The graphical part of the addon is implemented using the MatGenPanel class, which inherits from bpy.types.Panel. As with operators, the properties with the description of the panel for Blender's internal mechanisms are first declared. This is followed by a method for checking the context of poll, which allows to limit the panel visibility under certain conditions. In our case, such a condition is the rendering mode in Cycles.
The draw method draws GUI elements.
Finally, the global register and unregister functions add all declared classes to Blender's internal space through API helper methods.

Thank you for reading to the end, I hope this article was not deadly boring. It is possible that this material can be of practical use to someone.

The addon can be downloaded here:

Also popular now: