テンプレート:Release Notes/2.42/Materials/Nodes

提供: wiki
移動先: 案内検索

See CMS release notes for 2.42 at blender.org.

Nodes

- Foundations for new Node editor in Blender, generic framework that can be used for Material/Texture, Compositing, Logic or maybe even Sequencer. Note: this doesn't do anything yet, nor save! Is just to get this nice in CVS now. :)

- Grabbing works (Gkey) or tweak (LMB) or use RMB click-drag for grab - Shift+d works - Akey: select all - Drawing links works too now! some work done on hilites for node sockets.

- delete/duplicate with connection links - type awareness for sockets - make connections checks for max amount of possible connections - added dependency sorting of node list - cyclic connections are drawn red now, press Ckey to see the other bad cycles. - added UI toolkit support in nodes (try shift+a)

- Adding execution code for Node trees. Was a bit a puzzle, since I wantit to be multithreading by design. This now is solved by defining a stack per tree for all data that's being written into. This stack, which resides now in the NodeTree itself, then can be allocated per thread.

- For testing pleasure, I've added a 'mix node' and a 'show node', so you can already see it do something. :)

- reshuffled structure, to put things nice together, and have easier node adding. Current state is still WIP though, structure might change. For the record; new file node_shaders.c will contain all shader node definitions, apart from the drawing callbacks.


- To enable Nodes for Materials, you have to set the "Use Nodes" button, in the new Material buttons "Nodes" Panel or in header of the Node editor. Doing this will disable Material-Layers.

- Nodes now execute materials ("shaders"), but still only using the previewrender code.

- Nodes have (optional) previews for rendered images.

- Node headers allow to hide buttons and/or preview image

- Nodes can be dragged larger/smaller (right-bottom corner)

- Nodes can be hidden (minimized) with hotkey H

- CTRL+click on an Input Socket gives a popup with default values.

- Changing Material/Texture or Mix node will adjust Node title.

- Click-drag outside of a Node changes cursor to "Knife' and allows to draw a rect where to cut Links.

- Added new node types RGBtoBW, Texture, In/Output, ColorRamp

- Material Nodes have options to ouput diffuse or specular, or to use a negative normal. The input socket 'Normal' will force the material to use that normal, otherwise it uses the normal from the Material that has the node tree.

- When drawing a link between two not-matching sockets, Blender inserts a converting node (now only for value/rgb combos)

- When drawing a link to an input socket that's already in use, the old link will either disappear or flip to another unused socket.

- A click on a Material Node will activate it, and show all its settings in the Material Buttons. Active Material Nodes draw the material icon in red.

- A click on any node will show its options in the Node Panel in the Material buttons.

- Multiple Output Nodes can be used, to sample contents of a tree, but only one Output is the real one, which is indicated in a different color and red material icon.

- Added ThemeColors for node types

- ALT+C will convert existing Material-Layers to Node... this currently only adds the material/mix nodes and connects them.

- Press C to call another "Solve order", which will show all possible cyclic conflicts (if there are).

- Technical: nodes now use "Type" structs which define the structure of nodes and in/output sockets. The Type structs store all fixed info, callbacks, and allow to reconstruct saved Nodes to match what is required by Blender.

- Defining (new) nodes now is as simple as filling in a fixed Type struct, plus code some callbacks. A doc will be made!

- Node preview images are by default float

- nodes now have in header a triangle to minimize them or restore view

- mininodes have a scale dragger on right hand

Until now, the Node system worked on top of the 'current' Material, just like how the Material Layers worked. That's quite confusing in practice, especially to see what Material is a Node, or what is the "base material"

Best solution is to completely separate the two. This has been implemented as follows now;

- The confusing "Input" node has been removed.

- When choosing a Material in Blender, you can define this Material to be either 'normal' (default) or be the root of a Node tree.

- If a Material is a Node tree, you have to add Nodes in the tree to see something happen. An empty Node tree doesn't do anything (black).

- If a Material is a Node Tree, the 'data browse' menus show it with an 'N' mark before the name. The 'data block' buttons display it with the suffix 'NT' (instead of 'MA').

- In a Node Tree, any Material can be inserted, including itself. Only in that case the Material is being used itself for shading.

Added a new Panel "Links", which shows:

- where the Material is linked to (Object, Mesh, etc)

- if the Material is a NodeTree or not

- the actual active Material in the Tree

The "Node" Panel itself now only shows buttons from the other nodes, when they are active.

Further the Material Nodes themselves allow browsing and renaming or adding new Materials now too.

Second half of today's work was cleaning up selection when the Nodes overlap... it was possible to drag links from invisible sockets, or click headers for invisible nodes, etc. This because the mouse input code was not checking for visibility yet. Works now even for buttons. :)

To make learning how NodeTree Materials work easier; changed the default when you turn a Material into NodeTree.

It now doesn't link own Material to the first added Material Node, but allows you to do it, or create a new one.

- Texture Node: now displays 'intensity values' in node too, and has input, and shows in buttons when activated in Node editor. (no browsing buttons yet...)

- New: "Normal Node". This uses a new UI button, which allows to quickly input a normal vector, based on spherical coordinates. The Normal Node has optional vector input, and delivers a dot product then. This can be used as a blending factor between nodes, or for fake extra light in a certain direction.

- New: "Geometry Node". This actually replaces the Input node. It offers all coordinates (vectors) as being the starting point for shading and for textures. Note: for preview render this doesn't give much different results yet... this is the start for real render support!

- http://www.blender.org/bf/rt5.jpg The two new nodes in action

- Theme options for Node window available now in Info window

- theme colors now are different... the specific colors are only drawn in the headers of nodes, making the backdrop color constant. Allows for much more outstanding colors this way, without distracting from previews.

