diff options
author | Matt Ebb <matt@mke3.net> | 2009-07-17 06:43:15 +0400 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2009-07-17 06:43:15 +0400 |
commit | 1ef729358517248888073be71ba5d3b6e3d723ee (patch) | |
tree | dfa33f083ac1afd500e76dcf4bc581394637d0dd /source/blender/editors/screen/glutil.c | |
parent | 70f6255433fcb1f5551199ef7a285a9ab80a3318 (diff) |
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!
Diffstat (limited to 'source/blender/editors/screen/glutil.c')
-rw-r--r-- | source/blender/editors/screen/glutil.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index a23487effa1..5312ca26906 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -35,6 +35,7 @@ #include "DNA_listBase.h" #include "BKE_utildefines.h" +#include "BKE_colortools.h" #include "BLI_arithb.h" #include "BLI_threads.h" @@ -482,27 +483,20 @@ void glaDrawPixelsTex(float x, float y, int img_w, int img_h, int format, void * glaDrawPixelsTexScaled(x, y, img_w, img_h, format, rect, 1.0f, 1.0f); } -void glaDrawPixelsSafe_to32(float fx, float fy, int img_w, int img_h, int row_w, float *rectf) +void glaDrawPixelsSafe_to32(float fx, float fy, int img_w, int img_h, int row_w, float *rectf, int gamma_correct) { - float *rf; - int x, y; - char *rect32, *rc; + unsigned char *rect32; /* copy imgw-imgh to a temporal 32 bits rect */ if(img_w<1 || img_h<1) return; - rc= rect32= MEM_mallocN(img_w*img_h*sizeof(int), "temp 32 bits"); + rect32= MEM_mallocN(img_w*img_h*sizeof(int), "temp 32 bits"); - for(y=0; y<img_h; y++) { - rf= rectf; - for(x=0; x<img_w; x++, rf+=4, rc+=4) { - rc[0]= FTOCHAR(rf[0]); - rc[1]= FTOCHAR(rf[1]); - rc[2]= FTOCHAR(rf[2]); - rc[3]= FTOCHAR(rf[3]); - } - rectf+= 4*row_w; - } + if (gamma_correct) { + floatbuf_to_srgb_byte(rectf, rect32, 0, img_w, 0, img_h, img_w); + } else { + floatbuf_to_byte(rectf, rect32, 0, img_w, 0, img_h, img_w); + } glaDrawPixelsSafe(fx, fy, img_w, img_h, img_w, GL_RGBA, GL_UNSIGNED_BYTE, rect32); @@ -855,4 +849,3 @@ void bglFlush(void) #endif } - |