diff options
author | Alfredo de Greef <eeshlo@yahoo.com> | 2004-07-13 23:22:41 +0400 |
---|---|---|
committer | Alfredo de Greef <eeshlo@yahoo.com> | 2004-07-13 23:22:41 +0400 |
commit | b64afb526a8849fa5417bfde2167f158334d7a67 (patch) | |
tree | d00f656672c5c4f038fc029de8fbf273e4762cc6 /source/blender/yafray | |
parent | bf8c3e20204195de92eeaef108208b8702a7d133 (diff) |
Removed some testcode from yafray_Render.cpp
Added the missing anti-aliasing pixel filter size and threshold parameters for manual AA control (disable 'Auto AA' button).
Added support for yafray raytraced depth-of-field.
Added extra panel for Camera in edit window to edit dof paramaters.
The actual focus point will be drawn as a cross when camera 'ShowLimits' is enabled, similar to the aqsis code in tuhopuu.
Note to users: raytraced DoF is very slow, for best results, the default AA parameters are not good enough, especially with higher aperture values (more blur).
So for best results, disable 'Auto AA' and set the AA parameters yourself.
It works best with multi-pass AA ('AA passes' > 1) and a reasonable 'AA samples' value, something in the range 8 - 25 or even higher.
Currently the post-process DoF is not available in yafray, alternatives are being worked on.
Diffstat (limited to 'source/blender/yafray')
-rwxr-xr-x | source/blender/yafray/intern/export_File.cpp | 33 | ||||
-rw-r--r-- | source/blender/yafray/intern/export_Plugin.cpp | 26 | ||||
-rw-r--r-- | source/blender/yafray/intern/yafray_Render.cpp | 7 |
3 files changed, 42 insertions, 24 deletions
diff --git a/source/blender/yafray/intern/export_File.cpp b/source/blender/yafray/intern/export_File.cpp index 4067683d891..08f2837c7e3 100755 --- a/source/blender/yafray/intern/export_File.cpp +++ b/source/blender/yafray/intern/export_File.cpp @@ -204,23 +204,23 @@ bool yafrayFileRender_t::writeRender() ostr << "<render camera_name=\"MAINCAM\"\n"; ostr << "\traydepth=\"" << R.r.YF_raydepth << "\" gamma=\"" << R.r.YF_gamma << "\" exposure=\"" << R.r.YF_exposure << "\"\n"; - if(R.r.YF_AA) - ostr << "\tAA_passes=\"" << R.r.YF_AApasses << "\" AA_minsamples=\"" << R.r.YF_AAsamples << "\""; + if(R.r.YF_AA) { + ostr << "\tAA_passes=\"" << R.r.YF_AApasses << "\" AA_minsamples=\"" << R.r.YF_AAsamples << "\"\n"; + ostr << "\tAA_pixelwidth=\"" << R.r.YF_AApixelsize << "\" AA_threshold=\"" << R.r.YF_AAthreshold << "\"\n"; + } else { if ((R.r.GImethod!=0) && (R.r.GIquality>1) && (!R.r.GIcache)) - ostr << "\tAA_passes=\"5\" AA_minsamples=\"5\" " << endl; + ostr << "\tAA_passes=\"5\" AA_minsamples=\"5\"\n"; else if ((R.r.mode & R_OSA) && (R.r.osa)) { int passes=(R.r.osa%4)==0 ? R.r.osa/4 : 1; int minsamples=(R.r.osa%4)==0 ? 4 : R.r.osa; - ostr << "\tAA_passes=\"" << passes << "\" AA_minsamples=\"" << minsamples << "\""; + ostr << "\tAA_passes=\"" << passes << "\" AA_minsamples=\"" << minsamples << "\"\n"; } - else ostr << "\tAA_passes=\"0\" AA_minsamples=\"1\""; + else ostr << "\tAA_passes=\"0\" AA_minsamples=\"1\"\n"; + ostr << "\tAA_pixelwidth=\"1.5\" AA_threshold=\"0.05\" bias=\"" << R.r.YF_raybias << "\"\n"; } - ostr << "\n"; if (hasworld) ostr << "\tbackground_name=\"world_background\"\n"; - - ostr << "\tAA_pixelwidth=\"2\" AA_threshold=\"0.05\" bias=\"" << R.r.YF_raybias << "\""; // alpha channel render when RGBA button enabled if (R.r.planes==R_PLANES32) ostr << "\n\tsave_alpha=\"on\""; @@ -1121,7 +1121,7 @@ void yafrayFileRender_t::writeLamps() string lpmode="off"; // shadows only when Blender has shadow button enabled, only spots use LA_SHAD flag if (R.r.mode & R_SHADOW) - if (((lamp->type==LA_SPOT) && (lamp->mode & LA_SHAD)) || (lamp->mode & LA_SHAD_RAY)) lpmode="on";; + if (((lamp->type==LA_SPOT) && (lamp->mode & LA_SHAD)) || (lamp->mode & LA_SHAD_RAY)) lpmode="on"; ostr << "\" cast_shadows=\"" << lpmode << "\""; // spot specific stuff if (lamp->type==LA_SPOT) { @@ -1182,7 +1182,19 @@ void yafrayFileRender_t::writeCamera() float aspect = 1; if (R.r.xsch < R.r.ysch) aspect = float(R.r.xsch)/float(R.r.ysch); - ostr << "\" focal=\"" << mainCamLens/(aspect*32.0) << "\" >\n"; + ostr << "\" focal=\"" << mainCamLens/(aspect*32.0) << "\""; + + // dof params, only valid for real camera + if (maincam_obj->type==OB_CAMERA) { + Camera* cam = (Camera*)maincam_obj->data; + ostr << "\n\tdof_distance=\"" << cam->YF_dofdist << "\""; + ostr << " aperture=\"" << cam->YF_aperture << "\""; + string st = "on"; + if (cam->flag & CAM_YF_NO_QMC) st = "off"; + ostr << " use_qmc=\"" << st << "\""; + } + + ostr << " >\n"; xmlfile << ostr.str(); ostr.str(""); @@ -1197,7 +1209,6 @@ void yafrayFileRender_t::writeCamera() ostr << "\t<up x=\"" << maincam_obj->obmat[3][0] + R.viewmat[0][1] << "\" y=\"" << maincam_obj->obmat[3][1] + R.viewmat[1][1] << "\" z=\"" << maincam_obj->obmat[3][2] + R.viewmat[2][1] << "\" />\n"; - // add dof_distance param here xmlfile << ostr.str(); xmlfile << "</camera>\n\n"; diff --git a/source/blender/yafray/intern/export_Plugin.cpp b/source/blender/yafray/intern/export_Plugin.cpp index aaef91d198e..fcc2a853bfb 100644 --- a/source/blender/yafray/intern/export_Plugin.cpp +++ b/source/blender/yafray/intern/export_Plugin.cpp @@ -210,10 +210,12 @@ bool yafrayPluginRender_t::writeRender() params["raydepth"]=yafray::parameter_t((float)R.r.YF_raydepth); params["gamma"]=yafray::parameter_t(R.r.YF_gamma); params["exposure"]=yafray::parameter_t(R.r.YF_exposure); - if(R.r.YF_AA) + if (R.r.YF_AA) { - params["AA_passes"]=yafray::parameter_t((int)R.r.YF_AApasses); - params["AA_minsamples"]=yafray::parameter_t(R.r.YF_AAsamples); + params["AA_passes"] = yafray::parameter_t((int)R.r.YF_AApasses); + params["AA_minsamples"] = yafray::parameter_t(R.r.YF_AAsamples); + params["AA_pixelwidth"] = yafray::parameter_t(R.r.YF_AApixelsize); + params["AA_threshold"] = yafray::parameter_t(R.r.YF_AAthreshold); } else { @@ -232,10 +234,10 @@ bool yafrayPluginRender_t::writeRender() params["AA_passes"]=yafray::parameter_t(0); params["AA_minsamples"]=yafray::parameter_t(1); } + params["AA_pixelwidth"]=yafray::parameter_t(1.5); + params["AA_threshold"]=yafray::parameter_t(0.05f); } if (hasworld) params["background_name"]=yafray::parameter_t("world_background"); - params["AA_pixelwidth"]=yafray::parameter_t(1.5); - params["AA_threshold"]=yafray::parameter_t(0.05f); params["bias"]=yafray::parameter_t(R.r.YF_raybias); //params["outfile"]=yafray::parameter_t(imgout); blenderYafrayOutput_t output; @@ -1190,6 +1192,18 @@ void yafrayPluginRender_t::writeCamera() if (R.r.xsch < R.r.ysch) aspect = float(R.r.xsch)/float(R.r.ysch); params["focal"]=yafray::parameter_t(mainCamLens/(aspect*32.0)); + + // dof params, only valid for real camera + if (maincam_obj->type==OB_CAMERA) { + Camera* cam = (Camera*)maincam_obj->data; + params["dof_distance"] = yafray::parameter_t(cam->YF_dofdist); + params["aperture"] = yafray::parameter_t(cam->YF_aperture); + if (cam->flag & CAM_YF_NO_QMC) + params["use_qmc"] = yafray::parameter_t("off"); + else + params["use_qmc"] = yafray::parameter_t("on"); + } + params["from"]=yafray::parameter_t( yafray::point3d_t(maincam_obj->obmat[3][0], maincam_obj->obmat[3][1], maincam_obj->obmat[3][2])); float fdist = -R.viewmat[3][2]; @@ -1202,7 +1216,7 @@ void yafrayPluginRender_t::writeCamera() yafray::point3d_t(maincam_obj->obmat[3][0] + R.viewmat[0][1], maincam_obj->obmat[3][1] + R.viewmat[1][1], maincam_obj->obmat[3][2] + R.viewmat[2][1])); - // add dof_distance param here + yafrayGate->addCamera(params); } diff --git a/source/blender/yafray/intern/yafray_Render.cpp b/source/blender/yafray/intern/yafray_Render.cpp index b24497ce98b..e91b5bff707 100644 --- a/source/blender/yafray/intern/yafray_Render.cpp +++ b/source/blender/yafray/intern/yafray_Render.cpp @@ -137,13 +137,6 @@ bool yafrayRender_t::getAllMatTexObs() } - // test - for (map<string, vector<float> >::const_iterator obn=dupliMtx_list.begin(); - obn!=dupliMtx_list.end();++obn) - { - cout << obn->first << endl; - } - // in case dupliMtx_list not empty, make sure that there is at least one source object // in all_objects with the name given in dupliMtx_list if (!dupliMtx_list.empty()) { |