diff --git a/source/blender/collada/EffectExporter.cpp b/source/blender/collada/EffectExporter.cpp index ed37dada195..b4cc88ee3b8 100644 --- a/source/blender/collada/EffectExporter.cpp +++ b/source/blender/collada/EffectExporter.cpp @@ -37,6 +37,7 @@ #include "DNA_mesh_types.h" #include "DNA_texture_types.h" +#include "DNA_world_types.h" #include "BKE_customdata.h" @@ -81,6 +82,7 @@ bool EffectsExporter::hasEffects(Scene *sce) void EffectsExporter::exportEffects(Scene *sce) { if(hasEffects(sce)) { + this->scene = sce; openLibrary(); MaterialFunctor mf; mf.forEachMaterialInScene(sce, *this, this->export_settings->selected); @@ -175,7 +177,8 @@ void EffectsExporter::operator()(Material *ma, Object *ob) ep.setDiffuse(cot, false , "diffuse"); // ambient - cot = getcol(ma->ambr, ma->ambg, ma->ambb, 1.0f); + /* ma->ambX is calculated only on render, so lets do it here manually and not rely on ma->ambX. */ + cot = getcol(this->scene->world->ambr*ma->amb, this->scene->world->ambg*ma->amb, this->scene->world->ambb*ma->amb, 1.0f); ep.setAmbient(cot, false , "ambient"); // reflective, reflectivity diff --git a/source/blender/collada/EffectExporter.h b/source/blender/collada/EffectExporter.h index dc1f4c4474b..25d7ed15bc3 100644 --- a/source/blender/collada/EffectExporter.h +++ b/source/blender/collada/EffectExporter.h @@ -70,6 +70,8 @@ private: bool hasEffects(Scene *sce); const ExportSettings *export_settings; + + Scene *scene; }; #endif