Você está na página 1de 5

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 of freedom, 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 ge ne ra l imp le me nta tion note s for Nod e s here.

La ye ring Ma te ria ls

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

Node setup Car paint, material by M a t t Ebb (M P EG4, 500 K B / Xv i D A V I , 650K B / .bl end f i l e )

Node setup

Ice, by A ndy Gor a l cz y k ( M P EG4, 200K B / .bl end f i l e )

Frosted glass, by C l a a s K uhnen ( .bl end f i l e )

Node setup

Node setup

Toon shader, by C l a a s K uhnen

Getting Started
If 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

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

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 window exactly 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. La ye ring Ma te ria ls

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)

Two nodes, mixed

Cleaned up

Node Types
Outp ut The 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.

Ma te ria l

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.

T e xture The Texture Node requires a vector (texture coordinate) as input to work. Typically you'll use the Geomotry Node as Input.

G e ome try All Material Nodes in a tree will always use the same texture coordinates. These can be accessed with this Node, for example as Texture input.

G roup When 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 a b out G roup s he re .

Mix The 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.

R G B Curve s This Node shows a new UI widget, the "Curves". You can use it to adjust overall brightness or the individual RGB channels. More a b out Curve s wid ge t.

Norma l Use 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".

Ma p p ing The Mapping Node can be used to clamp/translate/rotate/scale Vectors or Colors.

V e ctor Curve s Although 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 a b out Curve s wid ge t.

Color R a mp This 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).

R G B to BW A simple color to value convertor

V a lue This Node generates a Value

RGB This Node generates a Color

Next steps
The 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

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.

Você também pode gostar