Full Inverse-Quadratic-Equation Lamp Falloff
authorJack Andersen <someemail@gmail.com>
Sun, 13 Mar 2016 01:00:12 +0000 (02:00 +0100)
committerAntony Riakiotakis <kalast@gmail.com>
Sun, 13 Mar 2016 01:05:36 +0000 (02:05 +0100)
commit861616bf693b78b070ada6cbc6aa79eb807fdde8
tree4626f295c739ea7fa689e4f56d6877845eb9adf1
parent989b0e472e74869be9f170e2dafbae76d6a4ce94
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
13 files changed:
release/scripts/startup/bl_ui/properties_data_lamp.py
source/blender/blenkernel/intern/lamp.c
source/blender/gpu/GPU_material.h
source/blender/gpu/intern/gpu_material.c
source/blender/gpu/shaders/gpu_shader_material.glsl
source/blender/makesdna/DNA_lamp_types.h
source/blender/makesrna/intern/rna_lamp.c
source/blender/render/intern/include/render_types.h
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/shadeoutput.c
source/gameengine/Converter/BL_BlenderDataConversion.cpp
source/gameengine/Rasterizer/RAS_ILightObject.h
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp