diff options
author | Ton Roosendaal <ton@blender.org> | 2006-01-12 01:36:31 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-01-12 01:36:31 +0300 |
commit | 0665f0d64799e6a38c4ca0930df73271f246e422 (patch) | |
tree | fa488d33452f0bfc6ec91e5bbbec726afcbcb9f3 /source/blender/src/glutil.c | |
parent | b92fa4151645d50e40faa8f4aaea4b7f6149947c (diff) |
Orange;
Until now, the zbuffer was written straight from the internal zbuffer,
which has values that are inverse-proportional (like 1.0/z) which makes
it very hard to use it for postprocess, like zblur or other composit effects
that require Z.
Based on info from ILM, the values stored for Z in exr files is the
actual distance from a camera. I think that's about time to migrate to that
convention!
By default now, after render, the z values are converted to floats. This
saves in exr files now, but not in the Iris Z files. That latter was a
blender-only anyway, so might be not a real hassle to drop. :)
You can see the difference in the image window, but notice the range now
is linear mapped from camera clipstart to clipend.
Note; I just discover that ortho Z values need a different correction...
Diffstat (limited to 'source/blender/src/glutil.c')
-rw-r--r-- | source/blender/src/glutil.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/source/blender/src/glutil.c b/source/blender/src/glutil.c index cc5c2f3c9ec..a8e10f05b28 100644 --- a/source/blender/src/glutil.c +++ b/source/blender/src/glutil.c @@ -286,7 +286,7 @@ void glaDrawPixelsTex(float x, float y, int img_w, int img_h, int format, void * glPixelStorei(GL_UNPACK_ROW_LENGTH, lrowlength); } -void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int format, void *rect) +void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int format, int type, void *rect) { float xzoom= glaGetOneFloat(GL_ZOOM_X); float yzoom= glaGetOneFloat(GL_ZOOM_Y); @@ -339,17 +339,25 @@ void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int format, void } glPixelStorei(GL_UNPACK_ROW_LENGTH, img_w); - if(format==GL_FLOAT) { - float *f_rect= (float *)rect; - glDrawPixels(draw_w, draw_h, GL_RGBA, GL_FLOAT, f_rect + (off_y*img_w + off_x)*4); - } - else if(format==GL_INT || format==GL_UNSIGNED_INT) { - int *i_rect= (int *)rect; - glDrawPixels(draw_w, draw_h, GL_LUMINANCE, format, i_rect + (off_y*img_w + off_x)); + if(format==GL_LUMINANCE || format==GL_RED) { + if(type==GL_FLOAT) { + float *f_rect= (float *)rect; + glDrawPixels(draw_w, draw_h, format, type, f_rect + (off_y*img_w + off_x)); + } + else if(type==GL_INT || type==GL_UNSIGNED_INT) { + int *i_rect= (int *)rect; + glDrawPixels(draw_w, draw_h, format, type, i_rect + (off_y*img_w + off_x)); + } } - else { - unsigned char *uc_rect= (unsigned char *) rect; - glDrawPixels(draw_w, draw_h, GL_RGBA, GL_UNSIGNED_BYTE, uc_rect + (off_y*img_w + off_x)*4); + else { /* RGBA */ + if(type==GL_FLOAT) { + float *f_rect= (float *)rect; + glDrawPixels(draw_w, draw_h, format, type, f_rect + (off_y*img_w + off_x)*4); + } + else if(type==GL_UNSIGNED_BYTE) { + unsigned char *uc_rect= (unsigned char *) rect; + glDrawPixels(draw_w, draw_h, format, type, uc_rect + (off_y*img_w + off_x)*4); + } } glPixelStorei(GL_UNPACK_ROW_LENGTH, old_row_length); |