Commit Graph

515 Commits

Author SHA1 Message Date
b771cd9ca8 Two tiny compositor annoyances;
- 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.
2006-11-13 16:43:45 +00:00
cd097a0e3c Bugfix #5147
Compositor: added a fixed (frame # based) seed in random, to ensure the
Texture node will give different results per frame.
2006-11-02 10:30:35 +00:00
b693662ba6 Removed a initialize check for NodeTrees.
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.
2006-11-01 20:41:39 +00:00
9f77785d7c Coding work while on the trip to london (based on Plumiferos wishlist);
- 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.
2006-10-26 10:13:16 +00:00
72c8d7c313 Bugfix #4806
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 :)
2006-08-15 08:56:48 +00:00
7440aba482 Compositor: finished work on node "File Output".
- 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)
2006-08-10 10:38:50 +00:00
6e2e7ad1b7 renamed struct bNode->new to struct bNode->new_node
so it doesn't conflict with c++
(Needed for SkyGen coded)

Kent
2006-08-02 17:29:34 +00:00
3650abf328 A couple of compositing nodes:
* 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.
2006-07-31 02:24:35 +00:00
cf313f867d Bugfix #4647
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.
2006-07-09 11:54:41 +00:00
71de727f3e Bugfix #4583
Shader Group nodes crashed on render... it was accidentally calling
composite free-buffer option.
2006-07-03 12:08:08 +00:00
7e081266a9 Bugfix #4460
Compositor:
The option to re-render a single node, didn't free memory if nodes were in
use showing exactly same RenderLayer.
2006-06-25 12:00:34 +00:00
4506e65902 More preview fixes, after irc reports:
- 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
2006-06-20 14:32:42 +00:00
e384f4d6f6 Fix #4358
Was on the todo as well; previews in Shader Nodes didn't get cleared on
re-renders, noticable when you switch preview type (i.e. sphere -> cube).
2006-06-19 17:29:44 +00:00
5f5ee11fcb Seems a large commit, but I also changed function names to match the new
naming convention for Compositing:

- Render Result node -> Render Layers node (name only appears in Add menu)
- Compositor image -> Viewer Node image

I've also added a version patch (2.41 saved files only) to rename existing
"Compositor" Images.
2006-06-19 08:45:11 +00:00
19832a0639 Solved bad design decision in Node Editor:
The buttons uiBlock was stored in a Node, for retrieval of node buttons,
however that won't work when multiple windows show same Nodes.
Now implemented more correct unique Block names (as all over in UI), and
use that name to retrieve buttons with API call uiGetBlock().
2006-06-17 13:04:09 +00:00
bc7b4988d0 Plumiferos request
Compositor:
Viewer Nodes inside of Groups now work too. To not frustrate interactive
speed, the following rules apply:

- Making a Group editable (or closing) doesn't signal recalculation of
  composite
- clicking on an Input socket always checks changes and calulcates
- When there are Viewers inside an edited Group, Viewers in the main tree
  are not executed.

Also added: a "hide unused sockets" icon in the header of Viewer nodes.
This allows cleanup of Groups, to prevent these sockets get reveiled.
2006-06-03 09:19:10 +00:00
b67eac2cfd Removed annoying debug print that checked preview render size while doing
previews in Nodes.
2006-05-24 12:10:28 +00:00
f0a5fe5c76 New Compositer option: "Free Unused". In the Node Editor header.
This will free all Node output buffers, while compositing, when not needed
anymore. Saves a whole lotta memory, and will enable to use many many more
nodes (or high resolution images).
2006-05-12 11:27:01 +00:00
e80099d921 Bugfix for Node editing;
When multiple output nodes exist (Material), the active Output flag could
get copied and wasn't reset properly. Now the depenendency sorting code
ensures only 1 output node is the active output for execution.
2006-05-03 13:20:25 +00:00
973b442075 Compositing goodie: ESC now works to stop, but it will finish the node it
was working on.
2006-03-08 21:12:48 +00:00
2858229e9f Compositor now checks for cyclic nodes too, and skips them while executing.
This prevents eternal loops. It prints error message in console.

Note that the Shader nodes dont need this, since they're just executed in
presorted order. The compositing nodes use threading, with a call asking
for the next job... if this includes cyclic nodes, the 'next job' will
always return  NULL.
2006-03-08 13:06:32 +00:00
6d6f539d03 Ungrouping a Node in Compositor left uiBlock pointers unchanged in
nodes, causing crashes evidently. :)
2006-03-05 14:37:46 +00:00
02a931ac4f Replacing SDL threads with pthread.
For some reason I thought SDL thread handling would be much simpler... but
the migration to posix pthread went very smooth and painless. Less code
even, and I even notice a slight performance increase!

