Commit Graph

115 Commits

Author SHA1 Message Date
Campbell Barton b90c7dd730 Building without OpenEXR works again 2015-05-26 17:49:08 +02:00
Antony Riakiotakis de68066c1c Fix multilayer OpenEXR not supporting metadata.
This will fix exporting of metadata and importing for imbufs, but image
editor will not display these metadata since multilayer gets converted
to renderresult, which does not support metadata display yet.
This commit is more meant for external image editors/viewers.
2015-05-26 12:02:30 +02:00
Bastien Montagne 25f5d2b4d7 Fix (unreported) broken RNA Image pack handling since multiview merge.
Was breaking loading of embedded FBX images (among other things, most likely).
2015-05-22 23:28:41 +02:00
Campbell Barton a077be3658 Cleanup: use r_* prefix for return args 2015-05-08 07:25:39 +10:00
Campbell Barton fdc5f9c0a8 Add name argument to data creation API calls
Was adding then renaming, unnecessarily.
2015-05-04 16:01:20 +10:00
Antony Riakiotakis 58c511fb01 Stamp refactoring:
Write those on render result during rendering, so we can cleanly write a
render result image after rendering.
2015-04-21 18:37:06 +02:00
Dalai Felinto d5f1b9c222 Multi-View and Stereo 3D
Official Documentation:
http://www.blender.org/manual/render/workflows/multiview.html

Implemented Features
====================
Builtin Stereo Camera
* Convergence Mode
* Interocular Distance
* Convergence Distance
* Pivot Mode

Viewport
* Cameras
* Plane
* Volume

Compositor
* View Switch Node
* Image Node Multi-View OpenEXR support

Sequencer
* Image/Movie Strips 'Use Multiview'

UV/Image Editor
* Option to see Multi-View images in Stereo-3D or its individual images
* Save/Open Multi-View (OpenEXR, Stereo3D, individual views) images

I/O
* Save/Open Multi-View (OpenEXR, Stereo3D, individual views) images

Scene Render Views
* Ability to have an arbitrary number of views in the scene

Missing Bits
============
First rule of Multi-View bug report: If something is not working as it should *when Views is off* this is a severe bug, do mention this in the report.

Second rule is, if something works *when Views is off* but doesn't (or crashes) when *Views is on*, this is a important bug. Do mention this in the report.

Everything else is likely small todos, and may wait until we are sure none of the above is happening.

Apart from that there are those known issues:
* Compositor Image Node poorly working for Multi-View OpenEXR
(this was working prefectly before the 'Use Multi-View' functionality)
* Selecting camera from Multi-View when looking from camera is problematic
* Animation Playback (ctrl+F11) doesn't support stereo formats
* Wrong filepath when trying to play back animated scene
* Viewport Rendering doesn't support Multi-View
* Overscan Rendering
* Fullscreen display modes need to warn the user
* Object copy should be aware of views suffix

Acknowledgments
===============
* Francesco Siddi for the help with the original feature specs and design
* Brecht Van Lommel for the original review of the code and design early on
* Blender Foundation for the Development Fund to support the project wrap up

Final patch reviewers:
* Antony Riakiotakis (psy-fi)
* Campbell Barton (ideasman42)
* Julian Eisel (Severin)
* Sergey Sharybin (nazgul)
* Thomas Dinged (dingto)

