This commit ports Hue Saturation Value node to the material node system.
Unlike in composite version, each value is an input. Composite node version
will be updated later to use the same scheme.
These nodes allow the user to separate and combine RGB color channels
as in the composite node editor. However they don't contain Alpha
channel as it is treated separately in case of material nodes.
"Combine RGB" allows the user to use values beyond standard float range
([0.0, 1.0]) if value input node is used to feed the value to it.
* Geometry node: Front/back output
This is used as a mask for determining whether you're looking at the front side or back side of a mesh, useful for blending materials, my practical need was giving different materials to the pages of a magazine: http://mke3.net/blender/etc/frontback-h264.mov
Give 1.0 if it's the front side, and 0.0 if it's the back side.
* Extended material node
This is the same as the material node, but gives more available inputs and outputs, (basically just connecting up more of ShadeInput and ShadeResult to the node). I didn't want to add it to the normal simple Material node since you don't always need all that stuff, and it would make the node huge, but when you do need it, it's nice to have it.
== Comp nodes ==
* Invert node
Inverting is something that happens all the time in a node setup, and this makes it easier. It's been possible to invert previously by adding a mix node and subtracting the input from 1.0, but it's not the best way of doing it. This node:
- makes it a lot faster to set up, rather than all the clicking required with the mix node
- is a lot more usable amidst a complex comp setup, when you're looking at a node tree, it's very helpful to be able to see at a glance what's going on. Using subtract for inverting is easily mixed up with other nodes in which you are actually subtracting, not inverting, and looks very similar to all the other mix nodes that usually litter a comp tree.
- has options to invert the RGB channels, the Alpha channel, or both. This saves adding lots of extra nodes (separate RGBA, subtract, set alpha) when you want to do something simple like invert an alpha channel. I'd like to add this option to other nodes too.
There's also a shader node version too.
* Also a few fixes that I committed ages ago, but seems to have been overwritten in Bob's node refactor:
- adding new compbufs to the set alpha and alphaover nodes when you have only one noodle connected to the lower input
- making the fac value on RGB curves still work when there's nothing connected to it
* refactor copying and freeing of node->storage by handlerizing them.
- freestoragefunc
- copystoragefunc
- node_util.c/h have generic handlers for these.
Works simple; just check for
if(node->exec & NODE_BREAK)
break;
The main process (node processor) sets such a flag, checking for esc
20 times per second. That means you can check for ESC while doing image
processing without much cpu overhead.
Currently only added in blur nodes and defocus. Needs to be added all over,
nice for others... needs careful tests too.
What we now could do is even calling ESC on editing commands or mouseclicks
in composite editor? Could give user feeling of interactive app :) Further,
finished nodes are kept in memory anyway.
This will allow python or plugin defined nodes to work as well.
(And fixes compile issues with MSVC in yesterdays commit for nodes)
Code provided by Nathan L.
Fixes in his code:
- free_nodesystem() was called too late (after guarded alloc was closed)
- free_nodesystem() was freeing nodes that were not malloced even
- free_nodesystem was using free, not freeN :)
- the typedefs needed to be malloced yes, to allow duplicate nodes like
group but also for dynamic nodes.
* Auto-create compbufs for first socket of alphaover and set alpha nodes.
This allows you to eg. plug something into the second socket of an
alphaover node, and choose a solid colour in the first empty socket for
the image to be superimposed over.
Previously I had to create a bunch of extra nodes to (for example) mix
100% black over my render, just to get a black compbuf of the right size
that I could plug in. Not nice.
The Mix node already works this way, and these two should have, but
didn't.
* Allow the 'Fac' value to be used on RGB curves when there is no input
image. This lets you easily fade the changes in and out to check it
against the original, or to tone down the effect of the colour correction.
Composite: some cases gave memory errors (not freed mem).
The code that tried to be smart in finding nodes to skip, caused that
stack buffers were not freed propertly.
Compositing, depenency fix, so nodes execute only when really changed.
(Error was in nodes that don't get buffers as input, but only values. These
nodes flooded "execute" events through the node tree.)
Vertex color node worked only if VCol Paint/Light was enabled. Fixed
that, and removed the vertex color node making it part of the geometry
node instead.
Also, preview.blend had black vertex colors for the sphere, so set them
to white like the other primitives.
* Added patch 5251 X/Y Offset to Split Viewer node, by Juho
(with some modifications from the patch version).
Also various small tweaks to compositor drawing & buttons.
Adding missing define for displace node (Matt can change the number when he gets back, this is just to fix compilation)
Removing "#pragma mark" from node.c. IIRC, that's XCode leaving crap around, so be sure to remove them when you commit (it outputs warnings on other compilers).
Added support for multiple UVs in the render engine. This also involved
changing the way faces are stored, to allow data to be added optionally
per 256 faces, same as the existing system for vertices.
A UV layer can be specified in the Map Input panel and the Geometry node
by name. Leaving this field blank will default to the active UV layer.
Also added sharing of face selection and hiding between UV layers, and at
the same time improved syncing with editmode selection and hiding.
Still to do:
- Multi UV support for fastshade.
- Multires and NMesh preservation of multiple UV sets.
Please read:
http://www.blender3d.org/cms/Imaging.834.0.html
Or in short:
- adding MultiLayer Image support
- recoded entire Image API
- better integration of movie/sequence Images
Was a whole load of work... went down for a week to do this. So, will need
a lot of testing! Will be in irc all evening.
#5417: Only Shadow material gave shadow outside of Spot bundle
#5414: Material Nodes: sockets without input were always treated as single
value inputs, ignoring color or vector. (Caused by commit to do
automatic conversions of socket links).
#5420: When reading with old Blender a new file that has a new window type,
saving it over, and read back in current Blender, the window type
should be reset to EMPTY, because all its data got lost.
- Removed stupid idea to insert convertor nodes in Node Shaders, when a
link is created by non-matching sockets. Now it works like Compositor,
doing a default conversion. Works like this:
1 from 3 or 4 values: take average
3 from 1: copy to all
3 from 4: copy 3
4 from 1: copy to 3, set alpha to 1
4 from 3: copy 3, set alpha to 1
- Added select-linked in Nodes. Lkey or Shift+L. Also in pulldown menus
Random seeding is still not perfect in render, especially lack of good
thread support still.
- VectorBlur node was calling seed for each exec, causing other nodes to
get fixed random too.
- added seed in non-OSA main loop for render
- use BLI_srandom, is better than BLI_srand
- After making a Group, internal socket values are now copied to the
group node, so an execute will give identical results
- After ungrouping, the cyclic dependency tagging didn't work well in
all cases, showing a red noodle line and giving composite errors.
For time being solved by calling the NodeSort twice.
- Viewer nodes now get previews updated always (used to be only the active)
Note: this is not for previews inside of groups!
Loadsa new compo nodes, most added in new menu "Mattes".
- Seperate into YCC
- Combine YCC
- Seperate into YUV
- Combine YUV
- (Chroma) Difference Matte
- Chroma Key
- Luminance Key
- Color Spill correction
Main problem is missing docs still... Bob is working on it, he'll also
make tooltips for all buttons.
Some UI things might change too, like more clear names.
- Image Node: after loading new file it didn't update the header name
- File-out Node: header color suggested there was only 1 'active', which
it isn't.
Apparently being so scroogish for cpu cycles makes crashes in Linux. I'll
add it on todo for later checks, but I need a windows or linux coder for
it!
For users: it might fix crashes when you have NodeTrees in Libraries.
- Icon previews for Images were created always for old files, which made
browsing (menus) incredible slow. Added a minor change in the flow, so
icons only get created when the user invokes loading images.
Andrea; you might check this, probably not al cases are covered yet?
- Compositor: the 'File Output' node now has a min/max frame for which it
writes files
- Compositor: fixed a very bad bug (even in 2.42a release) that made the
depsgraph for nodes not work... while editing, only the nodes that change
should be recalculated, but accidentally all of them were done each time.
Reports came in that Elephants Dream files crash on quit or loading other
files. Was caused by freeing Material Nodes, which was accessing memory
that potentially was just freed before (node->id). Apparently only Windows
really gives issues then, which is actually a good thing :)
- It saves a file with indicated type on each change, with number
appended denoting the current frame (like ANIM saving).
- Output filename button supports relative paths ("//")
- Shows optional preview image too
- For now, added a print on each file save as feedback
To make this option work nicely, changed the BKE_makepicstring() function
to have less globals inside, so it is more generic. Todo: allow amount of
digits in filenames to be set (to support files like tmp_123456.jpg)
* Combine RGBA
Basically the opposite of separate RGBA, brings 4 value channels into a single
RGBA image). Has interesting possibilities for reordering channels, when used
with separate RGBA!
* Dilate/Erode
Originally written by Brecht van Lommel, with some minor modifications and
tweaking by myself. Positive distances dilate, negative distances erode.
* I also added the 'value' field to the hue/saturation node. Minimal extra cost,
and can be handy.
The raytracer wasn't calling node shaders yet, so results showed only
shading for the base material.
This now works, but there's a conflict in the internal Blender shader that
makes recursive raytracing with nodes unpredictable. Basicaly the conflict
is that when a ray wants to shade a point, it should be able to check the
material for mirror properties, but this is undefined for node trees...
Probably we need to separate raytrace entirely from material shading. Is
a good topic for NodeShader 2.0, when we really split up materials in
shading components.
I'll add a note in the release log about this. Best results you get now
when you don't include mirror/ray-transp insde a node tree, in that case
a regular material mirror can render that material perfectly.
- Ztransp looked weird in Node previews, only showing the backfacing pixels
- previous change in preview.blend accidentally set camera clipping too low
for correct display of lamp preview
- refresh issue solved in preview when using Node shaders with ray-mirror