- soft shadow now is drawn pixel-sized, so doesn't scale up or down.

Node drawing

Small tweaks in Node drawing;

- theme colors now are different... the specific colors are only drawn in the headers of nodes, making the backdrop color constant. Allows for much more outstanding colors this way, without distracting from previews.

- soft shadow now is drawn pixel-sized, so doesn't scale up or down.

Orange Group Nodes

Node trees usually become messy and confusing quickly, so we need not only a way to collapse Nodes into single 'groups', but also a way to re-use that data to create libraries of effects.

This has been done by making a new Library data type, the NodeTree. Everything that has been grouped is stored here, and available for re-use, appending or linking. These NodeTrees are fully generic, i.e. can store shader trees, composit trees, and so on. The 'type' value as stored in the NodeTree will keep track of internal type definitions and execute/drawing callbacks. Needless to say, re-using shader trees in a composit tree is a bit useless, and will be prevented in the browsing code. :)

So; any NodeTree can become a "Goup Node" inside in a NodeTree. This Group Node then works just like any Node. To prevent the current code to become too complex, I've disabled the possibility to insert Groups inside of Groups. That might be enabled later, but is a real nasty piece of code to get OK.

Since Group Nodes are a dynamic Node type, a lot of work has been done to ensure Node definitions can be dynamic too, but still allow to be stored in files, and allow to be verified for type-definition changes on reloading. This system needs a little bit maturing still, so the Python gurus should better wait a little bit! (Also for me to write the definite API docs for it).

- Press CTRL+G to create a new Group. The grouping code checks for impossible selections (like an unselected node between selected nodes). Everthing that's selected then gets removed from the current tree, and inserted in a new NodeTree library data block. A Group Node then is added which links to this new NodeTree.

- Press ALT+G to ungroup. This will not delete the NodeTree library data, but just duplicate the Group into the current tree.

- Press TAB, or click on the NodeTree icon to edit Groups. Note that NodeTrees are instances, so editing one Group will also change the other users. This also means that when removing nodes in a Group (or hiding sockets or changing internal links) this is immediately corrected for all users of this Group, also in other Materials.

- While editing Groups, only the internal Nodes can be edited. A single click outside of the Group boundary will close this 'edit mode'.

What needs to be done:

- SHIFT+A menu in toolbox style, also including a list of Groups - Enable the single-user button in the Group Node - Displaying all (visible) internal group UI elements in the Node Panel - Enable Library linking and prevent editing of Groups then.

Nodes now render

This is still quite primitive, more on a level to replace the (now obsolete and disabled) Material Layers.

What needs to be done:

- make the "Geometry" node work properly, also for AA textures - make the Texture Node work (does very little at the moment) - give Material Nodes all inputs as needed (like Map-to Panel) - find a way to export more data from a Material Node, like the shadow value, or light intensity only, etc

Very important also to separate from the Material Buttons the "global" options, like "Ztransp" or "Wire" or "Halo". These can not be set for each Material-Node individually.

Also note that the Preview Render (Buttons window) now renders a bit differently. This was a horrid piece of antique code, using a totally incompatible way of rendering. Target is to fully re-use internal render code for previews.

A group node; named "Backlight"

http://www.blender.org/bf/g1.jpg http://www.blender.org/bf/g2.jpg

And how it looks rendered:

http://www.blender.org/bf/g3.jpg (no Nodes) http://www.blender.org/bf/g4.jpg (with Nodes)


made Node types Texture and Geometry integrated in render. Means the coordinate outputs now have correct dx/dy vectors for Image AA, and texture delivers correct intensity, rgb, alpha and normal.

Note; we need a "Vector Mapping" node, to do 2d/3d mapping, like in the Material "Map In" panel.

Material Nodes now have input sockets, to override the actual Material settings. If socket has no input, you can also edit Material settings here. (Color picker, number slider).

Orange Nodes

Orange: more Node goodies;

- New Node: "Mapping". Allows input vector to be translated, rotated and scaled. And optional be clipped to a range. Works for colors too!

- The button "Normal" now allows incremental input, so a click in the button won't change the normal anymore

- Connecting wires now show selection state for Nodes, with nice blended colors. Both colors were added in Themes, but default to black and white

Node previews now draw standard backdrop to show alpha better.

Socket Visibility control

Node types will be generated with a lot of possible inputs or outputs, and drawing all sockets all the time isn't very useful then.

A new option in the Node header ('plus' icon) allows to either hide all unused sockets (first keypress) or to reveil them (when there are hidden sockets, the icon displays black, otherwise it's blended).

Hidden sockets in Nodes also are not exported to a Group, so this way you can control what options (in/outputs) exactly are available.

To be done: - a way to hide individual sockets, like with a RMB click on it.

Stress Textures

"Stress" texture input channel

(As usual movies disappears after while)

Face example showing stress values on a blend. White is stretch, black is squeeze http://www.blender.org/bf/0001_0014.avi

Quick test with softbody stretch http://www.blender.org/bf/0001_0100.avi

Based on the difference of the "Orco" (original undeformed coordinate) and the actual render coordinate, a stress value is computed to make textures react to stretching or wrinking skin.

The texture coordinate is neutral (0) on relaxed state. -1 is squeezed to zero, +1 is stretched to infinity. Note that scaling (object itself or parent) also will result in stress values.

The reason for the huge commit is a cleanup in allocating memory for the vertices. These were growing too large with new options, so now it allocates the optional coordinates dynamically. Saves about 20 MB memory per 1M vertices already. But best of all is that I now can add much more fun... so tangents, here we come!


Materials

 New Material option: "OnlyCast". This makes the object only cast shadows,
 not show up in renders, nor being mirrored.