Code contributors of the original branch in github:
* Alexey Akishin
* Gabriel Caraballo
2015-04-06 10:40:12 -03:00
Campbell Barton b1d758ae6b Cleanup: redundant struct declarations 2015-03-29 03:56:39 +11:00
Nicholas Bishop 567e147f61 Code cleanup: remove unused function BKE_image_assign_ibuf
Reviewers: sergey

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D1083
2015-02-09 11:28:38 +01:00
Antony Riakiotakis f75d2fdd24 Port fix from gooseberry that doesn't load the full res file if a proxy
is requested.
2015-02-04 18:48:55 +01:00
Campbell Barton d036ad552f BKE_image: use BKE_image_*** prefix
use bools for return values and some api naming consistency.
2015-01-24 17:26:59 +11:00
Campbell Barton 888ab78edf Minor edits to T42649 fix
- only modify paths for newly loaded images
- don't attempt to read from library paths
2014-11-23 22:05:24 +01:00
Campbell Barton 29dc8259a8 Mistake naming in recent commit 2014-05-22 17:40:35 +10:00
Campbell Barton 049b6cfa6d Fix for image garbage collection failing to run for render-only views
Check for freeing old images was running per-object, move this to viewport drawing.
2014-05-22 11:58:07 +10:00
Campbell Barton 617557b08e Code cleanup: remove TRUE/FALSE & WITH_BOOL_COMPAT define 2014-04-01 15:22:28 +11:00
IRIE Shinsuke 6316306cc0 Fix bug in image texture UI: "Use Alpha" checkbox doesn't appear if file format is BMP. 2014-03-31 17:37:55 +09:00
Campbell Barton d900f5be55 Code cleanup: use bools where possible 2014-02-03 19:35:44 +11:00
Campbell Barton 3c86a1932f Code cleanup: add BLI_testextensie_n, replacing multuple calls to BLI_testextensie
also use attributes for BLI path functions
2014-01-31 03:30:05 +11:00
Campbell Barton 4ae7ae6f2e Code Cleanup: use bool for return values and correct comments
also remove CDDM_Check, theres no need for it.
2014-01-22 02:53:48 +11:00
Campbell Barton c48c62a831 Code Cleanup: replace checks for ima->source with BKE_image_is_animated 2014-01-14 04:59:58 +11:00
Sergey Sharybin ce893552c3 Image cache rewrite to using generic movie cache
Summary:
Behaves very much the same as cache for Movie Clip datablock:

- Image now have `MovieCache *cache` field which replaced
  legacy `ListBase ibufs`.

  This allows image datablock to easily keep of image
  buffers which are owned by itself. This field isn't
  saved to the file and getting restored on undo steps.

  However, cache limit is global for movies, sequences
  and image datablocks now. So overall cached image buffers
  size will not go above cache limit size in user
  preferences.

- Image buffers which are marked as BITMAPDIRTY will never
  be freed from the cache.

- Added utility function to iterate over image buffers
  saved in movie cache.

- Movie cache cleanup check callback now have ImBuf argument
  which can be used in a condition of cleanup.

- Added some utility functions which replaces legacy ibufs
  iterations with image cache iteration which happens from
  inside a lock.

- Fixed `image_mem_size()` which was only counting one of
  the buffers if both float and byte buffer present.

Additional notes:

- `BKE_image_get_first_ibuf()` is rather stupid, but direct
  access to ibufs->first was also the same stupid idea.

  Would consider avoid this function is another project.

- There are some places which doesn't look threadsafe, but
  they already were not so much threadsafe anyway before.

  So think not a big deal with solving this later.

Finally solves infinite memory usage by image sequences! :)

Reviewers: brecht, campbellbarton

Reviewed By: brecht

CC: sebastian_k

Differential Revision: http://developer.blender.org/D95
2013-12-13 16:30:00 +06:00
Campbell Barton 26c0839220 disable cycles when building without python, also use const for function args in more places. 2013-08-07 22:40:03 +00:00
Brecht Van Lommel 6bc2d57235 Fix #35449: image sequences to drive e.g. particle length or used in modifiers
were no properly updating when rendering animations.

The render engine was only updating the image user current frame on images used
by material textures. Now moved the function that updates all from the editors
to blenkernel level and do it on all frame changes.
2013-05-22 22:17:07 +00:00
Sergey Sharybin 68d8c6ad3d Fix #34779: Channels disappear from multilayer exr sequence
Issue was caused by delayed or missing image user frame
number update, which lead to image loading failure in
cases node is updating from image signal callback.

Solved in a way that file from image datablock is used
for sockets detection instead of loading image for
current frame.
2013-03-27 11:26:10 +00:00
Campbell Barton 221a383366 use 'bool' for BLI_/BKE_ functions. 2013-03-09 05:35:49 +00:00
Sergey Sharybin e5a135e0b2 Fixes for alpha mode do_versions code
Before this change only old flag "Premultiply" was used to
detect alpha mode, which is not enough actually.

