diff options
author | Alfredo de Greef <eeshlo@yahoo.com> | 2004-11-08 06:55:44 +0300 |
---|---|---|
committer | Alfredo de Greef <eeshlo@yahoo.com> | 2004-11-08 06:55:44 +0300 |
commit | 459deaf11f3f451b2f30b97b1e23e72343398445 (patch) | |
tree | e88c2e842c843cd8c5bee06a398e6feac0521c85 /source/blender/yafray/intern/export_File.cpp | |
parent | 8daff51e0fab7bf06847e4e019d7b0b21ab4bb69 (diff) |
Fixed:
Texture matrix bug in plugin code reported by Mel_Q.
Vertex colors, this was basically the same as the previous uv coord
splitting bug, for xml export, uv coord splitting was actually not quite
complete either (reported by richie).
Added:
Camera Ipo curves for DoF aperture and focal distance.
Aspect ratio set with AspX & AspY are now taken into account as well.
(needs yafray from cvs)
Bokeh parameters for DoF (also needs yafray from cvs).
'Bokeh' controls the shape of out of focus points when rendering
with depth of field enabled.
This is mostly visible on very out of focus highlights in the image.
There are currently seven types to choose from.:
'Disk1' is the default, the same as was used before.
'Disk2' is similar, but allows you to modify the shape further with the 'bias'
parameter, see below.
Triangle/Square/Pentagon/Hexagon, in addition to the bias control, you can
offset the rotation with the 'Rotation' parameter (in degrees).
'Ring', a weird ring shaped lens, no additional controls.
The 'bias' menu controls accentuation of the shape.
Three types available, uniform, center or edge, with uniform the default.
Although based on an actual phenomenon of real camera's, the current
code is bit of a hack and not physically based, and doesn't work all that
well yet (in yafray anyway). Since this is also mostly visible in the very
out of focus parts of the image, it usually also means that you need lots
of samples to get a reasonably smooth result.
Diffstat (limited to 'source/blender/yafray/intern/export_File.cpp')
-rwxr-xr-x | source/blender/yafray/intern/export_File.cpp | 102 |
1 files changed, 62 insertions, 40 deletions
diff --git a/source/blender/yafray/intern/export_File.cpp b/source/blender/yafray/intern/export_File.cpp index eca34a65504..4bae9520a90 100755 --- a/source/blender/yafray/intern/export_File.cpp +++ b/source/blender/yafray/intern/export_File.cpp @@ -1107,15 +1107,16 @@ void yafrayFileRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_li ostr.str(""); ostr << "\t\t\t<f a=\"" << idx1 << "\" b=\"" << idx2 << "\" c=\"" << idx3 << "\""; + // triangle uv and vcol indices + int ui1=0, ui2=1, ui3=2; + if (vlr->flag & R_DIVIDE_24) { + ui3++; + if (vlr->flag & R_FACE_SPLIT) { ui1++; ui2++; } + } + else if (vlr->flag & R_FACE_SPLIT) { ui2++; ui3++; } + TFace* uvc = vlr->tface; // possible uvcoords (v upside down) if (uvc) { - // use correct uv coords for this triangle - int ui1=0, ui2=1, ui3=2; - if (vlr->flag & R_DIVIDE_24) { - ui3++; - if (vlr->flag & R_FACE_SPLIT) { ui1++; ui2++; } - } - else if (vlr->flag & R_FACE_SPLIT) { ui2++; ui3++; } ostr << " u_a=\"" << uvc->uv[ui1][0] << "\" v_a=\"" << 1-uvc->uv[ui1][1] << "\"" << " u_b=\"" << uvc->uv[ui2][0] << "\" v_b=\"" << 1-uvc->uv[ui2][1] << "\"" << " u_c=\"" << uvc->uv[ui3][0] << "\" v_c=\"" << 1-uvc->uv[ui3][1] << "\""; @@ -1125,17 +1126,17 @@ void yafrayFileRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_li if ((EXPORT_VCOL) && (vlr->vcol)) { // vertex colors float vr, vg, vb; - vr = ((vlr->vcol[0] >> 24) & 255)/255.0; - vg = ((vlr->vcol[0] >> 16) & 255)/255.0; - vb = ((vlr->vcol[0] >> 8) & 255)/255.0; + vr = ((vlr->vcol[ui1] >> 24) & 255)/255.0; + vg = ((vlr->vcol[ui1] >> 16) & 255)/255.0; + vb = ((vlr->vcol[ui1] >> 8) & 255)/255.0; ostr << " vcol_a_r=\"" << vr << "\" vcol_a_g=\"" << vg << "\" vcol_a_b=\"" << vb << "\""; - vr = ((vlr->vcol[1] >> 24) & 255)/255.0; - vg = ((vlr->vcol[1] >> 16) & 255)/255.0; - vb = ((vlr->vcol[1] >> 8) & 255)/255.0; + vr = ((vlr->vcol[ui2] >> 24) & 255)/255.0; + vg = ((vlr->vcol[ui2] >> 16) & 255)/255.0; + vb = ((vlr->vcol[ui2] >> 8) & 255)/255.0; ostr << " vcol_b_r=\"" << vr << "\" vcol_b_g=\"" << vg << "\" vcol_b_b=\"" << vb << "\""; - vr = ((vlr->vcol[2] >> 24) & 255)/255.0; - vg = ((vlr->vcol[2] >> 16) & 255)/255.0; - vb = ((vlr->vcol[2] >> 8) & 255)/255.0; + vr = ((vlr->vcol[ui3] >> 24) & 255)/255.0; + vg = ((vlr->vcol[ui3] >> 16) & 255)/255.0; + vb = ((vlr->vcol[ui3] >> 8) & 255)/255.0; ostr << " vcol_c_r=\"" << vr << "\" vcol_c_g=\"" << vg << "\" vcol_c_b=\"" << vb << "\""; } ostr << " shader_name=\"" << fmatname << "\" />\n"; @@ -1151,25 +1152,30 @@ void yafrayFileRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_li ostr << "\t\t\t<f a=\"" << idx1 << "\" b=\"" << idx2 << "\" c=\"" << idx3 << "\""; + // increment uv & vcol indices + ui1 = (ui1+2) & 3; + ui2 = (ui2+2) & 3; + ui3 = (ui3+2) & 3; + if (uvc) { - ostr << " u_a=\"" << uvc->uv[2][0] << "\" v_a=\"" << 1-uvc->uv[2][1] << "\"" - << " u_b=\"" << uvc->uv[3][0] << "\" v_b=\"" << 1-uvc->uv[3][1] << "\"" - << " u_c=\"" << uvc->uv[0][0] << "\" v_c=\"" << 1-uvc->uv[0][1] << "\""; + ostr << " u_a=\"" << uvc->uv[ui1][0] << "\" v_a=\"" << 1-uvc->uv[ui1][1] << "\"" + << " u_b=\"" << uvc->uv[ui2][0] << "\" v_b=\"" << 1-uvc->uv[ui2][1] << "\"" + << " u_c=\"" << uvc->uv[ui3][0] << "\" v_c=\"" << 1-uvc->uv[ui3][1] << "\""; } if ((EXPORT_VCOL) && (vlr->vcol)) { // vertex colors float vr, vg, vb; - vr = ((vlr->vcol[2] >> 24) & 255)/255.0; - vg = ((vlr->vcol[2] >> 16) & 255)/255.0; - vb = ((vlr->vcol[2] >> 8) & 255)/255.0; + vr = ((vlr->vcol[ui1] >> 24) & 255)/255.0; + vg = ((vlr->vcol[ui1] >> 16) & 255)/255.0; + vb = ((vlr->vcol[ui1] >> 8) & 255)/255.0; ostr << " vcol_a_r=\"" << vr << "\" vcol_a_g=\"" << vg << "\" vcol_a_b=\"" << vb << "\""; - vr = ((vlr->vcol[3] >> 24) & 255)/255.0; - vg = ((vlr->vcol[3] >> 16) & 255)/255.0; - vb = ((vlr->vcol[3] >> 8) & 255)/255.0; + vr = ((vlr->vcol[ui2] >> 24) & 255)/255.0; + vg = ((vlr->vcol[ui2] >> 16) & 255)/255.0; + vb = ((vlr->vcol[ui2] >> 8) & 255)/255.0; ostr << " vcol_b_r=\"" << vr << "\" vcol_b_g=\"" << vg << "\" vcol_b_b=\"" << vb << "\""; - vr = ((vlr->vcol[0] >> 24) & 255)/255.0; - vg = ((vlr->vcol[0] >> 16) & 255)/255.0; - vb = ((vlr->vcol[0] >> 8) & 255)/255.0; + vr = ((vlr->vcol[ui3] >> 24) & 255)/255.0; + vg = ((vlr->vcol[ui3] >> 16) & 255)/255.0; + vb = ((vlr->vcol[ui3] >> 8) & 255)/255.0; ostr << " vcol_c_r=\"" << vr << "\" vcol_c_g=\"" << vg << "\" vcol_c_b=\"" << vb << "\""; } ostr << " shader_name=\"" << fmatname << "\" />\n"; @@ -1443,7 +1449,6 @@ void yafrayFileRender_t::writeLamps() } } - // write main camera void yafrayFileRender_t::writeCamera() { @@ -1456,15 +1461,12 @@ void yafrayFileRender_t::writeCamera() ostr << "type=\"perspective\""; // render resolution including the percentage buttons (aleady calculated in initrender for R renderdata) - int xres = R.r.xsch; - int yres = R.r.ysch; - ostr << " resx=\"" << xres << "\" resy=\"" << yres; - - // aspectratio can be set in Blender as well using aspX & aspY, need an extra param. for yafray cam. - float aspect = 1; - if (R.r.xsch < R.r.ysch) aspect = float(R.r.xsch)/float(R.r.ysch); + ostr << " resx=\"" << R.r.xsch << "\" resy=\"" << R.r.ysch << "\""; - ostr << "\" focal=\"" << mainCamLens/(aspect*32.0) << "\""; + float f_aspect = 1; + if ((R.r.xsch*R.r.xasp)<=(R.r.ysch*R.r.yasp)) f_aspect = float(R.r.xsch*R.r.xasp)/float(R.r.ysch*R.r.yasp); + ostr << "\n\tfocal=\"" << mainCamLens/(f_aspect*32.f); + ostr << "\" aspect_ratio=\"" << R.ycor << "\""; // dof params, only valid for real camera if (maincam_obj->type==OB_CAMERA) { @@ -1474,6 +1476,28 @@ void yafrayFileRender_t::writeCamera() string st = "on"; if (cam->flag & CAM_YF_NO_QMC) st = "off"; ostr << " use_qmc=\"" << st << "\""; + // bokeh params + st = "disk1"; + if (cam->YF_bkhtype==1) + st = "disk2"; + else if (cam->YF_bkhtype==2) + st = "triangle"; + else if (cam->YF_bkhtype==3) + st = "square"; + else if (cam->YF_bkhtype==4) + st = "pentagon"; + else if (cam->YF_bkhtype==5) + st = "hexagon"; + else if (cam->YF_bkhtype==6) + st = "ring"; + ostr << "\n\tbokeh_type=\"" << st << "\""; + st = "uniform"; + if (cam->YF_bkhbias==1) + st = "center"; + else if (cam->YF_bkhbias==2) + st = "edge"; + ostr << " bokeh_bias=\"" << st << "\""; + ostr << " bokeh_rotation=\"" << cam->YF_bkhrot << "\""; } ostr << " >\n"; @@ -1537,10 +1561,8 @@ void yafrayFileRender_t::writePathlight() case 5 : ostr << " samples=\"2048\" \n"; break; default: ostr << " samples=\"512\" \n"; } - float aspect = 1; - if (R.r.xsch < R.r.ysch) aspect = float(R.r.xsch)/float(R.r.ysch); float sbase = 2.0/float(R.r.xsch); - ostr << " cache=\"on\" use_QMC=\"on\" threshold=\"" <<R.r.GIrefinement<<"\""<<endl; + ostr << " cache=\"on\" use_QMC=\"on\" threshold=\"" << R.r.GIrefinement << "\"" << endl; ostr << " cache_size=\"" << sbase*R.r.GIpixelspersample << "\" shadow_threshold=\"" << 1.0 - R.r.GIshadowquality << "\" grid=\"82\" search=\"35\" >\n"; } |