diff options
author | Jack Andersen <someemail@gmail.com> | 2016-03-13 04:00:12 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2016-03-13 04:05:36 +0300 |
commit | 861616bf693b78b070ada6cbc6aa79eb807fdde8 (patch) | |
tree | 4626f295c739ea7fa689e4f56d6877845eb9adf1 /source/blender/makesdna | |
parent | 989b0e472e74869be9f170e2dafbae76d6a4ce94 (diff) |
Full Inverse-Quadratic-Equation Lamp Falloff
This patch adds a new `falloff_type` ('Inverse Coefficients') for Lamps in
Blender-Internal and GLSL.
The current falloff modes use a formula like this inverse-square one:
`I = E × (D^2 / (D^2 + Q × r^2))`
While such a formula is simple for 3D-artists to use, it's algebraically
cumbersome to work with. Game-designers authoring their own shaders
could benefit much more by having direct control of falloff-coefficients:
`I = E × (1.0 / (coefC + coefL × r + coefQ × r^2))`
In this mode, the `distance` parameter is unused (except for 'Sphere'
mode); instead relying on the designer to mathematically-model the
falloff-behavior.
The UI has been patched like so:
{F153843}
Reviewers: brecht, psy-fi
Reviewed By: psy-fi
Subscribers: brita_, antidote, campbellbarton, psy-fi
Differential Revision: https://developer.blender.org/D1194
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r-- | source/blender/makesdna/DNA_lamp_types.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/makesdna/DNA_lamp_types.h b/source/blender/makesdna/DNA_lamp_types.h index 8f0112294f3..a2e39f93875 100644 --- a/source/blender/makesdna/DNA_lamp_types.h +++ b/source/blender/makesdna/DNA_lamp_types.h @@ -61,6 +61,7 @@ typedef struct Lamp { float att1, att2; /* Quad1 and Quad2 attenuation */ + float coeff_const, coeff_lin, coeff_quad, coeff_pad; struct CurveMapping *curfalloff; short falloff_type; short pad2; @@ -161,11 +162,12 @@ typedef struct Lamp { #define LA_SUN_EFFECT_AP 2 /* falloff_type */ -#define LA_FALLOFF_CONSTANT 0 +#define LA_FALLOFF_CONSTANT 0 #define LA_FALLOFF_INVLINEAR 1 -#define LA_FALLOFF_INVSQUARE 2 -#define LA_FALLOFF_CURVE 3 -#define LA_FALLOFF_SLIDERS 4 +#define LA_FALLOFF_INVSQUARE 2 +#define LA_FALLOFF_CURVE 3 +#define LA_FALLOFF_SLIDERS 4 +#define LA_FALLOFF_INVCOEFFICIENTS 5 /* buftype, no flag */ |