Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/include/butspace.h2
-rw-r--r--source/blender/makesdna/DNA_lamp_types.h3
-rw-r--r--source/blender/makesdna/DNA_material_types.h11
-rw-r--r--source/blender/makesdna/DNA_scene_types.h2
-rw-r--r--source/blender/render/extern/include/render_types.h2
-rw-r--r--source/blender/renderconverter/intern/convertBlenderScene.c2
-rw-r--r--source/blender/src/buttons_scene.c50
-rw-r--r--source/blender/src/buttons_shading.c116
-rwxr-xr-xsource/blender/yafray/intern/export_File.cpp126
-rw-r--r--source/blender/yafray/intern/export_Plugin.cpp218
-rw-r--r--source/blender/yafray/intern/yafray_Render.cpp22
11 files changed, 398 insertions, 156 deletions
diff --git a/source/blender/include/butspace.h b/source/blender/include/butspace.h
index 443b97430fa..7bbadba8847 100644
--- a/source/blender/include/butspace.h
+++ b/source/blender/include/butspace.h
@@ -167,6 +167,8 @@ void test_idbutton_cb(void *namev, void *arg2_unused);
#define B_MATZTRANSP 1214
#define B_MATRAYTRANSP 1215
#define B_MATCOLORBAND 1216
+/* yafray: material preset menu event */
+#define B_MAT_YF_PRESET 1217
/* *********************** */
#define B_TEXBUTS 1400
diff --git a/source/blender/makesdna/DNA_lamp_types.h b/source/blender/makesdna/DNA_lamp_types.h
index 96aaf66f2eb..0a7bf2ddf5b 100644
--- a/source/blender/makesdna/DNA_lamp_types.h
+++ b/source/blender/makesdna/DNA_lamp_types.h
@@ -71,6 +71,9 @@ typedef struct Lamp {
int YF_numphotons, YF_numsearch;
short YF_phdepth, YF_useqmc, YF_bufsize, YF_pad;
float YF_causticblur, YF_ltradius;
+ /* yafray: glow params */
+ float YF_glowint;
+ short YF_glowtype, YF_pad2;
struct MTex *mtex[10];
struct Ipo *ipo;
diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h
index c60fa32db09..58af9c52de1 100644
--- a/source/blender/makesdna/DNA_material_types.h
+++ b/source/blender/makesdna/DNA_material_types.h
@@ -94,7 +94,7 @@ typedef struct Material {
char rampblend_col, rampblend_spec;
short ramp_show, pad3;
float rampfac_col, rampfac_spec;
-
+
struct MTex *mtex[10];
struct Ipo *ipo;
@@ -102,7 +102,14 @@ typedef struct Material {
float friction, fh, reflect;
float fhdist, xyfrict;
short dynamode, pad2;
-
+
+ /* yafray: dispersion parameters */
+ float YF_er, YF_eg, YF_eb;
+ float YF_dpwr;
+ short YF_dsmp, YF_djit;
+ /* yafray: material preset menu */
+ short YF_preset, pad6;
+
ScriptLink scriptlink;
} Material;
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 504a1cfe546..863c9c605b1 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -225,7 +225,7 @@ typedef struct RenderData {
/* yafray: global panel params. TODO: move elsewhere */
short GIquality, GIcache, GImethod, GIphotons, GIdirect;
- short YF_AA, YFexportxml, yfpad1[3];
+ short YF_AA, YFexportxml, YF_nobump, yfpad1[2];
int GIdepth, GIcausdepth, GIpixelspersample;
int GIphotoncount, GImixphotons;
float GIphotonradius;
diff --git a/source/blender/render/extern/include/render_types.h b/source/blender/render/extern/include/render_types.h
index 7b1aeb24009..744c4aad74d 100644
--- a/source/blender/render/extern/include/render_types.h
+++ b/source/blender/render/extern/include/render_types.h
@@ -302,6 +302,8 @@ typedef struct LampRen
int YF_numphotons, YF_numsearch;
short YF_phdepth, YF_useqmc, YF_bufsize;
float YF_causticblur, YF_ltradius;
+ float YF_glowint;
+ short YF_glowtype;
/* ray optim */
VlakRen *vlr_last;
diff --git a/source/blender/renderconverter/intern/convertBlenderScene.c b/source/blender/renderconverter/intern/convertBlenderScene.c
index 7ea86bf42d5..3619b5a96da 100644
--- a/source/blender/renderconverter/intern/convertBlenderScene.c
+++ b/source/blender/renderconverter/intern/convertBlenderScene.c
@@ -1757,6 +1757,8 @@ void RE_add_render_lamp(Object *ob, int doshadbuf)
lar->YF_causticblur = la->YF_causticblur;
lar->YF_ltradius = la->YF_ltradius;
lar->YF_bufsize = la->YF_bufsize;
+ lar->YF_glowint = la->YF_glowint;
+ lar->YF_glowtype = la->YF_glowtype;
}
lar->spotsi= la->spotsize;
diff --git a/source/blender/src/buttons_scene.c b/source/blender/src/buttons_scene.c
index 73fd32c53c9..7c525f81193 100644
--- a/source/blender/src/buttons_scene.c
+++ b/source/blender/src/buttons_scene.c
@@ -1266,23 +1266,27 @@ static void render_panel_yafrayGI()
uiDefBut(block, LABEL, 0, " ", 305,180,10,10, 0, 0, 0, 0, 0, "");
uiDefBut(block, LABEL, 0, "Method", 5,175,70,20, 0, 1.0, 0, 0, 0, "");
- uiDefButS(block, MENU, B_REDR, "GiMethod %t|None %x0|SkyDome %x1|Full %x2 |", 70,175,89,20, &G.scene->r.GImethod, 0, 0, 0, 0, "Global Illumination Method");
+ uiDefButS(block, MENU, B_REDR, "GiMethod %t|None %x0|SkyDome %x1|Full %x2", 70,175,89,20, &G.scene->r.GImethod, 0, 0, 0, 0, "Global Illumination Method");
+
uiDefBut(block, LABEL, 0, "Quality", 5,150,70,20, 0, 1.0, 0, 0, 0, "");
- uiDefButS(block, MENU, B_REDR, "GiQuality %t|None %x0|Low %x1|Medium %x2 |High %x3|Higher %x4|Best %x5|",
- 70,150,89,20, &G.scene->r.GIquality, 0, 0, 0, 0, "Global Illumination Quality");
+ uiDefButS(block, MENU, B_REDR, "GiQuality %t|None %x0|Low %x1|Medium %x2 |High %x3|Higher %x4|Best %x5|Use Blender AO settings %x6", 70,150,89,20, &G.scene->r.GIquality, 0, 0, 0, 0, "Global Illumination Quality");
if (G.scene->r.GImethod>0) {
uiDefButF(block, NUM, B_DIFF, "EmitPwr:", 5,35,154,20, &G.scene->r.GIpower, 0.01, 100.0, 10, 0, "arealight, material emit and background intensity scaling, 1 is normal");
if (G.scene->r.GImethod==2) uiDefButF(block, NUM, B_DIFF, "GI Pwr:", 5,10,154,20, &G.scene->r.GIindirpower, 0.01, 100.0, 10, 0, "GI indirect lighting intensity scaling, 1 is normal");
}
- if (G.scene->r.GImethod==2)
+ if (G.scene->r.GImethod>0)
{
if (G.scene->r.GIdepth==0) G.scene->r.GIdepth=2;
- uiDefButI(block, NUM, B_DIFF, "Depth:", 180,175,110,20, &G.scene->r.GIdepth, 1.0, 100.0, 10, 10, "Number of bounces of the indirect light");
- uiDefButI(block, NUM, B_DIFF, "CDepth:", 180,150,110,20, &G.scene->r.GIcausdepth, 1.0, 100.0, 10, 10, "Number of bounces inside objects (for caustics)");
- uiDefButS(block,TOG|BIT|0, B_REDR, "Cache",70,125,89,20, &G.scene->r.GIcache, 0, 0, 0, 0, "Cache irradiance samples (faster)");
- uiDefButS(block,TOG|BIT|0, B_REDR, "Photons",180,125,89,20, &G.scene->r.GIphotons, 0, 0, 0, 0, "Use global photons to help in GI");
+ if (G.scene->r.GImethod==2) {
+ uiDefButI(block, NUM, B_DIFF, "Depth:", 180,175,110,20, &G.scene->r.GIdepth, 1.0, 100.0, 10, 10, "Number of bounces of the indirect light");
+ uiDefButI(block, NUM, B_DIFF, "CDepth:", 180,150,110,20, &G.scene->r.GIcausdepth, 1.0, 100.0, 10, 10, "Number of bounces inside objects (for caustics)");
+ uiDefButS(block,TOG|BIT|0, B_REDR, "Photons",240,125,89,20, &G.scene->r.GIphotons, 0, 0, 0, 0, "Use global photons to help in GI");
+ }
+ uiDefButS(block,TOG|BIT|0, B_REDR, "Cache",125,125,89,20, &G.scene->r.GIcache, 0, 0, 0, 0, "Cache occlusion/irradiance samples (faster)");
+ if (G.scene->r.GIcache)
+ uiDefButS(block,TOG|BIT|0, B_REDR, "NoBump",15,125,89,20, &G.scene->r.YF_nobump, 0, 0, 0, 0, "Don't use bumpnormals for cache (faster, but no bumpmapping in total indirectly lit areas)");
if (G.scene->r.GIcache)
{
uiDefBut(block, LABEL, 0, "Cache parameters:", 5,105,130,20, 0, 1.0, 0, 0, 0, "");
@@ -1293,20 +1297,22 @@ static void render_panel_yafrayGI()
if (G.scene->r.GIrefinement==0) G.scene->r.GIrefinement=1.0;
uiDefButF(block, NUM, B_DIFF, "Ref:", 84,60,75,20, &G.scene->r.GIrefinement, 0.001, 1.0, 1, 0, "Threshold to refine shadows EXPERIMENTAL. 1 = no refinement");
}
- if (G.scene->r.GIphotons)
- {
- uiDefBut(block, LABEL, 0, "Photon parameters:", 170,105,130,20, 0, 1.0, 0, 0, 0, "");
- if(G.scene->r.GIphotoncount==0) G.scene->r.GIphotoncount=100000;
- uiDefButI(block, NUM, B_DIFF, "Count:", 170,85,140,20, &G.scene->r.GIphotoncount,
- 0, 10000000, 10, 10, "Number of photons to shoot");
- if(G.scene->r.GIphotonradius==0.0) G.scene->r.GIphotonradius=1.0;
- uiDefButF(block, NUMSLI, B_DIFF,"Radius:", 170,60,140,20, &(G.scene->r.GIphotonradius),
- 0.00001, 100.0 ,0,0, "Radius to search for photons to mix (blur)");
- if(G.scene->r.GImixphotons==0) G.scene->r.GImixphotons=100;
- uiDefButI(block, NUM, B_DIFF, "MixCount:", 170,35,140,20, &G.scene->r.GImixphotons,
- 0, 1000, 10, 10, "Number of photons to mix");
- uiDefButS(block,TOG|BIT|0, B_REDR, "Tune Photons",170,10,140,20, &G.scene->r.GIdirect,
- 0, 0, 0, 0, "Show the photonmap directly in the render for tuning");
+ if (G.scene->r.GImethod==2) {
+ if (G.scene->r.GIphotons)
+ {
+ uiDefBut(block, LABEL, 0, "Photon parameters:", 170,105,130,20, 0, 1.0, 0, 0, 0, "");
+ if(G.scene->r.GIphotoncount==0) G.scene->r.GIphotoncount=100000;
+ uiDefButI(block, NUM, B_DIFF, "Count:", 170,85,140,20, &G.scene->r.GIphotoncount,
+ 0, 10000000, 10, 10, "Number of photons to shoot");
+ if(G.scene->r.GIphotonradius==0.0) G.scene->r.GIphotonradius=1.0;
+ uiDefButF(block, NUMSLI, B_DIFF,"Radius:", 170,60,140,20, &(G.scene->r.GIphotonradius),
+ 0.00001, 100.0 ,0,0, "Radius to search for photons to mix (blur)");
+ if(G.scene->r.GImixphotons==0) G.scene->r.GImixphotons=100;
+ uiDefButI(block, NUM, B_DIFF, "MixCount:", 170,35,140,20, &G.scene->r.GImixphotons,
+ 0, 1000, 10, 10, "Number of photons to mix");
+ uiDefButS(block,TOG|BIT|0, B_REDR, "Tune Photons",170,10,140,20, &G.scene->r.GIdirect,
+ 0, 0, 0, 0, "Show the photonmap directly in the render for tuning");
+ }
}
}
}
diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c
index 31448a754cd..e1cf35cbb63 100644
--- a/source/blender/src/buttons_shading.c
+++ b/source/blender/src/buttons_shading.c
@@ -2295,8 +2295,11 @@ static void lamp_panel_yafray(Object *ob, Lamp *la)
/* in yafray the regular lamp can use shadowbuffers (softlight), used by spot with halo as well */
/* to prevent clash with blender shadowbuf flag, a special flag is used for yafray */
- if (la->type==LA_LOCAL)
+ if (la->type==LA_LOCAL) {
uiDefButS(block, TOG|BIT|14, B_SHADBUF, "Buf.Shadow",10,160,80,19,&la->mode, 0, 0, 0, 0, "Lets light produce shadows using shadow buffer");
+ uiDefButF(block, NUM, B_DIFF, "GlowInt:", 100,155,200,19, &la->YF_glowint, 0.0, 1.0, 1, 0, "Sets light glow intensity, 0 is off");
+ uiDefButS(block, NUM, B_DIFF, "GlowType:", 100,135,200,19, &la->YF_glowtype, 0, 1, 1, 0, "Sets light glow type");
+ }
/* shadowbuffers used only for 'softlight' & spotlight with halo */
if (((la->type==LA_LOCAL) && (la->mode & LA_YF_SOFT)) || ((la->type==LA_SPOT) && (la->mode & LA_HALO))) {
@@ -2453,7 +2456,62 @@ void do_matbuts(unsigned short event)
Material *ma;
MTex *mtex;
- switch(event) {
+ switch(event) {
+ case B_MAT_YF_PRESET: {
+ ma = G.buts->lockpoin;
+ switch (ma->YF_preset) {
+ case 0:
+ /* normal mode, no reflection/refraction */
+ ma->alpha = 1;
+ ma->mode &= ~(MA_RAYMIRROR+MA_RAYTRANSP+MA_ZTRA);
+ break;
+ case 1: {
+ /* clear glass */
+ ma->alpha = 0.001;
+ ma->ray_mirror = 1;
+ ma->fresnel_mir_i = 5;
+ ma->mode |= (MA_RAYMIRROR+MA_RAYTRANSP);
+ ma->mode &= ~MA_ZTRA;
+ ma->filter = 0;
+ ma->ang = 1.5;
+ break;
+ }
+ case 2: {
+ /* color glass */
+ ma->alpha = 0.001;
+ ma->ray_mirror = 1;
+ ma->fresnel_mir_i = 5;
+ ma->mode |= (MA_RAYMIRROR+MA_RAYTRANSP);
+ ma->mode &= ~MA_ZTRA;
+ ma->filter = 1;
+ ma->ang = 1.5;
+ break;
+ }
+ case 3: {
+ /* uniform reflect */
+ ma->alpha = 1;
+ ma->ray_mirror = 1;
+ ma->fresnel_mir_i = 1;
+ ma->mode |= MA_RAYMIRROR;
+ ma->mode &= ~(MA_RAYTRANSP+MA_ZTRA);
+ break;
+ }
+ case 4: {
+ /* fresnel reflect */
+ ma->alpha = 1;
+ ma->ray_mirror = 1;
+ ma->fresnel_mir_i = 5;
+ ma->mode |= MA_RAYMIRROR;
+ ma->mode &= ~(MA_RAYTRANSP+MA_ZTRA);
+ ma->ang = 3;
+ break;
+ }
+ }
+ BIF_preview_changed(G.buts);
+ allqueue(REDRAWBUTSSHADING, 0);
+ shade_buttons_change_3d();
+ break;
+ }
case B_ACTCOL:
scrarea_queue_headredraw(curarea);
allqueue(REDRAWBUTSSHADING, 0);
@@ -2833,6 +2891,55 @@ static void material_panel_tramir(Material *ma)
}
+
+/* yafray: adapted version of Blender's tramir panel.
+ * Only removed the buttons not needed, so only the ones that are important for yafray are left.
+ * Also re-arranged buttons for more room for extra parameters.
+ * With the exception of the material preset menu and the new parameters,
+ * most of blender's parameters are re-used without interfering with them.
+ */
+static void material_panel_tramir_yafray(Material *ma)
+{
+ uiBlock *block;
+
+ /* better to use same name as original panel */
+ block= uiNewBlock(&curarea->uiblocks, "material_panel_tramir", UI_EMBOSS, UI_HELV, curarea->win);
+ uiNewPanelTabbed("Shaders", "Material");
+ if(uiNewPanel(curarea, block, "Mirror Transp", "Material", 640, 0, 318, 204)==0) return;
+
+ /* material preset menu */
+ uiDefBut(block, LABEL, 0, "Mat.Preset", 20, 182, 100, 20, 0, 0.0, 0.0, 0, 0, "");
+ char *mstr = "Material presets %t|No Reflect/Transmit %x0|Clear Glass %x1|Color Glass %x2|Uniform Reflect %x3|Fresnel Reflect %x4";
+ uiDefButS(block, MENU, B_MAT_YF_PRESET, mstr, 110, 182, 200, 20, &ma->YF_preset, 0.0, 0.0, 0, 0, "Quick material presets to start with");
+
+ uiDefButI(block, TOG|BIT|18, B_MATPRV,"Ray Mirror", 10,160,100,20, &(ma->mode), 0, 0, 0, 0, "Enables raytracing for mirror reflection rendering");
+ uiDefButI(block, TOG|BIT|17, B_MATRAYTRANSP,"Ray Transp", 110,160,100,20, &(ma->mode), 0, 0, 0, 0, "Enables raytracing for transparency rendering");
+ uiDefButI(block, TOG|BIT|6, B_MATZTRANSP,"ZTransp", 210,160,100,20, &(ma->mode), 0, 0, 0, 0, "Use for objects with alphamap textures");
+
+ uiDefButF(block, NUMSLI, B_MATPRV, "rayMir ", 10,140,150,20, &(ma->ray_mirror), 0.0, 1.0, 100, 2, "Sets the amount mirror reflection for raytrace");
+ uiDefButF(block, NUMSLI, B_MATPRV, "frsOfs ", 160,140,150,20, &(ma->fresnel_mir_i), 1.0, 5.0, 10, 2, "Fresnel offset, 1 is uniform mirror, 5 is fresnel mirror (IOR>1)");
+
+ /* ior has extended range up to 30, for use with total fresnel reflection */
+ uiDefButF(block, NUMSLI, B_MATPRV, "IOR ", 10,110,150,20, &(ma->ang), 1.0, 30.0, 100, 2, "Sets the angular index of refraction for raytrace");
+ if(ma->mode & MA_RAYTRANSP)
+ uiDefButF(block, NUM, B_MATPRV, "Filt:", 160,110,150,20, &(ma->filter), 0.0, 1.0, 10, 0, "Amount of filtering for transparent raytrace");
+
+ /* extinction color */
+ uiDefBut(block, LABEL, 0, "Ext.Color", 10, 80, 150, 19, 0, 0.0, 0.0, 0, 0, "");
+ uiDefButF(block, COL, B_MATPRV_DRAW, "", 10, 20, 30, 58, &ma->YF_er, 0, 0, 0, B_MATCOL, "transmit extinction color, black is no extinction");
+ uiDefButF(block, NUMSLI, B_MATPRV, "eR ", 40, 60, 120, 18, &ma->YF_er, 0.0, 1.0, B_MATCOL, 0, "");
+ uiDefButF(block, NUMSLI, B_MATPRV, "eG ", 40, 40, 120, 18, &ma->YF_eg, 0.0, 1.0, B_MATCOL, 0, "");
+ uiDefButF(block, NUMSLI, B_MATPRV, "eB ", 40, 20, 120, 18, &ma->YF_eb, 0.0, 1.0, B_MATCOL, 0, "");
+
+ /* disperions parameters */
+ uiDefBut(block, LABEL, 0, "Dispersion", 160, 80, 150, 18, 0, 0.0, 0.0, 0, 0, "");
+ uiDefButF(block, NUM, B_MATPRV, "Pwr ", 160, 60, 150, 18, &ma->YF_dpwr, 0.0, 1.0, 0.25, 0, "Dispersion power, the higher, the more dispersion, 0 is no dispersion");
+ uiDefButS(block, NUM, B_MATPRV, "Samples ", 160, 40, 150, 18, &ma->YF_dsmp, 1.0, 100.0, 0, 0, "Dispersion samples, minimum at least 10, unless using jitter ");
+ uiDefButS(block, TOG|BIT|0, B_MATPRV, "Jitter", 160, 20, 150, 18, &ma->YF_djit, 0.0, 1.0, 0, 0, "Enable jittering of wavelenghts, adds noise");
+
+}
+
+
static void material_panel_shading(Material *ma)
{
uiBlock *block;
@@ -3153,7 +3260,10 @@ void material_panels()
if(ma) {
material_panel_ramps(ma);
material_panel_shading(ma);
- material_panel_tramir(ma);
+ if (G.scene->r.renderer==R_INTERN)
+ material_panel_tramir(ma);
+ else
+ material_panel_tramir_yafray(ma);
material_panel_texture(ma);
mtex= ma->mtex[ ma->texact ];
diff --git a/source/blender/yafray/intern/export_File.cpp b/source/blender/yafray/intern/export_File.cpp
index 90e05e627c5..9badc0c5eff 100755
--- a/source/blender/yafray/intern/export_File.cpp
+++ b/source/blender/yafray/intern/export_File.cpp
@@ -213,9 +213,8 @@ bool yafrayFileRender_t::writeRender()
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\"\n";
- else if ((R.r.mode & R_OSA) && (R.r.osa)) {
+ // removed the default AA settings for midquality GI, better leave it to user
+ 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 << "\"\n";
@@ -224,19 +223,20 @@ bool yafrayFileRender_t::writeRender()
ostr << "\tAA_pixelwidth=\"1.5\" AA_threshold=\"0.05\" bias=\"" << R.r.YF_raybias << "\"\n";
}
- if (hasworld) {
- World *world = G.scene->world;
- if (world->mode & WO_MIST) {
- ostr << "\tfog_density=\"" << world->mistdist << "\" ";
- ostr << "fog_color r=\"" << world->horr << "\" g=\"" << world->horg << "\" b=\"" << world->horb << "\"\n";
- }
- ostr << "\tbackground_name=\"world_background\"\n";
- }
+ World *world = G.scene->world;
+ if (world) ostr << "\tbackground_name=\"world_background\"\n";
// alpha channel render when RGBA button enabled
if (R.r.planes==R_PLANES32) ostr << "\n\tsave_alpha=\"on\"";
ostr << " >\n";
+ // basic fog
+ if (world && (world->mode & WO_MIST)) {
+ float fd = world->mistdist;
+ if (fd>0) fd=1.f/fd; else fd=1;
+ ostr << "\t<fog_density value=\"" << fd << "\" />\n";
+ ostr << "\t<fog_color r=\"" << world->horr << "\" g=\"" << world->horg << "\" b=\"" << world->horb << "\" />\n";
+ }
ostr << "\t<outfile value=\"" << imgout << "\" />\n";
ostr << "</render>\n\n";
@@ -659,8 +659,7 @@ void yafrayFileRender_t::writeShader(const string &shader_name, Material* matr,
ostr.str("");
ostr << "<shader type=\"blendershader\" name=\"" << shader_name << "\" >\n";
ostr << "\t<attributes>\n";
- float diff = 1; //matr->alpha;
- ostr << "\t\t<color r=\"" << matr->r*diff << "\" g=\"" << matr->g*diff << "\" b=\"" << matr->b*diff << "\" />\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";
ostr << "\t\t<mirror_color r=\"" << matr->mirr << "\" g=\"" << matr->mirg << "\" b=\"" << matr->mirb << "\" />\n";
ostr << "\t\t<diffuse_reflect value=\"" << matr->ref << "\" />\n";
@@ -674,8 +673,6 @@ void yafrayFileRender_t::writeShader(const string &shader_name, Material* matr,
if ( (matr->mode & MA_RAYMIRROR) || (matr->mode & MA_RAYTRANSP) )
ostr << "\t\t<IOR value=\"" << matr->ang << "\" />\n";
if (matr->mode & MA_RAYMIRROR) {
- // blender uses mir color for reflection as well
- //ostr << "\t\t<reflected r=\"" << matr->mirr << "\" g=\"" << matr->mirg << "\" b=\"" << matr->mirb << "\" />\n";
// Sofar yafray's min_refle parameter (which misleadingly actually controls fresnel reflection offset)
// has been mapped to Blender's ray_mirror parameter.
// This causes it be be misinterpreted and misused as a reflection amount control however.
@@ -686,11 +683,15 @@ void yafrayFileRender_t::writeShader(const string &shader_name, Material* matr,
ostr << "\t\t<reflect_amount value=\""<< matr->ray_mirror << "\" />\n";
float fo = 1.f-(matr->fresnel_mir_i-1.f)*0.25f; // blender param range [1,5], also here reversed (1 in Blender -> no fresnel)
ostr << "\t\t<fresnel_offset value=\""<< fo << "\" />\n";
+ // transmit extinction color
+ ostr << "\t\t<extinction r=\"" << matr->YF_er << "\" g=\"" << matr->YF_eg << "\" b=\"" << matr->YF_eb << "\" />\n";
+ // dispersion
+ ostr << "\t\t<dispersion_power value=\"" << matr->YF_dpwr << "\" />\n";
+ ostr << "\t\t<dispersion_samples value=\"" << matr->YF_dsmp << "\" />\n";
+ ostr << "\t\t<dispersion_jitter value=\"" << (matr->YF_djit ? "on" : "off") << "\" />\n";
}
if (matr->mode & MA_RAYTRANSP)
{
- //float tr=1.0-matr->alpha;
- //ostr << "\t\t<transmitted r=\"" << matr->r*tr << "\" g=\"" << matr->g*tr << "\" b=\"" << matr->b*tr << "\" />\n";
ostr << "\t\t<refract value=\"on\" />\n";
ostr << "\t\t<transmit_filter value=\"" << matr->filter << "\" />\n";
// tir on by default
@@ -1040,6 +1041,14 @@ void yafrayFileRender_t::writeMaterialsAndModulators()
ostr << "\t\t<clipping value=\"clip\" />\n";
else if (tex->extend==TEX_CLIPCUBE)
ostr << "\t\t<clipping value=\"clipcube\" />\n";
+ else if (tex->extend==TEX_CHECKER) {
+ ostr << "\t\t<clipping value=\"checker\" />\n";
+ string ts = "";
+ if (tex->flag & TEX_CHECKER_ODD) ts += "odd";
+ if (tex->flag & TEX_CHECKER_EVEN) ts += " even";
+ ostr << "\t\t<checker_mode value=\"" << ts << "\" />\n";
+ ostr << "\t\t<checker_dist value=\"" << tex->checkerdist << "\" />\n";
+ }
else
ostr << "\t\t<clipping value=\"repeat\" />\n";
@@ -1509,6 +1518,7 @@ void yafrayFileRender_t::writeLamps()
is_sphereL = true;
}
else ostr << "pointlight";
+ ostr << "\" glow_intensity=\"" << lamp->YF_glowint << "\" glow_type=\"" << lamp->YF_glowtype << "\"";
}
else if (lamp->type==LA_SPOT)
ostr << "spotlight";
@@ -1523,7 +1533,7 @@ void yafrayFileRender_t::writeLamps()
}
//no name available here, create one
- ostr << "\" name=\"LAMP" << i+1;
+ ostr << " name=\"LAMP" << i+1;
// color already premultiplied by energy, so only need distance here
float pwr = 1; // default for sun/hemi, distance irrelevant
if ((lamp->type!=LA_SUN) && (lamp->type!=LA_HEMI)) {
@@ -1709,16 +1719,58 @@ void yafrayFileRender_t::writeCamera()
void yafrayFileRender_t::writeHemilight()
{
+ World *world = G.scene->world;
+ bool fromAO = false;
+ if (R.r.GIquality==6){
+ // use Blender AO params is possible
+ if (world==NULL) return;
+ if ((world->mode & WO_AMB_OCC)==0) {
+ // no AO, use default GIquality
+ cout << "No ambient occlusion enabled\nUsing defaults of 25 samples & infinite distance instead" << endl;
+ }
+ else fromAO = true;
+ }
ostr.str("");
- ostr << "<light type=\"hemilight\" name=\"hemi_LT\" power=\"" << R.r.GIpower << "\"";
- switch (R.r.GIquality)
- {
- case 1 :
- case 2 : ostr << " samples=\"16\" >\n"; break;
- case 3 : ostr << " samples=\"36\" >\n"; break;
- case 4 : ostr << " samples=\"64\" >\n"; break;
- case 5 : ostr << " samples=\"128\" >\n"; break;
- default: ostr << " samples=\"25\" >\n";
+ if (R.r.GIcache) {
+ ostr << "<light type=\"pathlight\" name=\"path_LT\" power=\"" << R.r.GIpower << "\" mode=\"occlusion\"";
+ ostr << "\n\tcache=\"on\" use_QMC=\"on\" threshold=\"" << R.r.GIrefinement << "\" "
+ << "cache_size=\"" << ((2.0/float(R.r.xsch))*R.r.GIpixelspersample) << "\"";
+ ostr << "\n\tshadow_threshold=\"" << (1.0-R.r.GIshadowquality) << "\" grid=\"82\" search=\"35\"";
+ ostr << "\n\tignore_bumpnormals=\"" << (R.r.YF_nobump ? "on" : "off") << "\"";
+ if (fromAO) {
+ // for AO, with cache, using range of 32*1 to 32*16 seems good enough
+ ostr << "\n\tsamples=\"" << 32*world->aosamp << "\" maxdistance=\"" << world->aodist << "\" >\n";
+ }
+ else {
+ switch (R.r.GIquality)
+ {
+ case 1 : ostr << " samples=\"128\" >\n"; break;
+ case 2 : ostr << " samples=\"256\" >\n"; break;
+ case 3 : ostr << " samples=\"512\" >\n"; break;
+ case 4 : ostr << " samples=\"1024\" >\n"; break;
+ case 5 : ostr << " samples=\"2048\" >\n"; break;
+ default: ostr << " samples=\"256\" >\n";
+ }
+ }
+ }
+ else {
+ ostr << "<light type=\"hemilight\" name=\"hemi_LT\" power=\"" << R.r.GIpower << "\"";
+ if (fromAO) {
+ ostr << "\n\tsamples=\"" << world->aosamp*world->aosamp
+ << "\" maxdistance=\"" << world->aodist
+ << "\" use_QMC=\"" << ((world->aomode & WO_AORNDSMP) ? "off" : "on") << "\" >\n";
+ }
+ else {
+ switch (R.r.GIquality)
+ {
+ case 1 :
+ case 2 : ostr << " samples=\"16\" >\n"; break;
+ case 3 : ostr << " samples=\"36\" >\n"; break;
+ case 4 : ostr << " samples=\"64\" >\n"; break;
+ case 5 : ostr << " samples=\"128\" >\n"; break;
+ default: ostr << " samples=\"25\" >\n";
+ }
+ }
}
ostr << "</light>\n\n";
xmlfile << ostr.str();
@@ -1729,15 +1781,15 @@ void yafrayFileRender_t::writePathlight()
ostr.str("");
if (R.r.GIphotons)
{
- ostr << "<light type=\"globalphotonlight\" name=\"gpm\" photons=\""<<R.r.GIphotoncount<<"\""<<endl;
- ostr << "\tradius=\"" <<R.r.GIphotonradius << "\" depth=\""<< ((R.r.GIdepth>2) ? (R.r.GIdepth-1) : 1)
- << "\" caus_depth=\""<<R.r.GIcausdepth<< "\" search=\""<< R.r.GImixphotons<<"\" >"<<endl;
+ ostr << "<light type=\"globalphotonlight\" name=\"gpm\" photons=\"" << R.r.GIphotoncount << "\"" << endl;
+ ostr << "\tradius=\"" << R.r.GIphotonradius << "\" depth=\"" << ((R.r.GIdepth>2) ? (R.r.GIdepth-1) : 1)
+ << "\" caus_depth=\"" << R.r.GIcausdepth << "\" search=\"" << R.r.GImixphotons << "\" >"<<endl;
ostr << "</light>"<<endl;
}
ostr << "<light type=\"pathlight\" name=\"path_LT\" power=\"" << R.r.GIindirpower << "\"";
ostr << " depth=\"" << ((R.r.GIphotons) ? 1 : R.r.GIdepth) << "\" caus_depth=\"" << R.r.GIcausdepth <<"\"\n";
- if(R.r.GIdirect && R.r.GIphotons) ostr << "direct=\"on\"" << endl;
- if (R.r.GIcache && ! (R.r.GIdirect && R.r.GIphotons))
+ if (R.r.GIdirect && R.r.GIphotons) ostr << "direct=\"on\"" << endl;
+ if (R.r.GIcache && !(R.r.GIdirect && R.r.GIphotons))
{
switch (R.r.GIquality)
{
@@ -1748,10 +1800,11 @@ void yafrayFileRender_t::writePathlight()
case 5 : ostr << " samples=\"2048\" \n"; break;
default: ostr << " samples=\"512\" \n";
}
- float sbase = 2.0/float(R.r.xsch);
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";
+ ostr << "\tignore_bumpnormals=\"" << (R.r.YF_nobump ? "on" : "off") << "\"\n";
+ float sbase = 2.0/float(R.r.xsch);
+ ostr << "\tcache_size=\"" << sbase*R.r.GIpixelspersample << "\" shadow_threshold=\"" <<
+ 1.0-R.r.GIshadowquality << "\" grid=\"82\" search=\"35\" >\n";
}
else
{
@@ -1792,8 +1845,7 @@ bool yafrayFileRender_t::writeWorld()
if (BLI_testextensie(wimg->name, ".hdr")) {
ostr.str("");
ostr << "<background type=\"image\" name=\"world_background\" ";
- // since exposure adjust is an integer, using the texbri slider isn't actually very useful here (result either -1/0/1)
- // GIpower could be used, but is only active for GI
+ // exposure_adjust not restricted to integer range anymore
ostr << "exposure_adjust=\"" << wtex->tex->bright-1.f << "\" mapping=\"probe\" >\n";
ostr << "\t<filename value=\"" << wt_path << "\" />\n";
ostr << "\t<interpolate value=\"" << ((wtex->tex->imaflag & TEX_INTERPOL) ? "bilinear" : "none") << "\" />\n";
diff --git a/source/blender/yafray/intern/export_Plugin.cpp b/source/blender/yafray/intern/export_Plugin.cpp
index 63a02ffe087..9b4dc856f2f 100644
--- a/source/blender/yafray/intern/export_Plugin.cpp
+++ b/source/blender/yafray/intern/export_Plugin.cpp
@@ -220,12 +220,8 @@ bool yafrayPluginRender_t::writeRender()
}
else
{
- if ((R.r.GImethod!=0) && (R.r.GIquality>1) && (!R.r.GIcache))
- {
- params["AA_passes"] = yafray::parameter_t(5);
- params["AA_minsamples"] = yafray::parameter_t(5);
- }
- else if ((R.r.mode & R_OSA) && (R.r.osa))
+ // removed the default AA settings for midquality GI, better leave it to user
+ if ((R.r.mode & R_OSA) && (R.r.osa))
{
params["AA_passes"] = yafray::parameter_t((R.r.osa%4)==0 ? R.r.osa/4 : 1);
params["AA_minsamples"] = yafray::parameter_t((R.r.osa%4)==0 ? 4 : R.r.osa);
@@ -248,7 +244,10 @@ bool yafrayPluginRender_t::writeRender()
if (hasworld) {
World *world = G.scene->world;
if (world->mode & WO_MIST) {
- params["fog_density"] = yafray::parameter_t(world->mistdist);
+ // basic fog
+ float fd = world->mistdist;
+ if (fd>0) fd=1.f/fd; else fd=1;
+ params["fog_density"] = yafray::parameter_t(fd);
params["fog_color"] = yafray::parameter_t(yafray::color_t(world->horr, world->horg, world->horb));
}
params["background_name"] = yafray::parameter_t("world_background");
@@ -653,8 +652,7 @@ void yafrayPluginRender_t::writeShader(const string &shader_name, Material* matr
params["type"] = yafray::parameter_t("blendershader");
params["name"] = yafray::parameter_t(shader_name);
- float diff = 1; //matr->alpha;
- params["color"] = yafray::parameter_t(yafray::color_t(matr->r*diff, matr->g*diff, matr->b*diff));
+ 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));
params["mirror_color"] = yafray::parameter_t(yafray::color_t(matr->mirr, matr->mirg, matr->mirb));
params["diffuse_reflect"] = yafray::parameter_t(matr->ref);
@@ -670,24 +668,25 @@ void yafrayPluginRender_t::writeShader(const string &shader_name, Material* matr
params["IOR"] = yafray::parameter_t(matr->ang);
if (matr->mode & MA_RAYMIRROR)
{
- // blender uses mir color for reflection as well
- //params["reflected"] = yafray::parameter_t(yafray::color_t(matr->mirr, matr->mirg, matr->mirb));
// Sofar yafray's min_refle parameter (which misleadingly actually controls fresnel reflection offset)
// has been mapped to Blender's ray_mirror parameter.
// This causes it be be misinterpreted and misused as a reflection amount control however.
// Besides that, it also causes extra complications for the yafray Blendershader.
// So added an actual amount of reflection parameter instead, and another
- // extra parameter to actually control fresnel offset (re-uses Blender fresnel_mir_i param)
- // Hopefully that clears things up a bit...
+ // extra parameter 'frsOfs' to actually control fresnel offset (re-uses Blender fresnel_mir_i param).
params["reflect"] = yafray::parameter_t("on");
params["reflect_amount"] = yafray::parameter_t(matr->ray_mirror);
float fo = 1.f-(matr->fresnel_mir_i-1.f)*0.25f; // blender param range [1,5], also here reversed (1 in Blender -> no fresnel)
params["fresnel_offset"] = yafray::parameter_t(fo);
+ // transmit extinction color
+ params["extinction"] = yafray::parameter_t(yafray::color_t(matr->YF_er, matr->YF_eg, matr->YF_eb));
+ // dispersion
+ params["dispersion_power"] = yafray::parameter_t(matr->YF_dpwr);
+ params["dispersion_samples"] = yafray::parameter_t(matr->YF_dsmp);
+ params["dispersion_jitter"] = yafray::parameter_t(matr->YF_djit ? "on" : "off");
}
if (matr->mode & MA_RAYTRANSP)
{
- //float tr = 1.0-matr->alpha;
- //params["transmitted"]=yafray::parameter_t(yafray::color_t(matr->r*tr, matr->g*tr, matr->b*tr));
params["refract"] = yafray::parameter_t("on");
params["transmit_filter"] = yafray::parameter_t(matr->filter);
// tir on by default
@@ -797,17 +796,10 @@ void yafrayPluginRender_t::writeShader(const string &shader_name, Material* matr
mparams["input"] = yafray::parameter_t(string(matr->id.name) + string(temp));
else
mparams["input"] = yafray::parameter_t(shader_name + temp);
- // blendtype
- string ts = "mix";
- if (mtex->blendtype==MTEX_MUL) ts="mul";
- else if (mtex->blendtype==MTEX_ADD) ts="add";
- else if (mtex->blendtype==MTEX_SUB) ts="sub";
- else if (mtex->blendtype==MTEX_DIV) ts="divide";
- else if (mtex->blendtype==MTEX_DARK) ts="darken";
- else if (mtex->blendtype==MTEX_DIFF) ts="difference";
- else if (mtex->blendtype==MTEX_LIGHT) ts="lighten";
- else if (mtex->blendtype==MTEX_SCREEN) ts="screen";
- mparams["mode"] = yafray::parameter_t(ts);
+
+ // blendtype, would have been nice if the order would have been the same as for ramps...
+ const string blendtype[9] = {"mix", "mul", "add", "sub", "divide", "darken", "difference", "lighten", "screen"};
+ mparams["mode"] = yafray::parameter_t(blendtype[(int)mtex->blendtype]);
// texture color (for use with MUL and/or no_rgb etc..)
mparams["texcol"]=yafray::parameter_t(yafray::color_t(mtex->r,mtex->g,mtex->b));
@@ -887,6 +879,7 @@ void yafrayPluginRender_t::writeShader(const string &shader_name, Material* matr
}
// texture flag, combination of strings
+ string ts;
if (mtex->texflag & (MTEX_RGBTOINT | MTEX_STENCIL | MTEX_NEGATIVE)) {
ts = "";
if (mtex->texflag & MTEX_RGBTOINT) ts += "no_rgb ";
@@ -1038,6 +1031,14 @@ void yafrayPluginRender_t::writeMaterialsAndModulators()
params["clipping"] = yafray::parameter_t("clip");
else if (tex->extend==TEX_CLIPCUBE)
params["clipping"] = yafray::parameter_t("clipcube");
+ else if (tex->extend==TEX_CHECKER) {
+ params["clipping"] = yafray::parameter_t("checker");
+ string ts = "";
+ if (tex->flag & TEX_CHECKER_ODD) ts += "odd";
+ if (tex->flag & TEX_CHECKER_EVEN) ts += " even";
+ params["checker_mode"] = yafray::parameter_t(ts);
+ params["checker_dist"] = yafray::parameter_t(tex->checkerdist);
+ }
else
params["clipping"] = yafray::parameter_t("repeat");
@@ -1498,6 +1499,8 @@ void yafrayPluginRender_t::writeLamps()
is_sphereL = true;
}
else params["type"] = yafray::parameter_t("pointlight");
+ params["glow_intensity"] = yafray::parameter_t(lamp->YF_glowint);
+ params["glow_type"] = yafray::parameter_t(lamp->YF_glowtype);
}
else if (lamp->type==LA_SPOT)
params["type"] = yafray::parameter_t("spotlight");
@@ -1517,7 +1520,7 @@ void yafrayPluginRender_t::writeLamps()
params["name"] = yafray::parameter_t(temp);
// color already premultiplied by energy, so only need distance here
- float pwr = 1;
+ float pwr = 1; // default for sun/hemi, distance irrelevant
if ((lamp->type!=LA_SUN) && (lamp->type!=LA_HEMI)) {
if (lamp->mode & LA_SPHERE) {
// best approx. as used in LFexport script (LF d.f.m. 4pi?)
@@ -1698,34 +1701,70 @@ void yafrayPluginRender_t::writeCamera()
void yafrayPluginRender_t::writeHemilight()
{
- // updated to use Blender AO params
- World *world = G.scene->world;
- if (world==NULL) return;
- yafray::paramMap_t params;
- params["type"] = yafray::parameter_t("hemilight");
- params["name"] = yafray::parameter_t("hemi_LT");
- params["power"] = yafray::parameter_t(R.r.GIpower);
- params["samples"] = yafray::parameter_t(world->aosamp*world->aosamp);
- params["maxdistance"] = yafray::parameter_t(world->aodist);
- params["use_QMC"] = yafray::parameter_t((world->aomode & WO_AORNDSMP) ? "off" : "on");
- yafrayGate->addLight(params);
-
- /*
yafray::paramMap_t params;
- params["type"] = yafray::parameter_t("hemilight");
- params["name"] = yafray::parameter_t("hemi_LT");
- params["power"] = yafray::parameter_t(R.r.GIpower);
- switch (R.r.GIquality)
- {
- case 1 :
- case 2 : params["samples"]=yafray::parameter_t(16); break;
- case 3 : params["samples"]=yafray::parameter_t(36); break;
- case 4 : params["samples"]=yafray::parameter_t(64); break;
- case 5 : params["samples"]=yafray::parameter_t(128); break;
- default: params["samples"]=yafray::parameter_t(25);
+ World *world = G.scene->world;
+ bool fromAO = false;
+ if (R.r.GIquality==6){
+ // use Blender AO params is possible
+ if (world==NULL) return;
+ if ((world->mode & WO_AMB_OCC)==0) {
+ // no AO, use default GIquality
+ cout << "[Warning]: Can't use AO parameters\nNo ambient occlusion enabled, using default values instead" << endl;
+ }
+ else fromAO = true;
+ }
+ if (R.r.GIcache) {
+ params["type"] = yafray::parameter_t("pathlight");
+ params["name"] = yafray::parameter_t("path_LT");
+ params["power"] = yafray::parameter_t(R.r.GIpower);
+ params["mode"] = yafray::parameter_t("occlusion");
+ params["ignore_bumpnormals"] = yafray::parameter_t(R.r.YF_nobump ? "on" : "off");
+ if (fromAO) {
+ // for AO, with cache, using range of 32*1 to 32*16 seems good enough
+ params["samples"] = yafray::parameter_t(32*world->aosamp);
+ params["maxdistance"] = yafray::parameter_t(world->aodist);
+ }
+ else {
+ switch (R.r.GIquality)
+ {
+ case 1 : params["samples"] = yafray::parameter_t(128); break;
+ case 2 : params["samples"] = yafray::parameter_t(256); break;
+ case 3 : params["samples"] = yafray::parameter_t(512); break;
+ case 4 : params["samples"] = yafray::parameter_t(1024); break;
+ case 5 : params["samples"] = yafray::parameter_t(2048); break;
+ default: params["samples"] = yafray::parameter_t(256);
+ }
+ }
+ params["cache"] = yafray::parameter_t("on");
+ params["use_QMC"] = yafray::parameter_t("on");
+ params["threshold"] = yafray::parameter_t(R.r.GIrefinement);
+ params["cache_size"] = yafray::parameter_t((2.0/float(R.r.xsch))*R.r.GIpixelspersample);
+ params["shadow_threshold"] = yafray::parameter_t(1.0 - R.r.GIshadowquality);
+ params["grid"] = yafray::parameter_t(82);
+ params["search"] = yafray::parameter_t(35);
+ }
+ else {
+ params["type"] = yafray::parameter_t("hemilight");
+ params["name"] = yafray::parameter_t("hemi_LT");
+ params["power"] = yafray::parameter_t(R.r.GIpower);
+ if (fromAO) {
+ params["samples"] = yafray::parameter_t(world->aosamp*world->aosamp);
+ params["maxdistance"] = yafray::parameter_t(world->aodist);
+ params["use_QMC"] = yafray::parameter_t((world->aomode & WO_AORNDSMP) ? "off" : "on");
+ }
+ else {
+ switch (R.r.GIquality)
+ {
+ case 1 :
+ case 2 : params["samples"]=yafray::parameter_t(16); break;
+ case 3 : params["samples"]=yafray::parameter_t(36); break;
+ case 4 : params["samples"]=yafray::parameter_t(64); break;
+ case 5 : params["samples"]=yafray::parameter_t(128); break;
+ default: params["samples"]=yafray::parameter_t(25);
+ }
+ }
}
yafrayGate->addLight(params);
- */
}
void yafrayPluginRender_t::writePathlight()
@@ -1733,54 +1772,52 @@ void yafrayPluginRender_t::writePathlight()
if (R.r.GIphotons)
{
yafray::paramMap_t params;
- params["type"]=yafray::parameter_t("globalphotonlight");
- params["name"]=yafray::parameter_t("gpm");
- params["photons"]=yafray::parameter_t(R.r.GIphotoncount);
- params["radius"]=yafray::parameter_t(R.r.GIphotonradius);
- params["depth"]=yafray::parameter_t(((R.r.GIdepth>2) ? (R.r.GIdepth-1) : 1));
- params["caus_depth"]=yafray::parameter_t(R.r.GIcausdepth);
- params["search"]=yafray::parameter_t(R.r.GImixphotons);
+ params["type"] = yafray::parameter_t("globalphotonlight");
+ params["name"] = yafray::parameter_t("gpm");
+ params["photons"] = yafray::parameter_t(R.r.GIphotoncount);
+ params["radius"] = yafray::parameter_t(R.r.GIphotonradius);
+ params["depth"] = yafray::parameter_t(((R.r.GIdepth>2) ? (R.r.GIdepth-1) : 1));
+ params["caus_depth"] = yafray::parameter_t(R.r.GIcausdepth);
+ params["search"] = yafray::parameter_t(R.r.GImixphotons);
yafrayGate->addLight(params);
}
yafray::paramMap_t params;
- params["type"]=yafray::parameter_t("pathlight");
- params["name"]=yafray::parameter_t("path_LT");
- params["power"]=yafray::parameter_t(R.r.GIindirpower);
- params["depth"]=yafray::parameter_t(((R.r.GIphotons) ? 1 : R.r.GIdepth));
- params["caus_depth"]=yafray::parameter_t(R.r.GIcausdepth);
- if(R.r.GIdirect && R.r.GIphotons) params["direct"]=yafray::parameter_t("on");
- if (R.r.GIcache && ! (R.r.GIdirect && R.r.GIphotons))
+ params["type"] = yafray::parameter_t("pathlight");
+ params["name"] = yafray::parameter_t("path_LT");
+ params["power"] = yafray::parameter_t(R.r.GIindirpower);
+ params["depth"] = yafray::parameter_t(((R.r.GIphotons) ? 1 : R.r.GIdepth));
+ params["caus_depth"] = yafray::parameter_t(R.r.GIcausdepth);
+ if (R.r.GIdirect && R.r.GIphotons) params["direct"] = yafray::parameter_t("on");
+ if (R.r.GIcache && !(R.r.GIdirect && R.r.GIphotons))
{
switch (R.r.GIquality)
{
- case 1 : params["samples"]=yafray::parameter_t(128);break;
- case 2 : params["samples"]=yafray::parameter_t(256);break;
- case 3 : params["samples"]=yafray::parameter_t(512);break;
- case 4 : params["samples"]=yafray::parameter_t(1024);break;
- case 5 : params["samples"]=yafray::parameter_t(2048);break;
- default: params["samples"]=yafray::parameter_t(256);
+ case 1 : params["samples"] = yafray::parameter_t(128); break;
+ case 2 : params["samples"] = yafray::parameter_t(256); break;
+ case 3 : params["samples"] = yafray::parameter_t(512); break;
+ case 4 : params["samples"] = yafray::parameter_t(1024); break;
+ case 5 : params["samples"] = yafray::parameter_t(2048); break;
+ default: params["samples"] = yafray::parameter_t(256);
}
- 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);
- params["cache"]=yafray::parameter_t("on");
- params["use_QMC"]=yafray::parameter_t("on");
- params["threshold"]=yafray::parameter_t(R.r.GIrefinement);
- params["cache_size"]=yafray::parameter_t(sbase*R.r.GIpixelspersample);
- params["shadow_threshold"]=yafray::parameter_t(1.0 - R.r.GIshadowquality);
- params["grid"]=yafray::parameter_t(82);
- params["search"]=yafray::parameter_t(35);
+ params["cache"] = yafray::parameter_t("on");
+ params["use_QMC"] = yafray::parameter_t("on");
+ params["threshold"] = yafray::parameter_t(R.r.GIrefinement);
+ params["cache_size"] = yafray::parameter_t((2.0/float(R.r.xsch))*R.r.GIpixelspersample);
+ params["shadow_threshold"] = yafray::parameter_t(1.0 - R.r.GIshadowquality);
+ params["grid"] = yafray::parameter_t(82);
+ params["search"] = yafray::parameter_t(35);
+ params["ignore_bumpnormals"] = yafray::parameter_t(R.r.YF_nobump ? "on" : "off");
}
else
{
switch (R.r.GIquality)
{
- case 1 : params["samples"]=yafray::parameter_t(16);break;
- case 2 : params["samples"]=yafray::parameter_t(36);break;
- case 3 : params["samples"]=yafray::parameter_t(64);break;
- case 4 : params["samples"]=yafray::parameter_t(128);break;
- case 5 : params["samples"]=yafray::parameter_t(256);break;
- default: params["samples"]=yafray::parameter_t(25);break;
+ case 1 : params["samples"] = yafray::parameter_t(16); break;
+ case 2 : params["samples"] = yafray::parameter_t(36); break;
+ case 3 : params["samples"] = yafray::parameter_t(64); break;
+ case 4 : params["samples"] = yafray::parameter_t(128); break;
+ case 5 : params["samples"] = yafray::parameter_t(256); break;
+ default: params["samples"] = yafray::parameter_t(25);
}
}
yafrayGate->addLight(params);
@@ -1796,9 +1833,8 @@ bool yafrayPluginRender_t::writeWorld()
}
else if (R.r.GImethod==2) writePathlight();
}
-
if (world==NULL) return false;
-
+
yafray::paramMap_t params;
for (int i=0;i<MAX_MTEX;i++) {
MTex* wtex = world->mtex[i];
@@ -1810,7 +1846,7 @@ bool yafrayPluginRender_t::writeWorld()
if (BLI_testextensie(wimg->name, ".hdr")) {
params["type"] = yafray::parameter_t("image");
params["name"] = yafray::parameter_t("world_background");
- // since exposure adjust is an integer, using the texbri slider isn't actually very useful here (result either -1/0/1)
+ // exposure_adjust not restricted to integer range anymore
params["exposure_adjust"] = yafray::parameter_t(wtex->tex->bright-1.f);
params["mapping"] = yafray::parameter_t("probe");
params["filename"] = yafray::parameter_t(wt_path);
diff --git a/source/blender/yafray/intern/yafray_Render.cpp b/source/blender/yafray/intern/yafray_Render.cpp
index 00798c17a6a..18a12e14ae4 100644
--- a/source/blender/yafray/intern/yafray_Render.cpp
+++ b/source/blender/yafray/intern/yafray_Render.cpp
@@ -76,6 +76,15 @@ bool yafrayRender_t::getAllMatTexObs()
VlakRen* vlr;
+ // Blender does not include object which have total 0 alpha materials,
+ // however, the objects might have been included in the dupliMtx list,
+ // so this will cause a 'Duplilist non-empty...' error after going through the renderlist.
+ // To solve this, keep track of all render objects included sofar,
+ // and remove from dupliMtx_list if object not found.
+ // This should also help to solve some other yet undetected 'dupli..' errors,
+ // but on the other hand that could also hide the real problem of course...
+ map<string, Object*> renderobs;
+
for (int i=0;i<R.totvlak;i++) {
if ((i & 255)==0) vlr=R.blovl[i>>8]; else vlr++;
@@ -121,6 +130,7 @@ bool yafrayRender_t::getAllMatTexObs()
int nv = 0; // number of vertices
if (vlr->v4) nv=4; else if (vlr->v3) nv=3;
if (nv) {
+ renderobs[vlr->ob->id.name] = vlr->ob;
all_objects[vlr->ob].push_back(vlr);
if (vlr->tface) {
Image* fc_img = (Image*)vlr->tface->tpage;
@@ -135,6 +145,18 @@ bool yafrayRender_t::getAllMatTexObs()
}
+ // now remove any objects from dupliMtx_list which are not in the renderlist
+ for (map<string, vector<float> >::iterator dL=dupliMtx_list.begin();
+ dL!=dupliMtx_list.end();++dL)
+ {
+ string ro_name = dL->first;
+ if (renderobs.find(ro_name)==renderobs.end()) {
+ cout << "Object " << ro_name << " not in renderlist, removing from dupliMtx_list" << endl;
+ dL->second.clear();
+ dupliMtx_list.erase(ro_name);
+ }
+ }
+
// 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()) {