diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-02-08 20:25:35 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-02-08 20:25:35 +0400 |
commit | ebf18c6df927c0075dcc9057cf1774309d56464e (patch) | |
tree | 9227f3f8e1c68fa2db579b848da9ab3fac521e8b /source/blender/blenloader | |
parent | e092115e790f939417870f54636ec28f4b0fa19a (diff) |
Corrections to alpha pipeline do_versions
Basically they're aimed to solve issues when scene with sky
was used for compositing. If compo used alpha output result
of current trunk would be completely different form hwo it
was before.
Two heuristics here:
- If there's no world or world color is black, it completely
equals to straight alpha mode, no further magic is needed
to preserve compatibility
- If scene is used as Render Layer node and something is
connected to Alpha output of this node, ensure alpha mode
for this scene is set to Premultiplied.
Basically it shall give better compatibility and make
4K mango project just happy! :)
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 1d76bef8dc1..93bc0502b19 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -8649,6 +8649,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) for (scene = main->scene.first; scene; scene = scene->id.next) { Sequence *seq; + bool set_premul = false; SEQ_BEGIN (scene->ed, seq) { @@ -8659,6 +8660,23 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (scene->r.bake_samples == 0) scene->r.bake_samples = 256; + + if (scene->world) { + World *world = blo_do_versions_newlibadr(fd, scene->id.lib, scene->world); + + if (is_zero_v3(&world->horr)) { + if ((world->skytype & WO_SKYBLEND) == 0 || is_zero_v3(&world->zenr)) { + set_premul = true; + } + } + } + else + set_premul = true; + + if (set_premul) { + printf("2.66 versioning fix: replacing black sky with premultiplied alpha for scene %s\n", scene->id.name + 2); + scene->r.alphamode = R_ALPHAPREMUL; + } } for (image = main->image.first; image; image = image->id.next) { |