From d8b21b01c38bf2b7007458c221b2c1685d766cfd Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Tue, 30 Dec 2003 18:03:37 +0000 Subject: Added improved exposure calculation - based at 1.0-exp(-color) trick in Yafray. But to guarantee backwards compatibility, and some more control, Stefano Selleri hacked a useful formula for it. - We now have 2 values to set: - "exp": the exponential correction value (0-1) - "range": the light range that maps on color 1.0 (0-5) - Using exp(x) (is e^x) we can much better prevent overflows from render, which are currently hard-clipped in Blender. Setting a small 'exp' value wil efficiently smooth out high energy and map that back to a color for display. - total formula: newcol= linfac*(1.0-exp(col*logfac)) col, newcol are colors linfac= 1.0 + 1.0/((2.0*wrld.exp +0.5)^10) logfac= log( (linfac-1.0)/linfac )/wrld.range wrld.exp and wrld.range are the button values - default setting: exp=0.0 and range=1.0 give results extremely close to previous rendering. - graph: http://www.selleri.org/Blender/buffer/Image1.png for 'exp' setting ranging from 0-1, and with 'range'=2 Thanks Stefano for the help! --- source/blender/makesdna/DNA_world_types.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'source/blender/makesdna/DNA_world_types.h') diff --git a/source/blender/makesdna/DNA_world_types.h b/source/blender/makesdna/DNA_world_types.h index 91e205e4038..fd367369bd5 100644 --- a/source/blender/makesdna/DNA_world_types.h +++ b/source/blender/makesdna/DNA_world_types.h @@ -56,8 +56,13 @@ typedef struct World { float ambr, ambg, ambb, ambk; unsigned int fastcol; - - float exposure; + + /** + * New exposure/range control. linfac & logfac are constants... don't belong in + * file, but allocating 8 bytes for temp mem isnt useful either. + */ + float exposure, range; + float linfac, logfac; /** * Gravitation constant for the game world @@ -87,7 +92,6 @@ typedef struct World { short dofsta, dofend, dofmin, dofmax; - int pad1; struct Ipo *ipo; struct MTex *mtex[8]; -- cgit v1.2.3