Added another control for new pathlight refinement parameter and solved

a problem with name collision betwen textures and shaders reported by kino.
This commit is contained in:
Alejandro Conty Estevez 2004-01-24 12:23:41 +00:00
parent 38c0f593a8
commit 79884ff70b
4 changed files with 22 additions and 12 deletions

@ -216,7 +216,8 @@ typedef struct RenderData {
int GIphotoncount,GImixphotons;
float GIphotonradius;
int YF_numprocs,YF_raydepth;
float GIshadowquality, GIpower, YF_gamma, YF_exposure,YF_raybias;
float GIshadowquality, GIrefinement, GIpower;
float YF_gamma, YF_exposure,YF_raybias, YF_AAthreshold;
char backbuf[160], pic[160], ftype[160];

@ -1219,7 +1219,7 @@ static void render_panel_yafrayGI()
if (G.scene->r.GImethod>0) {
if (G.scene->r.GIpower==0) G.scene->r.GIpower=1;
uiDefButF(block, NUM, 0, "Power:", 5,35,154,20, &G.scene->r.GIpower, 0.01, 10.0, 10, 0, "GI lighting intensity scale, 1 is normal");
uiDefButF(block, NUM, 0, "Power:", 5,10,154,20, &G.scene->r.GIpower, 0.01, 10.0, 10, 0, "GI lighting intensity scale, 1 is normal");
}
@ -1234,10 +1234,12 @@ static void render_panel_yafrayGI()
{
uiDefBut(block, LABEL, 0, "Cache parameters:", 5,105,130,20, 0, 1.0, 0, 0, 0, "");
if (G.scene->r.GIshadowquality==0.0) G.scene->r.GIshadowquality=0.9;
uiDefButF(block, NUMSLI, 0,"ShadQu ", 5,85,154,20, &(G.scene->r.GIshadowquality), 0.0, 1.0 ,0,0, "Sets the shadow quality, keep it under 0.95 :-) ");
uiDefButF(block, NUM, 0,"ShadQu:", 5,85,154,20, &(G.scene->r.GIshadowquality), 0.01, 1.0 ,1,0, "Sets the shadow quality, keep it under 0.95 :-) ");
if (G.scene->r.GIpixelspersample==0) G.scene->r.GIpixelspersample=10;
uiDefButI(block, NUM, 0, "Pixel Precision:", 5,60,154,20, &G.scene->r.GIpixelspersample, 1, 50, 10, 10, "Maximum number of pixels without samples, the lower the better and slower");
uiDefButS(block,TOG|BIT|0, 0, "Gradient", 5,10,75,20, &G.scene->r.GIgradient, 0, 0, 0, 0, "Try to smooth lighting using a gradient");
uiDefButI(block, NUM, 0, "Prec:", 5,60,75,20, &G.scene->r.GIpixelspersample, 1, 50, 10, 10, "Maximum number of pixels without samples, the lower the better and slower");
uiDefButS(block,TOG|BIT|0, 0, "Gradient", 84,60,75,20, &G.scene->r.GIgradient, 0, 0, 0, 0, "Try to smooth lighting using a gradient");
if (G.scene->r.GIrefinement==0) G.scene->r.GIrefinement=1.0;
uiDefButF(block, NUM, 0, "Refinement:", 5,35,154,20, &G.scene->r.GIrefinement, 0.001, 1.0, 1, 0, "Threshold to refine shadows EXPERIMENTAL. 1 = no refinement");
}
if (G.scene->r.GIphotons)
{

@ -400,7 +400,9 @@ void yafrayFileRender_t::writeMaterialsAndModulators()
Tex* tex = mtex->tex;
if (tex==NULL) continue;
map<string, pair<Material*, MTex*> >::const_iterator mtexL = used_textures.find(string(tex->id.name+2));
//map<string, pair<Material*, MTex*> >::const_iterator mtexL = used_textures.find(string(tex->id.name+2));
// now included the full name
map<string, pair<Material*, MTex*> >::const_iterator mtexL = used_textures.find(string(tex->id.name));
if (mtexL!=used_textures.end()) {
ostr.str("");
ostr << "<shader type=\"blendermapper\" name=\"" << blendmat->first + "_map" << m <<"\"";
@ -572,7 +574,8 @@ void yafrayFileRender_t::writeMaterialsAndModulators()
Tex* tex = mtex->tex;
if (tex==NULL) continue;
map<string, pair<Material*, MTex*> >::const_iterator mtexL = used_textures.find(string(tex->id.name+2));
//map<string, pair<Material*, MTex*> >::const_iterator mtexL = used_textures.find(string(tex->id.name+2));
map<string, pair<Material*, MTex*> >::const_iterator mtexL = used_textures.find(string(tex->id.name));
if (mtexL!=used_textures.end()) {
ostr.str("");
@ -717,7 +720,8 @@ void yafrayFileRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_li
ostr <<" shadow=\""<< (shadow ? "on" : "off" )<<"\" ";
if (VLR_list[0]->mat->mode & MA_RAYTRANSP)
ostr << "caus_IOR=\"" << VLR_list[0]->mat->ang << "\" ";
if (strlen(matname)==0) matname = "blender_default"; else matname+=2; //skip MA id
if (strlen(matname)==0) matname = "blender_default";
//else matname+=2; //skip MA id
ostr << " shader_name=\"" << matname << "\" >\n";
ostr << "\t<attributes>\n";
if (VLR_list[0]->mat->mode & MA_RAYTRANSP)
@ -837,7 +841,8 @@ void yafrayFileRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_li
Material* fmat = vlr->mat;
bool EXPORT_VCOL = ((fmat->mode & (MA_VERTEXCOL|MA_VERTEXCOLP))!=0);
char* fmatname = fmat->id.name;
if (strlen(fmatname)==0) fmatname = "blender_default"; else fmatname+=2; //skip MA id
if (strlen(fmatname)==0) fmatname = "blender_default";
//else fmatname+=2; //skip MA id
TFace* uvc = vlr->tface; // possible uvcoords (v upside down)
int idx1, idx2, idx3;
@ -1168,7 +1173,7 @@ void yafrayFileRender_t::writePathlight()
float aspect = 1;
if (R.r.xsch < R.r.ysch) aspect = float(R.r.xsch)/float(R.r.ysch);
float sbase = 2.0*atan(0.5/(mainCamLens/(aspect*32.0)))/float(R.r.xsch);
ostr << " cache=\"on\" use_QMC=\"on\" \n";
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\" gradient=\"" <<
((R.r.GIgradient)? "on" : "off") << "\" >\n";

@ -101,7 +101,8 @@ bool yafrayRender_t::getAllMatTexObs()
if (strlen(matr->id.name)==0)
used_materials["blender_default"] = matr;
else
used_materials[matr->id.name+2] = matr; // skip 'MA' id
used_materials[matr->id.name] = matr; // <-- full name to avoid name collision in yafray
//used_materials[matr->id.name+2] = matr; // skip 'MA' id
// textures, all active channels
for (int m=0;m<8;m++) {
if (matr->septex & (1<<m)) continue; // only active channels
@ -120,7 +121,8 @@ bool yafrayRender_t::getAllMatTexObs()
(txtp!=TEX_IMAGE)) continue;
// in the case of an image texture, check that there is an actual image, otherwise ignore
if ((txtp & TEX_IMAGE) && (!tx->ima)) continue;
used_textures[tx->id.name+2] = make_pair(matr, mx);
used_textures[tx->id.name] = make_pair(matr, mx); // <-- full name to avoid name collision in yafray
//used_textures[tx->id.name+2] = make_pair(matr, mx);
}
}