Tutorials/Nodes Tutorial
Wikipedia,自由的百科全书
Contents |
Node-Based Materials And Compositing 基于节点的材质与视频合成
原文链接:[1]
Reference 参考指南
For reference on the different node types, see this article's separate reference page.
节点对于有相关经验的cg人来说并不难,如果你不需要“手把手”的教程,可以不必往下看,直接跳转到this article's separate reference page(合成节点参考指南)
Node-Based Materials Tutorial 基于节点的材质
| NOTE: This tutorial is under construction. For a more usable (if still under construction) source of information on nodes, see this article's separate reference page
这个教程正在制作中(目前只完成十分之一而已...)如果你急需节点方面的资料,请直接跳转到this article's separate reference page(合成节点参考指南) |
Introduction 简介
A popular feature request has finally been granted: node-based material shaders. The basic design is a flowchart of different "nodes," each of which modifies a color, a direction vector, or a single value (such as alpha).
Blender 2.42版本中加入了一个众人企盼以久到特性:节点材质(基于节点的材质 node-based material shaders),节点材质基本上是由一个流程图构成的,当中布满了节点,每个节点专门负责某一方面的渲染,比如颜色(color),向量(direction vector),或者是某个单独的值(比如透明度 alpha)。节点越多,控制选项也越多,自由度也高,能够合成更复杂的材质。
What does this mean in practice? It means that instead of building one material per object, you can build as many as you want and blend them together in the Node Editor. If you desire, you can even build entire materials purely inside the node editor, using the "normal" blender materials to only provide shading values.
这一切到底意味着什么呢?这意味着你可以混合无限多个子材质,而且混合方法多种多样,这一点后面你会看到。
Nodes are, however, an entirely different way of visualizing materials. They are, in essence, graphical programmable shaders, which can make them confusing to use. For many people it may be easier to learn by doing, not learning, which is why the first part of this documentation is a tutorial.
需要注意的是,节点材质不同于一般的材质,它不单具有一般材质的视觉特征,也具有图形化的可编程性,这对新手来说,可能稍微有点复杂。所以呢,多说无益,还是亲自动手玩一玩,这样更形象一点,学得也更快一点。
| NOTE: If Blender lags in this tutorial, try turning "International Fonts" on in the user preferences. Some ATI cards cannot render blender's normal fonts without severely lagging.
ATI显卡用户请保持字体的默认设置,也就是把"International Fonts"打开,如果你改变了Blender的默认字体,那么有可能在操作节点的时候出现延迟现象。 |
Building Your First Node Shader 建立你的第一个节点材质
Part I: Setup 第一部分:设置
Start up Blender. Make sure your starting with the default single-cube scene. Download the files in the Downloads section.
打开 Blender。确定你使用的是默认场景。
Rotate the view with the middle mouse button like in the below image, and scale the cube along the Z-axis untill it is fairly flat (you can also go into editmode and delete the top vertices of the cube if you wish).
用鼠标中键旋转视图,如下图,将 立方体(cube)沿 Z 轴缩放直到它看上去扁扁的~ (当然你也可以进入编辑模式editmode 并删除顶部的点)
Change the 3D View area into a Node Editor by using the left-most popup button on the 3D View header. Select "Node Editor" from the list.
单击3D窗口菜单栏最左边的图形按钮,在弹出菜单里面选择"Node Editor",这样就切换到了节点编辑器(Node Editor)。
Your first view of the Node Editor will be of an empty gray screen, as shown below.
现在看来节点编辑器里面是空的,如下图:
Goto the material buttons in the buttons window, then press "Use Nodes" either inside the Node Editor itself, or in the material buttons. When the material that was active disappears, make sure to either reload it or press the "Add New" button.
请在材质面板里面点击“Add New”,这样立方体就有了一个普通材质,而我们现在讲的不是普通材质,而是基于节点的材质,所以,请再点击材质面板里面的“Node”(或者点击节点编辑器里面的“Use Node”),点击之后,立方体刚刚建立的材质被删除了,取而代之的是一个空节点,也就是一个容器,注意,容器默认是不包含材质的,实际上它的确是空的,你可以看看节点编辑器,里面是空的。
光有容器是没有用的,我们始终需要一个材质,所以我们现在还需要再次点击“Add New”,以生成一个材质节点。
You will now see a view like this:
There are two "nodes" inside the editor now, a Material node and a Output node. The Material node is connected to the Output node by a connection between the Material node's output color socket and the Output node's input color socket (both of which are yellow to denote that they work with color values).
你会发现,在节点编辑器里面,除了生成一个材质节点(Material node),还生成一个输出节点(Output node),材质节点中的color接口与输出节点的color输入接口相连。(注意,两个相连的接口通常是同色的,比如现在这个例子,它们都是黄色的。)
| NOTE:
节点材质是一个母材质,即基于节点的材质,准确的说,它是一个包含了多个材质的大材质。 材质节点是一个子节点,这个子节点是一个材质。 二者是包含与被包含的关系。 |
You can move a node around by clicking in its "titlebar" at the top. The various buttons on the titlebar will collapse the node in different ways. The triangle will completely collapse it, leaving only the input/output points showing; the "+" will hide any unused input/output points, the one next to the "+" will hide any buttons showing, and the circle next to that will hide any preview window within the node.
你可以通过拖动节点的标题栏来移动节点,也可以点击标题栏中的几个小按钮来缩放节点,这些都只是视觉操作,所以就不多说了,你可以自己试一试,一试便知。
Node sockets (those circles on the node's sides) can be a color (yellow), a vector (blue), or a single value (grey) such as alpha. A node's input sockets are on the left side of the node, while the output sockets are on the right. Therefore the Material node can be connected to another node to receive the specular and diffuse colors, a normal vector (not visible is this view) and a reflection value. The Material node will output a single color, an alpha value plus a normal vector.
点接口就是哪些小圆点,它们可以是黄色的(代表颜色通道)、蓝色的(代表向量通道)、或者灰色的(代表某个单独的值,比如透明度)。节点的输入接口在节点的左边,数据从左边流入节点,而右边则是节点的输出接口,数据经节点处理加工之后从节点右边流出。 现在你观察一下节点编辑器里面的材质节点(Material node ),就会知道材质节点能处理什么数据和输出什么数据。 显然,材质节点可以接收颜色(colors)、高光(spec)、反射(reflection )和向量(normal),并输出颜色(colors)、透明度(alpha )和向量(normal)。
Disable the specularity of the Material node by clicking the "Spec" pushbutton below it. Go back to the material buttons and change the material's diffuse color to a greenish hue (you can also click the rectangle next to the Color input node on the material node itself) as shown below.
下面跟我一起操作,因为下面的演示暂时用不到高光(Spec)数据,所以请在节点编辑器中的材质节点里面取消Spec按钮。
然后回到材质面板,把材质的固有色(col)变为绿色。
As a sidenote, whenever you click on a material node, you will be able to edit its associated material in the material buttons.
Download the image file Hojo.tga attached to this tutorial. Now go to the material buttons, and add an image texture. Load the image into the texture. Press Use Alpha, then go back to the material buttons and slide the Alpha slider all the way to zero. Go and set the texture mapping mode to "Alpha."
将文章底部的绿色叶子图片Tutorials-NT-Leaf.png下载到你到计算机,然后给材质节点加个图片贴图(加贴图的方法跟普通材质的方法是一样的,先点击你要编辑的节点,然后到材质面板里面加贴图)把刚下载到图片加载进来。在图片的加载面板里面记得勾选“Use Alpha”(使用图片的透明通道),因为这个图片包含有透明信息。
然后回到材质面板,把贴图的Mapping mode 改为 “Alpha”。
最后把Alpha 滑动条的值变为0。
(译者注:这三个alpha的含义都不一样,注意区分,Use Alpha的意思是把图片的透明信息读取到内存里面,而第二个Alpha的意思是将读取进来的信息以透明方式来贴图,而不是以黑白不透明的方式来贴图; 第三个是材质本身的透明度。前面两个alpha与贴图相关,后面一个alpha与材质相关。材质本身包含了8个贴图通道,你可以把材质和贴图分开来看,材质有自己的透明度,处于最低层(即第0层),每个贴图有自己的透明度,贴图可以处于第1~8层 。罗嗦那么多,晕了吧?慢慢来,不懂没关系,或许我说错也不一定:)
(未完,待续~)
Final Notes
Links
Downloads
Credits
This article was written by Joseph Eagar.
Credits go to Halley for vocabulary fixes and making the main diagram in the reference section make sense, and to ZanQdo whose .blend the main tutorial is based on.