All threading code is still wrapped in blenlib/intern/threads.c
Only real change was making the callback functions to return void pointer,
instead of an int.

The mutex handling is also different... there's no test anymore if a
mutex was initialized, which is a bit confusing. But it appears to run
all fine still. :)

Nathan Letwory has been signalled already to provide the Windows pthread
library and make/scons linking. For MSVC we might need help from someone
else later though.
2006-02-25 11:56:08 +00:00
04ec4a2530 Compositor upgrade;
- Links now can be made between any socket type. The nodes recognize amount
  of channels, and will convert types if needed.
  Conversions from RGBA to 1 channel will use the 'RGB to BW' formula.

  Also note that conversions only happen when required. So you can blur an
  alpha channel, filter it, and put this in a 1-channel socket without any
  conversion to happen, which saves memory & cpu time.

  http://www.blender.org/bf/rt.jpg

  The blur nodes don't accept Vector input yet... But filter does.

- RGB Curve Nodes now have the premultiply option resored, 2 x faster

- Fixed some confusing code in Node Group handling... much stabler now
2006-02-20 13:43:40 +00:00
130c41c7ba More compositing goodies.
- Texture Node
Allows to use any Blender Texture block as input for masks or color
blending. The texture node doesn't generate a real image, but adjusts to
the size as mapped with during an operation. So it won't work to use it
as Image input for Blur or Filter nodes.

Note; the Vector inputs for this node only work with manual input now!

- Translation Node
Give any image an offset in X or Y direction

For the Texture node to work, I needed to move the central 'pixel
processor' up one level... to allow differently sized images to merge
and allow 'procedural images' without size.

Temporal image of the day: http://www.blender.org/bf/rt.jpg
2006-02-19 14:55:16 +00:00
f4ddc2fde2 Quick change in Hue/Saturation Node: made the central Hue value 0.5, to
make applying changes easier. Saturation slider goes to 2.0 now.

Fix: rendering compositing nodes without scene crashed in header stats
drawing.
2006-02-18 15:57:46 +00:00
387f9a7c6d Four-in-one commit:
(NOTE: new include dependency in Render module, might need MSVC update!
It has to include the imbuf/intern/openexr/ directory in search path)

-> New Composite node: "Hue Saturation".
Works like the former 'post process' menu. There's no gamma, brightness or
multiply needed in this node, for that the Curves Node functions better.

-> Enabled Toolbox in Node editor
This now also replaces the SHIFT+A for adding nodes. The nodes are
automatically added to the menus, using the 'class' category from the
type definition.

Current classes are (compositor examples):

Inputs: RenderResult, Image
Outputs: Composite, Viewer
Color Ops: RGB Curves, Mix, Hue Saturation, AlphaOver
Vector Ops: Normal, Vector Curves, Map Value
Filters: Filter, Blur, VectorBlur
Convertors: ColorRamp, RGBtoBW, Separate RGBA, Separate HSVA, Set Alpha
Generators: RGB, Value, Time
Groups: the list of custom defined nodes

-> OpenEXR tile saving support
Created an API for for saving tile-based Images with an unlimited amount
of layers/channels. I've tested it for 'render result' now, with the idea
that this can (optionally) replace the current inserting of tiles in the
main result buffers. Especially with a lot of layers, the used memory for
these buffers can easily go into the 100s of megs.
Two other advantages:
- all 'render result' layers can be saved entirely in a single file, for
  later use in compositing, also for animation output.
- on each render, per scene, a unique temp file can be stored, allowing
  to re-use these temp files on starting Blender or loading files, showing
  the last result of a render command.

The option is currently disabled, needs more work... but I had to commit
this because of the rest of the work I did!

-> Bug fix
The Image node didn't call an execute event when browsing another image.
2006-02-18 13:28:44 +00:00
8d0a2c4192 Added printing stats back in commandline renders. Prints now a full 'log',
using 1 line per part rendered. Might go back to 1 line again, but at this
moment I need the logs for debugging.
Same prints are active now for UI rendering. Just temporal :)
2006-02-15 15:22:49 +00:00
acb5f6e79f Added callback to compositor, so it can print in RenderWindow header the
current to-be composited node and amount of memory in use.
2006-02-14 18:04:25 +00:00
3cf0bbfa17 Nasty memory conflict in Compositor... when:
- a Group has Curve node inside
- this Group was re-used more times
- with threaded render activated
- and both groups executed on same time

