Commit Graph

75 Commits

Author SHA1 Message Date
47bc3d1208 Added names to UV and vertex color layers, and display them as a list.
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.
2006-12-21 13:47:27 +00:00
253432bfc7 The Big Image refactor!
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.
2006-12-20 17:57:56 +00:00
4595bef2b4 Three-fixes-in-one:
#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.
2006-12-12 11:13:43 +00:00
7f1e3874f9 Node editing usablity!
- 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
2006-12-08 21:20:36 +00:00
2c816da097 Two fixes:
- Shaded view was black, needed to tell it to use 'combined' pass :)
- Crash when deleting in compositor all nodes with an output.
2006-12-05 18:02:43 +00:00
8c6fe1bb1f Material Nodes and Composite now also supports unlimited threads.
Maybe we should add for Composite a seperate "Max threads" button though...
having 8 nodes allocating temp buffers at the same time might give issues.
2006-11-29 18:11:59 +00:00
20e6dc7f57 Bugfix, own collection:
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
2006-11-21 15:52:45 +00:00
a667b79b35 Small usability tweaks in Compositor:
- 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!
2006-11-20 09:37:01 +00:00
f89b052262 New Compo node: the Split-Viewer, showing two images halves to compare.
Works internally already with masks, so we can have several builtin
types.
2006-11-16 21:50:35 +00:00
5d8efc9756 Patch #2307, by Bob Holcomb
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.
2006-11-15 14:41:04 +00:00
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