blender material nodes
TRANSCRIPT
-
7/30/2019 Blender Material Nodes
1/5
Car paint, material by Matt Ebb(MPEG4, 500 KB / XviD AVI, 650KB/ .blend file )
Node setup
Ice, by Andy Goralczyk ( MPEG4,200KB / .blend file )
Node setup
Frosted glass, by Claas Kuhnen (.blend file ) Node setup
Blender's Material system was, until now, assuming a fixed set of
variables for shading and a limited set of 'channels' available for
mapping Textures on these variables.
The obvious advantage was that these settings were visible at a glance,
allowing quick setup of most of the basic Material features.
Currently most 3D suites have some kind of "shader editor", typically
represented as Nodes or Trees. Whilst constructing Materials out of its basic shader components allows a
high level offreedom, it can also turn out to be a very tedious job. Shader networks consisting of many
nodes can become confusing and hard to understand.
To combine the best of two worlds, whilst also allowing a Blender-compatible migration, a hybrid version
has now been implemented in Blender.
Read about general implementation notes for Nodes here.
Layering Materials
The original request was to look at ways to combine or layer multiple Materials, allowing the use of several
shading passes, one on top of the other, and also bypassing the limited number of texture channels. A
simple layer editor was constructed, which did not satisfy users. The next step was to implement this, this
time, using Nodes.
Examples
-
7/30/2019 Blender Material Nodes
2/5
Toon shader, by Claas K uhnen
Node setup
Press "Add New" (or use small menu button left of it) Press "Nodes" (or "Use Nodes")
Press red button "Add New" to link a new Material to
the Node
Getting StartedIf using Blender Nodes for the first time, check the general editing information on the Nodes UI page.
Enabling Nodes editing involves these two steps first:
Create a workspace in your screen with a Node Editor window.
Open the buttons window with the a view on the Material options
In this example we assume the active Object doesn't have a Material yet. The pictures below then show the
following steps:
1. Object with no Material
2. Press "Add New" (or use small menu button left of it)
3. Press "Nodes" (or "Use Nodes")
4. Link a new Material to the Node
-
7/30/2019 Blender Material Nodes
3/5
Two nodes, mixed Cleaned up
We have now created the following situation:
A base Material (1), which we use to link to Objects
Added a NodeTree to this base Material with two nodes and a
link
Linked the Material Node to a new Material (2)
This means a Blender Material can be used in three ways now.
1) As usual, a fixed block of settings you can link to Objects
2) As a base for a NodeTree; in this case browse menus will indicate that Material with a "N".
3) As a Node inside a NodeTree.
Some of the Material settings are not part of the shading system,
but define how the geometry is being used in the rendering
pipeline. These settings cannot be used per Node or be layered.
You can find these settings, and the buttons to browse/link
Materials, in the new "Links and Pipeline" Panel. Here you define
settings like "Halo" or whether the faces with this material are
included for ray-tracing or shadow buffers.
The situation we've created now works in the Buttons windowexactly as if a single Material were used, with the exception that
the base-Material stores the 'render pipe line' settings, and the node-material stores all shading
information.
You may also notice that the Material Node input values are synchronized with the Material itself when
changed. Only when the input sockets are used, are these values overridden.
Layering Materials
The steps to create two materials which are mixed is simple:
Select the Material Node
Shift D to duplicate it
Use the menu button in the new Node to assign it a new Material (menu item "Add new").
Selecting a Material Node also updates the settings in the Material buttons, this way you can give both
Nodes a different appearance.
Press Shift A and choose "Color Mix" to add a Mix Node.
Create the proper links to make it actually work (1st picture)
When you don't need to further edit this situation, you can clean up the Node view by using the buttons in
the Node header to hide the unused inputs and buttons, and to minimize the Mix Node. (2nd picture)
Node TypesOutputThe Output Node can be used anywhere in a network, and offers preview renders of the Material at the
linked location. The first added Output is the Output used for rendering, with a red sphere icon on the
Node to indicate this.
Material
-
7/30/2019 Blender Material Nodes
4/5
The Material Node will do a full shading (for all indicated lamps) similarly to using a regular Material. Note
that all calculations (Shadows, Ambient Occlusion, etc., etc) occur for each Material Node.
Currently a Material only allows four inputs, this is a candidate to be expanded.
TextureThe Texture Node requires a vector (texture coordinate) as input to work. Typically you'll use the Geomotry
Node as Input.
GeometryAll Material Nodes in a tree will always use the same texture coordinates. These can be accessed with this
Node, for example as Texture input.
GroupWhen you group Nodes (CTRL+G), this Group becomes a new Node Tree in the Blender Library, which then
can be linked by a "Group Node" to be re-used anywhere you want. More about Groups here.
MixThe Mix Node acts as a "pass-thru" for the first (top) Color input, and uses the "Fac" value to determine the
level that the second input effects the result, under the given operation. With "Fac" set to zero, no operation
occurs.
RGB CurvesThis Node shows a new UI widget, the "Curves". You can use it to adjust overall brightness or the individual
RGB channels. More about Curves widget.
NormalUse the Normal Node to define a fixed normal, or to perform a dot product with this normal. When used for
shading, this normal is in "camera space".
MappingThe Mapping Node can be used to clamp/translate/rotate/scale Vectors or Colors.
Vector CurvesAlthough this Node operates in a similar manner to the RGB Curves Node, it is initialized properly for 1:1
mapping and clamping values between -1 and 1. More about Curves widget.
Color RampThis Node converts a value to a RGB color and Alpha using a Ramp. The ramp editing works as per regular
ramps in the Blender UI (CTRL+click to add new key positions).
RGB to BWA simple color to value convertor
ValueThis Node generates a Value
RGBThis Node generates a Color
Next stepsThe current system will still need some evaluation...
Ray-traced mirror or transparency inside of Material Nodes is not well handled yet. This because the use
of node trees makes it impossible to retrieve a singular Material property (like, does this point on a face
-
7/30/2019 Blender Material Nodes
5/5
reflect or not?).
What does work is having a regular material that mirrors another material with a nodetree. We have to work
still on this topic.
Although it works quite well to have a full Material available as a Node, it can result in very slow rendering
when multiple Nodes require shadow or raytracing results. This can be solved by recoding the core internal
rendering loop to be made more "pass aware". Meaning, before Blender starts executing the Nodes, the
required AO render, shadow or raytrace results can be precalculated.
Since Nodes allow a high level of freedom to mix whatever you like, it is not easily possible to extract the
individual Passes, such as, only diffuse, or only specular, etc. This requires further research.
More Node types can be added, especially for lower level shading (like a Diffuse Node, or a Shadow
Node). This will require a good balanced design in advance though, something for which I'd welcome
contributions.
Preliminary tests were done to create Python Nodes, actually fully customizable and programmable
shaders. Requires further work still.