Then the premultipy optimize table was created twice... causing memory
to confuse.
2006-02-14 17:32:49 +00:00
92e0925ecb Made threaded Compositing more friendly for last node in list... the main
thread entered a loop without sleep() then.
2006-02-14 00:05:09 +00:00
2d7e61df40 Ugly bug in ungrouping... it left freed memory in the main database. 2006-02-13 20:39:31 +00:00
ed4cc927a7 Couple of features/fixes:
- Compositor now frees memory of buffers internally used in groups
  immediately. This wasn't part of the event-based cache anyway

- New option: "Free Texture Images" (in render Output panel). This
  frees after each render of each scene all images and mipmaps as
  used by textures. As reference it prints total amount of MB freed.

- Render stage 'creating speed vectors' had no ESC checking yet

- Made drawing scanline updates during render draw 1 scanline less...
  dunno, still hunting for weird opengl crashes.

- 3D preview render didn't properly skip sequence or composit render.
2006-02-11 23:17:41 +00:00
c2bc882bb9 Bugfix: duplicate time node didn't copy the curve itself. 2006-02-11 16:52:18 +00:00
945484e92a Upgrade for Node type definitions: the min/max allowed values for input
sockets were not used yet... now they're verified on read, and written
in socket stack data on adding new nodes.
Also the buttons in Nodes use these values now. Special request from
Nathan Vegdahl who seems to be messing around with my precious nodes! :)
2006-02-10 13:57:30 +00:00
3291adc997 Compositing workflow upgrade;
You now can set a Preview panel in the Image window, to define a sub-rect
of an image to be processed. Works like the preview in 3D Window. Just
press SHIFT+P to get it activated. Very nice speedup!

This is how it works:

- The compositor still uses the scene image size (including % setting) for
  Viewer or Composite output size
- If a preview exists, it calculates the cropped rect from its position
  in the Image window, and stores that in the Scene render data
- On composite execute, it copies only this part from the 'generator nodes',
  right now Images or Render Results. That makes the entire composite tree
  only using small rects, so it will execute fast.
- Also the render window will only display the cropped rect, and on F12
  only the cropped part is being executed
- On rendering in background mode, the cropping is ignored though.

Usability notes:

- translating or zooming view will automatically invoke a recalculation
- if you zoom in on details, the calculated rect will even become smaller
- only one Imagewindow can have this Preview Panel, to prevent conflicts of
  what the cropped area should be. Compositing is on Scene level, not local
  per image window. (Note; 3D Previews are local per window!)
- Closing the preview panel will invoke a full-size recalculation
- All passes/layers from rendering are nicely cropped, including Z and
  vectors.

The work to make the compositor do cropping was simple, but getting the
Image window displaying correctly and get all events OK was a lot of work...
indeed, we need to refactor Image Window usage once. Sorry for making the
mess even bigger now. :) I've tried not to interfere with UV edit or Paint
though... only when you're in compositing mode the panel will work.

BUG fix:

3D Preview render didn't work when multiple layers were set in the current
scene.
2006-02-09 11:07:04 +00:00
919411a32b Three fixes;
- Composit cache now gets fully freed on a render. Each output socket of a
  node stores the entire image... and while render that's a waste of memory

- Sky 'paper' render was using wrong texture coordinates

- Found missing test_break() in ztransp rendering.
2006-02-08 17:30:28 +00:00
e4a0390b39 Group Nodes made functional: each group now can be re-used (instanced)
with SHIFT+G. This works as well for local groups as library-linked
groups.

Also fixed that group nodes were copying internal data to the outside,
which made it impossible to use the socket-buttons to set individual
values for each group-instance.

Library-linked groups are prevented from editing. But, try to open a
group and it will give a request for 'make local'. The make local rule
is identical to other library data in blender, meaning:
- if all users of the library data are local -> the library data is
  flagged 'local', and if needed a unique name is made
- if there's mixed users (local and from other library data) it makes
  a full copy, and assigns this copy to all local users.
2006-02-07 15:50:55 +00:00
47054d00e6 Added "Blur factor" button in Vector Blur node, which scales the speed
vectors. It's actually shutter speed, but in this case works identical to
the old motionblur 'blur fac' button.