Now the logic here is:

- If "Premultiply" was enabled it is likely float image with
  straight alpha, which shall be premultiplied before usage.

  In this case image/sequence Alpha Mode is set to Straight.

- Otherwise use default alpha mode for image format based on
  an extension. This could fail in some cases like TIFF, but
  this wasn't handled fully correct in older blender anyway.

Initial discovered issue was that EXR images saved in older
Blender versions were set to Straight alpha mode, which is
obviously a straight way to lots of headache.
2013-02-19 08:37:08 +00:00
Brecht Van Lommel 32a6a3eb63 Fix #33747: do better backwards compatibility for image transparency changes.
The use alpha option moved from the texture datablock to the image, and now it
will duplicate the image datablock in case you have one texture using alpha and
the other not.
2013-02-08 15:56:14 +00:00
Sergey Sharybin fdfa5910b5 Fix #34040: Moving Normal Node with enabled Cycles Material Preview crashes
Issue was caused by couple of circumstances:

- Normal Map node requires tesselated faces to compute tangent space
- All temporary meshes needed for Cycles export were adding to G.main
- Undo pushes would temporary set meshes tessfaces to NULL
- Moving node will cause undo push and tree re-evaluate fr preview

All this leads to threading conflict between preview render and undo
system.

Solved it in  way that all temporary meshes are adding to that exact
Main which was passed to Cycles via BlendData. This required couple
of mechanic changes like adding extra parameter to *_add() functions
and adding some *_ex() functions to make it possible RNA adds objects
to Main passed to new() RNA function.

This was tricky to pass Main to RNA function and IMO that's not so
nice to pass main to function, so ended up with such decision:

- Object.to_mesh() will add temp mesh to G.main
- Added Main.meshes.new_from_object() which does the same as to_mesh,
  but adds temporary mesh to specified Main.

So now all temporary meshes needed for preview render would be added
to preview_main which does not conflict with undo pushes.

Viewport render shall not be an issue because object sync happens from
main thread in this case.

It could be some issues with final render, but that's not so much
likely to happen, so shall be fine.

Thanks to Brecht for review!
2013-02-05 12:46:15 +00:00
Sergey Sharybin 86991fbcb0 Fixed render time regression in Blender Internal
It was caused by image threading safe commit and it was noticeable
only on really multi-core CPU (like dual-socket Xeon stations), was
not visible on core i7 machine.

The reason of slowdown was spinlock around image buffer referencing,
which lead to lots of cores waiting for single core and using image
buffer after it was referenced was not so much longer than doing
reference itself.

The most clear solution here seemed to be introducing Image Pool
which will contain list of loaded and referenced image buffers, so
all threads could skip lock if the pool is used for reading only.
Lock only needed in cases when buffer for requested image user is
missing in the pool. This lock will happen only once per image so
overall amount of locks is much less that it was before.

To operate with pool:
- BKE_image_pool_new() creates new pool
- BKE_image_pool_free() destroys pool and dereferences all image
  buffers which were loaded to it
- BKE_image_pool_acquire_ibuf() returns image buffer for given
  image and user. Pool could be NULL and in this case fallback to
  BKE_image_acquire_ibuf will happen.

  This helps to avoid lots to if(poll) checks in image sampling
  code.

- BKE_image_pool_release_ibuf releases image buffer. In fact, it
  will only do something if pool is NULL, in all other case it'll
  equal to DoNothing operation.
2013-01-21 08:49:42 +00:00
Sergey Sharybin b01233b07f Movies support for Cycles
This adds support of movie textures for Cycles rendering.

Uses the same builtin images routines as packed/generated images,
but with some extra non-rna hookups from blender_session side.

Basically, it's not so clear how to give access to video frames
via C++ RNA -- it'll require exposing ImBuf to API, doing some
threading locks and so. Ended up adding two more functions which
are actually bad level call, but don't consider it's so much bad
-- we have few bad calls already, which are actually related.

