diff options
author | Matt Ebb <matt@mke3.net> | 2008-09-23 11:05:06 +0400 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2008-09-23 11:05:06 +0400 |
commit | 6b4ac3e7def9e1b7e11398f483f2b64581939766 (patch) | |
tree | 3f848440dd8595d0feca8e0e9bc3e45e08f02b14 /source/blender/blenloader/intern/readfile.c | |
parent | 50d0e1a988a55a7e7a59823c030ce9ac3413a9a2 (diff) |
* Volume colour absorption
Rather than a single absorption value to control how much light is absorbed as it
travels through a volume, there's now an additional absorption colour. This is
used to absorb different R/G/B components of light at different amounts. For
example, if a white light shines on a volume which absorbs green and blue
components, the volume will appear red.
To make it easier to use, the colour set in the UI is actually the inverse of the
absorption colour, so the colour you set is the colour that the volume will
appear as.
Here's an example of how it works:
http://mke3.net/blender/devel/rendering/volumetrics/vol_col_absorption.jpg
And this can be textured too:
http://mke3.net/blender/devel/rendering/volumetrics/vol_absorb_textured.png
Keep in mind, this doesn't use accurate spectral light wavelength mixing (just
R/G/B channels) so in cases where the absorption colour is fully red green or
blue, you'll get non-physical results.
Todo: refactor the volume texturing internal interface...
Diffstat (limited to 'source/blender/blenloader/intern/readfile.c')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 63f3f88da50..41035b1c373 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -7737,10 +7737,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } for(ma=main->mat.first; ma; ma= ma->id.next) { - if (ma->vol_shade_stepsize < 0.001f) ma->vol_shade_stepsize = 0.2f; - if (ma->vol_stepsize < 0.001f) ma->vol_stepsize = 0.2f; - if (ma->vol_absorption < 0.001f) ma->vol_absorption = 1.0f; - if (ma->vol_scattering < 0.001f) ma->vol_scattering = 1.0f; + /* trigger for non-volumetric file */ + if (ma->vol_shade_stepsize < 0.0001f) { + ma->vol_shade_stepsize = 0.2f; + ma->vol_stepsize = 0.2f; + ma->vol_absorption = 1.0f; + ma->vol_scattering = 1.0f; + ma->vol_absorption_col[0] = ma->vol_absorption_col[1] = ma->vol_absorption_col[2] = 0.0f; + } } } |