Note; the "Max Speed" button only clips speed, use this to prevent
extreme speed values. Max speed applied before the scaling happens.
2006-02-07 11:39:26 +00:00
f45546a1d3 iImage based Vector Blur
After a couple of experiments with variable blur filters, I tried
a more interesting, and who knows... original approach. :)

First watch results here:
http://www.blender.org/bf/rt0001_0030.avi
http://www.blender.org/bf/hand0001_0060.avi

These are the steps in producing such results:

- In preprocess, the speed vectors to previous and next frame are
  calculated. Speed vectors are screen-aligned and in pixel size.
- while rendering, these vectors get calculated per sample, and
  accumulated in the vector buffer checking for "minimum speed".
  (on start the vector buffer is initialized on max speed).

- After render:
- The entire image, all pixels, then is converted to quad polygons.
- Also the z value of the pixels is assigned to the polygons
- The vertices for the quads use averaged speed vectors (of the 4
  corner faces), using a 'minimum but non-zero' speed rule.

  This minimal speed trick works very well to prevent 'tearing' apart
  when multiple faces move in different directions in a pixel, or to
  be able to separate moving pixels clearly from non-moving ones

- So, now we have a sort of 'mask' of quad polygons. The previous steps
  guaranteed that this mask doesn't have antialias color info, and has
  speed vectors that ensure individual parts to move nicely without
  tearing effects. The Z allows multiple layers of moving masks.

- Then, in temporal buffer, faces get tagged if they move or not
- These tags then go to an anti-alias routine, which assigns alpha
  values to edge faces, based on the method we used in past to antialias
  bitmaps (still in our code, check the antialias.c in imbuf!)

- finally, the tag buffer is used to tag which z values of the original
  image have to be included (to allow blur go behind stuff).

- OK, now we're ready for accumulating! In a loop, all faces then get
  drawn (with zbuffer) with increasing influence of their speed vectors.
  The resulting image then is accumulated on top of the original with a
  decreasing weighting value.

It sounds all quite complex... but the speed is still encouraging. Above
images have 64 mblur steps, which takes about 1-3 seconds per frame.

Usage notes:

- Make sure the render-layer has passes 'Vector' and 'Z' on.
- add in Compositor the VectorBlur node, and connect the image, Z and
  speed to the inputs.
- The node allows to set amount of steps (10 steps = 10 forward, 10 back).
  and to set a maximum speed in pixels... to prevent extreme moving things
  to blur too wide.
2006-02-06 22:11:50 +00:00
98a0768028 Compositor: Added a basic "Time Node".
Just indicate start/end frame, and node outputs with Curve a value between
0.0 and 1.0.
2006-02-04 14:38:51 +00:00
6ac2c83016 Redoing the blur filters for composit;
http://www.blender.org/bf/filters/

I found out current blur actually doesn't do gauss, but more did regular
quadratic. Now you can choose common filter types, but more specifically;

- set gamma on, to emphasize bright parts in blur more than darker parts
- use the bokeh option for (current circlular only) blur based on true
  area filters (meaning, for each pixel it samples the entire surrounding).
  This enables more effects, but is also much slower. Have to check on
  optimization for this still... use with care!
2006-02-03 20:39:36 +00:00
7a7c33ea27 Crash fix! Found one unsafe malloc in allocating the Z render pass...
Brought back threaded compositing, this was blamed incorrectly.
2006-02-03 09:25:46 +00:00
8e12f750f2 - Preview images get generated on render event again
- disabled threading for composit for now, it has a memory error still...
  will work on that tomorrow more.
2006-02-02 23:55:14 +00:00
f493e8ed2e features & fixes:
- Enabled Groups to execute in Compositor. They were ignored still.
  Note; inside of groups nothing is cached, so a change of a group input
  will recalculate it fully. This is needed because groups are linked
  data (instances use same internal nodes).

- Made Composit node "Viewer" display correctly input for images with
  1/2/3/4 channels.

- Added pass rendering, tested now with only regular Materials. For
  Material nodes this is quite more complex... since they cannot be
  easily separated in passes (each Material does a full shade)
  In this commit all pass render is disabled though, will continue work on
  that later.
  Sneak preview: http://www.blender.org/bf/rt.jpg  (temporal image)

- What did remain is the 'Normal' pass output. Normal works very nice for
  relighting effects. Use the "Normal Node" to define where more or less
  light should be. (Use "Value Map" node to tweak influence of the
  Normal node 'dot' output.)

