diff options
author | Matt Ebb <matt@mke3.net> | 2007-09-16 17:50:34 +0400 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2007-09-16 17:50:34 +0400 |
commit | 90daa8f81126a86f2cd419a6288b5f0b097d478b (patch) | |
tree | 4c84662f08c72e42845f8e6667aa5c190126c5c0 /source/blender/blenloader/intern | |
parent | c8fe5a0ed95fa15e955d3224fd6a2c8a8b648d73 (diff) |
* Extra lamp falloff options, including custom curve!
This adds some new lamp attenuation options to the Lamp panel, replacing the old 'Quad' button. Yes, the panel layout is still nasty here, but I've ignored it for now to address properly in the panels cleanup work.
* Constant
http://mke3.net/blender/devel/rendering/falloff-constant.jpg
Lamp doesn't decay with distance
* Inverse Linear
http://mke3.net/blender/devel/rendering/falloff-invlinear.jpg
Default, and same as in older Blender without 'Quad' on. Decays linearly, with 'Dist' value as the lamp's half-energy-distance
* Inverse Square
http://mke3.net/blender/devel/rendering/falloff-invsquare.jpg
A sharper, more realistic decay, good for most electric lights (i.e. not sunlight). This is similar to the old Quad option with slight changes.
* Lin/Quad weighted
Exactly the same as in older Blenders with the old 'Quad' button enabled. When this setting is chosen, two sliders are shown, 'Linear' and 'Quad' (previously Quad1 and Quad2), which controls the 'linearness' or 'quadraticness' of the falloff curve. Lamps in old files with the 'Quad' button on will be initialised to this setting.
But much better for precise control over the lamp falloff now is:
* Custom Curve
This shows an extra 'Falloff Curve' panel, where you can use the standard Blender curve UI control to precisely control how the light falls off. The Y axis is intensity, and the X axis is distance, stretched over the length of the 'Dist' value.
Some example curves and renders:
http://mke3.net/blender/devel/rendering/falloff-curve1-curve.png
http://mke3.net/blender/devel/rendering/falloff-curve1.jpg
http://mke3.net/blender/devel/rendering/falloff-curve2-curve.png
http://mke3.net/blender/devel/rendering/falloff-curve2.jpg
http://mke3.net/blender/devel/rendering/falloff-curve3-curve.png
http://mke3.net/blender/devel/rendering/falloff-curve3.jpg (whee)
Diffstat (limited to 'source/blender/blenloader/intern')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 18 | ||||
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 3 |
2 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 38240ceeafa..624bfedf6cd 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -112,6 +112,7 @@ #include "BKE_action.h" #include "BKE_armature.h" +#include "BKE_colortools.h" #include "BKE_constraint.h" #include "BKE_curve.h" #include "BKE_customdata.h" @@ -1917,6 +1918,11 @@ static void direct_link_lamp(FileData *fd, Lamp *la) for(a=0; a<MAX_MTEX; a++) { la->mtex[a]= newdataadr(fd, la->mtex[a]); } + + la->curfalloff= newdataadr(fd, la->curfalloff); + if(la->curfalloff) + direct_link_curvemapping(fd, la->curfalloff); + la->preview = direct_link_preview_image(fd, la->preview); } @@ -6670,6 +6676,18 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } } + if(main->versionfile <= 245) { + Lamp *la; + if (main->versionfile != 245 || main->subversionfile < 1) { + for(la=main->lamp.first; la; la= la->id.next) { + if (la->mode & LA_QUAD) la->falloff_type = LA_FALLOFF_SLIDERS; + else la->falloff_type = LA_FALLOFF_INVLINEAR; + + la->curfalloff = curvemapping_add(1, 0.0f, 1.0f, 1.0f, 0.0f); + curvemapping_initialize(la->curfalloff); + } + } + } if (main->versionfile <= 245) { bScreen *sc; diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 90873efb5b9..4f09f51bc87 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -1380,6 +1380,9 @@ static void write_lamps(WriteData *wd, ListBase *idbase) if(la->mtex[a]) writestruct(wd, DATA, "MTex", 1, la->mtex[a]); } + if(la->curfalloff) + write_curvemapping(wd, la->curfalloff); + write_scriptlink(wd, &la->scriptlink); write_previews(wd, la->preview); |