Changed a bit how builtin images names are passing to image
manager. Now it's not just an ID datablock name, but also a frame
number concatenated via '@' character, which makes itpossible to
easily know frame number to be used for movie images, without
adding extra descriptors to image manager.

Decoding of builtin name is a bit slower now, but it should be
still nothing in comparison with rendering complexity.

Also exposed image user's frame_current to python API, which
is needed to get absolute frame number of movie from node's
image user.

P.S. Generated/packed images are also using bad level call but
only does it to make things more clear here.  Either all images
are using C++ RNA here or no images does. That's the most clear
for now.
2013-01-16 17:07:25 +00:00
Sergey Sharybin 851cb9b345 Added support of J2K codec for Jpeg2000 writing
This codec is absolutely needed to generate DCP using OpenDCP,
before that external application to convert JP2 to J2K was used
which slowed down export a lot.

New codec is exposed to image format settings panel and called
Codec. Default one is JP2 which creates files with .jp2 extension,
new one is called J2K which creates with .j2c extension.

Other changes:
- Fixed avi jpeg warning which was treating as error here.
- Made it so extension is detecting from ImageFormatData instead
  of image file type, which makes it possible to have different
  extension for the same file type depending on it's settings.

  IRIS format should still be changed (depending on number of
  channels it'll be .bw, .rgb or .rgba extension)

- Default image format settings would be set from image buffer
  when re-saving it. Makes it possible to easily open .j2c file
  and save it using J2K codec (without this change it'll save as
  .jp2 using JP2 codec)
2012-12-23 13:57:09 +00:00
Sergey Sharybin 5c6f6301b0 Image thread safe improvements
This commit makes BKE_image_acquire_ibuf referencing result, which means once
some area requested for image buffer, it'll be guaranteed this buffer wouldn't
be freed by image signal.

To de-reference buffer BKE_image_release_ibuf should now always be used.

To make referencing working correct we can not rely on result of
image_get_ibuf_threadsafe called outside from thread lock. This is so because
we need to guarantee getting image buffer from list of loaded buffers and it's
referencing happens atomic. Without lock here it is possible that between call
of image_get_ibuf_threadsafe and referencing the buffer IMA_SIGNAL_FREE would
be called. Image signal handling too is blocking now to prevent such a
situation.

Threads are locking by spinlock, which are faster than mutexes. There were some
slowdown reports in the past about render slowdown when using OSX on Xeon CPU.
It shouldn't happen with spin locks, but more tests on different hardware would
be really welcome. So far can not see speed regressions on own computers.

This commit also removes BKE_image_get_ibuf, because it was not so intuitive
when get_ibuf and acquire_ibuf should be used.

Thanks to Ton and Brecht for discussion/review :)
2012-11-15 15:59:58 +00:00
Sergey Sharybin 3285d47842 Fix #32930: texture colors in material nodes (blender internal) are brighter than normal
There was a missing byte buffer linearization for shader nodes.

Also fixed incorrect image input color space refresh when image is packed.
2012-10-22 17:34:06 +00:00
Sergey Sharybin 9e3e12fa4e Proper fix for #32626: TIFF renders are limited to 8 bit even when we choose 16.
Color management would be applied on both of float and byte buffers on image
save in cases if file format doesn't require linear float buffer and if image
is saving as render result.

This solves both initial report issue and TODO marked in previous fix.

Also de-duplicated image buffer color managing code and gave some more
meaningful names for few functions. Also wrote documentation around this
function, so current assumptions about spaces should be clear enough.

Made regression tests by saving EXR/PNG images to all supported format and
rendering OpenGL/Normal animation, in all cases seems everything is fine,
but more tests for sure would be welcome.
2012-09-24 11:56:07 +00:00
Sergey Sharybin a73dd3476e Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.

This introduces two configurable color spaces:

- Input color space for images and movie clips. This space is used to convert
  images/movies from color space in which file is saved to Blender's linear
  space (for float images, byte images are not internally converted, only input
  space is stored for such images and used later).

  This setting could be found in image/clip data block settings.

