diff options
-rw-r--r-- | source/blender/src/buttons_shading.c | 32 | ||||
-rwxr-xr-x | source/blender/yafray/intern/export_File.cpp | 14 | ||||
-rw-r--r-- | source/blender/yafray/intern/export_Plugin.cpp | 14 | ||||
-rw-r--r-- | source/blender/yafray/intern/export_Plugin.h | 2 |
4 files changed, 43 insertions, 19 deletions
diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c index 29c79ec0d30..f5d0d64d0e5 100644 --- a/source/blender/src/buttons_shading.c +++ b/source/blender/src/buttons_shading.c @@ -2922,22 +2922,26 @@ static void material_panel_tramir_yafray(Material *ma) /* ior has extended range up to 30, for use with total fresnel reflection */ uiDefButF(block, NUMSLI, B_MATPRV, "IOR ", 10,115,150,20, &(ma->ang), 1.0, 30.0, 100, 2, "Sets the angular index of refraction for raytrace"); - if(ma->mode & MA_RAYTRANSP) + + // parameters only used in ray_transp mode + if(ma->mode & MA_RAYTRANSP) { + // Filter uiDefButF(block, NUM, B_MATPRV, "Filt:", 160,115,150,20, &(ma->filter), 0.0, 1.0, 10, 0, "Amount of filtering for transparent raytrace"); - /* absorption color */ - uiDefBut(block, LABEL, 0, "Absorption Color", 10, 98, 150, 18, 0, 0.0, 0.0, 0, 0, ""); - uiDefButF(block, COL, B_MATPRV_DRAW, "", 10, 38, 30, 58, &ma->YF_ar, 0, 0, 0, B_MATCOL, "transmit absorption color, white is no absorption"); - uiDefButF(block, NUMSLI, B_MATPRV, "aR ", 40, 78, 120, 18, &ma->YF_ar, 1e-7f, 1.0, B_MATCOL, 0, ""); - uiDefButF(block, NUMSLI, B_MATPRV, "aG ", 40, 58, 120, 18, &ma->YF_ag, 1e-7f, 1.0, B_MATCOL, 0, ""); - uiDefButF(block, NUMSLI, B_MATPRV, "aB ", 40, 38, 120, 18, &ma->YF_ab, 1e-7f, 1.0, B_MATCOL, 0, ""); - uiDefButF(block, NUM, B_MATPRV, "Ds", 10, 18, 150, 18, &ma->YF_dscale, 1e-7f, 100.0, 10.0, 0, "absorption distance scale, 1 is one blender (world) unit of distance"); - - /* disperions parameters */ - uiDefBut(block, LABEL, 0, "Dispersion", 160, 98, 150, 18, 0, 0.0, 0.0, 0, 0, ""); - uiDefButF(block, NUM, B_MATPRV, "Pwr ", 160, 78, 150, 18, &ma->YF_dpwr, 0.0, 1.0, 0.25, 0, "Dispersion power, the higher, the more dispersion, 0 is no dispersion"); - uiDefButI(block, NUM, B_MATPRV, "Samples ", 160, 58, 150, 18, &ma->YF_dsmp, 1.0, 100.0, 0, 0, "Dispersion samples, minimum at least 10, unless using jitter "); - uiDefButI(block, TOG|BIT|0, B_MATPRV, "Jitter", 160, 38, 150, 18, &ma->YF_djit, 0.0, 1.0, 0, 0, "Enable jittering of wavelenghts, adds noise"); + /* absorption color */ + uiDefBut(block, LABEL, 0, "Absorption Color", 10, 98, 150, 18, 0, 0.0, 0.0, 0, 0, ""); + uiDefButF(block, COL, B_MATPRV_DRAW, "", 10, 38, 30, 58, &ma->YF_ar, 0, 0, 0, B_MATCOL, "transmit absorption color, white is no absorption"); + uiDefButF(block, NUMSLI, B_MATPRV, "aR ", 40, 78, 120, 18, &ma->YF_ar, 1e-7f, 1.0, B_MATCOL, 0, ""); + uiDefButF(block, NUMSLI, B_MATPRV, "aG ", 40, 58, 120, 18, &ma->YF_ag, 1e-7f, 1.0, B_MATCOL, 0, ""); + uiDefButF(block, NUMSLI, B_MATPRV, "aB ", 40, 38, 120, 18, &ma->YF_ab, 1e-7f, 1.0, B_MATCOL, 0, ""); + uiDefButF(block, NUM, B_MATPRV, "Ds", 10, 18, 150, 18, &ma->YF_dscale, 1e-7f, 100.0, 10.0, 0, "absorption distance scale, 1 is one blender (world) unit of distance"); + + /* disperions parameters */ + uiDefBut(block, LABEL, 0, "Dispersion", 160, 98, 150, 18, 0, 0.0, 0.0, 0, 0, ""); + uiDefButF(block, NUM, B_MATPRV, "Pwr ", 160, 78, 150, 18, &ma->YF_dpwr, 0.0, 1.0, 0.25, 0, "Dispersion power, the higher, the more dispersion, 0 is no dispersion"); + uiDefButI(block, NUM, B_MATPRV, "Samples ", 160, 58, 150, 18, &ma->YF_dsmp, 1.0, 100.0, 0, 0, "Dispersion samples, minimum at least 10, unless using jitter "); + uiDefButI(block, TOG|BIT|0, B_MATPRV, "Jitter", 160, 38, 150, 18, &ma->YF_djit, 0.0, 1.0, 0, 0, "Enable jittering of wavelenghts, adds noise"); + } } diff --git a/source/blender/yafray/intern/export_File.cpp b/source/blender/yafray/intern/export_File.cpp index d35903ba91d..43128b35933 100755 --- a/source/blender/yafray/intern/export_File.cpp +++ b/source/blender/yafray/intern/export_File.cpp @@ -667,7 +667,14 @@ void yafrayFileRender_t::writeShader(const string &shader_name, Material* matr, ostr << "<shader type=\"blendershader\" name=\"" << shader_name << "\" >\n"; ostr << "\t<attributes>\n"; ostr << "\t\t<color r=\"" << matr->r << "\" g=\"" << matr->g << "\" b=\"" << matr->b << "\" />\n"; - ostr << "\t\t<specular_color r=\"" << matr->specr << "\" g=\"" << matr->specg << "\" b=\"" << matr->specb << "\" />\n"; + float sr=matr->specr, sg=matr->specg, sb=matr->specb; + if (matr->spec_shader==MA_SPEC_WARDISO) { + // ........ + sr /= M_PI; + sg /= M_PI; + sb /= M_PI; + } + ostr << "\t\t<specular_color r=\"" << sr << "\" g=\"" << sg << "\" b=\"" << sb << "\" />\n"; ostr << "\t\t<mirror_color r=\"" << matr->mirr << "\" g=\"" << matr->mirg << "\" b=\"" << matr->mirb << "\" />\n"; ostr << "\t\t<diffuse_reflect value=\"" << matr->ref << "\" />\n"; ostr << "\t\t<specular_amount value=\"" << matr->spec << "\" />\n"; @@ -1615,7 +1622,9 @@ void yafrayFileRender_t::writeLamps() ostr << "\n\thalo=\"on\" " << "res=\"" << lamp->YF_bufsize << "\"\n"; int hsmp = ((12-lamp->shadhalostep)*16)/12; hsmp = (hsmp+1)*16; // makes range (16, 272) for halostep(12, 0), good enough? - ostr << "\tsamples=\"" << hsmp << "\" shadow_samples=\"" << (lamp->samp*lamp->samp) << "\"\n"; + // halo 'samples' now 'stepsize' + // convert from old integer samples value to some reasonable stepsize + ostr << "\tstepsize=\"" << (1.0/sqrt((float)hsmp)) << "\" shadow_samples=\"" << (lamp->samp*lamp->samp) << "\"\n"; ostr << "\thalo_blur=\"0\" shadow_blur=\"" << (lamp->soft*0.01f) << "\"\n"; ostr << "\tfog_density=\"" << (lamp->haint*0.2f) << "\""; } @@ -1886,6 +1895,7 @@ bool yafrayFileRender_t::writeWorld() ostr << " mapping=\"tube\" >\n"; ostr << "\t<filename value=\"" << wt_path << "\" />\n"; ostr << "\t<interpolate value=\"" << ((wtex->tex->imaflag & TEX_INTERPOL) ? "bilinear" : "none") << "\" />\n"; + if (wtex->tex->filtersize>1.f) ostr << "\t<prefilter value=\"on\" />\n"; ostr << "</background>\n\n"; xmlfile << ostr.str(); return true; diff --git a/source/blender/yafray/intern/export_Plugin.cpp b/source/blender/yafray/intern/export_Plugin.cpp index 0dad8f9de36..27333c89b89 100644 --- a/source/blender/yafray/intern/export_Plugin.cpp +++ b/source/blender/yafray/intern/export_Plugin.cpp @@ -653,7 +653,14 @@ void yafrayPluginRender_t::writeShader(const string &shader_name, Material* matr params["type"] = yafray::parameter_t("blendershader"); params["name"] = yafray::parameter_t(shader_name); params["color"] = yafray::parameter_t(yafray::color_t(matr->r, matr->g, matr->b)); - params["specular_color"] = yafray::parameter_t(yafray::color_t(matr->specr, matr->specg, matr->specb)); + float sr=matr->specr, sg=matr->specg, sb=matr->specb; + if (matr->spec_shader==MA_SPEC_WARDISO) { + // ........ + sr /= M_PI; + sg /= M_PI; + sb /= M_PI; + } + params["specular_color"] = yafray::parameter_t(yafray::color_t(sr, sg, sb)); params["mirror_color"] = yafray::parameter_t(yafray::color_t(matr->mirr, matr->mirg, matr->mirb)); params["diffuse_reflect"] = yafray::parameter_t(matr->ref); params["specular_amount"] = yafray::parameter_t(matr->spec); @@ -1593,7 +1600,9 @@ void yafrayPluginRender_t::writeLamps() params["res"] = yafray::parameter_t(lamp->YF_bufsize); int hsmp = ((12-lamp->shadhalostep)*16)/12; hsmp = (hsmp+1)*16; // makes range (16, 272) for halostep(12, 0), good enough? - params["samples"] = yafray::parameter_t(hsmp); + // halo 'samples' now 'stepsize' + // convert from old integer samples value to some reasonable stepsize + params["stepsize"] = yafray::parameter_t(1.0/sqrt((float)hsmp)); params["shadow_samples"] = yafray::parameter_t(lamp->samp*lamp->samp); params["halo_blur"] = yafray::parameter_t(0.0); params["shadow_blur"] = yafray::parameter_t(lamp->soft*0.01f); @@ -1879,6 +1888,7 @@ bool yafrayPluginRender_t::writeWorld() params["mapping"] = yafray::parameter_t("tube"); params["filename"] = yafray::parameter_t(wt_path); params["interpolate"] = yafray::parameter_t((wtex->tex->imaflag & TEX_INTERPOL) ? "bilinear" : "none"); + if (wtex->tex->filtersize>1.f) params["prefilter"] = yafray::parameter_t("on"); yafrayGate->addBackground(params); return true; } diff --git a/source/blender/yafray/intern/export_Plugin.h b/source/blender/yafray/intern/export_Plugin.h index c1d6a7fbd2e..2ec79ba1625 100644 --- a/source/blender/yafray/intern/export_Plugin.h +++ b/source/blender/yafray/intern/export_Plugin.h @@ -35,7 +35,7 @@ class yafrayPluginRender_t : public yafrayRender_t virtual void writeTextures(); virtual void writeShader(const std::string &shader_name, Material* matr, const std::string &facetexname=""); virtual void writeMaterialsAndModulators(); - virtual void writeObject(Object* obj, + virtual void writeObject(Object* obj, const std::vector<VlakRen*> &VLR_list, const float obmat[4][4]); virtual void writeAllObjects(); virtual void writeAreaLamp(LampRen* lamp, int num, float iview[4][4]); |