Commit Graph

81 Commits

Author SHA1 Message Date
Campbell Barton 988df24551 compositor color curve was MEM_dupallocN'ing the curve for every pixel calculation (when there were black or white inputs on the curve node).
avoid allocation by using local vars for black/white storage & curve calculation.
2012-08-21 08:30:45 +00:00
Sergey Sharybin 995a19a983 Sequencer: per-sequence modifier stack for color grading
This implements basic color grading modifiers in sequencer, supporting
color balance, RGB curves and HUE corrections.

Implementation is close to object modifiers, some details are there:

http://wiki.blender.org/index.php/User:Nazg-gul/SequencerModifiers

Modifiers supports multi-threaded calculation, masks and instant
parameter changes.

Also added cache for pre-processed image buffers for current frame,
so changing sequence properties does not require rendering of original
sequence (like rendering scene, loading file from disk and so)
2012-08-19 15:41:56 +00:00
Campbell Barton fd212cd4bc image sample line now updates with the compositor changes (mango request) 2012-06-13 22:38:31 +00:00
Brecht Van Lommel 7aa21d677a Python/CurveMapping: add Curve Mapping functions to add/remove curve points,
evaluate the curve and update after changes.
2012-05-15 18:34:00 +00:00
Campbell Barton 9892736206 code cleanup: header cleanup and remove some duplicate defines. 2012-05-12 20:39:39 +00:00
Campbell Barton 2b7ca2304a unify include guard defines, __$FILENAME__
without the underscores these clogged up the namespace for autocompleation which was annoying.
2012-02-17 18:59:41 +00:00
Brecht Van Lommel b9ff5840a6 Code refactoring: add unified image buffer functions for doing float => byte,
byte => float, float => float, byte => byte conversions with profile, dither
and predivide. Previously code for this was spread out too much.

There should be no functional changes, this is so the predivide/table/dither
patches can work correctly.
2011-12-28 13:29:33 +00:00
Campbell Barton 4a04f72069 remove $Id: tags after discussion on the mailign list: http://markmail.org/message/fp7ozcywxum3ar7n 2011-10-23 17:52:20 +00:00
Campbell Barton 4b449aefea remove support for irix 2011-09-21 08:40:30 +00:00
Campbell Barton 599cd56f53 minor edits / cleanup - no functional changes.
- use 'const float *' and array size in some function declarations.
- replace macros for BLI_math functions INPF, VECCOPY, VECADD etc.
- remove unused VertRen.clip struct member.
- remove static squared_dist() from 2 files, replace with BLI_math function len_squared_v3v3().
- use vertex arrays for drawing clipping background in the 3D viewport.
2011-09-11 02:50:01 +00:00
Brecht Van Lommel b434e7f933 LCMS code removed, was an experiment but never finished. 2011-05-16 13:34:42 +00:00
Nathan Letwory 22638e22ea doxygen: blenkernel under core as module. 2011-02-18 13:05:18 +00:00
Matt Ebb eec1318996 Preview commit in sculpt brushes broke resetting curves in other areas (rgb curves etc).
Fixed by adding a 'slope' parameter to curvemap_reset() to mirror curve presets around Y axis.