- Display color space which defines space in which particular display is working.

  This settings could be found in scene's Color Management panel.

When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.

This conversions are:

- View, which defines tone curve applying before display transformation.
  These are different ways to view the image on the same display device.
  For example it could be used to emulate film view on sRGB display.

- Exposure affects on image exposure before tone map is applied.

- Gamma is post-display gamma correction, could be used to match particular
  display gamma.

- RGB curves are user-defined curves which are applying before display
  transformation, could be used for different purposes.

All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.

This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).

Some technical notes:

- Image buffer's float buffer is now always in linear space, even if it was
  created from 16bit byte images.

- Space of byte buffer is stored in image buffer's rect_colorspace property.

- Profile of image buffer was removed since it's not longer meaningful.

- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
  to support other spaces, but it's quite large project which isn't so
  much important.

- Legacy Color Management option disabled is emulated by using None display.
  It could have some regressions, but there's no clear way to avoid them.

- If OpenColorIO is disabled on build time, it should make blender behaving
  in the same way as previous release with color management enabled.

More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management

--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
Campbell Barton 05755d307a fix [#31946] Masking doesn't respect pixel ratio 2012-09-13 05:29:38 +00:00
Campbell Barton 0bd759fddd new image operator now allows color grid (before was only grid on/off) 2012-08-29 08:17:38 +00:00
Campbell Barton 42aaa47e9b dont display image sequences outside the frame range in the 3D viewport. 2012-07-03 14:04:39 +00:00
Campbell Barton 5d9f3c5d18 fix for crash scaling an image 2012-06-29 10:52:37 +00:00
Gaia Clary 257283e030 added new function BKE_imbuf_to_image_format 2012-06-22 15:40:49 +00:00
Lukas Toenne 0586705b63 Fix #31747, broken image sequence loading after r47432.
The image file name function was updating the iuser->framenr using a supposed cfra parameter. However, the actual cfra is unknown when loading movies or sequences, so the iuser->framenr value itself was passed in its place, leading to incremental addition of the iuser frame offset. Removed the cfra parameter altogether from the image path function. This should instead be done separately if necessary, it's not an inherent part of constructing the image file name.
2012-06-10 07:35:45 +00:00
Brecht Van Lommel 4e338e894f Cycles: support for image sequences in image/environment texture node. 2012-06-04 19:38:33 +00:00
Sergey Sharybin 617027fdf3 Fix #31352: Image sequence texture - can't load image after changing image source
Added new flag to Imageuser which indicates whether user frame calculation is needed.
This flag is getting set in BKE_image_signal and handled in actual image usage areas
where both image user and current frame is known.
2012-06-04 10:41:18 +00:00
Campbell Barton 2c23bb8389 rna function Image.scale(w, h), useful for utility functions to open/scale/save images. 2012-05-17 15:26:11 +00:00
Campbell Barton 9892736206 code cleanup: header cleanup and remove some duplicate defines. 2012-05-12 20:39:39 +00:00
Campbell Barton 1dccd4c98a code cleanup: naming - pose/armature/image
also use ..._find_name(..., name) rather then ..._find_named(..., name) --- both were used.
2012-05-05 16:03:57 +00:00
Campbell Barton 34b18fcbc1 code cleanup: BKE_ naming, also make bpy.data.images.load() always load a new image. (not use existing one) 2012-05-05 14:52:04 +00:00
Campbell Barton a731e13043 code cleanup: function naming, use BKE_*type* prefix. 2012-05-05 14:03:12 +00:00
Campbell Barton 4ff038c411 screenshot operator now adds file extension in the file selector and has its own save options rather then using the render options (works like image save a copy). 2012-04-24 02:01:23 +00:00
Campbell Barton 7cc206ddca Code Cleanup: remove non existing function declarations.
added some missing functions too - which are not used yep but should be there for api completeness.
* CDDM_set_mloop
* CDDM_set_mpoly
* BLI_mempool_count
2012-02-29 15:00:37 +00:00