- EVIL bug fix: I've spend almost a day finding it... when combining AO and
  mirror render, the event queue was totally screwing up... two things not
  related at all!
  Found out error was in ray-mirror code, which was using partially
  uninitialized 'ShadeInput' data to pass on to render code.

- Another fix; made sure that while thread render, the threads don't get
  events, only the main program will do. Might fix issues reported by
  people on linux/windows.
2006-02-02 17:54:22 +00:00
2f8708da02 Three-in-one commit:
- Compositor now is threaded
Enable it with the Scene buttons "Threads". This will handle over nodes to
individual threads to be calculated. However, if nodes depend on others
they have to wait. The current system only threads per entire node, not for
calculating results in parts.

I've reshuffled the node execution code to evaluate 'changed' events, and
prepare the entire tree to become simply parsed for open jobs with a call
to   node = getExecutableNode()
By default, even without 'thread' option active, all node execution is
done within a separate thread.

Also fixed issues in yesterdays commit for 'event based' calculations, it
didn't do animated images, or execute (on rendering) the correct nodes
when you don't have Render-Result nodes included.

- Added generic Thread support in blenlib/ module
The renderer and the node system now both use same code for controlling the
threads. This has been moved to a new C file in blenlib/intern/threads.c.
Check this c file for an extensive doc and example how to use it.

The current implementation for Compositing allows unlimited amount of
threads. For rendering it is still tied to two threads, although it is
pretty easy to extend to 4 already. People with giant amounts of cpus can
poke me once for tests. :)

- Bugfix in creating group nodes
Group node definitions demand a clear separation of 'internal sockets' and
'external sockets'. The first are sockets being linked internally, the latter
are sockets exposed as sockets for the group itself.
When sockets were linked both internal and external, Blender crashed. It is
solved now by removing the external link(s).
2006-01-29 11:36:33 +00:00
45c7b2c5c2 Orange: made Compositing more interactive. It now has an event based
system tracking changes in nodes, making sure only these nodes and
the ones that depend, are executed.

Further the 'time cursor' now counts down to indicate which node is being
done.

Also: you now can disable the "use nodes" button in the header, edit all
changes, and when you press that button again it nicely executes the
changes.

Still on the todo:
- make compositing threaded
- find a way to nicely exit compositing on input events... so the UI
  keeps being responsive
- idea; a 'percentage' menu in header to enforce calculations on smaller
  images temporally
2006-01-28 15:21:04 +00:00
4a52c6ac6f Orange; more render & compo stuff!
-> Rendering in RenderLayers

It's important to distinguish a 'render layer' from a 'pass'. The first is
control over the main pipeline itself, to indicate what geometry is being
is rendered. The 'pass' (not in this commit!) is related to internal
shading code, like shadow/spec/AO/normals/etc.

Options for RenderLayers now are:
- Indicate which 3d 'view layers' have to be included (so you can render
  front and back separately)
- "Solid", all solid faces, includes sky at the moment too
- "ZTransp", all transparent faces
- "Halo", the halos
- "Strand", the particle strands (not coded yet...)

Currently only 2 'passes' are exported for render, which is the "Combined"
buffer and the "Z. The latter now works, and can be turned on/off.

Note that all layers are still fully kept in memory now, saving the tiles
and layers to disk (in exr) is also todo.

-> New Blur options

The existing Blur Node (compositor) now has an optional input image. This
has to be a 'value buffer', which can be a Zbuffer, or any mask you can
think of. The input values have to be in the 0-1 range, so another new
node was added too "Map Value".
The value input can also be used to tweak blur size with the (todo)
Time Node.

Temporal screenies:
http://www.blender.org/bf/rt.jpg
http://www.blender.org/bf/rt1.jpg
http://www.blender.org/bf/rt2.jpg

BTW: The compositor is very slow still, it recalulates all nodes on each
change still. Persistant memory and dependency checks is coming!
2006-01-26 22:18:46 +00:00
74f76981bf Orange: preparation commit for Output nodes type "Render" and "File".
They dont work yet, but i accidentally committed parts of it with a bugfix.
2006-01-24 17:09:04 +00:00
26b718654d Orange: fixes in Compositor:
- Curves in Image window didn't copy alpha (when no 32 bits rect for
  display was made already).
- Code was missing to validate grouped nodes in Compositor, didnt work
  at all yet
- Loading new Images in a Node (using filewindow) didn't assign the image

Image window now displays Alpha for float images too
2006-01-24 15:24:38 +00:00