Also removed curve preset with 'random' icon, wasn't doing what it looked like it should, 
this was intended only for hue correct node anyway.
2010-07-30 00:06:59 +00:00
Matt Ebb d384174b45 Tweaks to image editor scopes, while testing a bug 2010-05-10 01:46:44 +00:00
Matt Ebb bfe248b3d6 Patch [#21750] Add luma waveform and vectorscope to image view
by Xavier Thomas

This adds the waveform monitor and vectorscope to the image editor 'scopes' 
region, bringing it inline (plus a bit more) with sequence editor functionality,
and a big step closer to the end goal of unifying the display code for image/
comp/sequence editor. It's non-intrusive, using the same code paths as 
the histogram.

There's still room for more tweaks - I modified the original patch, changing 
the openGL immediate mode drawing of the waveform display to vertex arrays for 
speed optimisation. Xavier can look at doing this for the vectorscope now too.

Thanks very much Xavier!
2010-04-06 02:05:54 +00:00
Matt Ebb ec303cf980 Fix [#21188] HueCorrection Node, when reseting Curve, it goes to a incline instead of flat/straight 2010-03-09 07:41:27 +00:00
Campbell Barton 081c1205a3 correct fsf address 2010-02-12 13:34:04 +00:00
Matt Ebb b079dcc140 Fix compile on msvc (inline) 2010-01-19 02:15:37 +00:00
Matt Ebb aab8196a1c Finished some work from the weekend to keep local tree clean..
* Added a generic 'histogram' ui control, currently available in new image editor 
'scopes' region (shortcut P). Shows the histogram of the currently viewed image.

It's a baby step in unifying the functionality and code from the sequence editor, 
so eventually we can migrate the sequence preview to the image editor too, 
like compositor.

Still a couple of rough edges to tweak, regarding when it updates. Also would 
be very nice to have this region as a partially transparent overlapping region...
2010-01-19 01:32:06 +00:00
Brecht Van Lommel 29f90af19c Fix: curve reset for brushes now gives proper smooth curve as default,
also moved brush curve presets code into curvemapping code.
2010-01-04 17:28:37 +00:00
Matt Ebb b89138564e Changes to Color Management
After testing and feedback, I've decided to slightly modify the way color 
management works internally. While the previous method worked well for 
rendering, was a smaller transition and had some advantages over this
new method, it was a bit more ambiguous, and was making things difficult 
for other areas such as compositing.

This implementation now considers all color data (with only a couple of 
exceptions such as brush colors) to be stored in linear RGB color space, 
rather than sRGB as previously. This brings it in line with Nuke, which also 
operates this way, quite successfully. Color swatches, pickers, color ramp 
display are now gamma corrected to display gamma so you can see what 
you're doing, but the numbers themselves are considered linear. This 
makes understanding blending modes more clear (a 0.5 value on overlay 
will not change the result now) as well as making color swatches act more 
predictably in the compositor, however bringing over color values from 
applications like photoshop or gimp, that operate in a gamma space, 
will give identical results.

This commit will convert over existing files saved by earlier 2.5 versions to 
work generally the same, though there may be some slight differences with 
things like textures. Now that we're set on changing other areas of shading, 
this won't be too disruptive overall.

I've made a diagram explaining the pipeline here:
http://mke3.net/blender/devel/2.5/25_linear_workflow_pipeline.png

and some docs here:
http://www.blender.org/development/release-logs/blender-250/color-management/
2009-12-02 07:56:34 +00:00
Matt Ebb 1ef7293585 Colour Management
- 1st stage: Linear Workflow

This implements automatic linear workflow in Blender's renderer. With the 
new Colour Management option on in the Render buttons, all inputs to the 
renderer and compositor are converted to linear colour space before 
rendering, and gamma corrected afterwards. In essence, this makes all 
manual gamma correction with nodes, etc unnecessary, since it's done 
automatically through the pipeline.

It's all explained much better in the notes/doc here, so please have a look:
http://wiki.blender.org/index.php/Dev:Source/Blender/Architecture/Colour_Management

And an example of the sort of difference it makes:
http://mke3.net/blender/devel/rendering/b25_colormanagement_test01.jpg

This also enables Colour Management in the default B.blend, and changes the 
default lamp falloff to inverse square, which is more correct, and much 
easier to use now it's all gamma corrected properly.

Next step is to look into profiles/soft proofing for the compositor.

Thanks to brecht for reviewing and fixing some oversights!
2009-07-17 02:43:15 +00:00
Martin Poirier 7eeb8ac01c Color proofing support with lcms (http://www.littlecms.com/).
Enable with WITH_LCMS (options have been added for scons).
lcms is very common on linux package managers, so no need to add in extern (IMHO). Libs for windows can be added to /lib

Code is mostly a proof of concept with hardcoded path for icc profile (taken from the lcms test suite).

Adding this now to svn so it doesn't rot on my hard drive. People interested in pushing it forward should feel free to dig in the code or poke me about it.
2009-05-17 16:19:13 +00:00
Brecht Van Lommel cb89decfdc Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:

* GLSL support in the viewport and game engine, enable in the game
  menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
  gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
  storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.

* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
  An extra texture slot shows up once the last slot is used.

* Memory limit for undo, not enabled by default yet because it
  needs the .B.blend to be changed.
* Multiple undo for image painting.

* An offset for dupligroups, so not all objects in a group have to
  be at the origin.
2008-09-04 20:51:28 +00:00
Ton Roosendaal 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
Ton Roosendaal 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
Ton Roosendaal a126178fd8 Orange: made Image window react nicer to compositor output and own Curves;
- Image curves are only applied now when curves panel is in use. Closing
  the panel will disable curves, reopen Panel enable curves.
  You can minimize the Curves panel to keep it active. That latter then
  works as visualization curves are being applied.

- Compositor output now also uses Image window curves, if active.
2006-01-24 10:35:43 +00:00
Ton Roosendaal 042d612df2 Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:

Render:
- Full cleanup of render code, removing *all* globals and bad level calls
  all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
  default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
  tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.

Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
  easier use of movies in Blender

PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
  code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)

3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
  (pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
  rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!

Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
  with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
  done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
  window. (yes, output nodes to render-result, and to files, is on the list!)

The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
  system should be built from scratch. I can't really understand this code...
  I expect it is not much needed, especially with advanced layer/passes
  control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
  recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
  effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
  to check first the option to render to a Image window, so Blender can become
  a true single-window application. :)
  For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again

OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
Ton Roosendaal 715794859a Orange:
- cleanup of color curves code; goes at least twice faster now!
  (includes black/white point stuff)
- When using 'Curves' in image window on a byte rect, it creates a (temp)
  float rect to operate on. So curves work for regular pictures too now.
2006-01-12 15:46:29 +00:00
Ton Roosendaal 3b4907415c Orange: and now for the real exr fun: float buffer support in Image window!
Image as loaded in Blender (from openexr.com):
http://www.blender.org/bf/exrcurve1.jpg

Image with different white point:
http://www.blender.org/bf/exrcurve2.jpg

Image with white and black point and a curve:
http://www.blender.org/bf/exrcurve3.jpg

Use SHIFT+click to set the black point, and CTRL+click for white point.
The buttons in the panel work too, of course.

The curves work after the black/white range was corrected, so you can
stick to curves with a normal 0-1 range.
There's also now a general color curve, marked with 'C' button.

Note; this currently only maps the float colors to a visible 8 bits per
channel rect. You can save it, but when the blender file loads the curve
or mapping is not executed until you click in the curves... have to look
at that still.
Speed for this is also quite unoptimized... still WIP, but fun!
2006-01-09 23:52:51 +00:00
Ton Roosendaal 104ab9b103 Orange:
- New UI element: the "Curve Button".

For mapping ranges (like 0 - 1) to another range, the curve button can be
used for proportional falloff, bone influences, painting density, etc.
Most evident use is of course to map RGB color with curves.

To be able to use it, you have to allocate a CurveMapping struct and pass
this on to the button. The CurveMapping API is in the new C file
blenkernel/intern/colortools.c
It's as simple as calling:

   curvemap= curvemapping_add(3, 0, 0, 1, 1)

Which will create 3 curves, and sets a default 0-1 range. The current code
only supports up to 4 curves maximum per mapping struct.
The CurveMap button in Blender than handles allmost all  editing.
Evaluating a single channel:

   float newvalue= curvemapping_evaluateF(curvemap, 0, oldval);

Where the second argument is the channel index, here 0-1-2 are possible.
Or mapping a vector:

   curvemapping_evaluate3F(curvemap, newvec, oldvec);

Optimized versions for byte or short mapping is possible too, not done yet.

In butspace.c I've added a template wrapper for buttons around the curve, to
reveil settings or show tools; check this screenie:

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

- Buttons R, G, B: select channel
- icons + and -: zoom in, out
- icon 'wrench': menu with tools, like clear curve, set handle type
- icon 'clipping': menu with clip values, and to dis/enable clipping
- icon 'x': delete selection

In the curve button itself, only LMB clicks are handled (like all UI elements
in Blender).

- click on point: select
- shift+click on point: swap select
- click on point + drag: select point (if not selected) and move it
- click outside point + drag: translate view
- CTRL+click: add new point
- hold SHIFT while dragging to snap to grid
  (Yes I know... either one of these can be Blender compliant, not both!)
- if you drag a point exactly on top of another, it merges them

Other fixes:

- Icons now draw using "Safe RasterPos", so they align with pixel boundary.
  the old code made ints from the raster pos coordinate, which doesn't work
  well for zoom in/out situations

- bug in Node editing: buttons could not get freed, causing in memory error
  prints at end of a Blender session. That one was a very simple, but nasty
  error causing me all evening last night to find!
  (Hint; check diff of editnode.c, where uiDoButtons is called)

Last note: this adds 3 new files in our tree, I did scons, but not MSVC!
2006-01-08 11:41:06 +00:00