diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-09-15 14:05:07 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-09-15 14:05:07 +0400 |
commit | a73dd3476e7d180d3320afc04d218ce22f2f3bfc (patch) | |
tree | a540f5657bc9e8692eb0d3417de71393bad6bece /source/blender/blenfont | |
parent | b93da9b01e163158a830872d29f8bd874f63d54d (diff) |
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!
Diffstat (limited to 'source/blender/blenfont')
-rw-r--r-- | source/blender/blenfont/BLF_api.h | 3 | ||||
-rw-r--r-- | source/blender/blenfont/CMakeLists.txt | 1 | ||||
-rw-r--r-- | source/blender/blenfont/SConscript | 2 | ||||
-rw-r--r-- | source/blender/blenfont/intern/blf.c | 5 | ||||
-rw-r--r-- | source/blender/blenfont/intern/blf_font.c | 9 | ||||
-rw-r--r-- | source/blender/blenfont/intern/blf_internal_types.h | 4 |
6 files changed, 14 insertions, 10 deletions
diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h index 0732e02b5fc..ce10951d6ff 100644 --- a/source/blender/blenfont/BLF_api.h +++ b/source/blender/blenfont/BLF_api.h @@ -33,6 +33,7 @@ #define __BLF_API_H__ struct rctf; +struct ColorManagedDisplay; int BLF_init(int points, int dpi); void BLF_exit(void); @@ -151,7 +152,7 @@ void BLF_shadow_offset(int fontid, int x, int y); * * BLF_buffer(NULL, NULL, 0, 0, 0, FALSE); */ -void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, int w, int h, int nch, int do_color_management); +void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, int w, int h, int nch, struct ColorManagedDisplay *display); /* Set the color to be used for text. */ void BLF_buffer_col(int fontid, float r, float g, float b, float a); diff --git a/source/blender/blenfont/CMakeLists.txt b/source/blender/blenfont/CMakeLists.txt index ebf9ff4db39..da60710a137 100644 --- a/source/blender/blenfont/CMakeLists.txt +++ b/source/blender/blenfont/CMakeLists.txt @@ -27,6 +27,7 @@ set(INC ../blenlib ../editors/include ../makesdna + ../imbuf ../../../intern/guardedalloc ) diff --git a/source/blender/blenfont/SConscript b/source/blender/blenfont/SConscript index c46960d2311..d3c7b1c2fcc 100644 --- a/source/blender/blenfont/SConscript +++ b/source/blender/blenfont/SConscript @@ -4,7 +4,7 @@ Import ('env') sources = env.Glob('intern/*.c') -incs = '. intern #/intern/guardedalloc ../blenkernel ../blenlib ../makesdna ../editors/include' +incs = '. intern #/intern/guardedalloc ../blenkernel ../blenlib ../makesdna ../imbuf ../editors/include' incs += ' #/extern/glew/include' incs += ' ' + env['BF_FREETYPE_INC'] incs += ' ' + env['BF_GETTEXT_INC'] diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c index d4739b37f93..92fcb576e7d 100644 --- a/source/blender/blenfont/intern/blf.c +++ b/source/blender/blenfont/intern/blf.c @@ -50,7 +50,6 @@ #include "blf_internal_types.h" #include "blf_internal.h" - /* Max number of font in memory. * Take care that now every font have a glyph cache per size/dpi, * so we don't need load the same font with different size, just @@ -746,7 +745,7 @@ void BLF_shadow_offset(int fontid, int x, int y) } } -void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, int w, int h, int nch, int do_color_management) +void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, int w, int h, int nch, struct ColorManagedDisplay *display) { FontBLF *font = BLF_get(fontid); @@ -756,7 +755,7 @@ void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, int w, int h, int font->buf_info.w = w; font->buf_info.h = h; font->buf_info.ch = nch; - font->buf_info.do_color_management = do_color_management; + font->buf_info.display = display; } } diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c index cb05c89921e..02b66993c0a 100644 --- a/source/blender/blenfont/intern/blf_font.c +++ b/source/blender/blenfont/intern/blf_font.c @@ -53,6 +53,8 @@ #include "BIF_gl.h" #include "BLF_api.h" +#include "IMB_colormanagement.h" + #include "blf_internal_types.h" #include "blf_internal.h" @@ -245,11 +247,12 @@ void blf_font_buffer(FontBLF *font, const char *str) blf_font_ensure_ascii_table(font); /* another buffer specific call for color conversion */ - if (buf_info->do_color_management) { - srgb_to_linearrgb_v4(b_col_float, buf_info->col); + if (buf_info->display) { + copy_v4_v4(b_col_float, buf_info->col); + IMB_colormanagement_display_to_scene_linear_v3(b_col_float, buf_info->display); } else { - copy_v4_v4(b_col_float, buf_info->col); + srgb_to_linearrgb_v4(b_col_float, buf_info->col); } while (str[i]) { diff --git a/source/blender/blenfont/intern/blf_internal_types.h b/source/blender/blenfont/intern/blf_internal_types.h index 4c617da7583..1acc3dad4cf 100644 --- a/source/blender/blenfont/intern/blf_internal_types.h +++ b/source/blender/blenfont/intern/blf_internal_types.h @@ -145,8 +145,8 @@ typedef struct FontBufInfoBLF { /* number of channels. */ int ch; - /* is the float buffer linear */ - int do_color_management; + /* display device used for color management */ + struct ColorManagedDisplay *display; /* and the color, the alphas is get from the glyph! * color is srgb space */ |