Added nearly full support for Blender's procedural textures, with the exception
of 'envmap', 'magic', and 'plugin' modes.
The stucci texture also is not exact match, since it cannot be fully
emulated in yafray because of implementation issues. It will work best
for low turbulence values (which is actually not taken into account
in the export code).
Also, since Blender's static noise is basically just direct random number
output, don't expect the exact same result when rendered in yafray, but in this
case that probably shouldn't be that much of a problem...
(needs yafray from cvs)
(btw, on a side note, I put this in the comments once when working on the noise
stuff for Blender, but noise is affected by the 'depth' parameter, and there
is no way to control this directly from the GUI, can only be done by temporarily
switching to 'clouds' for instance.)
2004-11-28 02:13:57 +00:00
|
|
|
#include "export_Plugin.h"
|
2004-06-16 18:44:12 +00:00
|
|
|
|
|
|
|
#include <math.h>
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef WIN32
|
2005-03-19 20:19:10 +00:00
|
|
|
#define WIN32_SKIP_HKEY_PROTECTION
|
|
|
|
#include "BLI_winstuff.h"
|
2004-06-16 18:44:12 +00:00
|
|
|
|
|
|
|
#ifndef FILE_MAXDIR
|
|
|
|
#define FILE_MAXDIR 160
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef FILE_MAXFILE
|
|
|
|
#define FILE_MAXFILE 80
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
static string find_path()
|
|
|
|
{
|
|
|
|
HKEY hkey;
|
|
|
|
DWORD dwType, dwSize;
|
|
|
|
|
|
|
|
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,"Software\\YafRay Team\\YafRay",0,KEY_READ,&hkey)==ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
dwType = REG_EXPAND_SZ;
|
|
|
|
dwSize = MAX_PATH;
|
|
|
|
DWORD dwStat;
|
|
|
|
|
|
|
|
char *pInstallDir=new char[MAX_PATH];
|
|
|
|
|
|
|
|
dwStat=RegQueryValueEx(hkey, TEXT("InstallDir"),
|
|
|
|
NULL, NULL,(LPBYTE)pInstallDir, &dwSize);
|
|
|
|
|
|
|
|
if (dwStat == NO_ERROR)
|
|
|
|
{
|
|
|
|
string res=pInstallDir;
|
|
|
|
delete [] pInstallDir;
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
cout << "Couldn't READ \'InstallDir\' value. Is yafray correctly installed?\n";
|
|
|
|
delete [] pInstallDir;
|
|
|
|
|
|
|
|
RegCloseKey(hkey);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
cout << "Couldn't FIND registry key for yafray, is it installed?\n";
|
|
|
|
|
|
|
|
return string("");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static int createDir(char* name)
|
|
|
|
{
|
|
|
|
if (BLI_exists(name))
|
|
|
|
return 2; //exists
|
|
|
|
if (CreateDirectory((LPCTSTR)(name), NULL)) {
|
|
|
|
cout << "Directory: " << name << " created\n";
|
|
|
|
return 1; // created
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
cout << "Could not create directory: " << name << endl;
|
|
|
|
return 0; // fail
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" { extern char bprogname[]; }
|
|
|
|
|
|
|
|
// add drive character if not in path string, using blender executable location as reference
|
|
|
|
static void addDrive(string &path)
|
|
|
|
{
|
|
|
|
int sp = path.find_first_of(":");
|
|
|
|
if (sp==-1) {
|
|
|
|
string blpath = bprogname;
|
|
|
|
sp = blpath.find_first_of(":");
|
|
|
|
if (sp!=-1) path = blpath.substr(0, sp+1) + path;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/wait.h>
|
|
|
|
#include <signal.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static string YafrayPath()
|
|
|
|
{
|
|
|
|
#ifdef WIN32
|
|
|
|
string path=find_path();
|
2004-11-29 05:33:32 +00:00
|
|
|
return path;
|
2004-06-16 18:44:12 +00:00
|
|
|
#else
|
|
|
|
static char *alternative[]=
|
|
|
|
{
|
|
|
|
"/usr/local/lib/",
|
|
|
|
"/usr/lib/",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
for(int i=0;alternative[i]!=NULL;++i)
|
|
|
|
{
|
2004-11-29 05:33:32 +00:00
|
|
|
string fp = string(alternative[i]) + "libyafrayplugin.so";
|
2004-06-16 18:44:12 +00:00
|
|
|
struct stat st;
|
2004-11-29 05:33:32 +00:00
|
|
|
if (stat(fp.c_str(), &st)<0) continue;
|
|
|
|
if (st.st_mode & S_IROTH) return fp;
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
|
|
|
return "";
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static string YafrayPluginPath()
|
|
|
|
{
|
|
|
|
#ifdef WIN32
|
2004-06-21 08:17:05 +00:00
|
|
|
return find_path()+"\\plugins";
|
2004-06-16 18:44:12 +00:00
|
|
|
#else
|
|
|
|
static char *alternative[]=
|
|
|
|
{
|
|
|
|
"/usr/local/lib/yafray",
|
|
|
|
"/usr/lib/yafray",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
for(int i=0;alternative[i]!=NULL;++i)
|
|
|
|
{
|
|
|
|
struct stat st;
|
2004-11-29 05:33:32 +00:00
|
|
|
if (stat(alternative[i], &st)<0) continue;
|
|
|
|
if (S_ISDIR(st.st_mode) && (st.st_mode & S_IXOTH)) return alternative[i];
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
|
|
|
return "";
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
yafrayPluginRender_t::~yafrayPluginRender_t()
|
|
|
|
{
|
2004-11-29 05:33:32 +00:00
|
|
|
if (yafrayGate!=NULL) delete yafrayGate;
|
|
|
|
if (handle!=NULL) PIL_dynlib_close(handle);
|
2004-06-21 08:17:05 +00:00
|
|
|
#ifdef WIN32
|
2004-11-29 05:33:32 +00:00
|
|
|
if (corehandle!=NULL) PIL_dynlib_close(corehandle);
|
2004-06-21 08:17:05 +00:00
|
|
|
#endif
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool yafrayPluginRender_t::initExport()
|
|
|
|
{
|
2004-11-29 05:33:32 +00:00
|
|
|
// bug #1897: when forcing render without yafray present, handle can be valid,
|
|
|
|
// but find_symbol might have failed, trying second time will crash.
|
|
|
|
// So make sure plugin loaded correctly and only get handle once.
|
|
|
|
if ((!plugin_loaded) || (handle==NULL))
|
2004-06-16 18:44:12 +00:00
|
|
|
{
|
2004-11-29 05:33:32 +00:00
|
|
|
string location = YafrayPath();
|
2004-06-21 08:17:05 +00:00
|
|
|
#ifdef WIN32
|
|
|
|
/* Win 32 loader cannot find needed libs in yafray dir, so we have to load them
|
|
|
|
* by hand. This could be fixed using setdlldirectory function, but it is not
|
|
|
|
* available in all win32 versions
|
|
|
|
*/
|
2004-11-29 05:33:32 +00:00
|
|
|
corehandle = PIL_dynlib_open((char *)(location + "\\yafraycore.dll").c_str());
|
|
|
|
if (corehandle==NULL)
|
2004-06-21 08:17:05 +00:00
|
|
|
{
|
2004-11-29 05:33:32 +00:00
|
|
|
cerr << "Error loading yafray plugin: " << PIL_dynlib_get_error_as_string(corehandle) << endl;
|
2004-06-21 08:17:05 +00:00
|
|
|
return false;
|
|
|
|
}
|
2004-11-29 05:33:32 +00:00
|
|
|
location += "\\yafrayplugin.dll";
|
2004-06-21 08:17:05 +00:00
|
|
|
#endif
|
|
|
|
|
2004-11-29 05:33:32 +00:00
|
|
|
if (handle==NULL) {
|
|
|
|
handle = PIL_dynlib_open((char *)location.c_str());
|
|
|
|
if (handle==NULL)
|
|
|
|
{
|
|
|
|
cerr << "Error loading yafray plugin: " << PIL_dynlib_get_error_as_string(handle) << endl;
|
|
|
|
return false;
|
|
|
|
}
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
2004-06-21 08:17:05 +00:00
|
|
|
yafray::yafrayConstructor *constructor;
|
2004-11-29 05:33:32 +00:00
|
|
|
constructor = (yafray::yafrayConstructor *)PIL_dynlib_find_symbol(handle, YAFRAY_SYMBOL);
|
|
|
|
if (constructor==NULL)
|
2004-06-21 08:17:05 +00:00
|
|
|
{
|
2004-11-29 05:33:32 +00:00
|
|
|
cerr << "Error loading yafray plugin: " << PIL_dynlib_get_error_as_string(handle) << endl;
|
2004-06-21 08:17:05 +00:00
|
|
|
return false;
|
|
|
|
}
|
2004-12-22 22:38:06 +00:00
|
|
|
yafrayGate = constructor(R.r.YF_numprocs, YafrayPluginPath());
|
2004-06-21 08:17:05 +00:00
|
|
|
|
2004-11-29 05:33:32 +00:00
|
|
|
cout << "YafRay plugin loaded" << endl;
|
|
|
|
plugin_loaded = true;
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
|
|
|
|
2004-12-30 01:34:42 +00:00
|
|
|
// all buffers allocated in initrender.c
|
|
|
|
unsigned int *bpt=R.rectot, count=R.rectx*R.recty;
|
|
|
|
while (--count) bpt[count] = 0xff800000;
|
|
|
|
cout << "Image initialized" << endl;
|
2004-06-16 18:44:12 +00:00
|
|
|
|
2005-01-07 15:40:57 +00:00
|
|
|
int *zbuf=R.rectz;
|
2004-12-30 01:34:42 +00:00
|
|
|
count = R.rectx*R.recty;
|
|
|
|
while (--count) zbuf[count] = 0x7fffffff;
|
|
|
|
cout << "Zbuffer initialized" << endl;
|
2004-11-18 05:22:18 +00:00
|
|
|
|
2004-12-30 01:34:42 +00:00
|
|
|
// no need to fill ftot
|
|
|
|
|
2004-06-16 18:44:12 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool yafrayPluginRender_t::writeRender()
|
|
|
|
{
|
|
|
|
yafray::paramMap_t params;
|
|
|
|
params["camera_name"]=yafray::parameter_t("MAINCAM");
|
2004-06-27 20:10:20 +00:00
|
|
|
params["raydepth"]=yafray::parameter_t((float)R.r.YF_raydepth);
|
2004-06-16 18:44:12 +00:00
|
|
|
params["gamma"]=yafray::parameter_t(R.r.YF_gamma);
|
|
|
|
params["exposure"]=yafray::parameter_t(R.r.YF_exposure);
|
2004-07-13 19:22:41 +00:00
|
|
|
if (R.r.YF_AA)
|
2004-06-16 18:44:12 +00:00
|
|
|
{
|
2004-07-13 19:22:41 +00:00
|
|
|
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);
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
Second and final commit for this version of the yafray export code (probably, you never know
of course...)
Not quite complete, but due to lack of time as good as it will get for now.
From the previous commit, forgot to report that basic fog is supported as well. Though because I had not much time to complete the code, it is sort of unfinished, and you will have
to tweak parameters specifically for yafray again. It uses only the world horizon color, and
only uses the Blender mist distance setting.
Textures now support checker clip mode.
Fixed possibly all 'duplilist non-empty' errors, though it could hide the real cause of the
error.
AA is no longer enabled automatically for certain GI quality settings, I thought it best to
leave it to the user to decide.
SkyDome GI mode now supports cache as well. There is a new option in the GI quality menu 'Use
Blender AO settings', which will as it says use the most important AO settings for the
skydome parameters. The only AO parameters used are 'Samples', 'Dist' and the random sampling
switch, which unlike in Blender you might want to use more often, since the QMC sampling used
in yafray can result in visible patterns or a dithering type look. 'Random' is not completely
random in yafray however, it is actually jittered (stratified) sampling.
Using an occlusion cache, doesn't necessarily mean that you will always get much shorter
render times. As with 'full' GI and cache, one problem is bumpmaps, when using bump (or
normal) maps, the sampling will be much more dense, using lots more rendertime.
As a temporary fix there is a button 'NoBump', but this also has the side effect that in
areas of total indirect light (or when used with SkyDome cache) no bumpmapping will be
visible. It is therefor best used with some direct light as well.
For SkyDome with cache, and strong bumpmapping it might actually not make much difference,
since for low distance values you can usually get away with low sample values as well.
The entire material panel is now replaced by another panel to show only the parameters
important to yafray and add some new ones as well.
Since lots of users (especially yafray beginners) have had problems getting certain material
aspects right, there is now a material preset menu available to hopefully solve some of the
most common "How do I do this? It doesn't work!" questions seen in various forums.
Choosing an option from this menu will set the required parameters to default
values for yafray, and you can work your way from there to tweak it something you want.
Most buttons are copies of the same Blender parameters, with some variations. Just like
Blender 'Ray Mirror' enables reflection, 'Ray Transp' enables refraction. You can use
'ZTransp' for materials that have texture maps with alpha channels.
Again, same as Blender 'rayMir' sets the amount of reflection. Next button 'frsOfs' however
controls fresnel offset, meaning that when this is set to 1, you will get no fresnel effect
and when set to 5, reflection is totally determined by fresnel, which is important for
realistic glass/metals/etc.
IOR is self-explanatory (...), same as Blender.
When you have 'Ray Transp' enabled, the blender 'filter' button will appear next to the IOR
button. This has the same effect as in Blender.
Below that there are some new parameters, 'Ext.Color' sets the extinction color for
transparent materials. Usually, in real transparent materials, light loses some of it's
energy the further it has to travel through the object. This effect can be simulated with
this parameter. Thing to look out for is that it specifies the color which will be
REMOVED after traveling through the object. What this means is that say you have a clear
white glass sphere, and set the extinction color to a strong blue, the result will be a
very yellow object when rendered.
Next to the color sliders, there is another set of three parameters, with which you can
enable color dispersion for transparent objects. 'Pwr' sets the amount of dispersion,
the higher, the more dispersion (the more colorful the result).
(For real world materials, this number can be found or derived from data in various glass catalogues)
The 'Samples' button below that sets the number of samples used, minimum values are around
7-10, and for very strong dispersion you might need a lot more.
As usual, this also means an increase in render time of course, but to simulate
realistic materials, you shouldn't really need more than 25 samples.
In addition to that, when using low sample numbers, but to still get a good spread of colors,
you can enable the jitter button, but this will also add noise.
Point/soft(point with shadowbuffer) or sphere lights (light with radius), have a new option
to add a simple glow effect, so that lights can be made visible.
NOTE: just like spotlight halo's, glow is not visible against the background, there must be
another object behind it. Simplest solution is to use a large black shadeless plane behind
your scene.
The glow intensity can be set with the 'GlowInt' parameter (use very low values around 0.01
even lower), and you can choose from two different types with the 'GlowType' button (which
don't look much different, but type 1 is probably better, type 0 faster).
And that's it, with apologies for the still missing features and
full support in general, but this will have to do for now.
2005-05-22 22:46:17 +00:00
|
|
|
// removed the default AA settings for midquality GI, better leave it to user
|
|
|
|
if ((R.r.mode & R_OSA) && (R.r.osa))
|
2004-06-16 18:44:12 +00:00
|
|
|
{
|
Part one of the final yafray commit.
Totally updated blender shader in yafray, hopefully better matches blender
results. Though ramps are now partially supported, they cannot work in all
cases properly in yafray, and in fact are a bit useless probably as far as
yafray is concerned. In fact the 'Result' ramp input mode is not supported
at all, because it works on the total lighting result, and in a yafray
shader this is not possible since it works per light.
Also, since Blender and Yafray have totally different lighting models,
the 'Energy' ramp input mode also won't generally give the same results
as in Blender, since it works with light energy and in yafray this is
different from Blender. Even worse, the only ramp shader that will work
properly when used with GI is the 'Normal' ramp input mode.
As contradictory as this might seem, at various stages of the GI process,
lighting is not known, so properly getting light (ramp 'energy' mode)
or shader information (ramp 'shader' mode, which depends on lighting)
is not possible. Which all means that when the ramp is in 'energy' or
'shader' mode and using it with GI enabled, yafray can only 'see' the
underlying material color, not the ramps, which results in a mix of the
ramp colors (from direct light) with the material color (from indirect light).
There is currently nothing that can be done about that.
The supported texture mapping modes now includes raymir as well, transparency
as far as texturing is concerned now works similar to Blender, with the
exception that you still have to set alpha to a low value to get any
transparency effect at all in yafray. So the Blender 'filter' parameter
now also will affect yafray.
All texture blending modes are now supported (same for ramps).
'Translu' and 'Amb' texture modulation are not supported.
Texture interpolation can be switched off ('InterPol' switch in blender
image texture button section).
All Blender brdf models (aka 'shaders' for the Blender users) are now supported,
and again, you won't necessarily get the same results as in Blender.
The reason for that is partially of course the lighting differences, but also,
not all Blender 'shader' implementations are actually correct, and copying
those errors just for the sake of matching Blender results doesn't really
seem like a good idea...
Though this really is only the case for WardIso, less so for Minnaert and
Blinn, which in yafray are more or less (but not totally) a copy of
the Blender code.
In any case, in practice those differences might not be
too noticable at all (I hope).
Continue to the next part...
2005-05-21 20:49:24 +00:00
|
|
|
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);
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
Part one of the final yafray commit.
Totally updated blender shader in yafray, hopefully better matches blender
results. Though ramps are now partially supported, they cannot work in all
cases properly in yafray, and in fact are a bit useless probably as far as
yafray is concerned. In fact the 'Result' ramp input mode is not supported
at all, because it works on the total lighting result, and in a yafray
shader this is not possible since it works per light.
Also, since Blender and Yafray have totally different lighting models,
the 'Energy' ramp input mode also won't generally give the same results
as in Blender, since it works with light energy and in yafray this is
different from Blender. Even worse, the only ramp shader that will work
properly when used with GI is the 'Normal' ramp input mode.
As contradictory as this might seem, at various stages of the GI process,
lighting is not known, so properly getting light (ramp 'energy' mode)
or shader information (ramp 'shader' mode, which depends on lighting)
is not possible. Which all means that when the ramp is in 'energy' or
'shader' mode and using it with GI enabled, yafray can only 'see' the
underlying material color, not the ramps, which results in a mix of the
ramp colors (from direct light) with the material color (from indirect light).
There is currently nothing that can be done about that.
The supported texture mapping modes now includes raymir as well, transparency
as far as texturing is concerned now works similar to Blender, with the
exception that you still have to set alpha to a low value to get any
transparency effect at all in yafray. So the Blender 'filter' parameter
now also will affect yafray.
All texture blending modes are now supported (same for ramps).
'Translu' and 'Amb' texture modulation are not supported.
Texture interpolation can be switched off ('InterPol' switch in blender
image texture button section).
All Blender brdf models (aka 'shaders' for the Blender users) are now supported,
and again, you won't necessarily get the same results as in Blender.
The reason for that is partially of course the lighting differences, but also,
not all Blender 'shader' implementations are actually correct, and copying
those errors just for the sake of matching Blender results doesn't really
seem like a good idea...
Though this really is only the case for WardIso, less so for Minnaert and
Blinn, which in yafray are more or less (but not totally) a copy of
the Blender code.
In any case, in practice those differences might not be
too noticable at all (I hope).
Continue to the next part...
2005-05-21 20:49:24 +00:00
|
|
|
params["AA_passes"] = yafray::parameter_t(0);
|
|
|
|
params["AA_minsamples"] = yafray::parameter_t(1);
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
Part one of the final yafray commit.
Totally updated blender shader in yafray, hopefully better matches blender
results. Though ramps are now partially supported, they cannot work in all
cases properly in yafray, and in fact are a bit useless probably as far as
yafray is concerned. In fact the 'Result' ramp input mode is not supported
at all, because it works on the total lighting result, and in a yafray
shader this is not possible since it works per light.
Also, since Blender and Yafray have totally different lighting models,
the 'Energy' ramp input mode also won't generally give the same results
as in Blender, since it works with light energy and in yafray this is
different from Blender. Even worse, the only ramp shader that will work
properly when used with GI is the 'Normal' ramp input mode.
As contradictory as this might seem, at various stages of the GI process,
lighting is not known, so properly getting light (ramp 'energy' mode)
or shader information (ramp 'shader' mode, which depends on lighting)
is not possible. Which all means that when the ramp is in 'energy' or
'shader' mode and using it with GI enabled, yafray can only 'see' the
underlying material color, not the ramps, which results in a mix of the
ramp colors (from direct light) with the material color (from indirect light).
There is currently nothing that can be done about that.
The supported texture mapping modes now includes raymir as well, transparency
as far as texturing is concerned now works similar to Blender, with the
exception that you still have to set alpha to a low value to get any
transparency effect at all in yafray. So the Blender 'filter' parameter
now also will affect yafray.
All texture blending modes are now supported (same for ramps).
'Translu' and 'Amb' texture modulation are not supported.
Texture interpolation can be switched off ('InterPol' switch in blender
image texture button section).
All Blender brdf models (aka 'shaders' for the Blender users) are now supported,
and again, you won't necessarily get the same results as in Blender.
The reason for that is partially of course the lighting differences, but also,
not all Blender 'shader' implementations are actually correct, and copying
those errors just for the sake of matching Blender results doesn't really
seem like a good idea...
Though this really is only the case for WardIso, less so for Minnaert and
Blinn, which in yafray are more or less (but not totally) a copy of
the Blender code.
In any case, in practice those differences might not be
too noticable at all (I hope).
Continue to the next part...
2005-05-21 20:49:24 +00:00
|
|
|
params["AA_pixelwidth"] = yafray::parameter_t(1.5);
|
|
|
|
params["AA_threshold"] = yafray::parameter_t(0.05f);
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
2005-01-09 21:53:50 +00:00
|
|
|
if(R.r.mode & R_BORDER)
|
|
|
|
{
|
Part one of the final yafray commit.
Totally updated blender shader in yafray, hopefully better matches blender
results. Though ramps are now partially supported, they cannot work in all
cases properly in yafray, and in fact are a bit useless probably as far as
yafray is concerned. In fact the 'Result' ramp input mode is not supported
at all, because it works on the total lighting result, and in a yafray
shader this is not possible since it works per light.
Also, since Blender and Yafray have totally different lighting models,
the 'Energy' ramp input mode also won't generally give the same results
as in Blender, since it works with light energy and in yafray this is
different from Blender. Even worse, the only ramp shader that will work
properly when used with GI is the 'Normal' ramp input mode.
As contradictory as this might seem, at various stages of the GI process,
lighting is not known, so properly getting light (ramp 'energy' mode)
or shader information (ramp 'shader' mode, which depends on lighting)
is not possible. Which all means that when the ramp is in 'energy' or
'shader' mode and using it with GI enabled, yafray can only 'see' the
underlying material color, not the ramps, which results in a mix of the
ramp colors (from direct light) with the material color (from indirect light).
There is currently nothing that can be done about that.
The supported texture mapping modes now includes raymir as well, transparency
as far as texturing is concerned now works similar to Blender, with the
exception that you still have to set alpha to a low value to get any
transparency effect at all in yafray. So the Blender 'filter' parameter
now also will affect yafray.
All texture blending modes are now supported (same for ramps).
'Translu' and 'Amb' texture modulation are not supported.
Texture interpolation can be switched off ('InterPol' switch in blender
image texture button section).
All Blender brdf models (aka 'shaders' for the Blender users) are now supported,
and again, you won't necessarily get the same results as in Blender.
The reason for that is partially of course the lighting differences, but also,
not all Blender 'shader' implementations are actually correct, and copying
those errors just for the sake of matching Blender results doesn't really
seem like a good idea...
Though this really is only the case for WardIso, less so for Minnaert and
Blinn, which in yafray are more or less (but not totally) a copy of
the Blender code.
In any case, in practice those differences might not be
too noticable at all (I hope).
Continue to the next part...
2005-05-21 20:49:24 +00:00
|
|
|
params["border_xmin"] = yafray::parameter_t( R.r.border.xmin*2.0-1.0 );
|
|
|
|
params["border_xmax"] = yafray::parameter_t( R.r.border.xmax*2.0-1.0 );
|
|
|
|
params["border_ymin"] = yafray::parameter_t( R.r.border.ymin*2.0-1.0 );
|
|
|
|
params["border_ymax"] = yafray::parameter_t( R.r.border.ymax*2.0-1.0 );
|
|
|
|
}
|
|
|
|
if (hasworld) {
|
|
|
|
World *world = G.scene->world;
|
|
|
|
if (world->mode & WO_MIST) {
|
Second and final commit for this version of the yafray export code (probably, you never know
of course...)
Not quite complete, but due to lack of time as good as it will get for now.
From the previous commit, forgot to report that basic fog is supported as well. Though because I had not much time to complete the code, it is sort of unfinished, and you will have
to tweak parameters specifically for yafray again. It uses only the world horizon color, and
only uses the Blender mist distance setting.
Textures now support checker clip mode.
Fixed possibly all 'duplilist non-empty' errors, though it could hide the real cause of the
error.
AA is no longer enabled automatically for certain GI quality settings, I thought it best to
leave it to the user to decide.
SkyDome GI mode now supports cache as well. There is a new option in the GI quality menu 'Use
Blender AO settings', which will as it says use the most important AO settings for the
skydome parameters. The only AO parameters used are 'Samples', 'Dist' and the random sampling
switch, which unlike in Blender you might want to use more often, since the QMC sampling used
in yafray can result in visible patterns or a dithering type look. 'Random' is not completely
random in yafray however, it is actually jittered (stratified) sampling.
Using an occlusion cache, doesn't necessarily mean that you will always get much shorter
render times. As with 'full' GI and cache, one problem is bumpmaps, when using bump (or
normal) maps, the sampling will be much more dense, using lots more rendertime.
As a temporary fix there is a button 'NoBump', but this also has the side effect that in
areas of total indirect light (or when used with SkyDome cache) no bumpmapping will be
visible. It is therefor best used with some direct light as well.
For SkyDome with cache, and strong bumpmapping it might actually not make much difference,
since for low distance values you can usually get away with low sample values as well.
The entire material panel is now replaced by another panel to show only the parameters
important to yafray and add some new ones as well.
Since lots of users (especially yafray beginners) have had problems getting certain material
aspects right, there is now a material preset menu available to hopefully solve some of the
most common "How do I do this? It doesn't work!" questions seen in various forums.
Choosing an option from this menu will set the required parameters to default
values for yafray, and you can work your way from there to tweak it something you want.
Most buttons are copies of the same Blender parameters, with some variations. Just like
Blender 'Ray Mirror' enables reflection, 'Ray Transp' enables refraction. You can use
'ZTransp' for materials that have texture maps with alpha channels.
Again, same as Blender 'rayMir' sets the amount of reflection. Next button 'frsOfs' however
controls fresnel offset, meaning that when this is set to 1, you will get no fresnel effect
and when set to 5, reflection is totally determined by fresnel, which is important for
realistic glass/metals/etc.
IOR is self-explanatory (...), same as Blender.
When you have 'Ray Transp' enabled, the blender 'filter' button will appear next to the IOR
button. This has the same effect as in Blender.
Below that there are some new parameters, 'Ext.Color' sets the extinction color for
transparent materials. Usually, in real transparent materials, light loses some of it's
energy the further it has to travel through the object. This effect can be simulated with
this parameter. Thing to look out for is that it specifies the color which will be
REMOVED after traveling through the object. What this means is that say you have a clear
white glass sphere, and set the extinction color to a strong blue, the result will be a
very yellow object when rendered.
Next to the color sliders, there is another set of three parameters, with which you can
enable color dispersion for transparent objects. 'Pwr' sets the amount of dispersion,
the higher, the more dispersion (the more colorful the result).
(For real world materials, this number can be found or derived from data in various glass catalogues)
The 'Samples' button below that sets the number of samples used, minimum values are around
7-10, and for very strong dispersion you might need a lot more.
As usual, this also means an increase in render time of course, but to simulate
realistic materials, you shouldn't really need more than 25 samples.
In addition to that, when using low sample numbers, but to still get a good spread of colors,
you can enable the jitter button, but this will also add noise.
Point/soft(point with shadowbuffer) or sphere lights (light with radius), have a new option
to add a simple glow effect, so that lights can be made visible.
NOTE: just like spotlight halo's, glow is not visible against the background, there must be
another object behind it. Simplest solution is to use a large black shadeless plane behind
your scene.
The glow intensity can be set with the 'GlowInt' parameter (use very low values around 0.01
even lower), and you can choose from two different types with the 'GlowType' button (which
don't look much different, but type 1 is probably better, type 0 faster).
And that's it, with apologies for the still missing features and
full support in general, but this will have to do for now.
2005-05-22 22:46:17 +00:00
|
|
|
// basic fog
|
|
|
|
float fd = world->mistdist;
|
|
|
|
if (fd>0) fd=1.f/fd; else fd=1;
|
|
|
|
params["fog_density"] = yafray::parameter_t(fd);
|
Part one of the final yafray commit.
Totally updated blender shader in yafray, hopefully better matches blender
results. Though ramps are now partially supported, they cannot work in all
cases properly in yafray, and in fact are a bit useless probably as far as
yafray is concerned. In fact the 'Result' ramp input mode is not supported
at all, because it works on the total lighting result, and in a yafray
shader this is not possible since it works per light.
Also, since Blender and Yafray have totally different lighting models,
the 'Energy' ramp input mode also won't generally give the same results
as in Blender, since it works with light energy and in yafray this is
different from Blender. Even worse, the only ramp shader that will work
properly when used with GI is the 'Normal' ramp input mode.
As contradictory as this might seem, at various stages of the GI process,
lighting is not known, so properly getting light (ramp 'energy' mode)
or shader information (ramp 'shader' mode, which depends on lighting)
is not possible. Which all means that when the ramp is in 'energy' or
'shader' mode and using it with GI enabled, yafray can only 'see' the
underlying material color, not the ramps, which results in a mix of the
ramp colors (from direct light) with the material color (from indirect light).
There is currently nothing that can be done about that.
The supported texture mapping modes now includes raymir as well, transparency
as far as texturing is concerned now works similar to Blender, with the
exception that you still have to set alpha to a low value to get any
transparency effect at all in yafray. So the Blender 'filter' parameter
now also will affect yafray.
All texture blending modes are now supported (same for ramps).
'Translu' and 'Amb' texture modulation are not supported.
Texture interpolation can be switched off ('InterPol' switch in blender
image texture button section).
All Blender brdf models (aka 'shaders' for the Blender users) are now supported,
and again, you won't necessarily get the same results as in Blender.
The reason for that is partially of course the lighting differences, but also,
not all Blender 'shader' implementations are actually correct, and copying
those errors just for the sake of matching Blender results doesn't really
seem like a good idea...
Though this really is only the case for WardIso, less so for Minnaert and
Blinn, which in yafray are more or less (but not totally) a copy of
the Blender code.
In any case, in practice those differences might not be
too noticable at all (I hope).
Continue to the next part...
2005-05-21 20:49:24 +00:00
|
|
|
params["fog_color"] = yafray::parameter_t(yafray::color_t(world->horr, world->horg, world->horb));
|
|
|
|
}
|
|
|
|
params["background_name"] = yafray::parameter_t("world_background");
|
2005-01-09 21:53:50 +00:00
|
|
|
}
|
2004-06-16 18:44:12 +00:00
|
|
|
params["bias"]=yafray::parameter_t(R.r.YF_raybias);
|
Added some backward compatibility with old yafray blendershader. Because of missing
parameters the material preset menu won't be as useful. Both glass presets will look the same
because there is no 'filter' parameter in the old yafray for instance.
So using the new Blender version with an old yafray version should work a bit better,
though the other way around, using the new yafray with an old blender version, will generally
not work as well.
I added a few extra things. In 'yafray' panel re-arranged some buttons, and added a new
button 'Clamp RGB'. This button will be enabled by default and helps to improve AA on
high contrast edges in the image. When using bokeh however, it is best to switch this off,
otherwise lens shaped highlights will be quite a bit less visible.
Changed the 'extinction' parameter name to the probably more correct term 'absorption',
though mathematically it works out the same. Also changed the behaviour of this color,
it no longer specifies a color that will be removed as I wrote in the previous commit,
but instead the actual color at one (blender) unit of distance. The 'Ds' (distance scale)
button below the color sliders controls the scaling of this unit distance.
What this means is that if you take the standard blender cube, which covers two units of
distance by default, setting the distance scale button to 2.0 will make sure that the color
you specified is exactly that color at that distance (provided the base color itself is white
of course, or 'filter' is 0, otherwise it will be filtered by the base color too).
Beyond this distance the color will get darker.
The glow option for point/soft/sphere lights has a new parameter 'GloOfs', or glow offset.
Setting this to a higher value then 0 will soften the central peak of the glow.
Another unreported bug fix: For xml export, when yafray failed to render the xml file
for some unknown reason, or because of other problems, the export code would still load
the previously rendered image, this causes problems however if the image resolution is
not the same as the current Blender buffer, and so could cause memory corruption or crashes.
This is now taken into account.
World image backgrounds now use the blender mapping settings as well, but only the
'AngMap', 'Sphere' and 'Tube' settings. But in yafray those last two, unlike Blender, cover
the whole view, not just the upper half, so is not really fully compatible with yafray.
So now you have to set one of these buttons too when loading a hdr lightprobe image.
btw, something I forgot to mention in previous commits is that the exposure control using
the texture brightness slider is no longer restricted to integer values. It is now a
floating point value, so you're not restricted to the 0 1 and 2 slider positions anymore,
anything in between will work too.
And finally, display updating is now more like Blender, using the mouse cursor as frame
counter for animation, etc.
2005-05-27 17:52:53 +00:00
|
|
|
params["clamp_rgb"] = yafray::parameter_t((R.r.YF_clamprgb==0) ? "on" : "off");
|
2004-06-16 18:44:12 +00:00
|
|
|
blenderYafrayOutput_t output;
|
|
|
|
yafrayGate->render(params,output);
|
|
|
|
cout<<"render finished"<<endl;
|
|
|
|
yafrayGate->clear();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool yafrayPluginRender_t::finishExport()
|
|
|
|
{
|
|
|
|
//displayImage();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// displays the image rendered with xml export
|
|
|
|
// Now loads rendered image into blender renderbuf.
|
|
|
|
void yafrayPluginRender_t::displayImage()
|
|
|
|
{
|
|
|
|
// although it is possible to load the image using blender,
|
|
|
|
// maybe it is best to just do a read here, for now the yafray output is always a raw tga anyway
|
|
|
|
|
|
|
|
// rectot already freed in initrender
|
|
|
|
R.rectot = (unsigned int *)MEM_callocN(sizeof(int)*R.rectx*R.recty, "rectot");
|
|
|
|
|
|
|
|
FILE* fp = fopen(imgout.c_str(), "rb");
|
|
|
|
if (fp==NULL) {
|
|
|
|
cout << "YAF_displayImage(): Could not open image file\n";
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned char header[18];
|
|
|
|
fread(&header, 1, 18, fp);
|
|
|
|
unsigned short width = (unsigned short)(header[12] + (header[13]<<8));
|
|
|
|
unsigned short height = (unsigned short)(header[14] + (header[15]<<8));
|
|
|
|
unsigned char byte_per_pix = (unsigned char)(header[16]>>3);
|
|
|
|
// read past any id (none in this case though)
|
|
|
|
unsigned int idlen = (unsigned int)header[0];
|
|
|
|
if (idlen) fseek(fp, idlen, SEEK_CUR);
|
|
|
|
|
|
|
|
// read data directly into buffer, picture is upside down
|
|
|
|
for (unsigned short y=0;y<height;y++) {
|
|
|
|
unsigned char* bpt = (unsigned char*)R.rectot + ((((height-1)-y)*width)<<2);
|
|
|
|
for (unsigned short x=0;x<width;x++) {
|
|
|
|
bpt[2] = (unsigned char)fgetc(fp);
|
|
|
|
bpt[1] = (unsigned char)fgetc(fp);
|
|
|
|
bpt[0] = (unsigned char)fgetc(fp);
|
|
|
|
if (byte_per_pix==4)
|
|
|
|
bpt[3] = (unsigned char)fgetc(fp);
|
|
|
|
else
|
|
|
|
bpt[3] = 255;
|
|
|
|
bpt += 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fclose(fp);
|
|
|
|
fp = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-09-20 23:59:09 +00:00
|
|
|
#ifdef WIN32
|
|
|
|
#define MAXPATHLEN MAX_PATH
|
|
|
|
#else
|
|
|
|
#include <sys/param.h>
|
|
|
|
#endif
|
2004-07-12 03:20:31 +00:00
|
|
|
static void adjustPath(string &path)
|
|
|
|
{
|
|
|
|
// if relative, expand to full path
|
2004-09-20 23:59:09 +00:00
|
|
|
char cpath[MAXPATHLEN];
|
|
|
|
strcpy(cpath, path.c_str());
|
|
|
|
BLI_convertstringcode(cpath, G.sce, 0);
|
|
|
|
path = cpath;
|
2004-07-12 03:20:31 +00:00
|
|
|
#ifdef WIN32
|
|
|
|
// add drive char if not there
|
|
|
|
addDrive(path);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
static string noise2string(short nbtype)
|
|
|
|
{
|
|
|
|
switch (nbtype) {
|
|
|
|
case TEX_BLENDER:
|
|
|
|
return "blender";
|
|
|
|
case TEX_STDPERLIN:
|
|
|
|
return "stdperlin";
|
|
|
|
case TEX_VORONOI_F1:
|
|
|
|
return "voronoi_f1";
|
|
|
|
case TEX_VORONOI_F2:
|
|
|
|
return "voronoi_f2";
|
|
|
|
case TEX_VORONOI_F3:
|
|
|
|
return "voronoi_f3";
|
|
|
|
case TEX_VORONOI_F4:
|
|
|
|
return "voronoi_f4";
|
|
|
|
case TEX_VORONOI_F2F1:
|
|
|
|
return "voronoi_f2f1";
|
|
|
|
case TEX_VORONOI_CRACKLE:
|
|
|
|
return "voronoi_crackle";
|
|
|
|
case TEX_CELLNOISE:
|
|
|
|
return "cellnoise";
|
|
|
|
default:
|
|
|
|
case TEX_NEWPERLIN:
|
|
|
|
return "newperlin";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-06-16 18:44:12 +00:00
|
|
|
void yafrayPluginRender_t::writeTextures()
|
|
|
|
{
|
2004-11-14 04:30:28 +00:00
|
|
|
// used to keep track of images already written
|
|
|
|
// (to avoid duplicates if also in imagetex for material TexFace texture)
|
2004-11-18 01:50:09 +00:00
|
|
|
set<Image*> dupimg;
|
2004-11-14 04:30:28 +00:00
|
|
|
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
yafray::paramMap_t params;
|
|
|
|
list<yafray::paramMap_t> lparams;
|
|
|
|
for (map<string, MTex*>::const_iterator blendtex=used_textures.begin();
|
2004-06-16 18:44:12 +00:00
|
|
|
blendtex!=used_textures.end();++blendtex)
|
|
|
|
{
|
2005-05-09 03:46:21 +00:00
|
|
|
lparams.clear();
|
|
|
|
params.clear();
|
|
|
|
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
MTex* mtex = blendtex->second;
|
2004-06-16 18:44:12 +00:00
|
|
|
Tex* tex = mtex->tex;
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
// name is image name instead of texture name when type is image (see TEX_IMAGE case below)
|
|
|
|
// (done because of possible combinations of 'TexFace' images and regular image textures, to avoid duplicates)
|
|
|
|
if (tex->type!=TEX_IMAGE) params["name"] = yafray::parameter_t(blendtex->first);
|
|
|
|
|
|
|
|
float nsz = tex->noisesize;
|
|
|
|
if (nsz!=0.f) nsz=1.f/nsz;
|
|
|
|
|
|
|
|
// noisebasis type
|
|
|
|
string ntype = noise2string(tex->noisebasis);
|
Added nearly full support for Blender's procedural textures, with the exception
of 'envmap', 'magic', and 'plugin' modes.
The stucci texture also is not exact match, since it cannot be fully
emulated in yafray because of implementation issues. It will work best
for low turbulence values (which is actually not taken into account
in the export code).
Also, since Blender's static noise is basically just direct random number
output, don't expect the exact same result when rendered in yafray, but in this
case that probably shouldn't be that much of a problem...
(needs yafray from cvs)
(btw, on a side note, I put this in the comments once when working on the noise
stuff for Blender, but noise is affected by the 'depth' parameter, and there
is no way to control this directly from the GUI, can only be done by temporarily
switching to 'clouds' for instance.)
2004-11-28 02:13:57 +00:00
|
|
|
string ts, hardnoise=(tex->noisetype==TEX_NOISESOFT) ? "off" : "on";
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
|
2004-06-16 18:44:12 +00:00
|
|
|
switch (tex->type) {
|
|
|
|
case TEX_STUCCI:
|
Added nearly full support for Blender's procedural textures, with the exception
of 'envmap', 'magic', and 'plugin' modes.
The stucci texture also is not exact match, since it cannot be fully
emulated in yafray because of implementation issues. It will work best
for low turbulence values (which is actually not taken into account
in the export code).
Also, since Blender's static noise is basically just direct random number
output, don't expect the exact same result when rendered in yafray, but in this
case that probably shouldn't be that much of a problem...
(needs yafray from cvs)
(btw, on a side note, I put this in the comments once when working on the noise
stuff for Blender, but noise is affected by the 'depth' parameter, and there
is no way to control this directly from the GUI, can only be done by temporarily
switching to 'clouds' for instance.)
2004-11-28 02:13:57 +00:00
|
|
|
// stucci is clouds as bump, only difference is an extra parameter to handle wall in/out
|
|
|
|
// turbulence value is not used, so for large values will not match well
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
case TEX_CLOUDS: {
|
|
|
|
params["type"] = yafray::parameter_t("clouds");
|
|
|
|
params["size"] = yafray::parameter_t(nsz);
|
Added nearly full support for Blender's procedural textures, with the exception
of 'envmap', 'magic', and 'plugin' modes.
The stucci texture also is not exact match, since it cannot be fully
emulated in yafray because of implementation issues. It will work best
for low turbulence values (which is actually not taken into account
in the export code).
Also, since Blender's static noise is basically just direct random number
output, don't expect the exact same result when rendered in yafray, but in this
case that probably shouldn't be that much of a problem...
(needs yafray from cvs)
(btw, on a side note, I put this in the comments once when working on the noise
stuff for Blender, but noise is affected by the 'depth' parameter, and there
is no way to control this directly from the GUI, can only be done by temporarily
switching to 'clouds' for instance.)
2004-11-28 02:13:57 +00:00
|
|
|
params["hard"] = yafray::parameter_t(hardnoise);
|
|
|
|
if (tex->type==TEX_STUCCI) {
|
|
|
|
if (tex->stype==1)
|
|
|
|
ts = "positive";
|
|
|
|
else if (tex->stype==2)
|
|
|
|
ts = "negative";
|
|
|
|
else ts = "none";
|
|
|
|
params["bias"] = yafray::parameter_t(ts);
|
|
|
|
params["depth"] = yafray::parameter_t(0); // for stucci always 0
|
|
|
|
}
|
|
|
|
else params["depth"] = yafray::parameter_t(tex->noisedepth);
|
|
|
|
params["color_type"] = yafray::parameter_t(tex->stype);
|
|
|
|
params["noise_type"] = yafray::parameter_t(ntype);
|
2004-06-16 18:44:12 +00:00
|
|
|
break;
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
}
|
2004-06-16 18:44:12 +00:00
|
|
|
case TEX_WOOD:
|
|
|
|
{
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
params["type"] = yafray::parameter_t("wood");
|
Added nearly full support for Blender's procedural textures, with the exception
of 'envmap', 'magic', and 'plugin' modes.
The stucci texture also is not exact match, since it cannot be fully
emulated in yafray because of implementation issues. It will work best
for low turbulence values (which is actually not taken into account
in the export code).
Also, since Blender's static noise is basically just direct random number
output, don't expect the exact same result when rendered in yafray, but in this
case that probably shouldn't be that much of a problem...
(needs yafray from cvs)
(btw, on a side note, I put this in the comments once when working on the noise
stuff for Blender, but noise is affected by the 'depth' parameter, and there
is no way to control this directly from the GUI, can only be done by temporarily
switching to 'clouds' for instance.)
2004-11-28 02:13:57 +00:00
|
|
|
// blender does not use depth value for wood, always 0
|
|
|
|
params["depth"] = yafray::parameter_t(0);
|
|
|
|
float turb = (tex->stype<2) ? 0.0 : tex->turbul;
|
|
|
|
params["turbulence"] = yafray::parameter_t(turb);
|
|
|
|
params["size"] = yafray::parameter_t(nsz);
|
|
|
|
params["hard"] = yafray::parameter_t(hardnoise);
|
|
|
|
ts = (tex->stype & 1) ? "rings" : "bands"; //stype 1&3 ringtype
|
|
|
|
params["wood_type"] = yafray::parameter_t(ts);
|
|
|
|
params["noise_type"] = yafray::parameter_t(ntype);
|
Part one of the final yafray commit.
Totally updated blender shader in yafray, hopefully better matches blender
results. Though ramps are now partially supported, they cannot work in all
cases properly in yafray, and in fact are a bit useless probably as far as
yafray is concerned. In fact the 'Result' ramp input mode is not supported
at all, because it works on the total lighting result, and in a yafray
shader this is not possible since it works per light.
Also, since Blender and Yafray have totally different lighting models,
the 'Energy' ramp input mode also won't generally give the same results
as in Blender, since it works with light energy and in yafray this is
different from Blender. Even worse, the only ramp shader that will work
properly when used with GI is the 'Normal' ramp input mode.
As contradictory as this might seem, at various stages of the GI process,
lighting is not known, so properly getting light (ramp 'energy' mode)
or shader information (ramp 'shader' mode, which depends on lighting)
is not possible. Which all means that when the ramp is in 'energy' or
'shader' mode and using it with GI enabled, yafray can only 'see' the
underlying material color, not the ramps, which results in a mix of the
ramp colors (from direct light) with the material color (from indirect light).
There is currently nothing that can be done about that.
The supported texture mapping modes now includes raymir as well, transparency
as far as texturing is concerned now works similar to Blender, with the
exception that you still have to set alpha to a low value to get any
transparency effect at all in yafray. So the Blender 'filter' parameter
now also will affect yafray.
All texture blending modes are now supported (same for ramps).
'Translu' and 'Amb' texture modulation are not supported.
Texture interpolation can be switched off ('InterPol' switch in blender
image texture button section).
All Blender brdf models (aka 'shaders' for the Blender users) are now supported,
and again, you won't necessarily get the same results as in Blender.
The reason for that is partially of course the lighting differences, but also,
not all Blender 'shader' implementations are actually correct, and copying
those errors just for the sake of matching Blender results doesn't really
seem like a good idea...
Though this really is only the case for WardIso, less so for Minnaert and
Blinn, which in yafray are more or less (but not totally) a copy of
the Blender code.
In any case, in practice those differences might not be
too noticable at all (I hope).
Continue to the next part...
2005-05-21 20:49:24 +00:00
|
|
|
// shape parameter, for some reason noisebasis2 is used...
|
|
|
|
ts = "sin";
|
|
|
|
if (tex->noisebasis2==1) ts="saw"; else if (tex->noisebasis2==2) ts="tri";
|
|
|
|
params["shape"] = yafray::parameter_t(ts);
|
2004-06-16 18:44:12 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case TEX_MARBLE:
|
|
|
|
{
|
Added nearly full support for Blender's procedural textures, with the exception
of 'envmap', 'magic', and 'plugin' modes.
The stucci texture also is not exact match, since it cannot be fully
emulated in yafray because of implementation issues. It will work best
for low turbulence values (which is actually not taken into account
in the export code).
Also, since Blender's static noise is basically just direct random number
output, don't expect the exact same result when rendered in yafray, but in this
case that probably shouldn't be that much of a problem...
(needs yafray from cvs)
(btw, on a side note, I put this in the comments once when working on the noise
stuff for Blender, but noise is affected by the 'depth' parameter, and there
is no way to control this directly from the GUI, can only be done by temporarily
switching to 'clouds' for instance.)
2004-11-28 02:13:57 +00:00
|
|
|
params["type"] = yafray::parameter_t("marble");
|
|
|
|
params["depth"] = yafray::parameter_t(tex->noisedepth);
|
|
|
|
params["turbulence"] = yafray::parameter_t(tex->turbul);
|
|
|
|
params["size"] = yafray::parameter_t(nsz);
|
|
|
|
params["hard"] = yafray::parameter_t(hardnoise);
|
|
|
|
params["sharpness"] = yafray::parameter_t((float)(1<<tex->stype));
|
|
|
|
params["noise_type"] = yafray::parameter_t(ntype);
|
Part one of the final yafray commit.
Totally updated blender shader in yafray, hopefully better matches blender
results. Though ramps are now partially supported, they cannot work in all
cases properly in yafray, and in fact are a bit useless probably as far as
yafray is concerned. In fact the 'Result' ramp input mode is not supported
at all, because it works on the total lighting result, and in a yafray
shader this is not possible since it works per light.
Also, since Blender and Yafray have totally different lighting models,
the 'Energy' ramp input mode also won't generally give the same results
as in Blender, since it works with light energy and in yafray this is
different from Blender. Even worse, the only ramp shader that will work
properly when used with GI is the 'Normal' ramp input mode.
As contradictory as this might seem, at various stages of the GI process,
lighting is not known, so properly getting light (ramp 'energy' mode)
or shader information (ramp 'shader' mode, which depends on lighting)
is not possible. Which all means that when the ramp is in 'energy' or
'shader' mode and using it with GI enabled, yafray can only 'see' the
underlying material color, not the ramps, which results in a mix of the
ramp colors (from direct light) with the material color (from indirect light).
There is currently nothing that can be done about that.
The supported texture mapping modes now includes raymir as well, transparency
as far as texturing is concerned now works similar to Blender, with the
exception that you still have to set alpha to a low value to get any
transparency effect at all in yafray. So the Blender 'filter' parameter
now also will affect yafray.
All texture blending modes are now supported (same for ramps).
'Translu' and 'Amb' texture modulation are not supported.
Texture interpolation can be switched off ('InterPol' switch in blender
image texture button section).
All Blender brdf models (aka 'shaders' for the Blender users) are now supported,
and again, you won't necessarily get the same results as in Blender.
The reason for that is partially of course the lighting differences, but also,
not all Blender 'shader' implementations are actually correct, and copying
those errors just for the sake of matching Blender results doesn't really
seem like a good idea...
Though this really is only the case for WardIso, less so for Minnaert and
Blinn, which in yafray are more or less (but not totally) a copy of
the Blender code.
In any case, in practice those differences might not be
too noticable at all (I hope).
Continue to the next part...
2005-05-21 20:49:24 +00:00
|
|
|
ts = "sin";
|
|
|
|
if (tex->noisebasis2==1) ts="saw"; else if (tex->noisebasis2==2) ts="tri";
|
|
|
|
params["shape"] = yafray::parameter_t(ts);
|
2004-06-16 18:44:12 +00:00
|
|
|
break;
|
|
|
|
}
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
case TEX_VORONOI:
|
|
|
|
{
|
|
|
|
params["type"] = yafray::parameter_t("voronoi");
|
|
|
|
ts = "int";
|
|
|
|
if (tex->vn_coltype==1)
|
|
|
|
ts = "col1";
|
|
|
|
else if (tex->vn_coltype==2)
|
|
|
|
ts = "col2";
|
|
|
|
else if (tex->vn_coltype==3)
|
|
|
|
ts = "col3";
|
|
|
|
params["color_type"] = yafray::parameter_t(ts);
|
|
|
|
params["weight1"] = yafray::parameter_t(tex->vn_w1);
|
|
|
|
params["weight2"] = yafray::parameter_t(tex->vn_w2);
|
|
|
|
params["weight3"] = yafray::parameter_t(tex->vn_w3);
|
|
|
|
params["weight4"] = yafray::parameter_t(tex->vn_w4);
|
|
|
|
params["mk_exponent"] = yafray::parameter_t(tex->vn_mexp);
|
|
|
|
params["intensity"] = yafray::parameter_t(tex->ns_outscale);
|
|
|
|
params["size"] = yafray::parameter_t(nsz);
|
|
|
|
ts = "actual";
|
|
|
|
if (tex->vn_distm==TEX_DISTANCE_SQUARED)
|
|
|
|
ts = "squared";
|
|
|
|
else if (tex->vn_distm==TEX_MANHATTAN)
|
|
|
|
ts = "manhattan";
|
|
|
|
else if (tex->vn_distm==TEX_CHEBYCHEV)
|
|
|
|
ts = "chebychev";
|
|
|
|
else if (tex->vn_distm==TEX_MINKOVSKY_HALF)
|
|
|
|
ts = "minkovsky_half";
|
|
|
|
else if (tex->vn_distm==TEX_MINKOVSKY_FOUR)
|
|
|
|
ts = "minkovsky_four";
|
|
|
|
else if (tex->vn_distm==TEX_MINKOVSKY)
|
|
|
|
ts = "minkovsky";
|
|
|
|
params["distance_metric"] = yafray::parameter_t(ts);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case TEX_MUSGRAVE:
|
|
|
|
{
|
|
|
|
params["type"] = yafray::parameter_t("musgrave");
|
|
|
|
switch (tex->stype) {
|
|
|
|
case TEX_MFRACTAL:
|
|
|
|
ts = "multifractal";
|
|
|
|
break;
|
|
|
|
case TEX_RIDGEDMF:
|
|
|
|
ts = "ridgedmf";
|
|
|
|
break;
|
|
|
|
case TEX_HYBRIDMF:
|
|
|
|
ts = "hybridmf";
|
|
|
|
break;
|
|
|
|
case TEX_HTERRAIN:
|
|
|
|
ts = "heteroterrain";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
case TEX_FBM:
|
|
|
|
ts = "fBm";
|
|
|
|
}
|
|
|
|
params["musgrave_type"] = yafray::parameter_t(ts);
|
|
|
|
params["noise_type"] = yafray::parameter_t(ntype);
|
|
|
|
params["H"] = yafray::parameter_t(tex->mg_H);
|
|
|
|
params["lacunarity"] = yafray::parameter_t(tex->mg_lacunarity);
|
|
|
|
params["octaves"] = yafray::parameter_t(tex->mg_octaves);
|
|
|
|
if ((tex->stype==TEX_HTERRAIN) || (tex->stype==TEX_RIDGEDMF) || (tex->stype==TEX_HYBRIDMF)) {
|
|
|
|
params["offset"] = yafray::parameter_t(tex->mg_offset);
|
|
|
|
if ((tex->stype==TEX_RIDGEDMF) || (tex->stype==TEX_HYBRIDMF))
|
|
|
|
params["gain"] = yafray::parameter_t(tex->mg_gain);
|
|
|
|
}
|
|
|
|
params["size"] = yafray::parameter_t(nsz);
|
|
|
|
params["intensity"] = yafray::parameter_t(tex->ns_outscale);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case TEX_DISTNOISE:
|
|
|
|
{
|
|
|
|
params["type"] = yafray::parameter_t("distorted_noise");
|
|
|
|
params["distort"] = yafray::parameter_t(tex->dist_amount);
|
|
|
|
params["size"] = yafray::parameter_t(nsz);
|
|
|
|
params["noise_type1"] = yafray::parameter_t(ntype);
|
|
|
|
params["noise_type2"] = yafray::parameter_t(noise2string(tex->noisebasis2));
|
Added nearly full support for Blender's procedural textures, with the exception
of 'envmap', 'magic', and 'plugin' modes.
The stucci texture also is not exact match, since it cannot be fully
emulated in yafray because of implementation issues. It will work best
for low turbulence values (which is actually not taken into account
in the export code).
Also, since Blender's static noise is basically just direct random number
output, don't expect the exact same result when rendered in yafray, but in this
case that probably shouldn't be that much of a problem...
(needs yafray from cvs)
(btw, on a side note, I put this in the comments once when working on the noise
stuff for Blender, but noise is affected by the 'depth' parameter, and there
is no way to control this directly from the GUI, can only be done by temporarily
switching to 'clouds' for instance.)
2004-11-28 02:13:57 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case TEX_BLEND:
|
|
|
|
{
|
|
|
|
params["type"] = yafray::parameter_t("gradient");
|
|
|
|
switch (tex->stype) {
|
|
|
|
case 1: ts="quadratic"; break;
|
|
|
|
case 2: ts="cubic"; break;
|
|
|
|
case 3: ts="diagonal"; break;
|
|
|
|
case 4: ts="sphere"; break;
|
|
|
|
case 5: ts="halo"; break;
|
|
|
|
default:
|
|
|
|
case 0: ts="linear"; break;
|
|
|
|
}
|
|
|
|
params["gradient_type"] = yafray::parameter_t(ts);
|
|
|
|
if (tex->flag & TEX_FLIPBLEND) ts="on"; else ts="off";
|
|
|
|
params["flip_xy"] = yafray::parameter_t(ts);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case TEX_NOISE:
|
|
|
|
{
|
|
|
|
params["type"] = yafray::parameter_t("random_noise");
|
|
|
|
params["depth"] = yafray::parameter_t(tex->noisedepth);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case TEX_IMAGE:
|
|
|
|
{
|
|
|
|
Image* ima = tex->ima;
|
|
|
|
if (ima) {
|
|
|
|
// remember image to avoid duplicates later if also in imagetex
|
|
|
|
// (formerly done by removing from imagetex, but need image/material link)
|
|
|
|
dupimg.insert(ima);
|
|
|
|
params["type"] = yafray::parameter_t("image");
|
|
|
|
params["name"] = yafray::parameter_t(ima->id.name);
|
|
|
|
string texpath = ima->name;
|
|
|
|
adjustPath(texpath);
|
|
|
|
params["filename"] = yafray::parameter_t(texpath);
|
Part one of the final yafray commit.
Totally updated blender shader in yafray, hopefully better matches blender
results. Though ramps are now partially supported, they cannot work in all
cases properly in yafray, and in fact are a bit useless probably as far as
yafray is concerned. In fact the 'Result' ramp input mode is not supported
at all, because it works on the total lighting result, and in a yafray
shader this is not possible since it works per light.
Also, since Blender and Yafray have totally different lighting models,
the 'Energy' ramp input mode also won't generally give the same results
as in Blender, since it works with light energy and in yafray this is
different from Blender. Even worse, the only ramp shader that will work
properly when used with GI is the 'Normal' ramp input mode.
As contradictory as this might seem, at various stages of the GI process,
lighting is not known, so properly getting light (ramp 'energy' mode)
or shader information (ramp 'shader' mode, which depends on lighting)
is not possible. Which all means that when the ramp is in 'energy' or
'shader' mode and using it with GI enabled, yafray can only 'see' the
underlying material color, not the ramps, which results in a mix of the
ramp colors (from direct light) with the material color (from indirect light).
There is currently nothing that can be done about that.
The supported texture mapping modes now includes raymir as well, transparency
as far as texturing is concerned now works similar to Blender, with the
exception that you still have to set alpha to a low value to get any
transparency effect at all in yafray. So the Blender 'filter' parameter
now also will affect yafray.
All texture blending modes are now supported (same for ramps).
'Translu' and 'Amb' texture modulation are not supported.
Texture interpolation can be switched off ('InterPol' switch in blender
image texture button section).
All Blender brdf models (aka 'shaders' for the Blender users) are now supported,
and again, you won't necessarily get the same results as in Blender.
The reason for that is partially of course the lighting differences, but also,
not all Blender 'shader' implementations are actually correct, and copying
those errors just for the sake of matching Blender results doesn't really
seem like a good idea...
Though this really is only the case for WardIso, less so for Minnaert and
Blinn, which in yafray are more or less (but not totally) a copy of
the Blender code.
In any case, in practice those differences might not be
too noticable at all (I hope).
Continue to the next part...
2005-05-21 20:49:24 +00:00
|
|
|
params["interpolate"] = yafray::parameter_t((tex->imaflag & TEX_INTERPOL) ? "bilinear" : "none");
|
Added nearly full support for Blender's procedural textures, with the exception
of 'envmap', 'magic', and 'plugin' modes.
The stucci texture also is not exact match, since it cannot be fully
emulated in yafray because of implementation issues. It will work best
for low turbulence values (which is actually not taken into account
in the export code).
Also, since Blender's static noise is basically just direct random number
output, don't expect the exact same result when rendered in yafray, but in this
case that probably shouldn't be that much of a problem...
(needs yafray from cvs)
(btw, on a side note, I put this in the comments once when working on the noise
stuff for Blender, but noise is affected by the 'depth' parameter, and there
is no way to control this directly from the GUI, can only be done by temporarily
switching to 'clouds' for instance.)
2004-11-28 02:13:57 +00:00
|
|
|
}
|
|
|
|
break;
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
}
|
2004-06-16 18:44:12 +00:00
|
|
|
default:
|
|
|
|
cout << "Unsupported texture type\n";
|
|
|
|
}
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
yafrayGate->addShader(params, lparams);
|
|
|
|
|
2004-06-16 18:44:12 +00:00
|
|
|
// colorbands
|
|
|
|
if (tex->flag & TEX_COLORBAND)
|
|
|
|
{
|
|
|
|
ColorBand* cb = tex->coba;
|
|
|
|
if (cb)
|
|
|
|
{
|
2005-05-09 03:46:21 +00:00
|
|
|
lparams.clear();
|
2004-06-16 18:44:12 +00:00
|
|
|
params.clear();
|
Part one of the final yafray commit.
Totally updated blender shader in yafray, hopefully better matches blender
results. Though ramps are now partially supported, they cannot work in all
cases properly in yafray, and in fact are a bit useless probably as far as
yafray is concerned. In fact the 'Result' ramp input mode is not supported
at all, because it works on the total lighting result, and in a yafray
shader this is not possible since it works per light.
Also, since Blender and Yafray have totally different lighting models,
the 'Energy' ramp input mode also won't generally give the same results
as in Blender, since it works with light energy and in yafray this is
different from Blender. Even worse, the only ramp shader that will work
properly when used with GI is the 'Normal' ramp input mode.
As contradictory as this might seem, at various stages of the GI process,
lighting is not known, so properly getting light (ramp 'energy' mode)
or shader information (ramp 'shader' mode, which depends on lighting)
is not possible. Which all means that when the ramp is in 'energy' or
'shader' mode and using it with GI enabled, yafray can only 'see' the
underlying material color, not the ramps, which results in a mix of the
ramp colors (from direct light) with the material color (from indirect light).
There is currently nothing that can be done about that.
The supported texture mapping modes now includes raymir as well, transparency
as far as texturing is concerned now works similar to Blender, with the
exception that you still have to set alpha to a low value to get any
transparency effect at all in yafray. So the Blender 'filter' parameter
now also will affect yafray.
All texture blending modes are now supported (same for ramps).
'Translu' and 'Amb' texture modulation are not supported.
Texture interpolation can be switched off ('InterPol' switch in blender
image texture button section).
All Blender brdf models (aka 'shaders' for the Blender users) are now supported,
and again, you won't necessarily get the same results as in Blender.
The reason for that is partially of course the lighting differences, but also,
not all Blender 'shader' implementations are actually correct, and copying
those errors just for the sake of matching Blender results doesn't really
seem like a good idea...
Though this really is only the case for WardIso, less so for Minnaert and
Blinn, which in yafray are more or less (but not totally) a copy of
the Blender code.
In any case, in practice those differences might not be
too noticable at all (I hope).
Continue to the next part...
2005-05-21 20:49:24 +00:00
|
|
|
params["type"] = yafray::parameter_t("colorband");
|
|
|
|
params["name"] = yafray::parameter_t(blendtex->first + "_coba");
|
|
|
|
params["input"] = yafray::parameter_t(blendtex->first);
|
2004-06-16 18:44:12 +00:00
|
|
|
for (int i=0;i<cb->tot;i++)
|
|
|
|
{
|
|
|
|
yafray::paramMap_t mparams;
|
Part one of the final yafray commit.
Totally updated blender shader in yafray, hopefully better matches blender
results. Though ramps are now partially supported, they cannot work in all
cases properly in yafray, and in fact are a bit useless probably as far as
yafray is concerned. In fact the 'Result' ramp input mode is not supported
at all, because it works on the total lighting result, and in a yafray
shader this is not possible since it works per light.
Also, since Blender and Yafray have totally different lighting models,
the 'Energy' ramp input mode also won't generally give the same results
as in Blender, since it works with light energy and in yafray this is
different from Blender. Even worse, the only ramp shader that will work
properly when used with GI is the 'Normal' ramp input mode.
As contradictory as this might seem, at various stages of the GI process,
lighting is not known, so properly getting light (ramp 'energy' mode)
or shader information (ramp 'shader' mode, which depends on lighting)
is not possible. Which all means that when the ramp is in 'energy' or
'shader' mode and using it with GI enabled, yafray can only 'see' the
underlying material color, not the ramps, which results in a mix of the
ramp colors (from direct light) with the material color (from indirect light).
There is currently nothing that can be done about that.
The supported texture mapping modes now includes raymir as well, transparency
as far as texturing is concerned now works similar to Blender, with the
exception that you still have to set alpha to a low value to get any
transparency effect at all in yafray. So the Blender 'filter' parameter
now also will affect yafray.
All texture blending modes are now supported (same for ramps).
'Translu' and 'Amb' texture modulation are not supported.
Texture interpolation can be switched off ('InterPol' switch in blender
image texture button section).
All Blender brdf models (aka 'shaders' for the Blender users) are now supported,
and again, you won't necessarily get the same results as in Blender.
The reason for that is partially of course the lighting differences, but also,
not all Blender 'shader' implementations are actually correct, and copying
those errors just for the sake of matching Blender results doesn't really
seem like a good idea...
Though this really is only the case for WardIso, less so for Minnaert and
Blinn, which in yafray are more or less (but not totally) a copy of
the Blender code.
In any case, in practice those differences might not be
too noticable at all (I hope).
Continue to the next part...
2005-05-21 20:49:24 +00:00
|
|
|
mparams["value"] = yafray::parameter_t(cb->data[i].pos);
|
|
|
|
mparams["color"] = yafray::parameter_t(yafray::colorA_t(cb->data[i].r,
|
2004-06-16 18:44:12 +00:00
|
|
|
cb->data[i].g,
|
|
|
|
cb->data[i].b,
|
|
|
|
cb->data[i].a));
|
|
|
|
lparams.push_back(mparams);
|
|
|
|
}
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
yafrayGate->addShader(params, lparams);
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
|
|
|
|
// If used, textures for the material 'TexFace' case
|
|
|
|
if (!imagetex.empty()) {
|
2004-11-18 01:50:09 +00:00
|
|
|
for (map<Image*, set<Material*> >::const_iterator imgtex=imagetex.begin();
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
imgtex!=imagetex.end();++imgtex)
|
|
|
|
{
|
2004-11-14 04:30:28 +00:00
|
|
|
// skip if already written above
|
|
|
|
if (dupimg.find(imgtex->first)==dupimg.end()) {
|
Part one of the final yafray commit.
Totally updated blender shader in yafray, hopefully better matches blender
results. Though ramps are now partially supported, they cannot work in all
cases properly in yafray, and in fact are a bit useless probably as far as
yafray is concerned. In fact the 'Result' ramp input mode is not supported
at all, because it works on the total lighting result, and in a yafray
shader this is not possible since it works per light.
Also, since Blender and Yafray have totally different lighting models,
the 'Energy' ramp input mode also won't generally give the same results
as in Blender, since it works with light energy and in yafray this is
different from Blender. Even worse, the only ramp shader that will work
properly when used with GI is the 'Normal' ramp input mode.
As contradictory as this might seem, at various stages of the GI process,
lighting is not known, so properly getting light (ramp 'energy' mode)
or shader information (ramp 'shader' mode, which depends on lighting)
is not possible. Which all means that when the ramp is in 'energy' or
'shader' mode and using it with GI enabled, yafray can only 'see' the
underlying material color, not the ramps, which results in a mix of the
ramp colors (from direct light) with the material color (from indirect light).
There is currently nothing that can be done about that.
The supported texture mapping modes now includes raymir as well, transparency
as far as texturing is concerned now works similar to Blender, with the
exception that you still have to set alpha to a low value to get any
transparency effect at all in yafray. So the Blender 'filter' parameter
now also will affect yafray.
All texture blending modes are now supported (same for ramps).
'Translu' and 'Amb' texture modulation are not supported.
Texture interpolation can be switched off ('InterPol' switch in blender
image texture button section).
All Blender brdf models (aka 'shaders' for the Blender users) are now supported,
and again, you won't necessarily get the same results as in Blender.
The reason for that is partially of course the lighting differences, but also,
not all Blender 'shader' implementations are actually correct, and copying
those errors just for the sake of matching Blender results doesn't really
seem like a good idea...
Though this really is only the case for WardIso, less so for Minnaert and
Blinn, which in yafray are more or less (but not totally) a copy of
the Blender code.
In any case, in practice those differences might not be
too noticable at all (I hope).
Continue to the next part...
2005-05-21 20:49:24 +00:00
|
|
|
lparams.clear();
|
2004-11-14 04:30:28 +00:00
|
|
|
params.clear();
|
|
|
|
params["name"] = yafray::parameter_t(imgtex->first->id.name);
|
|
|
|
params["type"] = yafray::parameter_t("image");
|
|
|
|
string texpath(imgtex->first->name);
|
|
|
|
adjustPath(texpath);
|
|
|
|
params["filename"] = yafray::parameter_t(texpath);
|
|
|
|
yafrayGate->addShader(params, lparams);
|
|
|
|
}
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
void yafrayPluginRender_t::writeShader(const string &shader_name, Material* matr, const string &facetexname)
|
|
|
|
{
|
|
|
|
yafray::paramMap_t params;
|
Part one of the final yafray commit.
Totally updated blender shader in yafray, hopefully better matches blender
results. Though ramps are now partially supported, they cannot work in all
cases properly in yafray, and in fact are a bit useless probably as far as
yafray is concerned. In fact the 'Result' ramp input mode is not supported
at all, because it works on the total lighting result, and in a yafray
shader this is not possible since it works per light.
Also, since Blender and Yafray have totally different lighting models,
the 'Energy' ramp input mode also won't generally give the same results
as in Blender, since it works with light energy and in yafray this is
different from Blender. Even worse, the only ramp shader that will work
properly when used with GI is the 'Normal' ramp input mode.
As contradictory as this might seem, at various stages of the GI process,
lighting is not known, so properly getting light (ramp 'energy' mode)
or shader information (ramp 'shader' mode, which depends on lighting)
is not possible. Which all means that when the ramp is in 'energy' or
'shader' mode and using it with GI enabled, yafray can only 'see' the
underlying material color, not the ramps, which results in a mix of the
ramp colors (from direct light) with the material color (from indirect light).
There is currently nothing that can be done about that.
The supported texture mapping modes now includes raymir as well, transparency
as far as texturing is concerned now works similar to Blender, with the
exception that you still have to set alpha to a low value to get any
transparency effect at all in yafray. So the Blender 'filter' parameter
now also will affect yafray.
All texture blending modes are now supported (same for ramps).
'Translu' and 'Amb' texture modulation are not supported.
Texture interpolation can be switched off ('InterPol' switch in blender
image texture button section).
All Blender brdf models (aka 'shaders' for the Blender users) are now supported,
and again, you won't necessarily get the same results as in Blender.
The reason for that is partially of course the lighting differences, but also,
not all Blender 'shader' implementations are actually correct, and copying
those errors just for the sake of matching Blender results doesn't really
seem like a good idea...
Though this really is only the case for WardIso, less so for Minnaert and
Blinn, which in yafray are more or less (but not totally) a copy of
the Blender code.
In any case, in practice those differences might not be
too noticable at all (I hope).
Continue to the next part...
2005-05-21 20:49:24 +00:00
|
|
|
list<yafray::paramMap_t> lparams;
|
|
|
|
|
|
|
|
// if material has ramps, export colorbands first
|
|
|
|
if (matr->mode & (MA_RAMP_COL|MA_RAMP_SPEC))
|
|
|
|
{
|
|
|
|
// both colorbands without input shader
|
|
|
|
ColorBand* cb = matr->ramp_col;
|
|
|
|
if ((matr->mode & MA_RAMP_COL) && (cb!=NULL))
|
|
|
|
{
|
|
|
|
params["type"] = yafray::parameter_t("colorband");
|
|
|
|
params["name"] = yafray::parameter_t(shader_name+"_difframp");
|
|
|
|
for (int i=0;i<cb->tot;i++) {
|
|
|
|
yafray::paramMap_t mparams;
|
|
|
|
mparams["value"] = yafray::parameter_t(cb->data[i].pos);
|
|
|
|
mparams["color"] = yafray::parameter_t(yafray::colorA_t(cb->data[i].r, cb->data[i].g, cb->data[i].b, cb->data[i].a));
|
|
|
|
lparams.push_back(mparams);
|
|
|
|
}
|
|
|
|
yafrayGate->addShader(params, lparams);
|
|
|
|
}
|
|
|
|
cb = matr->ramp_spec;
|
|
|
|
if ((matr->mode & MA_RAMP_SPEC) && (cb!=NULL))
|
|
|
|
{
|
|
|
|
lparams.clear();
|
|
|
|
params.clear();
|
|
|
|
params["type"] = yafray::parameter_t("colorband");
|
|
|
|
params["name"] = yafray::parameter_t(shader_name+"_specramp");
|
|
|
|
for (int i=0;i<cb->tot;i++) {
|
|
|
|
yafray::paramMap_t mparams;
|
|
|
|
mparams["value"] = yafray::parameter_t(cb->data[i].pos);
|
|
|
|
mparams["color"] = yafray::parameter_t(yafray::colorA_t(cb->data[i].r, cb->data[i].g, cb->data[i].b, cb->data[i].a));
|
|
|
|
lparams.push_back(mparams);
|
|
|
|
}
|
|
|
|
yafrayGate->addShader(params, lparams);
|
|
|
|
}
|
|
|
|
lparams.clear();
|
|
|
|
params.clear();
|
|
|
|
}
|
|
|
|
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
params["type"] = yafray::parameter_t("blendershader");
|
|
|
|
params["name"] = yafray::parameter_t(shader_name);
|
Second and final commit for this version of the yafray export code (probably, you never know
of course...)
Not quite complete, but due to lack of time as good as it will get for now.
From the previous commit, forgot to report that basic fog is supported as well. Though because I had not much time to complete the code, it is sort of unfinished, and you will have
to tweak parameters specifically for yafray again. It uses only the world horizon color, and
only uses the Blender mist distance setting.
Textures now support checker clip mode.
Fixed possibly all 'duplilist non-empty' errors, though it could hide the real cause of the
error.
AA is no longer enabled automatically for certain GI quality settings, I thought it best to
leave it to the user to decide.
SkyDome GI mode now supports cache as well. There is a new option in the GI quality menu 'Use
Blender AO settings', which will as it says use the most important AO settings for the
skydome parameters. The only AO parameters used are 'Samples', 'Dist' and the random sampling
switch, which unlike in Blender you might want to use more often, since the QMC sampling used
in yafray can result in visible patterns or a dithering type look. 'Random' is not completely
random in yafray however, it is actually jittered (stratified) sampling.
Using an occlusion cache, doesn't necessarily mean that you will always get much shorter
render times. As with 'full' GI and cache, one problem is bumpmaps, when using bump (or
normal) maps, the sampling will be much more dense, using lots more rendertime.
As a temporary fix there is a button 'NoBump', but this also has the side effect that in
areas of total indirect light (or when used with SkyDome cache) no bumpmapping will be
visible. It is therefor best used with some direct light as well.
For SkyDome with cache, and strong bumpmapping it might actually not make much difference,
since for low distance values you can usually get away with low sample values as well.
The entire material panel is now replaced by another panel to show only the parameters
important to yafray and add some new ones as well.
Since lots of users (especially yafray beginners) have had problems getting certain material
aspects right, there is now a material preset menu available to hopefully solve some of the
most common "How do I do this? It doesn't work!" questions seen in various forums.
Choosing an option from this menu will set the required parameters to default
values for yafray, and you can work your way from there to tweak it something you want.
Most buttons are copies of the same Blender parameters, with some variations. Just like
Blender 'Ray Mirror' enables reflection, 'Ray Transp' enables refraction. You can use
'ZTransp' for materials that have texture maps with alpha channels.
Again, same as Blender 'rayMir' sets the amount of reflection. Next button 'frsOfs' however
controls fresnel offset, meaning that when this is set to 1, you will get no fresnel effect
and when set to 5, reflection is totally determined by fresnel, which is important for
realistic glass/metals/etc.
IOR is self-explanatory (...), same as Blender.
When you have 'Ray Transp' enabled, the blender 'filter' button will appear next to the IOR
button. This has the same effect as in Blender.
Below that there are some new parameters, 'Ext.Color' sets the extinction color for
transparent materials. Usually, in real transparent materials, light loses some of it's
energy the further it has to travel through the object. This effect can be simulated with
this parameter. Thing to look out for is that it specifies the color which will be
REMOVED after traveling through the object. What this means is that say you have a clear
white glass sphere, and set the extinction color to a strong blue, the result will be a
very yellow object when rendered.
Next to the color sliders, there is another set of three parameters, with which you can
enable color dispersion for transparent objects. 'Pwr' sets the amount of dispersion,
the higher, the more dispersion (the more colorful the result).
(For real world materials, this number can be found or derived from data in various glass catalogues)
The 'Samples' button below that sets the number of samples used, minimum values are around
7-10, and for very strong dispersion you might need a lot more.
As usual, this also means an increase in render time of course, but to simulate
realistic materials, you shouldn't really need more than 25 samples.
In addition to that, when using low sample numbers, but to still get a good spread of colors,
you can enable the jitter button, but this will also add noise.
Point/soft(point with shadowbuffer) or sphere lights (light with radius), have a new option
to add a simple glow effect, so that lights can be made visible.
NOTE: just like spotlight halo's, glow is not visible against the background, there must be
another object behind it. Simplest solution is to use a large black shadeless plane behind
your scene.
The glow intensity can be set with the 'GlowInt' parameter (use very low values around 0.01
even lower), and you can choose from two different types with the 'GlowType' button (which
don't look much different, but type 1 is probably better, type 0 faster).
And that's it, with apologies for the still missing features and
full support in general, but this will have to do for now.
2005-05-22 22:46:17 +00:00
|
|
|
params["color"] = yafray::parameter_t(yafray::color_t(matr->r, matr->g, matr->b));
|
Some small modifications.
Absorption and Dispersion parameters now only visible when 'Ray Transp'
enabled. WardIso specular amount scale to match Blender output.
Updated halo spotlight 'samples' to use new yafray syntax.
Quick addition for access to another yafray feature:
When using HDR backgrounds for lighting ('SkyDome' of 'Full' GI methods),
it is currently not always possible to get smooth lighting results.
Especially HDR images with small lightsource can be very noisy,
because currently yafray still relies on brute force random sampling.
As a temporary simple solution (better options will be available in the
'next generation' yafray), yafray can do some processing on the
image to smooth out all (or most) noise.
Besides smooth lighting, this also has
the advantage that AA will have less work to do,
GI quality can be set to the lowest level and still get reasonably
good results. Disadvantage however is that shadow definition is lost.
To switch on this option, set the world image texture filter parameter
to any value greater than 1.0
When 'filter' is 1.0 or less, normal hdr sampling is done as before.
So, current fastest possible render settings for IBL:
set texture image filter parameter of the background image to any value
greater than 1.0, set GI to 'SkyDome' type, enable 'Cache',
(possibly enable 'NoBump' when scene uses lots of bumpmapping),
set 'Quality' menu to 'Use Blender AO settings',
make sure AO is enabled in blender World buttons and set there the number
of AO samples to 1.
Should at least be good enough for previews.
2005-06-10 00:12:42 +00:00
|
|
|
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));
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
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);
|
|
|
|
params["alpha"] = yafray::parameter_t(matr->alpha);
|
|
|
|
|
|
|
|
// if no GI used, the GIpower parameter is not always initialized, so in that case ignore it
|
|
|
|
float bg_mult = (R.r.GImethod==0) ? 1 : R.r.GIpower;
|
|
|
|
params["emit"]=yafray::parameter_t(matr->emit*bg_mult);
|
|
|
|
|
|
|
|
// reflection/refraction
|
|
|
|
if ( (matr->mode & MA_RAYMIRROR) || (matr->mode & MA_RAYTRANSP) )
|
|
|
|
params["IOR"] = yafray::parameter_t(matr->ang);
|
Added some backward compatibility with old yafray blendershader. Because of missing
parameters the material preset menu won't be as useful. Both glass presets will look the same
because there is no 'filter' parameter in the old yafray for instance.
So using the new Blender version with an old yafray version should work a bit better,
though the other way around, using the new yafray with an old blender version, will generally
not work as well.
I added a few extra things. In 'yafray' panel re-arranged some buttons, and added a new
button 'Clamp RGB'. This button will be enabled by default and helps to improve AA on
high contrast edges in the image. When using bokeh however, it is best to switch this off,
otherwise lens shaped highlights will be quite a bit less visible.
Changed the 'extinction' parameter name to the probably more correct term 'absorption',
though mathematically it works out the same. Also changed the behaviour of this color,
it no longer specifies a color that will be removed as I wrote in the previous commit,
but instead the actual color at one (blender) unit of distance. The 'Ds' (distance scale)
button below the color sliders controls the scaling of this unit distance.
What this means is that if you take the standard blender cube, which covers two units of
distance by default, setting the distance scale button to 2.0 will make sure that the color
you specified is exactly that color at that distance (provided the base color itself is white
of course, or 'filter' is 0, otherwise it will be filtered by the base color too).
Beyond this distance the color will get darker.
The glow option for point/soft/sphere lights has a new parameter 'GloOfs', or glow offset.
Setting this to a higher value then 0 will soften the central peak of the glow.
Another unreported bug fix: For xml export, when yafray failed to render the xml file
for some unknown reason, or because of other problems, the export code would still load
the previously rendered image, this causes problems however if the image resolution is
not the same as the current Blender buffer, and so could cause memory corruption or crashes.
This is now taken into account.
World image backgrounds now use the blender mapping settings as well, but only the
'AngMap', 'Sphere' and 'Tube' settings. But in yafray those last two, unlike Blender, cover
the whole view, not just the upper half, so is not really fully compatible with yafray.
So now you have to set one of these buttons too when loading a hdr lightprobe image.
btw, something I forgot to mention in previous commits is that the exposure control using
the texture brightness slider is no longer restricted to integer values. It is now a
floating point value, so you're not restricted to the 0 1 and 2 slider positions anymore,
anything in between will work too.
And finally, display updating is now more like Blender, using the mouse cursor as frame
counter for animation, etc.
2005-05-27 17:52:53 +00:00
|
|
|
|
Part one of the final yafray commit.
Totally updated blender shader in yafray, hopefully better matches blender
results. Though ramps are now partially supported, they cannot work in all
cases properly in yafray, and in fact are a bit useless probably as far as
yafray is concerned. In fact the 'Result' ramp input mode is not supported
at all, because it works on the total lighting result, and in a yafray
shader this is not possible since it works per light.
Also, since Blender and Yafray have totally different lighting models,
the 'Energy' ramp input mode also won't generally give the same results
as in Blender, since it works with light energy and in yafray this is
different from Blender. Even worse, the only ramp shader that will work
properly when used with GI is the 'Normal' ramp input mode.
As contradictory as this might seem, at various stages of the GI process,
lighting is not known, so properly getting light (ramp 'energy' mode)
or shader information (ramp 'shader' mode, which depends on lighting)
is not possible. Which all means that when the ramp is in 'energy' or
'shader' mode and using it with GI enabled, yafray can only 'see' the
underlying material color, not the ramps, which results in a mix of the
ramp colors (from direct light) with the material color (from indirect light).
There is currently nothing that can be done about that.
The supported texture mapping modes now includes raymir as well, transparency
as far as texturing is concerned now works similar to Blender, with the
exception that you still have to set alpha to a low value to get any
transparency effect at all in yafray. So the Blender 'filter' parameter
now also will affect yafray.
All texture blending modes are now supported (same for ramps).
'Translu' and 'Amb' texture modulation are not supported.
Texture interpolation can be switched off ('InterPol' switch in blender
image texture button section).
All Blender brdf models (aka 'shaders' for the Blender users) are now supported,
and again, you won't necessarily get the same results as in Blender.
The reason for that is partially of course the lighting differences, but also,
not all Blender 'shader' implementations are actually correct, and copying
those errors just for the sake of matching Blender results doesn't really
seem like a good idea...
Though this really is only the case for WardIso, less so for Minnaert and
Blinn, which in yafray are more or less (but not totally) a copy of
the Blender code.
In any case, in practice those differences might not be
too noticable at all (I hope).
Continue to the next part...
2005-05-21 20:49:24 +00:00
|
|
|
if (matr->mode & MA_RAYMIRROR)
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
{
|
Part one of the final yafray commit.
Totally updated blender shader in yafray, hopefully better matches blender
results. Though ramps are now partially supported, they cannot work in all
cases properly in yafray, and in fact are a bit useless probably as far as
yafray is concerned. In fact the 'Result' ramp input mode is not supported
at all, because it works on the total lighting result, and in a yafray
shader this is not possible since it works per light.
Also, since Blender and Yafray have totally different lighting models,
the 'Energy' ramp input mode also won't generally give the same results
as in Blender, since it works with light energy and in yafray this is
different from Blender. Even worse, the only ramp shader that will work
properly when used with GI is the 'Normal' ramp input mode.
As contradictory as this might seem, at various stages of the GI process,
lighting is not known, so properly getting light (ramp 'energy' mode)
or shader information (ramp 'shader' mode, which depends on lighting)
is not possible. Which all means that when the ramp is in 'energy' or
'shader' mode and using it with GI enabled, yafray can only 'see' the
underlying material color, not the ramps, which results in a mix of the
ramp colors (from direct light) with the material color (from indirect light).
There is currently nothing that can be done about that.
The supported texture mapping modes now includes raymir as well, transparency
as far as texturing is concerned now works similar to Blender, with the
exception that you still have to set alpha to a low value to get any
transparency effect at all in yafray. So the Blender 'filter' parameter
now also will affect yafray.
All texture blending modes are now supported (same for ramps).
'Translu' and 'Amb' texture modulation are not supported.
Texture interpolation can be switched off ('InterPol' switch in blender
image texture button section).
All Blender brdf models (aka 'shaders' for the Blender users) are now supported,
and again, you won't necessarily get the same results as in Blender.
The reason for that is partially of course the lighting differences, but also,
not all Blender 'shader' implementations are actually correct, and copying
those errors just for the sake of matching Blender results doesn't really
seem like a good idea...
Though this really is only the case for WardIso, less so for Minnaert and
Blinn, which in yafray are more or less (but not totally) a copy of
the Blender code.
In any case, in practice those differences might not be
too noticable at all (I hope).
Continue to the next part...
2005-05-21 20:49:24 +00:00
|
|
|
// 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
|
Second and final commit for this version of the yafray export code (probably, you never know
of course...)
Not quite complete, but due to lack of time as good as it will get for now.
From the previous commit, forgot to report that basic fog is supported as well. Though because I had not much time to complete the code, it is sort of unfinished, and you will have
to tweak parameters specifically for yafray again. It uses only the world horizon color, and
only uses the Blender mist distance setting.
Textures now support checker clip mode.
Fixed possibly all 'duplilist non-empty' errors, though it could hide the real cause of the
error.
AA is no longer enabled automatically for certain GI quality settings, I thought it best to
leave it to the user to decide.
SkyDome GI mode now supports cache as well. There is a new option in the GI quality menu 'Use
Blender AO settings', which will as it says use the most important AO settings for the
skydome parameters. The only AO parameters used are 'Samples', 'Dist' and the random sampling
switch, which unlike in Blender you might want to use more often, since the QMC sampling used
in yafray can result in visible patterns or a dithering type look. 'Random' is not completely
random in yafray however, it is actually jittered (stratified) sampling.
Using an occlusion cache, doesn't necessarily mean that you will always get much shorter
render times. As with 'full' GI and cache, one problem is bumpmaps, when using bump (or
normal) maps, the sampling will be much more dense, using lots more rendertime.
As a temporary fix there is a button 'NoBump', but this also has the side effect that in
areas of total indirect light (or when used with SkyDome cache) no bumpmapping will be
visible. It is therefor best used with some direct light as well.
For SkyDome with cache, and strong bumpmapping it might actually not make much difference,
since for low distance values you can usually get away with low sample values as well.
The entire material panel is now replaced by another panel to show only the parameters
important to yafray and add some new ones as well.
Since lots of users (especially yafray beginners) have had problems getting certain material
aspects right, there is now a material preset menu available to hopefully solve some of the
most common "How do I do this? It doesn't work!" questions seen in various forums.
Choosing an option from this menu will set the required parameters to default
values for yafray, and you can work your way from there to tweak it something you want.
Most buttons are copies of the same Blender parameters, with some variations. Just like
Blender 'Ray Mirror' enables reflection, 'Ray Transp' enables refraction. You can use
'ZTransp' for materials that have texture maps with alpha channels.
Again, same as Blender 'rayMir' sets the amount of reflection. Next button 'frsOfs' however
controls fresnel offset, meaning that when this is set to 1, you will get no fresnel effect
and when set to 5, reflection is totally determined by fresnel, which is important for
realistic glass/metals/etc.
IOR is self-explanatory (...), same as Blender.
When you have 'Ray Transp' enabled, the blender 'filter' button will appear next to the IOR
button. This has the same effect as in Blender.
Below that there are some new parameters, 'Ext.Color' sets the extinction color for
transparent materials. Usually, in real transparent materials, light loses some of it's
energy the further it has to travel through the object. This effect can be simulated with
this parameter. Thing to look out for is that it specifies the color which will be
REMOVED after traveling through the object. What this means is that say you have a clear
white glass sphere, and set the extinction color to a strong blue, the result will be a
very yellow object when rendered.
Next to the color sliders, there is another set of three parameters, with which you can
enable color dispersion for transparent objects. 'Pwr' sets the amount of dispersion,
the higher, the more dispersion (the more colorful the result).
(For real world materials, this number can be found or derived from data in various glass catalogues)
The 'Samples' button below that sets the number of samples used, minimum values are around
7-10, and for very strong dispersion you might need a lot more.
As usual, this also means an increase in render time of course, but to simulate
realistic materials, you shouldn't really need more than 25 samples.
In addition to that, when using low sample numbers, but to still get a good spread of colors,
you can enable the jitter button, but this will also add noise.
Point/soft(point with shadowbuffer) or sphere lights (light with radius), have a new option
to add a simple glow effect, so that lights can be made visible.
NOTE: just like spotlight halo's, glow is not visible against the background, there must be
another object behind it. Simplest solution is to use a large black shadeless plane behind
your scene.
The glow intensity can be set with the 'GlowInt' parameter (use very low values around 0.01
even lower), and you can choose from two different types with the 'GlowType' button (which
don't look much different, but type 1 is probably better, type 0 faster).
And that's it, with apologies for the still missing features and
full support in general, but this will have to do for now.
2005-05-22 22:46:17 +00:00
|
|
|
// extra parameter 'frsOfs' to actually control fresnel offset (re-uses Blender fresnel_mir_i param).
|
Part one of the final yafray commit.
Totally updated blender shader in yafray, hopefully better matches blender
results. Though ramps are now partially supported, they cannot work in all
cases properly in yafray, and in fact are a bit useless probably as far as
yafray is concerned. In fact the 'Result' ramp input mode is not supported
at all, because it works on the total lighting result, and in a yafray
shader this is not possible since it works per light.
Also, since Blender and Yafray have totally different lighting models,
the 'Energy' ramp input mode also won't generally give the same results
as in Blender, since it works with light energy and in yafray this is
different from Blender. Even worse, the only ramp shader that will work
properly when used with GI is the 'Normal' ramp input mode.
As contradictory as this might seem, at various stages of the GI process,
lighting is not known, so properly getting light (ramp 'energy' mode)
or shader information (ramp 'shader' mode, which depends on lighting)
is not possible. Which all means that when the ramp is in 'energy' or
'shader' mode and using it with GI enabled, yafray can only 'see' the
underlying material color, not the ramps, which results in a mix of the
ramp colors (from direct light) with the material color (from indirect light).
There is currently nothing that can be done about that.
The supported texture mapping modes now includes raymir as well, transparency
as far as texturing is concerned now works similar to Blender, with the
exception that you still have to set alpha to a low value to get any
transparency effect at all in yafray. So the Blender 'filter' parameter
now also will affect yafray.
All texture blending modes are now supported (same for ramps).
'Translu' and 'Amb' texture modulation are not supported.
Texture interpolation can be switched off ('InterPol' switch in blender
image texture button section).
All Blender brdf models (aka 'shaders' for the Blender users) are now supported,
and again, you won't necessarily get the same results as in Blender.
The reason for that is partially of course the lighting differences, but also,
not all Blender 'shader' implementations are actually correct, and copying
those errors just for the sake of matching Blender results doesn't really
seem like a good idea...
Though this really is only the case for WardIso, less so for Minnaert and
Blinn, which in yafray are more or less (but not totally) a copy of
the Blender code.
In any case, in practice those differences might not be
too noticable at all (I hope).
Continue to the next part...
2005-05-21 20:49:24 +00:00
|
|
|
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);
|
Added some backward compatibility with old yafray blendershader. Because of missing
parameters the material preset menu won't be as useful. Both glass presets will look the same
because there is no 'filter' parameter in the old yafray for instance.
So using the new Blender version with an old yafray version should work a bit better,
though the other way around, using the new yafray with an old blender version, will generally
not work as well.
I added a few extra things. In 'yafray' panel re-arranged some buttons, and added a new
button 'Clamp RGB'. This button will be enabled by default and helps to improve AA on
high contrast edges in the image. When using bokeh however, it is best to switch this off,
otherwise lens shaped highlights will be quite a bit less visible.
Changed the 'extinction' parameter name to the probably more correct term 'absorption',
though mathematically it works out the same. Also changed the behaviour of this color,
it no longer specifies a color that will be removed as I wrote in the previous commit,
but instead the actual color at one (blender) unit of distance. The 'Ds' (distance scale)
button below the color sliders controls the scaling of this unit distance.
What this means is that if you take the standard blender cube, which covers two units of
distance by default, setting the distance scale button to 2.0 will make sure that the color
you specified is exactly that color at that distance (provided the base color itself is white
of course, or 'filter' is 0, otherwise it will be filtered by the base color too).
Beyond this distance the color will get darker.
The glow option for point/soft/sphere lights has a new parameter 'GloOfs', or glow offset.
Setting this to a higher value then 0 will soften the central peak of the glow.
Another unreported bug fix: For xml export, when yafray failed to render the xml file
for some unknown reason, or because of other problems, the export code would still load
the previously rendered image, this causes problems however if the image resolution is
not the same as the current Blender buffer, and so could cause memory corruption or crashes.
This is now taken into account.
World image backgrounds now use the blender mapping settings as well, but only the
'AngMap', 'Sphere' and 'Tube' settings. But in yafray those last two, unlike Blender, cover
the whole view, not just the upper half, so is not really fully compatible with yafray.
So now you have to set one of these buttons too when loading a hdr lightprobe image.
btw, something I forgot to mention in previous commits is that the exposure control using
the texture brightness slider is no longer restricted to integer values. It is now a
floating point value, so you're not restricted to the 0 1 and 2 slider positions anymore,
anything in between will work too.
And finally, display updating is now more like Blender, using the mouse cursor as frame
counter for animation, etc.
2005-05-27 17:52:53 +00:00
|
|
|
|
|
|
|
// for backward compatibility, also add old 'reflected' parameter, copy of mirror_color
|
|
|
|
params["reflected"] = yafray::parameter_t(yafray::color_t(matr->mirr, matr->mirg, matr->mirb));
|
|
|
|
// same for 'min_refle' param. Instead of the ray_mirror parameter that was used before, since now
|
|
|
|
// the parameter's function is taken over by the fresnel offset parameter, use that instead.
|
|
|
|
params["min_refle"] = yafray::parameter_t(fo);
|
|
|
|
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
}
|
Added some backward compatibility with old yafray blendershader. Because of missing
parameters the material preset menu won't be as useful. Both glass presets will look the same
because there is no 'filter' parameter in the old yafray for instance.
So using the new Blender version with an old yafray version should work a bit better,
though the other way around, using the new yafray with an old blender version, will generally
not work as well.
I added a few extra things. In 'yafray' panel re-arranged some buttons, and added a new
button 'Clamp RGB'. This button will be enabled by default and helps to improve AA on
high contrast edges in the image. When using bokeh however, it is best to switch this off,
otherwise lens shaped highlights will be quite a bit less visible.
Changed the 'extinction' parameter name to the probably more correct term 'absorption',
though mathematically it works out the same. Also changed the behaviour of this color,
it no longer specifies a color that will be removed as I wrote in the previous commit,
but instead the actual color at one (blender) unit of distance. The 'Ds' (distance scale)
button below the color sliders controls the scaling of this unit distance.
What this means is that if you take the standard blender cube, which covers two units of
distance by default, setting the distance scale button to 2.0 will make sure that the color
you specified is exactly that color at that distance (provided the base color itself is white
of course, or 'filter' is 0, otherwise it will be filtered by the base color too).
Beyond this distance the color will get darker.
The glow option for point/soft/sphere lights has a new parameter 'GloOfs', or glow offset.
Setting this to a higher value then 0 will soften the central peak of the glow.
Another unreported bug fix: For xml export, when yafray failed to render the xml file
for some unknown reason, or because of other problems, the export code would still load
the previously rendered image, this causes problems however if the image resolution is
not the same as the current Blender buffer, and so could cause memory corruption or crashes.
This is now taken into account.
World image backgrounds now use the blender mapping settings as well, but only the
'AngMap', 'Sphere' and 'Tube' settings. But in yafray those last two, unlike Blender, cover
the whole view, not just the upper half, so is not really fully compatible with yafray.
So now you have to set one of these buttons too when loading a hdr lightprobe image.
btw, something I forgot to mention in previous commits is that the exposure control using
the texture brightness slider is no longer restricted to integer values. It is now a
floating point value, so you're not restricted to the 0 1 and 2 slider positions anymore,
anything in between will work too.
And finally, display updating is now more like Blender, using the mouse cursor as frame
counter for animation, etc.
2005-05-27 17:52:53 +00:00
|
|
|
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
if (matr->mode & MA_RAYTRANSP)
|
|
|
|
{
|
Part one of the final yafray commit.
Totally updated blender shader in yafray, hopefully better matches blender
results. Though ramps are now partially supported, they cannot work in all
cases properly in yafray, and in fact are a bit useless probably as far as
yafray is concerned. In fact the 'Result' ramp input mode is not supported
at all, because it works on the total lighting result, and in a yafray
shader this is not possible since it works per light.
Also, since Blender and Yafray have totally different lighting models,
the 'Energy' ramp input mode also won't generally give the same results
as in Blender, since it works with light energy and in yafray this is
different from Blender. Even worse, the only ramp shader that will work
properly when used with GI is the 'Normal' ramp input mode.
As contradictory as this might seem, at various stages of the GI process,
lighting is not known, so properly getting light (ramp 'energy' mode)
or shader information (ramp 'shader' mode, which depends on lighting)
is not possible. Which all means that when the ramp is in 'energy' or
'shader' mode and using it with GI enabled, yafray can only 'see' the
underlying material color, not the ramps, which results in a mix of the
ramp colors (from direct light) with the material color (from indirect light).
There is currently nothing that can be done about that.
The supported texture mapping modes now includes raymir as well, transparency
as far as texturing is concerned now works similar to Blender, with the
exception that you still have to set alpha to a low value to get any
transparency effect at all in yafray. So the Blender 'filter' parameter
now also will affect yafray.
All texture blending modes are now supported (same for ramps).
'Translu' and 'Amb' texture modulation are not supported.
Texture interpolation can be switched off ('InterPol' switch in blender
image texture button section).
All Blender brdf models (aka 'shaders' for the Blender users) are now supported,
and again, you won't necessarily get the same results as in Blender.
The reason for that is partially of course the lighting differences, but also,
not all Blender 'shader' implementations are actually correct, and copying
those errors just for the sake of matching Blender results doesn't really
seem like a good idea...
Though this really is only the case for WardIso, less so for Minnaert and
Blinn, which in yafray are more or less (but not totally) a copy of
the Blender code.
In any case, in practice those differences might not be
too noticable at all (I hope).
Continue to the next part...
2005-05-21 20:49:24 +00:00
|
|
|
params["refract"] = yafray::parameter_t("on");
|
|
|
|
params["transmit_filter"] = yafray::parameter_t(matr->filter);
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
// tir on by default
|
|
|
|
params["tir"] = yafray::parameter_t("on");
|
2005-05-30 08:11:46 +00:00
|
|
|
|
|
|
|
// transmit absorption color
|
|
|
|
// to make things easier(?) for user it now specifies the actual color at 1 unit / YF_dscale of distance
|
|
|
|
const float maxlog = -log(1e-38);
|
|
|
|
float ar = (matr->YF_ar>0) ? -log(matr->YF_ar) : maxlog;
|
|
|
|
float ag = (matr->YF_ag>0) ? -log(matr->YF_ag) : maxlog;
|
|
|
|
float ab = (matr->YF_ab>0) ? -log(matr->YF_ab) : maxlog;
|
|
|
|
float sc = matr->YF_dscale;
|
|
|
|
if (sc!=0.f) sc=1.f/sc;
|
|
|
|
params["absorption"] = yafray::parameter_t(yafray::color_t(ar*sc, ag*sc, ab*sc));
|
|
|
|
// 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");
|
|
|
|
|
Added some backward compatibility with old yafray blendershader. Because of missing
parameters the material preset menu won't be as useful. Both glass presets will look the same
because there is no 'filter' parameter in the old yafray for instance.
So using the new Blender version with an old yafray version should work a bit better,
though the other way around, using the new yafray with an old blender version, will generally
not work as well.
I added a few extra things. In 'yafray' panel re-arranged some buttons, and added a new
button 'Clamp RGB'. This button will be enabled by default and helps to improve AA on
high contrast edges in the image. When using bokeh however, it is best to switch this off,
otherwise lens shaped highlights will be quite a bit less visible.
Changed the 'extinction' parameter name to the probably more correct term 'absorption',
though mathematically it works out the same. Also changed the behaviour of this color,
it no longer specifies a color that will be removed as I wrote in the previous commit,
but instead the actual color at one (blender) unit of distance. The 'Ds' (distance scale)
button below the color sliders controls the scaling of this unit distance.
What this means is that if you take the standard blender cube, which covers two units of
distance by default, setting the distance scale button to 2.0 will make sure that the color
you specified is exactly that color at that distance (provided the base color itself is white
of course, or 'filter' is 0, otherwise it will be filtered by the base color too).
Beyond this distance the color will get darker.
The glow option for point/soft/sphere lights has a new parameter 'GloOfs', or glow offset.
Setting this to a higher value then 0 will soften the central peak of the glow.
Another unreported bug fix: For xml export, when yafray failed to render the xml file
for some unknown reason, or because of other problems, the export code would still load
the previously rendered image, this causes problems however if the image resolution is
not the same as the current Blender buffer, and so could cause memory corruption or crashes.
This is now taken into account.
World image backgrounds now use the blender mapping settings as well, but only the
'AngMap', 'Sphere' and 'Tube' settings. But in yafray those last two, unlike Blender, cover
the whole view, not just the upper half, so is not really fully compatible with yafray.
So now you have to set one of these buttons too when loading a hdr lightprobe image.
btw, something I forgot to mention in previous commits is that the exposure control using
the texture brightness slider is no longer restricted to integer values. It is now a
floating point value, so you're not restricted to the 0 1 and 2 slider positions anymore,
anything in between will work too.
And finally, display updating is now more like Blender, using the mouse cursor as frame
counter for animation, etc.
2005-05-27 17:52:53 +00:00
|
|
|
// for backward compatibility, also add old 'transmitted' parameter, copy of 'color' * (1-alpha)
|
|
|
|
float na = 1.f-matr->alpha;
|
|
|
|
params["transmitted"] = yafray::parameter_t(yafray::color_t(matr->r*na, matr->g*na, matr->b*na));
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
string Mmode = "";
|
|
|
|
if (matr->mode & MA_TRACEBLE) Mmode += "traceable";
|
|
|
|
if (matr->mode & MA_SHADOW) Mmode += " shadow";
|
|
|
|
if (matr->mode & MA_SHLESS) Mmode += " shadeless";
|
|
|
|
if (matr->mode & MA_VERTEXCOL) Mmode += " vcol_light";
|
|
|
|
if (matr->mode & MA_VERTEXCOLP) Mmode += " vcol_paint";
|
|
|
|
if (matr->mode & MA_ZTRA) Mmode += " ztransp";
|
|
|
|
if (matr->mode & MA_ONLYSHADOW) Mmode += " onlyshadow";
|
|
|
|
if (Mmode!="") params["matmodes"] = yafray::parameter_t(Mmode);
|
|
|
|
|
Part one of the final yafray commit.
Totally updated blender shader in yafray, hopefully better matches blender
results. Though ramps are now partially supported, they cannot work in all
cases properly in yafray, and in fact are a bit useless probably as far as
yafray is concerned. In fact the 'Result' ramp input mode is not supported
at all, because it works on the total lighting result, and in a yafray
shader this is not possible since it works per light.
Also, since Blender and Yafray have totally different lighting models,
the 'Energy' ramp input mode also won't generally give the same results
as in Blender, since it works with light energy and in yafray this is
different from Blender. Even worse, the only ramp shader that will work
properly when used with GI is the 'Normal' ramp input mode.
As contradictory as this might seem, at various stages of the GI process,
lighting is not known, so properly getting light (ramp 'energy' mode)
or shader information (ramp 'shader' mode, which depends on lighting)
is not possible. Which all means that when the ramp is in 'energy' or
'shader' mode and using it with GI enabled, yafray can only 'see' the
underlying material color, not the ramps, which results in a mix of the
ramp colors (from direct light) with the material color (from indirect light).
There is currently nothing that can be done about that.
The supported texture mapping modes now includes raymir as well, transparency
as far as texturing is concerned now works similar to Blender, with the
exception that you still have to set alpha to a low value to get any
transparency effect at all in yafray. So the Blender 'filter' parameter
now also will affect yafray.
All texture blending modes are now supported (same for ramps).
'Translu' and 'Amb' texture modulation are not supported.
Texture interpolation can be switched off ('InterPol' switch in blender
image texture button section).
All Blender brdf models (aka 'shaders' for the Blender users) are now supported,
and again, you won't necessarily get the same results as in Blender.
The reason for that is partially of course the lighting differences, but also,
not all Blender 'shader' implementations are actually correct, and copying
those errors just for the sake of matching Blender results doesn't really
seem like a good idea...
Though this really is only the case for WardIso, less so for Minnaert and
Blinn, which in yafray are more or less (but not totally) a copy of
the Blender code.
In any case, in practice those differences might not be
too noticable at all (I hope).
Continue to the next part...
2005-05-21 20:49:24 +00:00
|
|
|
// diffuse & specular brdf, lambert/cooktorr defaults
|
|
|
|
// diffuse
|
|
|
|
if (matr->diff_shader==MA_DIFF_ORENNAYAR) {
|
|
|
|
params["diffuse_brdf"] = yafray::parameter_t("oren_nayar");
|
|
|
|
params["roughness"] = yafray::parameter_t(matr->roughness);
|
|
|
|
}
|
|
|
|
else if (matr->diff_shader==MA_DIFF_TOON) {
|
|
|
|
params["diffuse_brdf"] = yafray::parameter_t("toon");
|
|
|
|
params["toondiffuse_size"] = yafray::parameter_t(matr->param[0]);
|
|
|
|
params["toondiffuse_smooth"] = yafray::parameter_t(matr->param[1]);
|
|
|
|
}
|
|
|
|
else if (matr->diff_shader==MA_DIFF_MINNAERT) {
|
|
|
|
params["diffuse_brdf"] = yafray::parameter_t("minnaert");
|
|
|
|
params["darkening"] = yafray::parameter_t(matr->darkness);
|
|
|
|
}
|
|
|
|
else params["diffuse_brdf"] = yafray::parameter_t("lambert");
|
|
|
|
// specular
|
|
|
|
if (matr->spec_shader==MA_SPEC_PHONG) {
|
|
|
|
params["specular_brdf"] = yafray::parameter_t("phong");
|
|
|
|
params["hard"] = yafray::parameter_t(matr->har);
|
|
|
|
}
|
|
|
|
else if (matr->spec_shader==MA_SPEC_BLINN) {
|
|
|
|
params["specular_brdf"] = yafray::parameter_t("blinn");
|
|
|
|
params["blinn_ior"] = yafray::parameter_t(matr->refrac);
|
|
|
|
params["hard"] = yafray::parameter_t(matr->har);
|
|
|
|
}
|
|
|
|
else if (matr->spec_shader==MA_SPEC_TOON) {
|
|
|
|
params["specular_brdf"] = yafray::parameter_t("toon");
|
|
|
|
params["toonspecular_size"] = yafray::parameter_t(matr->param[2]);
|
|
|
|
params["toonspecular_smooth"] = yafray::parameter_t(matr->param[3]);
|
|
|
|
}
|
|
|
|
else if (matr->spec_shader==MA_SPEC_WARDISO) {
|
|
|
|
params["specular_brdf"] = yafray::parameter_t("ward");
|
|
|
|
params["u_roughness"] = yafray::parameter_t(matr->rms);
|
|
|
|
params["v_roughness"] = yafray::parameter_t(matr->rms);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
params["specular_brdf"] = yafray::parameter_t("blender_cooktorr");
|
|
|
|
params["hard"] = yafray::parameter_t(matr->har);
|
|
|
|
}
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
|
Part one of the final yafray commit.
Totally updated blender shader in yafray, hopefully better matches blender
results. Though ramps are now partially supported, they cannot work in all
cases properly in yafray, and in fact are a bit useless probably as far as
yafray is concerned. In fact the 'Result' ramp input mode is not supported
at all, because it works on the total lighting result, and in a yafray
shader this is not possible since it works per light.
Also, since Blender and Yafray have totally different lighting models,
the 'Energy' ramp input mode also won't generally give the same results
as in Blender, since it works with light energy and in yafray this is
different from Blender. Even worse, the only ramp shader that will work
properly when used with GI is the 'Normal' ramp input mode.
As contradictory as this might seem, at various stages of the GI process,
lighting is not known, so properly getting light (ramp 'energy' mode)
or shader information (ramp 'shader' mode, which depends on lighting)
is not possible. Which all means that when the ramp is in 'energy' or
'shader' mode and using it with GI enabled, yafray can only 'see' the
underlying material color, not the ramps, which results in a mix of the
ramp colors (from direct light) with the material color (from indirect light).
There is currently nothing that can be done about that.
The supported texture mapping modes now includes raymir as well, transparency
as far as texturing is concerned now works similar to Blender, with the
exception that you still have to set alpha to a low value to get any
transparency effect at all in yafray. So the Blender 'filter' parameter
now also will affect yafray.
All texture blending modes are now supported (same for ramps).
'Translu' and 'Amb' texture modulation are not supported.
Texture interpolation can be switched off ('InterPol' switch in blender
image texture button section).
All Blender brdf models (aka 'shaders' for the Blender users) are now supported,
and again, you won't necessarily get the same results as in Blender.
The reason for that is partially of course the lighting differences, but also,
not all Blender 'shader' implementations are actually correct, and copying
those errors just for the sake of matching Blender results doesn't really
seem like a good idea...
Though this really is only the case for WardIso, less so for Minnaert and
Blinn, which in yafray are more or less (but not totally) a copy of
the Blender code.
In any case, in practice those differences might not be
too noticable at all (I hope).
Continue to the next part...
2005-05-21 20:49:24 +00:00
|
|
|
// ramps, if used
|
|
|
|
if (matr->mode & (MA_RAMP_COL|MA_RAMP_SPEC))
|
|
|
|
{
|
|
|
|
const string rm_blend[9] = {"mix", "add", "mul", "sub", "screen", "divide", "difference", "darken", "lighten"};
|
|
|
|
const string rm_mode[4] = {"shader", "energy", "normal", "result"};
|
|
|
|
// diffuse
|
|
|
|
if ((matr->mode & MA_RAMP_COL) && (matr->ramp_col!=NULL))
|
|
|
|
{
|
|
|
|
params["diffuse_ramp"] = yafray::parameter_t(shader_name+"_difframp");
|
|
|
|
params["diffuse_ramp_mode"] = yafray::parameter_t(rm_mode[(int)matr->rampin_col]);
|
|
|
|
params["diffuse_ramp_blend"] = yafray::parameter_t(rm_blend[(int)matr->rampblend_col]);
|
|
|
|
params["diffuse_ramp_factor"] = yafray::parameter_t(matr->rampfac_col);
|
|
|
|
}
|
|
|
|
// specular
|
|
|
|
if ((matr->mode & MA_RAMP_SPEC) && (matr->ramp_spec!=NULL)) {
|
|
|
|
params["specular_ramp"] = yafray::parameter_t(shader_name+"_specramp");
|
|
|
|
params["specular_ramp_mode"] = yafray::parameter_t(rm_mode[(int)matr->rampin_spec]);
|
|
|
|
params["specular_ramp_blend"] = yafray::parameter_t(rm_blend[(int)matr->rampblend_spec]);
|
|
|
|
params["specular_ramp_factor"] = yafray::parameter_t(matr->rampfac_spec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// modulators
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
// first modulator is the texture of the face, if used (TexFace mode)
|
|
|
|
if (facetexname.length()!=0) {
|
|
|
|
yafray::paramMap_t mparams;
|
|
|
|
mparams["input"] = yafray::parameter_t(facetexname);
|
|
|
|
mparams["color"] = yafray::parameter_t(1);
|
|
|
|
lparams.push_back(mparams);
|
|
|
|
}
|
|
|
|
|
2004-12-05 03:51:01 +00:00
|
|
|
for (int m2=0;m2<MAX_MTEX;m2++)
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
{
|
|
|
|
if (matr->septex & (1<<m2)) continue;// all active channels
|
|
|
|
// ignore null mtex
|
|
|
|
MTex* mtex = matr->mtex[m2];
|
|
|
|
if (mtex==NULL) continue;
|
|
|
|
// ignore null tex
|
|
|
|
Tex* tex = mtex->tex;
|
|
|
|
if (tex==NULL) continue;
|
|
|
|
|
|
|
|
map<string, MTex*>::const_iterator mtexL = used_textures.find(string(tex->id.name));
|
|
|
|
if (mtexL!=used_textures.end())
|
|
|
|
{
|
|
|
|
yafray::paramMap_t mparams;
|
|
|
|
// when no facetex used, shader_name is created from original material name
|
|
|
|
char temp[32];
|
|
|
|
sprintf(temp,"_map%d", m2);
|
|
|
|
if (facetexname.length()!=0)
|
|
|
|
mparams["input"] = yafray::parameter_t(string(matr->id.name) + string(temp));
|
|
|
|
else
|
|
|
|
mparams["input"] = yafray::parameter_t(shader_name + temp);
|
Second and final commit for this version of the yafray export code (probably, you never know
of course...)
Not quite complete, but due to lack of time as good as it will get for now.
From the previous commit, forgot to report that basic fog is supported as well. Though because I had not much time to complete the code, it is sort of unfinished, and you will have
to tweak parameters specifically for yafray again. It uses only the world horizon color, and
only uses the Blender mist distance setting.
Textures now support checker clip mode.
Fixed possibly all 'duplilist non-empty' errors, though it could hide the real cause of the
error.
AA is no longer enabled automatically for certain GI quality settings, I thought it best to
leave it to the user to decide.
SkyDome GI mode now supports cache as well. There is a new option in the GI quality menu 'Use
Blender AO settings', which will as it says use the most important AO settings for the
skydome parameters. The only AO parameters used are 'Samples', 'Dist' and the random sampling
switch, which unlike in Blender you might want to use more often, since the QMC sampling used
in yafray can result in visible patterns or a dithering type look. 'Random' is not completely
random in yafray however, it is actually jittered (stratified) sampling.
Using an occlusion cache, doesn't necessarily mean that you will always get much shorter
render times. As with 'full' GI and cache, one problem is bumpmaps, when using bump (or
normal) maps, the sampling will be much more dense, using lots more rendertime.
As a temporary fix there is a button 'NoBump', but this also has the side effect that in
areas of total indirect light (or when used with SkyDome cache) no bumpmapping will be
visible. It is therefor best used with some direct light as well.
For SkyDome with cache, and strong bumpmapping it might actually not make much difference,
since for low distance values you can usually get away with low sample values as well.
The entire material panel is now replaced by another panel to show only the parameters
important to yafray and add some new ones as well.
Since lots of users (especially yafray beginners) have had problems getting certain material
aspects right, there is now a material preset menu available to hopefully solve some of the
most common "How do I do this? It doesn't work!" questions seen in various forums.
Choosing an option from this menu will set the required parameters to default
values for yafray, and you can work your way from there to tweak it something you want.
Most buttons are copies of the same Blender parameters, with some variations. Just like
Blender 'Ray Mirror' enables reflection, 'Ray Transp' enables refraction. You can use
'ZTransp' for materials that have texture maps with alpha channels.
Again, same as Blender 'rayMir' sets the amount of reflection. Next button 'frsOfs' however
controls fresnel offset, meaning that when this is set to 1, you will get no fresnel effect
and when set to 5, reflection is totally determined by fresnel, which is important for
realistic glass/metals/etc.
IOR is self-explanatory (...), same as Blender.
When you have 'Ray Transp' enabled, the blender 'filter' button will appear next to the IOR
button. This has the same effect as in Blender.
Below that there are some new parameters, 'Ext.Color' sets the extinction color for
transparent materials. Usually, in real transparent materials, light loses some of it's
energy the further it has to travel through the object. This effect can be simulated with
this parameter. Thing to look out for is that it specifies the color which will be
REMOVED after traveling through the object. What this means is that say you have a clear
white glass sphere, and set the extinction color to a strong blue, the result will be a
very yellow object when rendered.
Next to the color sliders, there is another set of three parameters, with which you can
enable color dispersion for transparent objects. 'Pwr' sets the amount of dispersion,
the higher, the more dispersion (the more colorful the result).
(For real world materials, this number can be found or derived from data in various glass catalogues)
The 'Samples' button below that sets the number of samples used, minimum values are around
7-10, and for very strong dispersion you might need a lot more.
As usual, this also means an increase in render time of course, but to simulate
realistic materials, you shouldn't really need more than 25 samples.
In addition to that, when using low sample numbers, but to still get a good spread of colors,
you can enable the jitter button, but this will also add noise.
Point/soft(point with shadowbuffer) or sphere lights (light with radius), have a new option
to add a simple glow effect, so that lights can be made visible.
NOTE: just like spotlight halo's, glow is not visible against the background, there must be
another object behind it. Simplest solution is to use a large black shadeless plane behind
your scene.
The glow intensity can be set with the 'GlowInt' parameter (use very low values around 0.01
even lower), and you can choose from two different types with the 'GlowType' button (which
don't look much different, but type 1 is probably better, type 0 faster).
And that's it, with apologies for the still missing features and
full support in general, but this will have to do for now.
2005-05-22 22:46:17 +00:00
|
|
|
|
|
|
|
// 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]);
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
|
|
|
|
// 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));
|
|
|
|
// texture contrast, brightness & color adjustment
|
|
|
|
mparams["filtercolor"]=yafray::parameter_t(yafray::color_t(tex->rfac,tex->gfac,tex->bfac));
|
|
|
|
mparams["contrast"]=yafray::parameter_t(tex->contrast);
|
|
|
|
mparams["brightness"]=yafray::parameter_t(tex->bright);
|
|
|
|
// all texture flags now are switches, having the value 1 or -1 (negative option)
|
|
|
|
// the negative option only used for the intensity modulation options.
|
|
|
|
|
|
|
|
// material (diffuse) color, amount controlled by colfac (see below)
|
|
|
|
if (mtex->mapto & MAP_COL)
|
|
|
|
mparams["color"]=yafray::parameter_t(1.0);
|
|
|
|
// bumpmapping
|
|
|
|
if ((mtex->mapto & MAP_NORM) || (mtex->maptoneg & MAP_NORM))
|
|
|
|
{
|
Added nearly full support for Blender's procedural textures, with the exception
of 'envmap', 'magic', and 'plugin' modes.
The stucci texture also is not exact match, since it cannot be fully
emulated in yafray because of implementation issues. It will work best
for low turbulence values (which is actually not taken into account
in the export code).
Also, since Blender's static noise is basically just direct random number
output, don't expect the exact same result when rendered in yafray, but in this
case that probably shouldn't be that much of a problem...
(needs yafray from cvs)
(btw, on a side note, I put this in the comments once when working on the noise
stuff for Blender, but noise is affected by the 'depth' parameter, and there
is no way to control this directly from the GUI, can only be done by temporarily
switching to 'clouds' for instance.)
2004-11-28 02:13:57 +00:00
|
|
|
// for yafray, bump factor is negated (unless tex is stucci, not affected by 'Neg')
|
|
|
|
// scaled down quite a bit
|
|
|
|
float nf = mtex->norfac;
|
|
|
|
if (tex->type!=TEX_STUCCI) nf *= -1.f;
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
if (mtex->maptoneg & MAP_NORM) nf *= -1.f;
|
|
|
|
mparams["normal"] = yafray::parameter_t(nf/60.f);
|
|
|
|
}
|
|
|
|
|
|
|
|
// all blender texture modulation as switches, either 1 or -1 (negative state of button)
|
|
|
|
// Csp, specular color modulation
|
|
|
|
if (mtex->mapto & MAP_COLSPEC)
|
Part one of the final yafray commit.
Totally updated blender shader in yafray, hopefully better matches blender
results. Though ramps are now partially supported, they cannot work in all
cases properly in yafray, and in fact are a bit useless probably as far as
yafray is concerned. In fact the 'Result' ramp input mode is not supported
at all, because it works on the total lighting result, and in a yafray
shader this is not possible since it works per light.
Also, since Blender and Yafray have totally different lighting models,
the 'Energy' ramp input mode also won't generally give the same results
as in Blender, since it works with light energy and in yafray this is
different from Blender. Even worse, the only ramp shader that will work
properly when used with GI is the 'Normal' ramp input mode.
As contradictory as this might seem, at various stages of the GI process,
lighting is not known, so properly getting light (ramp 'energy' mode)
or shader information (ramp 'shader' mode, which depends on lighting)
is not possible. Which all means that when the ramp is in 'energy' or
'shader' mode and using it with GI enabled, yafray can only 'see' the
underlying material color, not the ramps, which results in a mix of the
ramp colors (from direct light) with the material color (from indirect light).
There is currently nothing that can be done about that.
The supported texture mapping modes now includes raymir as well, transparency
as far as texturing is concerned now works similar to Blender, with the
exception that you still have to set alpha to a low value to get any
transparency effect at all in yafray. So the Blender 'filter' parameter
now also will affect yafray.
All texture blending modes are now supported (same for ramps).
'Translu' and 'Amb' texture modulation are not supported.
Texture interpolation can be switched off ('InterPol' switch in blender
image texture button section).
All Blender brdf models (aka 'shaders' for the Blender users) are now supported,
and again, you won't necessarily get the same results as in Blender.
The reason for that is partially of course the lighting differences, but also,
not all Blender 'shader' implementations are actually correct, and copying
those errors just for the sake of matching Blender results doesn't really
seem like a good idea...
Though this really is only the case for WardIso, less so for Minnaert and
Blinn, which in yafray are more or less (but not totally) a copy of
the Blender code.
In any case, in practice those differences might not be
too noticable at all (I hope).
Continue to the next part...
2005-05-21 20:49:24 +00:00
|
|
|
mparams["colspec"] = yafray::parameter_t(1.0);
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
// CMir, mirror color modulation
|
|
|
|
if (mtex->mapto & MAP_COLMIR)
|
Part one of the final yafray commit.
Totally updated blender shader in yafray, hopefully better matches blender
results. Though ramps are now partially supported, they cannot work in all
cases properly in yafray, and in fact are a bit useless probably as far as
yafray is concerned. In fact the 'Result' ramp input mode is not supported
at all, because it works on the total lighting result, and in a yafray
shader this is not possible since it works per light.
Also, since Blender and Yafray have totally different lighting models,
the 'Energy' ramp input mode also won't generally give the same results
as in Blender, since it works with light energy and in yafray this is
different from Blender. Even worse, the only ramp shader that will work
properly when used with GI is the 'Normal' ramp input mode.
As contradictory as this might seem, at various stages of the GI process,
lighting is not known, so properly getting light (ramp 'energy' mode)
or shader information (ramp 'shader' mode, which depends on lighting)
is not possible. Which all means that when the ramp is in 'energy' or
'shader' mode and using it with GI enabled, yafray can only 'see' the
underlying material color, not the ramps, which results in a mix of the
ramp colors (from direct light) with the material color (from indirect light).
There is currently nothing that can be done about that.
The supported texture mapping modes now includes raymir as well, transparency
as far as texturing is concerned now works similar to Blender, with the
exception that you still have to set alpha to a low value to get any
transparency effect at all in yafray. So the Blender 'filter' parameter
now also will affect yafray.
All texture blending modes are now supported (same for ramps).
'Translu' and 'Amb' texture modulation are not supported.
Texture interpolation can be switched off ('InterPol' switch in blender
image texture button section).
All Blender brdf models (aka 'shaders' for the Blender users) are now supported,
and again, you won't necessarily get the same results as in Blender.
The reason for that is partially of course the lighting differences, but also,
not all Blender 'shader' implementations are actually correct, and copying
those errors just for the sake of matching Blender results doesn't really
seem like a good idea...
Though this really is only the case for WardIso, less so for Minnaert and
Blinn, which in yafray are more or less (but not totally) a copy of
the Blender code.
In any case, in practice those differences might not be
too noticable at all (I hope).
Continue to the next part...
2005-05-21 20:49:24 +00:00
|
|
|
mparams["colmir"] = yafray::parameter_t(1.0);
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
|
|
|
|
// Ref, diffuse reflection amount modulation
|
|
|
|
if ((mtex->mapto & MAP_REF) || (mtex->maptoneg & MAP_REF))
|
|
|
|
{
|
|
|
|
int t = 1;
|
|
|
|
if (mtex->maptoneg & MAP_REF) t = -1;
|
Part one of the final yafray commit.
Totally updated blender shader in yafray, hopefully better matches blender
results. Though ramps are now partially supported, they cannot work in all
cases properly in yafray, and in fact are a bit useless probably as far as
yafray is concerned. In fact the 'Result' ramp input mode is not supported
at all, because it works on the total lighting result, and in a yafray
shader this is not possible since it works per light.
Also, since Blender and Yafray have totally different lighting models,
the 'Energy' ramp input mode also won't generally give the same results
as in Blender, since it works with light energy and in yafray this is
different from Blender. Even worse, the only ramp shader that will work
properly when used with GI is the 'Normal' ramp input mode.
As contradictory as this might seem, at various stages of the GI process,
lighting is not known, so properly getting light (ramp 'energy' mode)
or shader information (ramp 'shader' mode, which depends on lighting)
is not possible. Which all means that when the ramp is in 'energy' or
'shader' mode and using it with GI enabled, yafray can only 'see' the
underlying material color, not the ramps, which results in a mix of the
ramp colors (from direct light) with the material color (from indirect light).
There is currently nothing that can be done about that.
The supported texture mapping modes now includes raymir as well, transparency
as far as texturing is concerned now works similar to Blender, with the
exception that you still have to set alpha to a low value to get any
transparency effect at all in yafray. So the Blender 'filter' parameter
now also will affect yafray.
All texture blending modes are now supported (same for ramps).
'Translu' and 'Amb' texture modulation are not supported.
Texture interpolation can be switched off ('InterPol' switch in blender
image texture button section).
All Blender brdf models (aka 'shaders' for the Blender users) are now supported,
and again, you won't necessarily get the same results as in Blender.
The reason for that is partially of course the lighting differences, but also,
not all Blender 'shader' implementations are actually correct, and copying
those errors just for the sake of matching Blender results doesn't really
seem like a good idea...
Though this really is only the case for WardIso, less so for Minnaert and
Blinn, which in yafray are more or less (but not totally) a copy of
the Blender code.
In any case, in practice those differences might not be
too noticable at all (I hope).
Continue to the next part...
2005-05-21 20:49:24 +00:00
|
|
|
mparams["difref"] = yafray::parameter_t(t);
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Spec, specular amount mod
|
|
|
|
if ((mtex->mapto & MAP_SPEC) || (mtex->maptoneg & MAP_SPEC))
|
|
|
|
{
|
|
|
|
int t = 1;
|
|
|
|
if (mtex->maptoneg & MAP_SPEC) t = -1;
|
Part one of the final yafray commit.
Totally updated blender shader in yafray, hopefully better matches blender
results. Though ramps are now partially supported, they cannot work in all
cases properly in yafray, and in fact are a bit useless probably as far as
yafray is concerned. In fact the 'Result' ramp input mode is not supported
at all, because it works on the total lighting result, and in a yafray
shader this is not possible since it works per light.
Also, since Blender and Yafray have totally different lighting models,
the 'Energy' ramp input mode also won't generally give the same results
as in Blender, since it works with light energy and in yafray this is
different from Blender. Even worse, the only ramp shader that will work
properly when used with GI is the 'Normal' ramp input mode.
As contradictory as this might seem, at various stages of the GI process,
lighting is not known, so properly getting light (ramp 'energy' mode)
or shader information (ramp 'shader' mode, which depends on lighting)
is not possible. Which all means that when the ramp is in 'energy' or
'shader' mode and using it with GI enabled, yafray can only 'see' the
underlying material color, not the ramps, which results in a mix of the
ramp colors (from direct light) with the material color (from indirect light).
There is currently nothing that can be done about that.
The supported texture mapping modes now includes raymir as well, transparency
as far as texturing is concerned now works similar to Blender, with the
exception that you still have to set alpha to a low value to get any
transparency effect at all in yafray. So the Blender 'filter' parameter
now also will affect yafray.
All texture blending modes are now supported (same for ramps).
'Translu' and 'Amb' texture modulation are not supported.
Texture interpolation can be switched off ('InterPol' switch in blender
image texture button section).
All Blender brdf models (aka 'shaders' for the Blender users) are now supported,
and again, you won't necessarily get the same results as in Blender.
The reason for that is partially of course the lighting differences, but also,
not all Blender 'shader' implementations are actually correct, and copying
those errors just for the sake of matching Blender results doesn't really
seem like a good idea...
Though this really is only the case for WardIso, less so for Minnaert and
Blinn, which in yafray are more or less (but not totally) a copy of
the Blender code.
In any case, in practice those differences might not be
too noticable at all (I hope).
Continue to the next part...
2005-05-21 20:49:24 +00:00
|
|
|
mparams["specular"] = yafray::parameter_t(t);
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// hardness modulation
|
|
|
|
if ((mtex->mapto & MAP_HAR) || (mtex->maptoneg & MAP_HAR))
|
|
|
|
{
|
|
|
|
int t = 1;
|
|
|
|
if (mtex->maptoneg & MAP_HAR) t = -1;
|
Part one of the final yafray commit.
Totally updated blender shader in yafray, hopefully better matches blender
results. Though ramps are now partially supported, they cannot work in all
cases properly in yafray, and in fact are a bit useless probably as far as
yafray is concerned. In fact the 'Result' ramp input mode is not supported
at all, because it works on the total lighting result, and in a yafray
shader this is not possible since it works per light.
Also, since Blender and Yafray have totally different lighting models,
the 'Energy' ramp input mode also won't generally give the same results
as in Blender, since it works with light energy and in yafray this is
different from Blender. Even worse, the only ramp shader that will work
properly when used with GI is the 'Normal' ramp input mode.
As contradictory as this might seem, at various stages of the GI process,
lighting is not known, so properly getting light (ramp 'energy' mode)
or shader information (ramp 'shader' mode, which depends on lighting)
is not possible. Which all means that when the ramp is in 'energy' or
'shader' mode and using it with GI enabled, yafray can only 'see' the
underlying material color, not the ramps, which results in a mix of the
ramp colors (from direct light) with the material color (from indirect light).
There is currently nothing that can be done about that.
The supported texture mapping modes now includes raymir as well, transparency
as far as texturing is concerned now works similar to Blender, with the
exception that you still have to set alpha to a low value to get any
transparency effect at all in yafray. So the Blender 'filter' parameter
now also will affect yafray.
All texture blending modes are now supported (same for ramps).
'Translu' and 'Amb' texture modulation are not supported.
Texture interpolation can be switched off ('InterPol' switch in blender
image texture button section).
All Blender brdf models (aka 'shaders' for the Blender users) are now supported,
and again, you won't necessarily get the same results as in Blender.
The reason for that is partially of course the lighting differences, but also,
not all Blender 'shader' implementations are actually correct, and copying
those errors just for the sake of matching Blender results doesn't really
seem like a good idea...
Though this really is only the case for WardIso, less so for Minnaert and
Blinn, which in yafray are more or less (but not totally) a copy of
the Blender code.
In any case, in practice those differences might not be
too noticable at all (I hope).
Continue to the next part...
2005-05-21 20:49:24 +00:00
|
|
|
mparams["hard"] = yafray::parameter_t(t);
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// alpha modulation
|
|
|
|
if ((mtex->mapto & MAP_ALPHA) || (mtex->maptoneg & MAP_ALPHA))
|
|
|
|
{
|
|
|
|
int t = 1;
|
|
|
|
if (mtex->maptoneg & MAP_ALPHA) t = -1;
|
Part one of the final yafray commit.
Totally updated blender shader in yafray, hopefully better matches blender
results. Though ramps are now partially supported, they cannot work in all
cases properly in yafray, and in fact are a bit useless probably as far as
yafray is concerned. In fact the 'Result' ramp input mode is not supported
at all, because it works on the total lighting result, and in a yafray
shader this is not possible since it works per light.
Also, since Blender and Yafray have totally different lighting models,
the 'Energy' ramp input mode also won't generally give the same results
as in Blender, since it works with light energy and in yafray this is
different from Blender. Even worse, the only ramp shader that will work
properly when used with GI is the 'Normal' ramp input mode.
As contradictory as this might seem, at various stages of the GI process,
lighting is not known, so properly getting light (ramp 'energy' mode)
or shader information (ramp 'shader' mode, which depends on lighting)
is not possible. Which all means that when the ramp is in 'energy' or
'shader' mode and using it with GI enabled, yafray can only 'see' the
underlying material color, not the ramps, which results in a mix of the
ramp colors (from direct light) with the material color (from indirect light).
There is currently nothing that can be done about that.
The supported texture mapping modes now includes raymir as well, transparency
as far as texturing is concerned now works similar to Blender, with the
exception that you still have to set alpha to a low value to get any
transparency effect at all in yafray. So the Blender 'filter' parameter
now also will affect yafray.
All texture blending modes are now supported (same for ramps).
'Translu' and 'Amb' texture modulation are not supported.
Texture interpolation can be switched off ('InterPol' switch in blender
image texture button section).
All Blender brdf models (aka 'shaders' for the Blender users) are now supported,
and again, you won't necessarily get the same results as in Blender.
The reason for that is partially of course the lighting differences, but also,
not all Blender 'shader' implementations are actually correct, and copying
those errors just for the sake of matching Blender results doesn't really
seem like a good idea...
Though this really is only the case for WardIso, less so for Minnaert and
Blinn, which in yafray are more or less (but not totally) a copy of
the Blender code.
In any case, in practice those differences might not be
too noticable at all (I hope).
Continue to the next part...
2005-05-21 20:49:24 +00:00
|
|
|
mparams["alpha"] = yafray::parameter_t(t);
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// emit modulation
|
|
|
|
if ((mtex->mapto & MAP_EMIT) || (mtex->maptoneg & MAP_EMIT)) {
|
|
|
|
int t = 1;
|
|
|
|
if (mtex->maptoneg & MAP_EMIT) t = -1;
|
Part one of the final yafray commit.
Totally updated blender shader in yafray, hopefully better matches blender
results. Though ramps are now partially supported, they cannot work in all
cases properly in yafray, and in fact are a bit useless probably as far as
yafray is concerned. In fact the 'Result' ramp input mode is not supported
at all, because it works on the total lighting result, and in a yafray
shader this is not possible since it works per light.
Also, since Blender and Yafray have totally different lighting models,
the 'Energy' ramp input mode also won't generally give the same results
as in Blender, since it works with light energy and in yafray this is
different from Blender. Even worse, the only ramp shader that will work
properly when used with GI is the 'Normal' ramp input mode.
As contradictory as this might seem, at various stages of the GI process,
lighting is not known, so properly getting light (ramp 'energy' mode)
or shader information (ramp 'shader' mode, which depends on lighting)
is not possible. Which all means that when the ramp is in 'energy' or
'shader' mode and using it with GI enabled, yafray can only 'see' the
underlying material color, not the ramps, which results in a mix of the
ramp colors (from direct light) with the material color (from indirect light).
There is currently nothing that can be done about that.
The supported texture mapping modes now includes raymir as well, transparency
as far as texturing is concerned now works similar to Blender, with the
exception that you still have to set alpha to a low value to get any
transparency effect at all in yafray. So the Blender 'filter' parameter
now also will affect yafray.
All texture blending modes are now supported (same for ramps).
'Translu' and 'Amb' texture modulation are not supported.
Texture interpolation can be switched off ('InterPol' switch in blender
image texture button section).
All Blender brdf models (aka 'shaders' for the Blender users) are now supported,
and again, you won't necessarily get the same results as in Blender.
The reason for that is partially of course the lighting differences, but also,
not all Blender 'shader' implementations are actually correct, and copying
those errors just for the sake of matching Blender results doesn't really
seem like a good idea...
Though this really is only the case for WardIso, less so for Minnaert and
Blinn, which in yafray are more or less (but not totally) a copy of
the Blender code.
In any case, in practice those differences might not be
too noticable at all (I hope).
Continue to the next part...
2005-05-21 20:49:24 +00:00
|
|
|
mparams["emit"] = yafray::parameter_t(t);
|
|
|
|
}
|
|
|
|
|
|
|
|
// raymir modulation
|
|
|
|
if ((mtex->mapto & MAP_RAYMIRR) || (mtex->maptoneg & MAP_RAYMIRR)) {
|
|
|
|
int t = 1;
|
|
|
|
if (mtex->maptoneg & MAP_RAYMIRR) t = -1;
|
|
|
|
mparams["raymir"] = yafray::parameter_t(t);
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// texture flag, combination of strings
|
Second and final commit for this version of the yafray export code (probably, you never know
of course...)
Not quite complete, but due to lack of time as good as it will get for now.
From the previous commit, forgot to report that basic fog is supported as well. Though because I had not much time to complete the code, it is sort of unfinished, and you will have
to tweak parameters specifically for yafray again. It uses only the world horizon color, and
only uses the Blender mist distance setting.
Textures now support checker clip mode.
Fixed possibly all 'duplilist non-empty' errors, though it could hide the real cause of the
error.
AA is no longer enabled automatically for certain GI quality settings, I thought it best to
leave it to the user to decide.
SkyDome GI mode now supports cache as well. There is a new option in the GI quality menu 'Use
Blender AO settings', which will as it says use the most important AO settings for the
skydome parameters. The only AO parameters used are 'Samples', 'Dist' and the random sampling
switch, which unlike in Blender you might want to use more often, since the QMC sampling used
in yafray can result in visible patterns or a dithering type look. 'Random' is not completely
random in yafray however, it is actually jittered (stratified) sampling.
Using an occlusion cache, doesn't necessarily mean that you will always get much shorter
render times. As with 'full' GI and cache, one problem is bumpmaps, when using bump (or
normal) maps, the sampling will be much more dense, using lots more rendertime.
As a temporary fix there is a button 'NoBump', but this also has the side effect that in
areas of total indirect light (or when used with SkyDome cache) no bumpmapping will be
visible. It is therefor best used with some direct light as well.
For SkyDome with cache, and strong bumpmapping it might actually not make much difference,
since for low distance values you can usually get away with low sample values as well.
The entire material panel is now replaced by another panel to show only the parameters
important to yafray and add some new ones as well.
Since lots of users (especially yafray beginners) have had problems getting certain material
aspects right, there is now a material preset menu available to hopefully solve some of the
most common "How do I do this? It doesn't work!" questions seen in various forums.
Choosing an option from this menu will set the required parameters to default
values for yafray, and you can work your way from there to tweak it something you want.
Most buttons are copies of the same Blender parameters, with some variations. Just like
Blender 'Ray Mirror' enables reflection, 'Ray Transp' enables refraction. You can use
'ZTransp' for materials that have texture maps with alpha channels.
Again, same as Blender 'rayMir' sets the amount of reflection. Next button 'frsOfs' however
controls fresnel offset, meaning that when this is set to 1, you will get no fresnel effect
and when set to 5, reflection is totally determined by fresnel, which is important for
realistic glass/metals/etc.
IOR is self-explanatory (...), same as Blender.
When you have 'Ray Transp' enabled, the blender 'filter' button will appear next to the IOR
button. This has the same effect as in Blender.
Below that there are some new parameters, 'Ext.Color' sets the extinction color for
transparent materials. Usually, in real transparent materials, light loses some of it's
energy the further it has to travel through the object. This effect can be simulated with
this parameter. Thing to look out for is that it specifies the color which will be
REMOVED after traveling through the object. What this means is that say you have a clear
white glass sphere, and set the extinction color to a strong blue, the result will be a
very yellow object when rendered.
Next to the color sliders, there is another set of three parameters, with which you can
enable color dispersion for transparent objects. 'Pwr' sets the amount of dispersion,
the higher, the more dispersion (the more colorful the result).
(For real world materials, this number can be found or derived from data in various glass catalogues)
The 'Samples' button below that sets the number of samples used, minimum values are around
7-10, and for very strong dispersion you might need a lot more.
As usual, this also means an increase in render time of course, but to simulate
realistic materials, you shouldn't really need more than 25 samples.
In addition to that, when using low sample numbers, but to still get a good spread of colors,
you can enable the jitter button, but this will also add noise.
Point/soft(point with shadowbuffer) or sphere lights (light with radius), have a new option
to add a simple glow effect, so that lights can be made visible.
NOTE: just like spotlight halo's, glow is not visible against the background, there must be
another object behind it. Simplest solution is to use a large black shadeless plane behind
your scene.
The glow intensity can be set with the 'GlowInt' parameter (use very low values around 0.01
even lower), and you can choose from two different types with the 'GlowType' button (which
don't look much different, but type 1 is probably better, type 0 faster).
And that's it, with apologies for the still missing features and
full support in general, but this will have to do for now.
2005-05-22 22:46:17 +00:00
|
|
|
string ts;
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
if (mtex->texflag & (MTEX_RGBTOINT | MTEX_STENCIL | MTEX_NEGATIVE)) {
|
|
|
|
ts = "";
|
|
|
|
if (mtex->texflag & MTEX_RGBTOINT) ts += "no_rgb ";
|
|
|
|
if (mtex->texflag & MTEX_STENCIL) ts += "stencil ";
|
|
|
|
if (mtex->texflag & MTEX_NEGATIVE) ts += "negative";
|
|
|
|
mparams["texflag"]=yafray::parameter_t(ts);
|
|
|
|
}
|
|
|
|
|
|
|
|
// colfac, controls amount of color modulation
|
|
|
|
mparams["colfac"]=yafray::parameter_t(mtex->colfac);
|
|
|
|
// def_var
|
|
|
|
mparams["def_var"]=yafray::parameter_t(mtex->def_var);
|
|
|
|
//varfac
|
|
|
|
mparams["varfac"]=yafray::parameter_t(mtex->varfac);
|
|
|
|
|
|
|
|
if ((tex->imaflag & (TEX_CALCALPHA | TEX_USEALPHA)) || (tex->flag & TEX_NEGALPHA))
|
|
|
|
{
|
|
|
|
ts = "";
|
|
|
|
if (tex->imaflag & TEX_CALCALPHA) ts += "calc_alpha ";
|
|
|
|
if (tex->imaflag & TEX_USEALPHA) ts += "use_alpha ";
|
|
|
|
if (tex->flag & TEX_NEGALPHA) ts += "neg_alpha";
|
2004-12-07 05:31:17 +00:00
|
|
|
mparams["alpha_flag"] = yafray::parameter_t(ts);
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
}
|
2004-12-07 05:31:17 +00:00
|
|
|
|
|
|
|
// image as normalmap flag
|
|
|
|
if (tex->imaflag & TEX_NORMALMAP) mparams["normalmap"] = yafray::parameter_t("on");
|
|
|
|
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
lparams.push_back(mparams);
|
|
|
|
}
|
|
|
|
}
|
Part one of the final yafray commit.
Totally updated blender shader in yafray, hopefully better matches blender
results. Though ramps are now partially supported, they cannot work in all
cases properly in yafray, and in fact are a bit useless probably as far as
yafray is concerned. In fact the 'Result' ramp input mode is not supported
at all, because it works on the total lighting result, and in a yafray
shader this is not possible since it works per light.
Also, since Blender and Yafray have totally different lighting models,
the 'Energy' ramp input mode also won't generally give the same results
as in Blender, since it works with light energy and in yafray this is
different from Blender. Even worse, the only ramp shader that will work
properly when used with GI is the 'Normal' ramp input mode.
As contradictory as this might seem, at various stages of the GI process,
lighting is not known, so properly getting light (ramp 'energy' mode)
or shader information (ramp 'shader' mode, which depends on lighting)
is not possible. Which all means that when the ramp is in 'energy' or
'shader' mode and using it with GI enabled, yafray can only 'see' the
underlying material color, not the ramps, which results in a mix of the
ramp colors (from direct light) with the material color (from indirect light).
There is currently nothing that can be done about that.
The supported texture mapping modes now includes raymir as well, transparency
as far as texturing is concerned now works similar to Blender, with the
exception that you still have to set alpha to a low value to get any
transparency effect at all in yafray. So the Blender 'filter' parameter
now also will affect yafray.
All texture blending modes are now supported (same for ramps).
'Translu' and 'Amb' texture modulation are not supported.
Texture interpolation can be switched off ('InterPol' switch in blender
image texture button section).
All Blender brdf models (aka 'shaders' for the Blender users) are now supported,
and again, you won't necessarily get the same results as in Blender.
The reason for that is partially of course the lighting differences, but also,
not all Blender 'shader' implementations are actually correct, and copying
those errors just for the sake of matching Blender results doesn't really
seem like a good idea...
Though this really is only the case for WardIso, less so for Minnaert and
Blinn, which in yafray are more or less (but not totally) a copy of
the Blender code.
In any case, in practice those differences might not be
too noticable at all (I hope).
Continue to the next part...
2005-05-21 20:49:24 +00:00
|
|
|
yafrayGate->addShader(params, lparams);
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2004-06-16 18:44:12 +00:00
|
|
|
// write all materials & modulators
|
|
|
|
void yafrayPluginRender_t::writeMaterialsAndModulators()
|
|
|
|
{
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
// shaders/mappers for regular texture (or non-texture) mode
|
|
|
|
// In case material has texface mode, and all faces have an image texture,
|
|
|
|
// this shader will not be used, but still be written
|
|
|
|
yafray::paramMap_t params;
|
|
|
|
list<yafray::paramMap_t> lparams;
|
2004-06-16 18:44:12 +00:00
|
|
|
for (map<string, Material*>::const_iterator blendmat=used_materials.begin();
|
|
|
|
blendmat!=used_materials.end();++blendmat)
|
|
|
|
{
|
|
|
|
Material* matr = blendmat->second;
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
// mapper(s)
|
2004-12-05 03:51:01 +00:00
|
|
|
for (int m=0;m<MAX_MTEX;m++)
|
2004-06-16 18:44:12 +00:00
|
|
|
{
|
|
|
|
if (matr->septex & (1<<m)) continue;// all active channels
|
|
|
|
// ignore null mtex
|
|
|
|
MTex* mtex = matr->mtex[m];
|
|
|
|
if (mtex==NULL) continue;
|
|
|
|
// ignore null tex
|
|
|
|
Tex* tex = mtex->tex;
|
|
|
|
if (tex==NULL) continue;
|
|
|
|
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
map<string, MTex*>::const_iterator mtexL = used_textures.find(string(tex->id.name));
|
2004-06-16 18:44:12 +00:00
|
|
|
if (mtexL!=used_textures.end())
|
|
|
|
{
|
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.
2004-11-08 03:55:44 +00:00
|
|
|
params.clear(); //!!!
|
|
|
|
lparams.clear();
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
char temp[32];
|
|
|
|
sprintf(temp, "_map%d", m);
|
|
|
|
params["type"] = yafray::parameter_t("blendermapper");
|
|
|
|
params["name"] = yafray::parameter_t(blendmat->first + string(temp));
|
Part one of the final yafray commit.
Totally updated blender shader in yafray, hopefully better matches blender
results. Though ramps are now partially supported, they cannot work in all
cases properly in yafray, and in fact are a bit useless probably as far as
yafray is concerned. In fact the 'Result' ramp input mode is not supported
at all, because it works on the total lighting result, and in a yafray
shader this is not possible since it works per light.
Also, since Blender and Yafray have totally different lighting models,
the 'Energy' ramp input mode also won't generally give the same results
as in Blender, since it works with light energy and in yafray this is
different from Blender. Even worse, the only ramp shader that will work
properly when used with GI is the 'Normal' ramp input mode.
As contradictory as this might seem, at various stages of the GI process,
lighting is not known, so properly getting light (ramp 'energy' mode)
or shader information (ramp 'shader' mode, which depends on lighting)
is not possible. Which all means that when the ramp is in 'energy' or
'shader' mode and using it with GI enabled, yafray can only 'see' the
underlying material color, not the ramps, which results in a mix of the
ramp colors (from direct light) with the material color (from indirect light).
There is currently nothing that can be done about that.
The supported texture mapping modes now includes raymir as well, transparency
as far as texturing is concerned now works similar to Blender, with the
exception that you still have to set alpha to a low value to get any
transparency effect at all in yafray. So the Blender 'filter' parameter
now also will affect yafray.
All texture blending modes are now supported (same for ramps).
'Translu' and 'Amb' texture modulation are not supported.
Texture interpolation can be switched off ('InterPol' switch in blender
image texture button section).
All Blender brdf models (aka 'shaders' for the Blender users) are now supported,
and again, you won't necessarily get the same results as in Blender.
The reason for that is partially of course the lighting differences, but also,
not all Blender 'shader' implementations are actually correct, and copying
those errors just for the sake of matching Blender results doesn't really
seem like a good idea...
Though this really is only the case for WardIso, less so for Minnaert and
Blinn, which in yafray are more or less (but not totally) a copy of
the Blender code.
In any case, in practice those differences might not be
too noticable at all (I hope).
Continue to the next part...
2005-05-21 20:49:24 +00:00
|
|
|
if ((mtex->texco & TEXCO_OBJECT) || (mtex->texco & TEXCO_REFL) || (mtex->texco & TEXCO_NORM))
|
2004-06-16 18:44:12 +00:00
|
|
|
{
|
Part one of the final yafray commit.
Totally updated blender shader in yafray, hopefully better matches blender
results. Though ramps are now partially supported, they cannot work in all
cases properly in yafray, and in fact are a bit useless probably as far as
yafray is concerned. In fact the 'Result' ramp input mode is not supported
at all, because it works on the total lighting result, and in a yafray
shader this is not possible since it works per light.
Also, since Blender and Yafray have totally different lighting models,
the 'Energy' ramp input mode also won't generally give the same results
as in Blender, since it works with light energy and in yafray this is
different from Blender. Even worse, the only ramp shader that will work
properly when used with GI is the 'Normal' ramp input mode.
As contradictory as this might seem, at various stages of the GI process,
lighting is not known, so properly getting light (ramp 'energy' mode)
or shader information (ramp 'shader' mode, which depends on lighting)
is not possible. Which all means that when the ramp is in 'energy' or
'shader' mode and using it with GI enabled, yafray can only 'see' the
underlying material color, not the ramps, which results in a mix of the
ramp colors (from direct light) with the material color (from indirect light).
There is currently nothing that can be done about that.
The supported texture mapping modes now includes raymir as well, transparency
as far as texturing is concerned now works similar to Blender, with the
exception that you still have to set alpha to a low value to get any
transparency effect at all in yafray. So the Blender 'filter' parameter
now also will affect yafray.
All texture blending modes are now supported (same for ramps).
'Translu' and 'Amb' texture modulation are not supported.
Texture interpolation can be switched off ('InterPol' switch in blender
image texture button section).
All Blender brdf models (aka 'shaders' for the Blender users) are now supported,
and again, you won't necessarily get the same results as in Blender.
The reason for that is partially of course the lighting differences, but also,
not all Blender 'shader' implementations are actually correct, and copying
those errors just for the sake of matching Blender results doesn't really
seem like a good idea...
Though this really is only the case for WardIso, less so for Minnaert and
Blinn, which in yafray are more or less (but not totally) a copy of
the Blender code.
In any case, in practice those differences might not be
too noticable at all (I hope).
Continue to the next part...
2005-05-21 20:49:24 +00:00
|
|
|
// For object, reflection & normal mapping, add the object matrix to the modulator,
|
2004-06-16 18:44:12 +00:00
|
|
|
// as in LF script, use camera matrix if no object specified.
|
|
|
|
// In this case this means the inverse of that matrix
|
|
|
|
float texmat[4][4], itexmat[4][4];
|
|
|
|
if ((mtex->texco & TEXCO_OBJECT) && (mtex->object))
|
|
|
|
MTC_Mat4CpyMat4(texmat, mtex->object->obmat);
|
|
|
|
else // also for refl. map
|
|
|
|
MTC_Mat4CpyMat4(texmat, maincam_obj->obmat);
|
|
|
|
MTC_Mat4Invert(itexmat, texmat);
|
|
|
|
#define flp yafray::parameter_t
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
params["m00"]=flp(itexmat[0][0]); params["m01"]=flp(itexmat[1][0]);
|
|
|
|
params["m02"]=flp(itexmat[2][0]); params["m03"]=flp(itexmat[3][0]);
|
|
|
|
params["m10"]=flp(itexmat[0][1]); params["m11"]=flp(itexmat[1][1]);
|
|
|
|
params["m12"]=flp(itexmat[2][1]); params["m13"]=flp(itexmat[3][1]);
|
|
|
|
params["m20"]=flp(itexmat[0][2]); params["m21"]=flp(itexmat[1][2]);
|
|
|
|
params["m22"]=flp(itexmat[2][2]); params["m23"]=flp(itexmat[3][2]);
|
|
|
|
params["m30"]=flp(itexmat[0][3]); params["m31"]=flp(itexmat[1][3]);
|
|
|
|
params["m32"]=flp(itexmat[2][3]); params["m33"]=flp(itexmat[3][3]);
|
2004-06-16 18:44:12 +00:00
|
|
|
#undef flp
|
|
|
|
}
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
// use image name instead of texname when texture is image
|
|
|
|
if ((tex->type==TEX_IMAGE) && tex->ima)
|
|
|
|
params["input"] = yafray::parameter_t(tex->ima->id.name);
|
|
|
|
else if ((tex->flag & TEX_COLORBAND) & (tex->coba!=NULL))
|
|
|
|
params["input"] = yafray::parameter_t(mtexL->first + "_coba");
|
2004-06-16 18:44:12 +00:00
|
|
|
else
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
params["input"] = yafray::parameter_t(mtexL->first);
|
2004-06-16 18:44:12 +00:00
|
|
|
|
|
|
|
// texture size
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
params["sizex"] = yafray::parameter_t(mtex->size[0]);
|
|
|
|
params["sizey"] = yafray::parameter_t(mtex->size[1]);
|
|
|
|
params["sizez"] = yafray::parameter_t(mtex->size[2]);
|
2004-06-16 18:44:12 +00:00
|
|
|
|
|
|
|
// texture offset
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
params["ofsx"] = yafray::parameter_t(mtex->ofs[0]);
|
|
|
|
params["ofsy"] = yafray::parameter_t(mtex->ofs[1]);
|
|
|
|
params["ofsz"] = yafray::parameter_t(mtex->ofs[2]);
|
2004-06-16 18:44:12 +00:00
|
|
|
|
|
|
|
// texture coordinates, have to disable 'sticky' in Blender
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
if (mtex->texco & TEXCO_UV)
|
|
|
|
params["texco"] = yafray::parameter_t("uv");
|
2004-06-16 18:44:12 +00:00
|
|
|
else if ((mtex->texco & TEXCO_GLOB) || (mtex->texco & TEXCO_OBJECT))
|
|
|
|
// object mode is also set as global, but the object matrix
|
|
|
|
// was specified above with <modulator..>
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
params["texco"] = yafray::parameter_t("global");
|
2004-06-16 18:44:12 +00:00
|
|
|
else if (mtex->texco & TEXCO_ORCO)
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
params["texco"] = yafray::parameter_t("orco");
|
2004-06-16 18:44:12 +00:00
|
|
|
else if (mtex->texco & TEXCO_WINDOW)
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
params["texco"] = yafray::parameter_t("window");
|
2004-06-16 18:44:12 +00:00
|
|
|
else if (mtex->texco & TEXCO_NORM)
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
params["texco"] = yafray::parameter_t("normal");
|
2004-06-16 18:44:12 +00:00
|
|
|
else if (mtex->texco & TEXCO_REFL)
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
params["texco"] = yafray::parameter_t("reflect");
|
|
|
|
|
|
|
|
// texture projection axes, both image & procedural
|
|
|
|
string proj = "nxyz"; // 'n' for 'none'
|
|
|
|
params["proj_x"] = yafray::parameter_t(string(1,proj[mtex->projx]));
|
|
|
|
params["proj_y"] = yafray::parameter_t(string(1,proj[mtex->projy]));
|
|
|
|
params["proj_z"] = yafray::parameter_t(string(1,proj[mtex->projz]));
|
2004-06-16 18:44:12 +00:00
|
|
|
|
|
|
|
// texture mapping parameters only relevant to image type
|
|
|
|
if (tex->type==TEX_IMAGE)
|
|
|
|
{
|
|
|
|
if (mtex->mapping==MTEX_FLAT)
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
params["mapping"] = yafray::parameter_t("flat");
|
2004-06-16 18:44:12 +00:00
|
|
|
else if (mtex->mapping==MTEX_CUBE)
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
params["mapping"] = yafray::parameter_t("cube");
|
2004-06-16 18:44:12 +00:00
|
|
|
else if (mtex->mapping==MTEX_TUBE)
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
params["mapping"] = yafray::parameter_t("tube");
|
2004-06-16 18:44:12 +00:00
|
|
|
else if (mtex->mapping==MTEX_SPHERE)
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
params["mapping"] = yafray::parameter_t("sphere");
|
2004-06-16 18:44:12 +00:00
|
|
|
|
|
|
|
// repeat
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
params["xrepeat"] = yafray::parameter_t(tex->xrepeat);
|
|
|
|
params["yrepeat"] = yafray::parameter_t(tex->yrepeat);
|
2004-06-16 18:44:12 +00:00
|
|
|
|
|
|
|
// clipping
|
|
|
|
if (tex->extend==TEX_EXTEND)
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
params["clipping"] = yafray::parameter_t("extend");
|
2004-06-16 18:44:12 +00:00
|
|
|
else if (tex->extend==TEX_CLIP)
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
params["clipping"] = yafray::parameter_t("clip");
|
2004-06-16 18:44:12 +00:00
|
|
|
else if (tex->extend==TEX_CLIPCUBE)
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
params["clipping"] = yafray::parameter_t("clipcube");
|
Second and final commit for this version of the yafray export code (probably, you never know
of course...)
Not quite complete, but due to lack of time as good as it will get for now.
From the previous commit, forgot to report that basic fog is supported as well. Though because I had not much time to complete the code, it is sort of unfinished, and you will have
to tweak parameters specifically for yafray again. It uses only the world horizon color, and
only uses the Blender mist distance setting.
Textures now support checker clip mode.
Fixed possibly all 'duplilist non-empty' errors, though it could hide the real cause of the
error.
AA is no longer enabled automatically for certain GI quality settings, I thought it best to
leave it to the user to decide.
SkyDome GI mode now supports cache as well. There is a new option in the GI quality menu 'Use
Blender AO settings', which will as it says use the most important AO settings for the
skydome parameters. The only AO parameters used are 'Samples', 'Dist' and the random sampling
switch, which unlike in Blender you might want to use more often, since the QMC sampling used
in yafray can result in visible patterns or a dithering type look. 'Random' is not completely
random in yafray however, it is actually jittered (stratified) sampling.
Using an occlusion cache, doesn't necessarily mean that you will always get much shorter
render times. As with 'full' GI and cache, one problem is bumpmaps, when using bump (or
normal) maps, the sampling will be much more dense, using lots more rendertime.
As a temporary fix there is a button 'NoBump', but this also has the side effect that in
areas of total indirect light (or when used with SkyDome cache) no bumpmapping will be
visible. It is therefor best used with some direct light as well.
For SkyDome with cache, and strong bumpmapping it might actually not make much difference,
since for low distance values you can usually get away with low sample values as well.
The entire material panel is now replaced by another panel to show only the parameters
important to yafray and add some new ones as well.
Since lots of users (especially yafray beginners) have had problems getting certain material
aspects right, there is now a material preset menu available to hopefully solve some of the
most common "How do I do this? It doesn't work!" questions seen in various forums.
Choosing an option from this menu will set the required parameters to default
values for yafray, and you can work your way from there to tweak it something you want.
Most buttons are copies of the same Blender parameters, with some variations. Just like
Blender 'Ray Mirror' enables reflection, 'Ray Transp' enables refraction. You can use
'ZTransp' for materials that have texture maps with alpha channels.
Again, same as Blender 'rayMir' sets the amount of reflection. Next button 'frsOfs' however
controls fresnel offset, meaning that when this is set to 1, you will get no fresnel effect
and when set to 5, reflection is totally determined by fresnel, which is important for
realistic glass/metals/etc.
IOR is self-explanatory (...), same as Blender.
When you have 'Ray Transp' enabled, the blender 'filter' button will appear next to the IOR
button. This has the same effect as in Blender.
Below that there are some new parameters, 'Ext.Color' sets the extinction color for
transparent materials. Usually, in real transparent materials, light loses some of it's
energy the further it has to travel through the object. This effect can be simulated with
this parameter. Thing to look out for is that it specifies the color which will be
REMOVED after traveling through the object. What this means is that say you have a clear
white glass sphere, and set the extinction color to a strong blue, the result will be a
very yellow object when rendered.
Next to the color sliders, there is another set of three parameters, with which you can
enable color dispersion for transparent objects. 'Pwr' sets the amount of dispersion,
the higher, the more dispersion (the more colorful the result).
(For real world materials, this number can be found or derived from data in various glass catalogues)
The 'Samples' button below that sets the number of samples used, minimum values are around
7-10, and for very strong dispersion you might need a lot more.
As usual, this also means an increase in render time of course, but to simulate
realistic materials, you shouldn't really need more than 25 samples.
In addition to that, when using low sample numbers, but to still get a good spread of colors,
you can enable the jitter button, but this will also add noise.
Point/soft(point with shadowbuffer) or sphere lights (light with radius), have a new option
to add a simple glow effect, so that lights can be made visible.
NOTE: just like spotlight halo's, glow is not visible against the background, there must be
another object behind it. Simplest solution is to use a large black shadeless plane behind
your scene.
The glow intensity can be set with the 'GlowInt' parameter (use very low values around 0.01
even lower), and you can choose from two different types with the 'GlowType' button (which
don't look much different, but type 1 is probably better, type 0 faster).
And that's it, with apologies for the still missing features and
full support in general, but this will have to do for now.
2005-05-22 22:46:17 +00:00
|
|
|
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);
|
|
|
|
}
|
2004-06-16 18:44:12 +00:00
|
|
|
else
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
params["clipping"] = yafray::parameter_t("repeat");
|
2004-06-16 18:44:12 +00:00
|
|
|
|
|
|
|
// crop min/max
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
params["cropmin_x"] = yafray::parameter_t(tex->cropxmin);
|
|
|
|
params["cropmin_y"] = yafray::parameter_t(tex->cropymin);
|
|
|
|
params["cropmax_x"] = yafray::parameter_t(tex->cropxmax);
|
|
|
|
params["cropmax_y"] = yafray::parameter_t(tex->cropymax);
|
2004-06-16 18:44:12 +00:00
|
|
|
|
|
|
|
// rot90 flag
|
|
|
|
if (tex->imaflag & TEX_IMAROT)
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
params["rot90"] = yafray::parameter_t("on");
|
2004-06-16 18:44:12 +00:00
|
|
|
else
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
params["rot90"] = yafray::parameter_t("off");
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
yafrayGate->addShader(params, lparams);
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
// shader + modulators
|
|
|
|
writeShader(blendmat->first, matr);
|
2004-06-16 18:44:12 +00:00
|
|
|
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
}
|
2004-06-16 18:44:12 +00:00
|
|
|
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
// write the mappers & shaders for the TexFace case
|
|
|
|
if (!imagetex.empty()) {
|
|
|
|
// Yafray doesn't have per-face-textures, only per-face-shaders,
|
|
|
|
// so create as many mappers/shaders as the images used by the object
|
|
|
|
params.clear();
|
|
|
|
lparams.clear();
|
|
|
|
int snum = 0;
|
2004-11-18 01:50:09 +00:00
|
|
|
for (map<Image*, set<Material*> >::const_iterator imgtex=imagetex.begin();
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
imgtex!=imagetex.end();++imgtex)
|
|
|
|
{
|
|
|
|
|
2004-11-18 01:50:09 +00:00
|
|
|
for (set<Material*>::const_iterator imgmat=imgtex->second.begin();
|
|
|
|
imgmat!=imgtex->second.end();++imgmat)
|
|
|
|
{
|
|
|
|
Material* matr = *imgmat;
|
|
|
|
// mapper
|
|
|
|
params["type"] = yafray::parameter_t("blendermapper");
|
|
|
|
char temp[32];
|
|
|
|
sprintf(temp, "_ftmap%d", snum);
|
|
|
|
params["name"] = yafray::parameter_t(string(matr->id.name) + string(temp));
|
|
|
|
params["input"] = yafray::parameter_t(imgtex->first->id.name);
|
|
|
|
// all yafray default settings, except for texco, so no need to set others
|
|
|
|
params["texco"] = yafray::parameter_t("uv");
|
|
|
|
yafrayGate->addShader(params, lparams);
|
|
|
|
|
|
|
|
// shader, remember name, used later when writing per-face-shaders
|
|
|
|
sprintf(temp, "_ftsha%d", snum);
|
|
|
|
string shader_name = string(matr->id.name) + string(temp);
|
|
|
|
imgtex_shader[string(matr->id.name) + string(imgtex->first->id.name)] = shader_name;
|
|
|
|
|
|
|
|
sprintf(temp, "_ftmap%d", snum++);
|
|
|
|
string facetexname = string(matr->id.name) + string(temp);
|
|
|
|
writeShader(shader_name, matr, facetexname);
|
|
|
|
}
|
2004-06-16 18:44:12 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
|
|
|
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
void yafrayPluginRender_t::genUVcoords(vector<yafray::GFLOAT> &uvcoords, VlakRen *vlr, TFace* uvc, bool comple)
|
2004-06-16 18:44:12 +00:00
|
|
|
{
|
|
|
|
if (uvc)
|
|
|
|
{
|
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.
2004-11-08 03:55:44 +00:00
|
|
|
// tri uv split indices
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
int ui1=0, ui2=1, ui3=2;
|
|
|
|
if (vlr->flag & R_DIVIDE_24) {
|
|
|
|
ui3++;
|
|
|
|
if (vlr->flag & R_FACE_SPLIT) { ui1++; ui2++; }
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
else if (vlr->flag & R_FACE_SPLIT) { ui2++; ui3++; }
|
|
|
|
if (comple) {
|
|
|
|
ui1 = (ui1+2) & 3;
|
|
|
|
ui2 = (ui2+2) & 3;
|
|
|
|
ui3 = (ui3+2) & 3;
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
uvcoords.push_back(uvc->uv[ui1][0]); uvcoords.push_back(1-uvc->uv[ui1][1]);
|
|
|
|
uvcoords.push_back(uvc->uv[ui2][0]); uvcoords.push_back(1-uvc->uv[ui2][1]);
|
|
|
|
uvcoords.push_back(uvc->uv[ui3][0]); uvcoords.push_back(1-uvc->uv[ui3][1]);
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
uvcoords.push_back(0); uvcoords.push_back(0);
|
|
|
|
uvcoords.push_back(0); uvcoords.push_back(0);
|
|
|
|
uvcoords.push_back(0); uvcoords.push_back(0);
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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.
2004-11-08 03:55:44 +00:00
|
|
|
void yafrayPluginRender_t::genVcol(vector<yafray::CFLOAT> &vcol, VlakRen *vlr, bool comple)
|
2004-06-16 18:44:12 +00:00
|
|
|
{
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
if (vlr->vcol)
|
2004-06-16 18:44:12 +00:00
|
|
|
{
|
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.
2004-11-08 03:55:44 +00:00
|
|
|
// tri vcol split 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++; }
|
|
|
|
if (comple) {
|
|
|
|
ui1 = (ui1+2) & 3;
|
|
|
|
ui2 = (ui2+2) & 3;
|
|
|
|
ui3 = (ui3+2) & 3;
|
|
|
|
}
|
2005-05-09 03:46:21 +00:00
|
|
|
unsigned char* pt = reinterpret_cast<unsigned char*>(&vlr->vcol[ui1]);
|
|
|
|
vcol.push_back((float)pt[3]/255.f); vcol.push_back((float)pt[2]/255.f); vcol.push_back((float)pt[1]/255.f);
|
|
|
|
pt = reinterpret_cast<unsigned char*>(&vlr->vcol[ui2]);
|
|
|
|
vcol.push_back((float)pt[3]/255.f); vcol.push_back((float)pt[2]/255.f); vcol.push_back((float)pt[1]/255.f);
|
|
|
|
pt = reinterpret_cast<unsigned char*>(&vlr->vcol[ui3]);
|
|
|
|
vcol.push_back((float)pt[3]/255.f); vcol.push_back((float)pt[2]/255.f); vcol.push_back((float)pt[1]/255.f);
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-07-26 00:48:28 +00:00
|
|
|
vcol.push_back(0); vcol.push_back(0); vcol.push_back(0);
|
|
|
|
vcol.push_back(0); vcol.push_back(0); vcol.push_back(0);
|
|
|
|
vcol.push_back(0); vcol.push_back(0); vcol.push_back(0);
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void yafrayPluginRender_t::genFace(vector<int> &faces,vector<string> &shaders,vector<int> &faceshader,
|
2004-06-17 11:24:30 +00:00
|
|
|
vector<yafray::GFLOAT> &uvcoords,vector<yafray::CFLOAT> &vcol,
|
2004-06-16 18:44:12 +00:00
|
|
|
map<VertRen*, int> &vert_idx,VlakRen *vlr,
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
bool has_orco,bool has_uv)
|
2004-06-16 18:44:12 +00:00
|
|
|
{
|
|
|
|
Material* fmat = vlr->mat;
|
|
|
|
bool EXPORT_VCOL = ((fmat->mode & (MA_VERTEXCOL|MA_VERTEXCOLP))!=0);
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
string fmatname(fmat->id.name);
|
|
|
|
// use name in imgtex_shader list if 'TexFace' enabled for this face material
|
|
|
|
if (fmat->mode & MA_FACETEXTURE) {
|
|
|
|
TFace* tface = vlr->tface;
|
|
|
|
if (tface) {
|
|
|
|
Image* fimg = (Image*)tface->tpage;
|
2004-11-18 01:50:09 +00:00
|
|
|
if (fimg) fmatname = imgtex_shader[fmatname + string(fimg->id.name)];
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (fmatname.length()==0) fmatname = "blender_default";
|
2004-06-16 18:44:12 +00:00
|
|
|
bool newmat=true;
|
|
|
|
for(unsigned int i=0;i<shaders.size();++i)
|
|
|
|
if(shaders[i]==fmatname)
|
|
|
|
{
|
|
|
|
newmat=false;
|
|
|
|
faceshader.push_back(i);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if(newmat)
|
|
|
|
{
|
|
|
|
shaders.push_back(fmatname);
|
|
|
|
faceshader.push_back(shaders.size()-1);
|
|
|
|
}
|
|
|
|
TFace* uvc = vlr->tface; // possible uvcoords (v upside down)
|
|
|
|
int idx1, idx2, idx3;
|
|
|
|
|
|
|
|
idx1 = vert_idx.find(vlr->v1)->second;
|
|
|
|
idx2 = vert_idx.find(vlr->v2)->second;
|
|
|
|
idx3 = vert_idx.find(vlr->v3)->second;
|
|
|
|
|
|
|
|
// make sure the indices point to the vertices when orco coords exported
|
|
|
|
if (has_orco) { idx1*=2; idx2*=2; idx3*=2; }
|
|
|
|
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
faces.push_back(idx1); faces.push_back(idx2); faces.push_back(idx3);
|
2004-06-16 18:44:12 +00:00
|
|
|
|
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.
2004-11-08 03:55:44 +00:00
|
|
|
if(has_uv) genUVcoords(uvcoords, vlr, uvc);
|
|
|
|
if (EXPORT_VCOL) genVcol(vcol, vlr);
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void yafrayPluginRender_t::genCompleFace(vector<int> &faces,/*vector<string> &shaders,*/vector<int> &faceshader,
|
2004-06-17 11:24:30 +00:00
|
|
|
vector<yafray::GFLOAT> &uvcoords,vector<yafray::CFLOAT> &vcol,
|
2004-06-16 18:44:12 +00:00
|
|
|
map<VertRen*, int> &vert_idx,VlakRen *vlr,
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
bool has_orco,bool has_uv)
|
2004-06-16 18:44:12 +00:00
|
|
|
{
|
|
|
|
Material* fmat = vlr->mat;
|
|
|
|
bool EXPORT_VCOL = ((fmat->mode & (MA_VERTEXCOL|MA_VERTEXCOLP))!=0);
|
|
|
|
|
|
|
|
faceshader.push_back(faceshader.back());
|
|
|
|
TFace* uvc = vlr->tface; // possible uvcoords (v upside down)
|
|
|
|
int idx1, idx2, idx3;
|
|
|
|
idx1 = vert_idx.find(vlr->v3)->second;
|
|
|
|
idx2 = vert_idx.find(vlr->v4)->second;
|
|
|
|
idx3 = vert_idx.find(vlr->v1)->second;
|
|
|
|
|
|
|
|
// make sure the indices point to the vertices when orco coords exported
|
|
|
|
if (has_orco) { idx1*=2; idx2*=2; idx3*=2; }
|
|
|
|
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
faces.push_back(idx1); faces.push_back(idx2); faces.push_back(idx3);
|
2004-06-16 18:44:12 +00:00
|
|
|
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
if (has_uv) genUVcoords(uvcoords, vlr, uvc, true);
|
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.
2004-11-08 03:55:44 +00:00
|
|
|
if (EXPORT_VCOL) genVcol(vcol, vlr, true);
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
|
|
|
|
2004-07-12 03:20:31 +00:00
|
|
|
void yafrayPluginRender_t::genVertices(vector<yafray::point3d_t> &verts, int &vidx,
|
|
|
|
map<VertRen*, int> &vert_idx, VlakRen* vlr, bool has_orco, Object* obj)
|
2004-06-16 18:44:12 +00:00
|
|
|
{
|
|
|
|
VertRen* ver;
|
2004-07-12 03:20:31 +00:00
|
|
|
float tvec[3]; // for back2world transform
|
2005-04-11 23:23:25 +00:00
|
|
|
|
|
|
|
// for deformed objects, object->imat is no longer valid,
|
|
|
|
// so have to create inverse render matrix ourselves here
|
|
|
|
float mat[4][4], imat[4][4];
|
|
|
|
MTC_Mat4MulMat4(mat, obj->obmat, R.viewmat);
|
|
|
|
MTC_Mat4Invert(imat, mat);
|
|
|
|
|
2004-06-16 18:44:12 +00:00
|
|
|
if (vert_idx.find(vlr->v1)==vert_idx.end())
|
|
|
|
{
|
|
|
|
vert_idx[vlr->v1] = vidx++;
|
|
|
|
ver = vlr->v1;
|
2004-07-12 03:20:31 +00:00
|
|
|
MTC_cp3Float(ver->co, tvec);
|
2005-04-11 23:23:25 +00:00
|
|
|
MTC_Mat4MulVecfl(imat, tvec);
|
2004-07-12 03:20:31 +00:00
|
|
|
verts.push_back(yafray::point3d_t(tvec[0], tvec[1], tvec[2]));
|
2004-06-16 18:44:12 +00:00
|
|
|
if (has_orco)
|
2004-06-17 11:24:30 +00:00
|
|
|
verts.push_back(yafray::point3d_t(ver->orco[0],ver->orco[1],ver->orco[2]));
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
|
|
|
if (vert_idx.find(vlr->v2)==vert_idx.end())
|
|
|
|
{
|
|
|
|
vert_idx[vlr->v2] = vidx++;
|
|
|
|
ver = vlr->v2;
|
2004-07-12 03:20:31 +00:00
|
|
|
MTC_cp3Float(ver->co, tvec);
|
2005-04-11 23:23:25 +00:00
|
|
|
MTC_Mat4MulVecfl(imat, tvec);
|
2004-07-12 03:20:31 +00:00
|
|
|
verts.push_back(yafray::point3d_t(tvec[0], tvec[1], tvec[2]));
|
2004-06-16 18:44:12 +00:00
|
|
|
if (has_orco)
|
2004-06-17 11:24:30 +00:00
|
|
|
verts.push_back(yafray::point3d_t(ver->orco[0],ver->orco[1],ver->orco[2]));
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
|
|
|
if (vert_idx.find(vlr->v3)==vert_idx.end())
|
|
|
|
{
|
|
|
|
vert_idx[vlr->v3] = vidx++;
|
|
|
|
ver = vlr->v3;
|
2004-07-12 03:20:31 +00:00
|
|
|
MTC_cp3Float(ver->co, tvec);
|
2005-04-11 23:23:25 +00:00
|
|
|
MTC_Mat4MulVecfl(imat, tvec);
|
2004-07-12 03:20:31 +00:00
|
|
|
verts.push_back(yafray::point3d_t(tvec[0], tvec[1], tvec[2]));
|
2004-06-16 18:44:12 +00:00
|
|
|
if (has_orco)
|
2004-06-17 11:24:30 +00:00
|
|
|
verts.push_back(yafray::point3d_t(ver->orco[0],ver->orco[1],ver->orco[2]));
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
|
|
|
if ((vlr->v4) && (vert_idx.find(vlr->v4)==vert_idx.end()))
|
|
|
|
{
|
|
|
|
vert_idx[vlr->v4] = vidx++;
|
|
|
|
ver = vlr->v4;
|
2004-07-12 03:20:31 +00:00
|
|
|
MTC_cp3Float(ver->co, tvec);
|
2005-04-11 23:23:25 +00:00
|
|
|
MTC_Mat4MulVecfl(imat, tvec);
|
2004-07-12 03:20:31 +00:00
|
|
|
verts.push_back(yafray::point3d_t(tvec[0], tvec[1], tvec[2]));
|
2004-06-16 18:44:12 +00:00
|
|
|
if (has_orco)
|
2004-06-17 11:24:30 +00:00
|
|
|
verts.push_back(yafray::point3d_t(ver->orco[0],ver->orco[1],ver->orco[2]));
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void yafrayPluginRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_list, const float obmat[4][4])
|
|
|
|
{
|
|
|
|
float mtr[4*4];
|
2004-07-26 00:48:28 +00:00
|
|
|
mtr[0*4+0]=obmat[0][0]; mtr[0*4+1]=obmat[1][0]; mtr[0*4+2]=obmat[2][0]; mtr[0*4+3]=obmat[3][0];
|
|
|
|
mtr[1*4+0]=obmat[0][1]; mtr[1*4+1]=obmat[1][1]; mtr[1*4+2]=obmat[2][1]; mtr[1*4+3]=obmat[3][1];
|
|
|
|
mtr[2*4+0]=obmat[0][2]; mtr[2*4+1]=obmat[1][2]; mtr[2*4+2]=obmat[2][2]; mtr[2*4+3]=obmat[3][2];
|
|
|
|
mtr[3*4+0]=obmat[0][3]; mtr[3*4+1]=obmat[1][3]; mtr[3*4+2]=obmat[2][3]; mtr[3*4+3]=obmat[3][3];
|
2004-06-16 18:44:12 +00:00
|
|
|
yafrayGate->transformPush(mtr);
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
|
|
|
|
VlakRen* face0 = VLR_list[0];
|
|
|
|
Material* face0mat = face0->mat;
|
|
|
|
|
|
|
|
bool castShadows = face0mat->mode & MA_TRACEBLE;
|
2004-06-16 18:44:12 +00:00
|
|
|
float caus_IOR=1.0;
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
yafray::color_t caus_tcolor(0.0, 0.0, 0.0), caus_rcolor(0.0, 0.0, 0.0);
|
|
|
|
bool caus = (((face0->mat->mode & MA_RAYTRANSP) | (face0->mat->mode & MA_RAYMIRROR))!=0);
|
2004-07-29 18:51:17 +00:00
|
|
|
if (caus) {
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
caus_IOR = face0mat->ang;
|
|
|
|
float tr = 1.0-face0mat->alpha;
|
|
|
|
caus_tcolor.set(face0mat->r*tr, face0mat->g*tr, face0mat->b*tr);
|
|
|
|
tr = face0mat->ray_mirror;
|
|
|
|
caus_rcolor.set(face0mat->mirr*tr, face0mat->mirg*tr, face0mat->mirb*tr);
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
2004-11-23 06:10:03 +00:00
|
|
|
|
|
|
|
// Export orco coords test.
|
|
|
|
// Previously was done by checking orco pointer, however this can be non-null but still not initialized.
|
|
|
|
// Test the rendermaterial texco flag instead.
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
bool has_orco = ((face0mat->texco & TEXCO_ORCO)!=0);
|
2004-11-23 06:10:03 +00:00
|
|
|
|
2004-07-12 03:20:31 +00:00
|
|
|
bool no_auto = true; //in case non-mesh, or mesh has no autosmooth
|
|
|
|
float sm_angle = 0.1f;
|
2004-06-16 18:44:12 +00:00
|
|
|
if (obj->type==OB_MESH)
|
|
|
|
{
|
|
|
|
Mesh* mesh = (Mesh*)obj->data;
|
2004-07-12 03:20:31 +00:00
|
|
|
if (mesh->flag & ME_AUTOSMOOTH) {
|
|
|
|
sm_angle = mesh->smoothresh;
|
|
|
|
no_auto = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// this for non-mesh as well
|
|
|
|
if (no_auto) {
|
|
|
|
// no per face smooth flag in yafray, if AutoSmooth not used,
|
|
|
|
// use smooth flag of the first face instead
|
2005-05-10 02:00:13 +00:00
|
|
|
if (face0->flag & ME_SMOOTH) sm_angle=180;
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
2004-06-17 11:24:30 +00:00
|
|
|
vector<yafray::point3d_t> verts;
|
|
|
|
vector<yafray::CFLOAT> vcol;
|
2004-06-16 18:44:12 +00:00
|
|
|
// now all vertices
|
|
|
|
map<VertRen*, int> vert_idx; // for removing duplicate verts and creating an index list
|
|
|
|
int vidx = 0; // vertex index counter
|
|
|
|
bool has_uv=false;
|
|
|
|
for (vector<VlakRen*>::const_iterator fci=VLR_list.begin();
|
|
|
|
fci!=VLR_list.end();++fci)
|
|
|
|
{
|
|
|
|
VlakRen* vlr = *fci;
|
2004-07-12 03:20:31 +00:00
|
|
|
genVertices(verts, vidx, vert_idx, vlr, has_orco, obj);
|
2004-06-16 18:44:12 +00:00
|
|
|
if(vlr->tface) has_uv=true;
|
|
|
|
}
|
|
|
|
// all faces using the index list created above
|
|
|
|
vector<int> faces;
|
|
|
|
vector<string> shaders;
|
|
|
|
vector<int> faceshader;
|
2004-06-17 11:24:30 +00:00
|
|
|
vector<yafray::GFLOAT> uvcoords;
|
2004-06-16 18:44:12 +00:00
|
|
|
for (vector<VlakRen*>::const_iterator fci2=VLR_list.begin();
|
|
|
|
fci2!=VLR_list.end();++fci2)
|
|
|
|
{
|
|
|
|
VlakRen* vlr = *fci2;
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
genFace(faces, shaders, faceshader, uvcoords, vcol, vert_idx, vlr, has_orco, has_uv);
|
2004-06-16 18:44:12 +00:00
|
|
|
if (vlr->v4)
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
genCompleFace(faces, faceshader, uvcoords, vcol, vert_idx, vlr, has_orco, has_uv);
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
|
|
|
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
yafrayGate->addObject_trimesh(string(obj->id.name), verts, faces, uvcoords, vcol,
|
|
|
|
shaders, faceshader, sm_angle, castShadows, true, true, caus, has_orco,
|
|
|
|
caus_rcolor, caus_tcolor, caus_IOR);
|
2004-06-16 18:44:12 +00:00
|
|
|
yafrayGate->transformPop();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// write all objects
|
|
|
|
void yafrayPluginRender_t::writeAllObjects()
|
|
|
|
{
|
|
|
|
|
|
|
|
// first all objects except dupliverts (and main instance object for dups)
|
|
|
|
for (map<Object*, vector<VlakRen*> >::const_iterator obi=all_objects.begin();
|
|
|
|
obi!=all_objects.end(); ++obi)
|
|
|
|
{
|
|
|
|
// skip main duplivert object if in dupliMtx_list, written later
|
|
|
|
Object* obj = obi->first;
|
|
|
|
if (dupliMtx_list.find(string(obj->id.name))!=dupliMtx_list.end()) continue;
|
2004-07-12 03:20:31 +00:00
|
|
|
writeObject(obj, obi->second, obj->obmat);
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Now all duplivert objects (if any) as instances of main object
|
|
|
|
// The original object has been included in the VlakRen renderlist above (see convertBlenderScene.c)
|
|
|
|
// but is written here which all other duplis are instances of.
|
|
|
|
float obmat[4][4], cmat[4][4], imat[4][4], nmat[4][4];
|
|
|
|
for (map<string, vector<float> >::const_iterator dupMtx=dupliMtx_list.begin();
|
|
|
|
dupMtx!=dupliMtx_list.end();++dupMtx) {
|
|
|
|
|
|
|
|
// original inverse matrix, not actual matrix of object, but first duplivert.
|
|
|
|
for (int i=0;i<4;i++)
|
|
|
|
for (int j=0;j<4;j++)
|
|
|
|
obmat[i][j] = dupMtx->second[(i<<2)+j];
|
|
|
|
MTC_Mat4Invert(imat, obmat);
|
|
|
|
|
|
|
|
// first object written as normal (but with transform of first duplivert)
|
|
|
|
Object* obj = dup_srcob[dupMtx->first];
|
|
|
|
writeObject(obj, all_objects[obj], obmat);
|
|
|
|
|
|
|
|
// all others instances of first
|
|
|
|
for (unsigned int curmtx=16;curmtx<dupMtx->second.size();curmtx+=16)
|
|
|
|
{ // number of 4x4 matrices
|
|
|
|
// new mtx
|
|
|
|
for (int i=0;i<4;i++)
|
|
|
|
for (int j=0;j<4;j++)
|
|
|
|
nmat[i][j] = dupMtx->second[curmtx+(i<<2)+j];
|
|
|
|
|
|
|
|
MTC_Mat4MulMat4(cmat, imat, nmat); // transform with respect to original = inverse_original * new
|
|
|
|
|
|
|
|
float mtr[4*4];
|
2004-07-26 00:48:28 +00:00
|
|
|
mtr[0*4+0]=cmat[0][0]; mtr[0*4+1]=cmat[1][0]; mtr[0*4+2]=cmat[2][0]; mtr[0*4+3]=cmat[3][0];
|
|
|
|
mtr[1*4+0]=cmat[0][1]; mtr[1*4+1]=cmat[1][1]; mtr[1*4+2]=cmat[2][1]; mtr[1*4+3]=cmat[3][1];
|
|
|
|
mtr[2*4+0]=cmat[0][2]; mtr[2*4+1]=cmat[1][2]; mtr[2*4+2]=cmat[2][2]; mtr[2*4+3]=cmat[3][2];
|
|
|
|
mtr[3*4+0]=cmat[0][3]; mtr[3*4+1]=cmat[1][3]; mtr[3*4+2]=cmat[2][3]; mtr[3*4+3]=cmat[3][3];
|
2004-06-16 18:44:12 +00:00
|
|
|
yafrayGate->transformPush(mtr);
|
|
|
|
|
|
|
|
// new name from original
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
string name=(obj->id.name);
|
2004-06-16 18:44:12 +00:00
|
|
|
char temp[16];
|
|
|
|
sprintf(temp,"_dup%d",(curmtx>>4));
|
|
|
|
name+=temp;
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
yafrayGate->addObject_reference(name,obj->id.name);
|
2004-06-16 18:44:12 +00:00
|
|
|
yafrayGate->transformPop();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2004-07-12 03:20:31 +00:00
|
|
|
void yafrayPluginRender_t::writeAreaLamp(LampRen* lamp, int num, float iview[4][4])
|
2004-06-16 18:44:12 +00:00
|
|
|
{
|
|
|
|
yafray::paramMap_t params;
|
|
|
|
|
|
|
|
if (lamp->area_shape!=LA_AREA_SQUARE) return;
|
|
|
|
float *a=lamp->area[0], *b=lamp->area[1], *c=lamp->area[2], *d=lamp->area[3];
|
|
|
|
float power=lamp->energy;
|
|
|
|
|
|
|
|
string md = "off";
|
2004-07-26 00:48:28 +00:00
|
|
|
// if no GI used, the GIphotons flag can still be set, so only use when 'full' selected
|
|
|
|
if ((R.r.GImethod==2) && (R.r.GIphotons)) { md="on"; power*=R.r.GIpower; }
|
2004-06-16 18:44:12 +00:00
|
|
|
params["type"]=yafray::parameter_t("arealight");
|
|
|
|
char temp[16];
|
|
|
|
sprintf(temp,"LAMP%d",num+1);
|
|
|
|
params["name"]=yafray::parameter_t(temp);
|
|
|
|
params["dummy"]=yafray::parameter_t(md);
|
|
|
|
params["power"]=yafray::parameter_t(power);
|
2004-08-11 23:32:13 +00:00
|
|
|
// samples not used for GI with photons, can still be exported, is ignored
|
|
|
|
int psm=0, sm = lamp->ray_totsamp;
|
|
|
|
if (sm>=25) psm = sm/5;
|
|
|
|
params["samples"]=yafray::parameter_t(sm);
|
|
|
|
params["psamples"]=yafray::parameter_t(psm);
|
2004-07-12 03:20:31 +00:00
|
|
|
|
|
|
|
// transform area lamp coords back to world
|
|
|
|
float lpco[4][3];
|
|
|
|
MTC_cp3Float(a, lpco[0]);
|
|
|
|
MTC_Mat4MulVecfl(iview, lpco[0]);
|
|
|
|
MTC_cp3Float(b, lpco[1]);
|
|
|
|
MTC_Mat4MulVecfl(iview, lpco[1]);
|
|
|
|
MTC_cp3Float(c, lpco[2]);
|
|
|
|
MTC_Mat4MulVecfl(iview, lpco[2]);
|
|
|
|
MTC_cp3Float(d, lpco[3]);
|
|
|
|
MTC_Mat4MulVecfl(iview, lpco[3]);
|
|
|
|
params["a"] = yafray::parameter_t(yafray::point3d_t(lpco[0][0], lpco[0][1], lpco[0][2]));
|
|
|
|
params["b"] = yafray::parameter_t(yafray::point3d_t(lpco[1][0], lpco[1][1], lpco[1][2]));
|
|
|
|
params["c"] = yafray::parameter_t(yafray::point3d_t(lpco[2][0], lpco[2][1], lpco[2][2]));
|
|
|
|
params["d"] = yafray::parameter_t(yafray::point3d_t(lpco[3][0], lpco[3][1], lpco[3][2]));
|
|
|
|
|
2004-06-16 18:44:12 +00:00
|
|
|
params["color"]=yafray::parameter_t(yafray::color_t(lamp->r,lamp->g,lamp->b));
|
|
|
|
yafrayGate->addLight(params);
|
|
|
|
}
|
|
|
|
|
|
|
|
void yafrayPluginRender_t::writeLamps()
|
|
|
|
{
|
2004-07-12 03:20:31 +00:00
|
|
|
// inver viewmatrix needed for back2world transform
|
|
|
|
float iview[4][4];
|
|
|
|
// R.viewinv != inv.R.viewmat because of possible ortho mode (see convertBlenderScene.c)
|
|
|
|
// have to invert it here
|
|
|
|
MTC_Mat4Invert(iview, R.viewmat);
|
|
|
|
|
2004-06-16 18:44:12 +00:00
|
|
|
// all lamps
|
|
|
|
for (int i=0;i<R.totlamp;i++)
|
|
|
|
{
|
|
|
|
yafray::paramMap_t params;
|
|
|
|
string type="";
|
|
|
|
LampRen* lamp = R.la[i];
|
Major update, all implemented a bit in a hurry, and probably will need bugfixes at some point.
Extended the range of the depth and cdepth parameters as reqested by leope.
Bumpmapping should now be a bit more similar to the Blender render.
Added support for all remaining lightsources in yafray, tried to make use of
as much of the existing Blender parameters as possible.
Blender Lamp: added switch to enable rendering with shadowbuffer ('softlight' in yafray).
All other parameters are similar to the Blender settings, for yafray both the
bias parameter and the shadowbuffer size can be lower than equivalent Blender
settings, since the yafray buffer is floating point. Remember that 6 shadowmaps
are created in this case, so can use quite a bit of memory with large
buffer settings.
When 'ray shadow' is enabled for this lamp type, it is possible to set a light
radius to create a spherical arealight source ('spherelight' in yafray),
when this is 0, it is exported as a pointlight instead.
Blender Spot: as in Blender now supports 'halo' rendering.
Halo spots always use shadowbuffers, so when enabled the buttons for shadowmap
settings will appear. The 'ray shadow' button can still be used to disable
shadows cast onto other objects, independent of halo shadows.
One thing to remember, halo's don't work with empty backgrounds, something must
be behind the spotlight for it to be visible.
And finally, the photonlight:
probably the most confusing (as more things related to yafray), the photonlight
is not a real lightsource, it is only used as a source to shoot photons from.
Since indirect lighting is already supported (and looks better as well)
only caustics mode is supported.
So to be able to use this properly other lightsources must be used with it.
For the photonlighting to be 'correct' similar lightsettings as for the 'source'
light are needed.
Probably the best way to do this, when you are happy with the lighting setup
you have, and want to add caustics, copy the light you want to enable for
caustics (shift-D) and leave everything as is, then change the mode to
'Photon'.
To not waiste any photons, the photonlight behaves similar to the spotlight,
you can set the width of the beam with the 'angle' parameter. Make sure
that any object that needs to cast caustics is within that beam, make
the beam width as small as possible to tightly fit the object.
The following other parameters can be set:
-photons: the number of photons to shoot.
-search: the number of photons to search when rendering, the higher,
the blurrier the caustics.
-depth: the amount of photon bounces allowed, since the primary use is for
caustics, you probably best set this to the same level as the 'ray depth'
parameter.
-Blur: this controls the amount of caustics blur (in addition to the search
parameter), very low values will cause very sharp caustics, which when used
with a low photonnumber, probably lead to only some noisy specks being rendered.
-Use QMC: Use quasi monte carlo sampling, can lead to cleaner results, but also
can sometimes cause patterns.
Since the photonlight has no meaning to Blender, when using photonlights and
switching back to the internal render, the light doesn't do anything, and no
type button will be selected. The lightsource can still be selected, but unless
switching to yafray, no parameters can set.
Apologies to Anexus, I had no time to really do something with your code,
I'll still look at it later, to see if I can improve anything in my implementation.
2004-07-28 22:37:12 +00:00
|
|
|
|
2004-07-12 03:20:31 +00:00
|
|
|
if (lamp->type==LA_AREA) { writeAreaLamp(lamp, i, iview); continue; }
|
Major update, all implemented a bit in a hurry, and probably will need bugfixes at some point.
Extended the range of the depth and cdepth parameters as reqested by leope.
Bumpmapping should now be a bit more similar to the Blender render.
Added support for all remaining lightsources in yafray, tried to make use of
as much of the existing Blender parameters as possible.
Blender Lamp: added switch to enable rendering with shadowbuffer ('softlight' in yafray).
All other parameters are similar to the Blender settings, for yafray both the
bias parameter and the shadowbuffer size can be lower than equivalent Blender
settings, since the yafray buffer is floating point. Remember that 6 shadowmaps
are created in this case, so can use quite a bit of memory with large
buffer settings.
When 'ray shadow' is enabled for this lamp type, it is possible to set a light
radius to create a spherical arealight source ('spherelight' in yafray),
when this is 0, it is exported as a pointlight instead.
Blender Spot: as in Blender now supports 'halo' rendering.
Halo spots always use shadowbuffers, so when enabled the buttons for shadowmap
settings will appear. The 'ray shadow' button can still be used to disable
shadows cast onto other objects, independent of halo shadows.
One thing to remember, halo's don't work with empty backgrounds, something must
be behind the spotlight for it to be visible.
And finally, the photonlight:
probably the most confusing (as more things related to yafray), the photonlight
is not a real lightsource, it is only used as a source to shoot photons from.
Since indirect lighting is already supported (and looks better as well)
only caustics mode is supported.
So to be able to use this properly other lightsources must be used with it.
For the photonlighting to be 'correct' similar lightsettings as for the 'source'
light are needed.
Probably the best way to do this, when you are happy with the lighting setup
you have, and want to add caustics, copy the light you want to enable for
caustics (shift-D) and leave everything as is, then change the mode to
'Photon'.
To not waiste any photons, the photonlight behaves similar to the spotlight,
you can set the width of the beam with the 'angle' parameter. Make sure
that any object that needs to cast caustics is within that beam, make
the beam width as small as possible to tightly fit the object.
The following other parameters can be set:
-photons: the number of photons to shoot.
-search: the number of photons to search when rendering, the higher,
the blurrier the caustics.
-depth: the amount of photon bounces allowed, since the primary use is for
caustics, you probably best set this to the same level as the 'ray depth'
parameter.
-Blur: this controls the amount of caustics blur (in addition to the search
parameter), very low values will cause very sharp caustics, which when used
with a low photonnumber, probably lead to only some noisy specks being rendered.
-Use QMC: Use quasi monte carlo sampling, can lead to cleaner results, but also
can sometimes cause patterns.
Since the photonlight has no meaning to Blender, when using photonlights and
switching back to the internal render, the light doesn't do anything, and no
type button will be selected. The lightsource can still be selected, but unless
switching to yafray, no parameters can set.
Apologies to Anexus, I had no time to really do something with your code,
I'll still look at it later, to see if I can improve anything in my implementation.
2004-07-28 22:37:12 +00:00
|
|
|
|
2004-06-16 18:44:12 +00:00
|
|
|
// TODO: add decay setting in yafray
|
Major update, all implemented a bit in a hurry, and probably will need bugfixes at some point.
Extended the range of the depth and cdepth parameters as reqested by leope.
Bumpmapping should now be a bit more similar to the Blender render.
Added support for all remaining lightsources in yafray, tried to make use of
as much of the existing Blender parameters as possible.
Blender Lamp: added switch to enable rendering with shadowbuffer ('softlight' in yafray).
All other parameters are similar to the Blender settings, for yafray both the
bias parameter and the shadowbuffer size can be lower than equivalent Blender
settings, since the yafray buffer is floating point. Remember that 6 shadowmaps
are created in this case, so can use quite a bit of memory with large
buffer settings.
When 'ray shadow' is enabled for this lamp type, it is possible to set a light
radius to create a spherical arealight source ('spherelight' in yafray),
when this is 0, it is exported as a pointlight instead.
Blender Spot: as in Blender now supports 'halo' rendering.
Halo spots always use shadowbuffers, so when enabled the buttons for shadowmap
settings will appear. The 'ray shadow' button can still be used to disable
shadows cast onto other objects, independent of halo shadows.
One thing to remember, halo's don't work with empty backgrounds, something must
be behind the spotlight for it to be visible.
And finally, the photonlight:
probably the most confusing (as more things related to yafray), the photonlight
is not a real lightsource, it is only used as a source to shoot photons from.
Since indirect lighting is already supported (and looks better as well)
only caustics mode is supported.
So to be able to use this properly other lightsources must be used with it.
For the photonlighting to be 'correct' similar lightsettings as for the 'source'
light are needed.
Probably the best way to do this, when you are happy with the lighting setup
you have, and want to add caustics, copy the light you want to enable for
caustics (shift-D) and leave everything as is, then change the mode to
'Photon'.
To not waiste any photons, the photonlight behaves similar to the spotlight,
you can set the width of the beam with the 'angle' parameter. Make sure
that any object that needs to cast caustics is within that beam, make
the beam width as small as possible to tightly fit the object.
The following other parameters can be set:
-photons: the number of photons to shoot.
-search: the number of photons to search when rendering, the higher,
the blurrier the caustics.
-depth: the amount of photon bounces allowed, since the primary use is for
caustics, you probably best set this to the same level as the 'ray depth'
parameter.
-Blur: this controls the amount of caustics blur (in addition to the search
parameter), very low values will cause very sharp caustics, which when used
with a low photonnumber, probably lead to only some noisy specks being rendered.
-Use QMC: Use quasi monte carlo sampling, can lead to cleaner results, but also
can sometimes cause patterns.
Since the photonlight has no meaning to Blender, when using photonlights and
switching back to the internal render, the light doesn't do anything, and no
type button will be selected. The lightsource can still be selected, but unless
switching to yafray, no parameters can set.
Apologies to Anexus, I had no time to really do something with your code,
I'll still look at it later, to see if I can improve anything in my implementation.
2004-07-28 22:37:12 +00:00
|
|
|
bool is_softL=false, is_sphereL=false;
|
|
|
|
if (lamp->type==LA_LOCAL) {
|
|
|
|
if (lamp->mode & LA_YF_SOFT) {
|
|
|
|
// shadowmapped omnidirectional light
|
|
|
|
params["type"] = yafray::parameter_t("softlight");
|
|
|
|
is_softL = true;
|
|
|
|
}
|
|
|
|
else if ((lamp->mode & LA_SHAD_RAY) && (lamp->YF_ltradius>0.0)) {
|
|
|
|
// area sphere, only when ray shadows enabled and radius>0.0
|
|
|
|
params["type"] = yafray::parameter_t("spherelight");
|
|
|
|
is_sphereL = true;
|
|
|
|
}
|
|
|
|
else params["type"] = yafray::parameter_t("pointlight");
|
Second and final commit for this version of the yafray export code (probably, you never know
of course...)
Not quite complete, but due to lack of time as good as it will get for now.
From the previous commit, forgot to report that basic fog is supported as well. Though because I had not much time to complete the code, it is sort of unfinished, and you will have
to tweak parameters specifically for yafray again. It uses only the world horizon color, and
only uses the Blender mist distance setting.
Textures now support checker clip mode.
Fixed possibly all 'duplilist non-empty' errors, though it could hide the real cause of the
error.
AA is no longer enabled automatically for certain GI quality settings, I thought it best to
leave it to the user to decide.
SkyDome GI mode now supports cache as well. There is a new option in the GI quality menu 'Use
Blender AO settings', which will as it says use the most important AO settings for the
skydome parameters. The only AO parameters used are 'Samples', 'Dist' and the random sampling
switch, which unlike in Blender you might want to use more often, since the QMC sampling used
in yafray can result in visible patterns or a dithering type look. 'Random' is not completely
random in yafray however, it is actually jittered (stratified) sampling.
Using an occlusion cache, doesn't necessarily mean that you will always get much shorter
render times. As with 'full' GI and cache, one problem is bumpmaps, when using bump (or
normal) maps, the sampling will be much more dense, using lots more rendertime.
As a temporary fix there is a button 'NoBump', but this also has the side effect that in
areas of total indirect light (or when used with SkyDome cache) no bumpmapping will be
visible. It is therefor best used with some direct light as well.
For SkyDome with cache, and strong bumpmapping it might actually not make much difference,
since for low distance values you can usually get away with low sample values as well.
The entire material panel is now replaced by another panel to show only the parameters
important to yafray and add some new ones as well.
Since lots of users (especially yafray beginners) have had problems getting certain material
aspects right, there is now a material preset menu available to hopefully solve some of the
most common "How do I do this? It doesn't work!" questions seen in various forums.
Choosing an option from this menu will set the required parameters to default
values for yafray, and you can work your way from there to tweak it something you want.
Most buttons are copies of the same Blender parameters, with some variations. Just like
Blender 'Ray Mirror' enables reflection, 'Ray Transp' enables refraction. You can use
'ZTransp' for materials that have texture maps with alpha channels.
Again, same as Blender 'rayMir' sets the amount of reflection. Next button 'frsOfs' however
controls fresnel offset, meaning that when this is set to 1, you will get no fresnel effect
and when set to 5, reflection is totally determined by fresnel, which is important for
realistic glass/metals/etc.
IOR is self-explanatory (...), same as Blender.
When you have 'Ray Transp' enabled, the blender 'filter' button will appear next to the IOR
button. This has the same effect as in Blender.
Below that there are some new parameters, 'Ext.Color' sets the extinction color for
transparent materials. Usually, in real transparent materials, light loses some of it's
energy the further it has to travel through the object. This effect can be simulated with
this parameter. Thing to look out for is that it specifies the color which will be
REMOVED after traveling through the object. What this means is that say you have a clear
white glass sphere, and set the extinction color to a strong blue, the result will be a
very yellow object when rendered.
Next to the color sliders, there is another set of three parameters, with which you can
enable color dispersion for transparent objects. 'Pwr' sets the amount of dispersion,
the higher, the more dispersion (the more colorful the result).
(For real world materials, this number can be found or derived from data in various glass catalogues)
The 'Samples' button below that sets the number of samples used, minimum values are around
7-10, and for very strong dispersion you might need a lot more.
As usual, this also means an increase in render time of course, but to simulate
realistic materials, you shouldn't really need more than 25 samples.
In addition to that, when using low sample numbers, but to still get a good spread of colors,
you can enable the jitter button, but this will also add noise.
Point/soft(point with shadowbuffer) or sphere lights (light with radius), have a new option
to add a simple glow effect, so that lights can be made visible.
NOTE: just like spotlight halo's, glow is not visible against the background, there must be
another object behind it. Simplest solution is to use a large black shadeless plane behind
your scene.
The glow intensity can be set with the 'GlowInt' parameter (use very low values around 0.01
even lower), and you can choose from two different types with the 'GlowType' button (which
don't look much different, but type 1 is probably better, type 0 faster).
And that's it, with apologies for the still missing features and
full support in general, but this will have to do for now.
2005-05-22 22:46:17 +00:00
|
|
|
params["glow_intensity"] = yafray::parameter_t(lamp->YF_glowint);
|
Added some backward compatibility with old yafray blendershader. Because of missing
parameters the material preset menu won't be as useful. Both glass presets will look the same
because there is no 'filter' parameter in the old yafray for instance.
So using the new Blender version with an old yafray version should work a bit better,
though the other way around, using the new yafray with an old blender version, will generally
not work as well.
I added a few extra things. In 'yafray' panel re-arranged some buttons, and added a new
button 'Clamp RGB'. This button will be enabled by default and helps to improve AA on
high contrast edges in the image. When using bokeh however, it is best to switch this off,
otherwise lens shaped highlights will be quite a bit less visible.
Changed the 'extinction' parameter name to the probably more correct term 'absorption',
though mathematically it works out the same. Also changed the behaviour of this color,
it no longer specifies a color that will be removed as I wrote in the previous commit,
but instead the actual color at one (blender) unit of distance. The 'Ds' (distance scale)
button below the color sliders controls the scaling of this unit distance.
What this means is that if you take the standard blender cube, which covers two units of
distance by default, setting the distance scale button to 2.0 will make sure that the color
you specified is exactly that color at that distance (provided the base color itself is white
of course, or 'filter' is 0, otherwise it will be filtered by the base color too).
Beyond this distance the color will get darker.
The glow option for point/soft/sphere lights has a new parameter 'GloOfs', or glow offset.
Setting this to a higher value then 0 will soften the central peak of the glow.
Another unreported bug fix: For xml export, when yafray failed to render the xml file
for some unknown reason, or because of other problems, the export code would still load
the previously rendered image, this causes problems however if the image resolution is
not the same as the current Blender buffer, and so could cause memory corruption or crashes.
This is now taken into account.
World image backgrounds now use the blender mapping settings as well, but only the
'AngMap', 'Sphere' and 'Tube' settings. But in yafray those last two, unlike Blender, cover
the whole view, not just the upper half, so is not really fully compatible with yafray.
So now you have to set one of these buttons too when loading a hdr lightprobe image.
btw, something I forgot to mention in previous commits is that the exposure control using
the texture brightness slider is no longer restricted to integer values. It is now a
floating point value, so you're not restricted to the 0 1 and 2 slider positions anymore,
anything in between will work too.
And finally, display updating is now more like Blender, using the mouse cursor as frame
counter for animation, etc.
2005-05-27 17:52:53 +00:00
|
|
|
params["glow_offset"] = yafray::parameter_t(lamp->YF_glowofs);
|
Second and final commit for this version of the yafray export code (probably, you never know
of course...)
Not quite complete, but due to lack of time as good as it will get for now.
From the previous commit, forgot to report that basic fog is supported as well. Though because I had not much time to complete the code, it is sort of unfinished, and you will have
to tweak parameters specifically for yafray again. It uses only the world horizon color, and
only uses the Blender mist distance setting.
Textures now support checker clip mode.
Fixed possibly all 'duplilist non-empty' errors, though it could hide the real cause of the
error.
AA is no longer enabled automatically for certain GI quality settings, I thought it best to
leave it to the user to decide.
SkyDome GI mode now supports cache as well. There is a new option in the GI quality menu 'Use
Blender AO settings', which will as it says use the most important AO settings for the
skydome parameters. The only AO parameters used are 'Samples', 'Dist' and the random sampling
switch, which unlike in Blender you might want to use more often, since the QMC sampling used
in yafray can result in visible patterns or a dithering type look. 'Random' is not completely
random in yafray however, it is actually jittered (stratified) sampling.
Using an occlusion cache, doesn't necessarily mean that you will always get much shorter
render times. As with 'full' GI and cache, one problem is bumpmaps, when using bump (or
normal) maps, the sampling will be much more dense, using lots more rendertime.
As a temporary fix there is a button 'NoBump', but this also has the side effect that in
areas of total indirect light (or when used with SkyDome cache) no bumpmapping will be
visible. It is therefor best used with some direct light as well.
For SkyDome with cache, and strong bumpmapping it might actually not make much difference,
since for low distance values you can usually get away with low sample values as well.
The entire material panel is now replaced by another panel to show only the parameters
important to yafray and add some new ones as well.
Since lots of users (especially yafray beginners) have had problems getting certain material
aspects right, there is now a material preset menu available to hopefully solve some of the
most common "How do I do this? It doesn't work!" questions seen in various forums.
Choosing an option from this menu will set the required parameters to default
values for yafray, and you can work your way from there to tweak it something you want.
Most buttons are copies of the same Blender parameters, with some variations. Just like
Blender 'Ray Mirror' enables reflection, 'Ray Transp' enables refraction. You can use
'ZTransp' for materials that have texture maps with alpha channels.
Again, same as Blender 'rayMir' sets the amount of reflection. Next button 'frsOfs' however
controls fresnel offset, meaning that when this is set to 1, you will get no fresnel effect
and when set to 5, reflection is totally determined by fresnel, which is important for
realistic glass/metals/etc.
IOR is self-explanatory (...), same as Blender.
When you have 'Ray Transp' enabled, the blender 'filter' button will appear next to the IOR
button. This has the same effect as in Blender.
Below that there are some new parameters, 'Ext.Color' sets the extinction color for
transparent materials. Usually, in real transparent materials, light loses some of it's
energy the further it has to travel through the object. This effect can be simulated with
this parameter. Thing to look out for is that it specifies the color which will be
REMOVED after traveling through the object. What this means is that say you have a clear
white glass sphere, and set the extinction color to a strong blue, the result will be a
very yellow object when rendered.
Next to the color sliders, there is another set of three parameters, with which you can
enable color dispersion for transparent objects. 'Pwr' sets the amount of dispersion,
the higher, the more dispersion (the more colorful the result).
(For real world materials, this number can be found or derived from data in various glass catalogues)
The 'Samples' button below that sets the number of samples used, minimum values are around
7-10, and for very strong dispersion you might need a lot more.
As usual, this also means an increase in render time of course, but to simulate
realistic materials, you shouldn't really need more than 25 samples.
In addition to that, when using low sample numbers, but to still get a good spread of colors,
you can enable the jitter button, but this will also add noise.
Point/soft(point with shadowbuffer) or sphere lights (light with radius), have a new option
to add a simple glow effect, so that lights can be made visible.
NOTE: just like spotlight halo's, glow is not visible against the background, there must be
another object behind it. Simplest solution is to use a large black shadeless plane behind
your scene.
The glow intensity can be set with the 'GlowInt' parameter (use very low values around 0.01
even lower), and you can choose from two different types with the 'GlowType' button (which
don't look much different, but type 1 is probably better, type 0 faster).
And that's it, with apologies for the still missing features and
full support in general, but this will have to do for now.
2005-05-22 22:46:17 +00:00
|
|
|
params["glow_type"] = yafray::parameter_t(lamp->YF_glowtype);
|
Major update, all implemented a bit in a hurry, and probably will need bugfixes at some point.
Extended the range of the depth and cdepth parameters as reqested by leope.
Bumpmapping should now be a bit more similar to the Blender render.
Added support for all remaining lightsources in yafray, tried to make use of
as much of the existing Blender parameters as possible.
Blender Lamp: added switch to enable rendering with shadowbuffer ('softlight' in yafray).
All other parameters are similar to the Blender settings, for yafray both the
bias parameter and the shadowbuffer size can be lower than equivalent Blender
settings, since the yafray buffer is floating point. Remember that 6 shadowmaps
are created in this case, so can use quite a bit of memory with large
buffer settings.
When 'ray shadow' is enabled for this lamp type, it is possible to set a light
radius to create a spherical arealight source ('spherelight' in yafray),
when this is 0, it is exported as a pointlight instead.
Blender Spot: as in Blender now supports 'halo' rendering.
Halo spots always use shadowbuffers, so when enabled the buttons for shadowmap
settings will appear. The 'ray shadow' button can still be used to disable
shadows cast onto other objects, independent of halo shadows.
One thing to remember, halo's don't work with empty backgrounds, something must
be behind the spotlight for it to be visible.
And finally, the photonlight:
probably the most confusing (as more things related to yafray), the photonlight
is not a real lightsource, it is only used as a source to shoot photons from.
Since indirect lighting is already supported (and looks better as well)
only caustics mode is supported.
So to be able to use this properly other lightsources must be used with it.
For the photonlighting to be 'correct' similar lightsettings as for the 'source'
light are needed.
Probably the best way to do this, when you are happy with the lighting setup
you have, and want to add caustics, copy the light you want to enable for
caustics (shift-D) and leave everything as is, then change the mode to
'Photon'.
To not waiste any photons, the photonlight behaves similar to the spotlight,
you can set the width of the beam with the 'angle' parameter. Make sure
that any object that needs to cast caustics is within that beam, make
the beam width as small as possible to tightly fit the object.
The following other parameters can be set:
-photons: the number of photons to shoot.
-search: the number of photons to search when rendering, the higher,
the blurrier the caustics.
-depth: the amount of photon bounces allowed, since the primary use is for
caustics, you probably best set this to the same level as the 'ray depth'
parameter.
-Blur: this controls the amount of caustics blur (in addition to the search
parameter), very low values will cause very sharp caustics, which when used
with a low photonnumber, probably lead to only some noisy specks being rendered.
-Use QMC: Use quasi monte carlo sampling, can lead to cleaner results, but also
can sometimes cause patterns.
Since the photonlight has no meaning to Blender, when using photonlights and
switching back to the internal render, the light doesn't do anything, and no
type button will be selected. The lightsource can still be selected, but unless
switching to yafray, no parameters can set.
Apologies to Anexus, I had no time to really do something with your code,
I'll still look at it later, to see if I can improve anything in my implementation.
2004-07-28 22:37:12 +00:00
|
|
|
}
|
2004-06-16 18:44:12 +00:00
|
|
|
else if (lamp->type==LA_SPOT)
|
Major update, all implemented a bit in a hurry, and probably will need bugfixes at some point.
Extended the range of the depth and cdepth parameters as reqested by leope.
Bumpmapping should now be a bit more similar to the Blender render.
Added support for all remaining lightsources in yafray, tried to make use of
as much of the existing Blender parameters as possible.
Blender Lamp: added switch to enable rendering with shadowbuffer ('softlight' in yafray).
All other parameters are similar to the Blender settings, for yafray both the
bias parameter and the shadowbuffer size can be lower than equivalent Blender
settings, since the yafray buffer is floating point. Remember that 6 shadowmaps
are created in this case, so can use quite a bit of memory with large
buffer settings.
When 'ray shadow' is enabled for this lamp type, it is possible to set a light
radius to create a spherical arealight source ('spherelight' in yafray),
when this is 0, it is exported as a pointlight instead.
Blender Spot: as in Blender now supports 'halo' rendering.
Halo spots always use shadowbuffers, so when enabled the buttons for shadowmap
settings will appear. The 'ray shadow' button can still be used to disable
shadows cast onto other objects, independent of halo shadows.
One thing to remember, halo's don't work with empty backgrounds, something must
be behind the spotlight for it to be visible.
And finally, the photonlight:
probably the most confusing (as more things related to yafray), the photonlight
is not a real lightsource, it is only used as a source to shoot photons from.
Since indirect lighting is already supported (and looks better as well)
only caustics mode is supported.
So to be able to use this properly other lightsources must be used with it.
For the photonlighting to be 'correct' similar lightsettings as for the 'source'
light are needed.
Probably the best way to do this, when you are happy with the lighting setup
you have, and want to add caustics, copy the light you want to enable for
caustics (shift-D) and leave everything as is, then change the mode to
'Photon'.
To not waiste any photons, the photonlight behaves similar to the spotlight,
you can set the width of the beam with the 'angle' parameter. Make sure
that any object that needs to cast caustics is within that beam, make
the beam width as small as possible to tightly fit the object.
The following other parameters can be set:
-photons: the number of photons to shoot.
-search: the number of photons to search when rendering, the higher,
the blurrier the caustics.
-depth: the amount of photon bounces allowed, since the primary use is for
caustics, you probably best set this to the same level as the 'ray depth'
parameter.
-Blur: this controls the amount of caustics blur (in addition to the search
parameter), very low values will cause very sharp caustics, which when used
with a low photonnumber, probably lead to only some noisy specks being rendered.
-Use QMC: Use quasi monte carlo sampling, can lead to cleaner results, but also
can sometimes cause patterns.
Since the photonlight has no meaning to Blender, when using photonlights and
switching back to the internal render, the light doesn't do anything, and no
type button will be selected. The lightsource can still be selected, but unless
switching to yafray, no parameters can set.
Apologies to Anexus, I had no time to really do something with your code,
I'll still look at it later, to see if I can improve anything in my implementation.
2004-07-28 22:37:12 +00:00
|
|
|
params["type"] = yafray::parameter_t("spotlight");
|
|
|
|
else if ((lamp->type==LA_SUN) || (lamp->type==LA_HEMI)) // hemi exported as sun
|
|
|
|
params["type"] = yafray::parameter_t("sunlight");
|
|
|
|
else if (lamp->type==LA_YF_PHOTON)
|
|
|
|
params["type"] = yafray::parameter_t("photonlight");
|
|
|
|
else {
|
2004-06-16 18:44:12 +00:00
|
|
|
// possibly unknown type, ignore
|
|
|
|
cout << "Unknown Blender lamp type: " << lamp->type << endl;
|
|
|
|
continue;
|
|
|
|
}
|
Major update, all implemented a bit in a hurry, and probably will need bugfixes at some point.
Extended the range of the depth and cdepth parameters as reqested by leope.
Bumpmapping should now be a bit more similar to the Blender render.
Added support for all remaining lightsources in yafray, tried to make use of
as much of the existing Blender parameters as possible.
Blender Lamp: added switch to enable rendering with shadowbuffer ('softlight' in yafray).
All other parameters are similar to the Blender settings, for yafray both the
bias parameter and the shadowbuffer size can be lower than equivalent Blender
settings, since the yafray buffer is floating point. Remember that 6 shadowmaps
are created in this case, so can use quite a bit of memory with large
buffer settings.
When 'ray shadow' is enabled for this lamp type, it is possible to set a light
radius to create a spherical arealight source ('spherelight' in yafray),
when this is 0, it is exported as a pointlight instead.
Blender Spot: as in Blender now supports 'halo' rendering.
Halo spots always use shadowbuffers, so when enabled the buttons for shadowmap
settings will appear. The 'ray shadow' button can still be used to disable
shadows cast onto other objects, independent of halo shadows.
One thing to remember, halo's don't work with empty backgrounds, something must
be behind the spotlight for it to be visible.
And finally, the photonlight:
probably the most confusing (as more things related to yafray), the photonlight
is not a real lightsource, it is only used as a source to shoot photons from.
Since indirect lighting is already supported (and looks better as well)
only caustics mode is supported.
So to be able to use this properly other lightsources must be used with it.
For the photonlighting to be 'correct' similar lightsettings as for the 'source'
light are needed.
Probably the best way to do this, when you are happy with the lighting setup
you have, and want to add caustics, copy the light you want to enable for
caustics (shift-D) and leave everything as is, then change the mode to
'Photon'.
To not waiste any photons, the photonlight behaves similar to the spotlight,
you can set the width of the beam with the 'angle' parameter. Make sure
that any object that needs to cast caustics is within that beam, make
the beam width as small as possible to tightly fit the object.
The following other parameters can be set:
-photons: the number of photons to shoot.
-search: the number of photons to search when rendering, the higher,
the blurrier the caustics.
-depth: the amount of photon bounces allowed, since the primary use is for
caustics, you probably best set this to the same level as the 'ray depth'
parameter.
-Blur: this controls the amount of caustics blur (in addition to the search
parameter), very low values will cause very sharp caustics, which when used
with a low photonnumber, probably lead to only some noisy specks being rendered.
-Use QMC: Use quasi monte carlo sampling, can lead to cleaner results, but also
can sometimes cause patterns.
Since the photonlight has no meaning to Blender, when using photonlights and
switching back to the internal render, the light doesn't do anything, and no
type button will be selected. The lightsource can still be selected, but unless
switching to yafray, no parameters can set.
Apologies to Anexus, I had no time to really do something with your code,
I'll still look at it later, to see if I can improve anything in my implementation.
2004-07-28 22:37:12 +00:00
|
|
|
|
2004-06-16 18:44:12 +00:00
|
|
|
//no name available here, create one
|
|
|
|
char temp[16];
|
|
|
|
sprintf(temp,"LAMP%d",i+1);
|
Major update, all implemented a bit in a hurry, and probably will need bugfixes at some point.
Extended the range of the depth and cdepth parameters as reqested by leope.
Bumpmapping should now be a bit more similar to the Blender render.
Added support for all remaining lightsources in yafray, tried to make use of
as much of the existing Blender parameters as possible.
Blender Lamp: added switch to enable rendering with shadowbuffer ('softlight' in yafray).
All other parameters are similar to the Blender settings, for yafray both the
bias parameter and the shadowbuffer size can be lower than equivalent Blender
settings, since the yafray buffer is floating point. Remember that 6 shadowmaps
are created in this case, so can use quite a bit of memory with large
buffer settings.
When 'ray shadow' is enabled for this lamp type, it is possible to set a light
radius to create a spherical arealight source ('spherelight' in yafray),
when this is 0, it is exported as a pointlight instead.
Blender Spot: as in Blender now supports 'halo' rendering.
Halo spots always use shadowbuffers, so when enabled the buttons for shadowmap
settings will appear. The 'ray shadow' button can still be used to disable
shadows cast onto other objects, independent of halo shadows.
One thing to remember, halo's don't work with empty backgrounds, something must
be behind the spotlight for it to be visible.
And finally, the photonlight:
probably the most confusing (as more things related to yafray), the photonlight
is not a real lightsource, it is only used as a source to shoot photons from.
Since indirect lighting is already supported (and looks better as well)
only caustics mode is supported.
So to be able to use this properly other lightsources must be used with it.
For the photonlighting to be 'correct' similar lightsettings as for the 'source'
light are needed.
Probably the best way to do this, when you are happy with the lighting setup
you have, and want to add caustics, copy the light you want to enable for
caustics (shift-D) and leave everything as is, then change the mode to
'Photon'.
To not waiste any photons, the photonlight behaves similar to the spotlight,
you can set the width of the beam with the 'angle' parameter. Make sure
that any object that needs to cast caustics is within that beam, make
the beam width as small as possible to tightly fit the object.
The following other parameters can be set:
-photons: the number of photons to shoot.
-search: the number of photons to search when rendering, the higher,
the blurrier the caustics.
-depth: the amount of photon bounces allowed, since the primary use is for
caustics, you probably best set this to the same level as the 'ray depth'
parameter.
-Blur: this controls the amount of caustics blur (in addition to the search
parameter), very low values will cause very sharp caustics, which when used
with a low photonnumber, probably lead to only some noisy specks being rendered.
-Use QMC: Use quasi monte carlo sampling, can lead to cleaner results, but also
can sometimes cause patterns.
Since the photonlight has no meaning to Blender, when using photonlights and
switching back to the internal render, the light doesn't do anything, and no
type button will be selected. The lightsource can still be selected, but unless
switching to yafray, no parameters can set.
Apologies to Anexus, I had no time to really do something with your code,
I'll still look at it later, to see if I can improve anything in my implementation.
2004-07-28 22:37:12 +00:00
|
|
|
params["name"] = yafray::parameter_t(temp);
|
Part one of the final yafray commit.
Totally updated blender shader in yafray, hopefully better matches blender
results. Though ramps are now partially supported, they cannot work in all
cases properly in yafray, and in fact are a bit useless probably as far as
yafray is concerned. In fact the 'Result' ramp input mode is not supported
at all, because it works on the total lighting result, and in a yafray
shader this is not possible since it works per light.
Also, since Blender and Yafray have totally different lighting models,
the 'Energy' ramp input mode also won't generally give the same results
as in Blender, since it works with light energy and in yafray this is
different from Blender. Even worse, the only ramp shader that will work
properly when used with GI is the 'Normal' ramp input mode.
As contradictory as this might seem, at various stages of the GI process,
lighting is not known, so properly getting light (ramp 'energy' mode)
or shader information (ramp 'shader' mode, which depends on lighting)
is not possible. Which all means that when the ramp is in 'energy' or
'shader' mode and using it with GI enabled, yafray can only 'see' the
underlying material color, not the ramps, which results in a mix of the
ramp colors (from direct light) with the material color (from indirect light).
There is currently nothing that can be done about that.
The supported texture mapping modes now includes raymir as well, transparency
as far as texturing is concerned now works similar to Blender, with the
exception that you still have to set alpha to a low value to get any
transparency effect at all in yafray. So the Blender 'filter' parameter
now also will affect yafray.
All texture blending modes are now supported (same for ramps).
'Translu' and 'Amb' texture modulation are not supported.
Texture interpolation can be switched off ('InterPol' switch in blender
image texture button section).
All Blender brdf models (aka 'shaders' for the Blender users) are now supported,
and again, you won't necessarily get the same results as in Blender.
The reason for that is partially of course the lighting differences, but also,
not all Blender 'shader' implementations are actually correct, and copying
those errors just for the sake of matching Blender results doesn't really
seem like a good idea...
Though this really is only the case for WardIso, less so for Minnaert and
Blinn, which in yafray are more or less (but not totally) a copy of
the Blender code.
In any case, in practice those differences might not be
too noticable at all (I hope).
Continue to the next part...
2005-05-21 20:49:24 +00:00
|
|
|
|
2004-06-16 18:44:12 +00:00
|
|
|
// color already premultiplied by energy, so only need distance here
|
Second and final commit for this version of the yafray export code (probably, you never know
of course...)
Not quite complete, but due to lack of time as good as it will get for now.
From the previous commit, forgot to report that basic fog is supported as well. Though because I had not much time to complete the code, it is sort of unfinished, and you will have
to tweak parameters specifically for yafray again. It uses only the world horizon color, and
only uses the Blender mist distance setting.
Textures now support checker clip mode.
Fixed possibly all 'duplilist non-empty' errors, though it could hide the real cause of the
error.
AA is no longer enabled automatically for certain GI quality settings, I thought it best to
leave it to the user to decide.
SkyDome GI mode now supports cache as well. There is a new option in the GI quality menu 'Use
Blender AO settings', which will as it says use the most important AO settings for the
skydome parameters. The only AO parameters used are 'Samples', 'Dist' and the random sampling
switch, which unlike in Blender you might want to use more often, since the QMC sampling used
in yafray can result in visible patterns or a dithering type look. 'Random' is not completely
random in yafray however, it is actually jittered (stratified) sampling.
Using an occlusion cache, doesn't necessarily mean that you will always get much shorter
render times. As with 'full' GI and cache, one problem is bumpmaps, when using bump (or
normal) maps, the sampling will be much more dense, using lots more rendertime.
As a temporary fix there is a button 'NoBump', but this also has the side effect that in
areas of total indirect light (or when used with SkyDome cache) no bumpmapping will be
visible. It is therefor best used with some direct light as well.
For SkyDome with cache, and strong bumpmapping it might actually not make much difference,
since for low distance values you can usually get away with low sample values as well.
The entire material panel is now replaced by another panel to show only the parameters
important to yafray and add some new ones as well.
Since lots of users (especially yafray beginners) have had problems getting certain material
aspects right, there is now a material preset menu available to hopefully solve some of the
most common "How do I do this? It doesn't work!" questions seen in various forums.
Choosing an option from this menu will set the required parameters to default
values for yafray, and you can work your way from there to tweak it something you want.
Most buttons are copies of the same Blender parameters, with some variations. Just like
Blender 'Ray Mirror' enables reflection, 'Ray Transp' enables refraction. You can use
'ZTransp' for materials that have texture maps with alpha channels.
Again, same as Blender 'rayMir' sets the amount of reflection. Next button 'frsOfs' however
controls fresnel offset, meaning that when this is set to 1, you will get no fresnel effect
and when set to 5, reflection is totally determined by fresnel, which is important for
realistic glass/metals/etc.
IOR is self-explanatory (...), same as Blender.
When you have 'Ray Transp' enabled, the blender 'filter' button will appear next to the IOR
button. This has the same effect as in Blender.
Below that there are some new parameters, 'Ext.Color' sets the extinction color for
transparent materials. Usually, in real transparent materials, light loses some of it's
energy the further it has to travel through the object. This effect can be simulated with
this parameter. Thing to look out for is that it specifies the color which will be
REMOVED after traveling through the object. What this means is that say you have a clear
white glass sphere, and set the extinction color to a strong blue, the result will be a
very yellow object when rendered.
Next to the color sliders, there is another set of three parameters, with which you can
enable color dispersion for transparent objects. 'Pwr' sets the amount of dispersion,
the higher, the more dispersion (the more colorful the result).
(For real world materials, this number can be found or derived from data in various glass catalogues)
The 'Samples' button below that sets the number of samples used, minimum values are around
7-10, and for very strong dispersion you might need a lot more.
As usual, this also means an increase in render time of course, but to simulate
realistic materials, you shouldn't really need more than 25 samples.
In addition to that, when using low sample numbers, but to still get a good spread of colors,
you can enable the jitter button, but this will also add noise.
Point/soft(point with shadowbuffer) or sphere lights (light with radius), have a new option
to add a simple glow effect, so that lights can be made visible.
NOTE: just like spotlight halo's, glow is not visible against the background, there must be
another object behind it. Simplest solution is to use a large black shadeless plane behind
your scene.
The glow intensity can be set with the 'GlowInt' parameter (use very low values around 0.01
even lower), and you can choose from two different types with the 'GlowType' button (which
don't look much different, but type 1 is probably better, type 0 faster).
And that's it, with apologies for the still missing features and
full support in general, but this will have to do for now.
2005-05-22 22:46:17 +00:00
|
|
|
float pwr = 1; // default for sun/hemi, distance irrelevant
|
Major update, all implemented a bit in a hurry, and probably will need bugfixes at some point.
Extended the range of the depth and cdepth parameters as reqested by leope.
Bumpmapping should now be a bit more similar to the Blender render.
Added support for all remaining lightsources in yafray, tried to make use of
as much of the existing Blender parameters as possible.
Blender Lamp: added switch to enable rendering with shadowbuffer ('softlight' in yafray).
All other parameters are similar to the Blender settings, for yafray both the
bias parameter and the shadowbuffer size can be lower than equivalent Blender
settings, since the yafray buffer is floating point. Remember that 6 shadowmaps
are created in this case, so can use quite a bit of memory with large
buffer settings.
When 'ray shadow' is enabled for this lamp type, it is possible to set a light
radius to create a spherical arealight source ('spherelight' in yafray),
when this is 0, it is exported as a pointlight instead.
Blender Spot: as in Blender now supports 'halo' rendering.
Halo spots always use shadowbuffers, so when enabled the buttons for shadowmap
settings will appear. The 'ray shadow' button can still be used to disable
shadows cast onto other objects, independent of halo shadows.
One thing to remember, halo's don't work with empty backgrounds, something must
be behind the spotlight for it to be visible.
And finally, the photonlight:
probably the most confusing (as more things related to yafray), the photonlight
is not a real lightsource, it is only used as a source to shoot photons from.
Since indirect lighting is already supported (and looks better as well)
only caustics mode is supported.
So to be able to use this properly other lightsources must be used with it.
For the photonlighting to be 'correct' similar lightsettings as for the 'source'
light are needed.
Probably the best way to do this, when you are happy with the lighting setup
you have, and want to add caustics, copy the light you want to enable for
caustics (shift-D) and leave everything as is, then change the mode to
'Photon'.
To not waiste any photons, the photonlight behaves similar to the spotlight,
you can set the width of the beam with the 'angle' parameter. Make sure
that any object that needs to cast caustics is within that beam, make
the beam width as small as possible to tightly fit the object.
The following other parameters can be set:
-photons: the number of photons to shoot.
-search: the number of photons to search when rendering, the higher,
the blurrier the caustics.
-depth: the amount of photon bounces allowed, since the primary use is for
caustics, you probably best set this to the same level as the 'ray depth'
parameter.
-Blur: this controls the amount of caustics blur (in addition to the search
parameter), very low values will cause very sharp caustics, which when used
with a low photonnumber, probably lead to only some noisy specks being rendered.
-Use QMC: Use quasi monte carlo sampling, can lead to cleaner results, but also
can sometimes cause patterns.
Since the photonlight has no meaning to Blender, when using photonlights and
switching back to the internal render, the light doesn't do anything, and no
type button will be selected. The lightsource can still be selected, but unless
switching to yafray, no parameters can set.
Apologies to Anexus, I had no time to really do something with your code,
I'll still look at it later, to see if I can improve anything in my implementation.
2004-07-28 22:37:12 +00:00
|
|
|
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?)
|
|
|
|
pwr = lamp->dist*(lamp->dist+1)*(0.25/M_PI);
|
|
|
|
//decay = 2;
|
|
|
|
}
|
|
|
|
else {
|
2004-06-16 18:44:12 +00:00
|
|
|
pwr = lamp->dist;
|
Major update, all implemented a bit in a hurry, and probably will need bugfixes at some point.
Extended the range of the depth and cdepth parameters as reqested by leope.
Bumpmapping should now be a bit more similar to the Blender render.
Added support for all remaining lightsources in yafray, tried to make use of
as much of the existing Blender parameters as possible.
Blender Lamp: added switch to enable rendering with shadowbuffer ('softlight' in yafray).
All other parameters are similar to the Blender settings, for yafray both the
bias parameter and the shadowbuffer size can be lower than equivalent Blender
settings, since the yafray buffer is floating point. Remember that 6 shadowmaps
are created in this case, so can use quite a bit of memory with large
buffer settings.
When 'ray shadow' is enabled for this lamp type, it is possible to set a light
radius to create a spherical arealight source ('spherelight' in yafray),
when this is 0, it is exported as a pointlight instead.
Blender Spot: as in Blender now supports 'halo' rendering.
Halo spots always use shadowbuffers, so when enabled the buttons for shadowmap
settings will appear. The 'ray shadow' button can still be used to disable
shadows cast onto other objects, independent of halo shadows.
One thing to remember, halo's don't work with empty backgrounds, something must
be behind the spotlight for it to be visible.
And finally, the photonlight:
probably the most confusing (as more things related to yafray), the photonlight
is not a real lightsource, it is only used as a source to shoot photons from.
Since indirect lighting is already supported (and looks better as well)
only caustics mode is supported.
So to be able to use this properly other lightsources must be used with it.
For the photonlighting to be 'correct' similar lightsettings as for the 'source'
light are needed.
Probably the best way to do this, when you are happy with the lighting setup
you have, and want to add caustics, copy the light you want to enable for
caustics (shift-D) and leave everything as is, then change the mode to
'Photon'.
To not waiste any photons, the photonlight behaves similar to the spotlight,
you can set the width of the beam with the 'angle' parameter. Make sure
that any object that needs to cast caustics is within that beam, make
the beam width as small as possible to tightly fit the object.
The following other parameters can be set:
-photons: the number of photons to shoot.
-search: the number of photons to search when rendering, the higher,
the blurrier the caustics.
-depth: the amount of photon bounces allowed, since the primary use is for
caustics, you probably best set this to the same level as the 'ray depth'
parameter.
-Blur: this controls the amount of caustics blur (in addition to the search
parameter), very low values will cause very sharp caustics, which when used
with a low photonnumber, probably lead to only some noisy specks being rendered.
-Use QMC: Use quasi monte carlo sampling, can lead to cleaner results, but also
can sometimes cause patterns.
Since the photonlight has no meaning to Blender, when using photonlights and
switching back to the internal render, the light doesn't do anything, and no
type button will be selected. The lightsource can still be selected, but unless
switching to yafray, no parameters can set.
Apologies to Anexus, I had no time to really do something with your code,
I'll still look at it later, to see if I can improve anything in my implementation.
2004-07-28 22:37:12 +00:00
|
|
|
//decay = 1;
|
|
|
|
}
|
|
|
|
}
|
2004-08-11 23:32:13 +00:00
|
|
|
|
|
|
|
if (is_sphereL) {
|
|
|
|
// 'dummy' mode for spherelight when used with gpm
|
|
|
|
string md = "off";
|
|
|
|
// if no GI used, the GIphotons flag can still be set, so only use when 'full' selected
|
|
|
|
if ((R.r.GImethod==2) && (R.r.GIphotons)) { md="on"; pwr*=R.r.GIpower; }
|
|
|
|
params["power"] = yafray::parameter_t(pwr);
|
|
|
|
params["dummy"] = yafray::parameter_t(md);
|
|
|
|
}
|
|
|
|
else params["power"] = yafray::parameter_t(pwr);
|
Major update, all implemented a bit in a hurry, and probably will need bugfixes at some point.
Extended the range of the depth and cdepth parameters as reqested by leope.
Bumpmapping should now be a bit more similar to the Blender render.
Added support for all remaining lightsources in yafray, tried to make use of
as much of the existing Blender parameters as possible.
Blender Lamp: added switch to enable rendering with shadowbuffer ('softlight' in yafray).
All other parameters are similar to the Blender settings, for yafray both the
bias parameter and the shadowbuffer size can be lower than equivalent Blender
settings, since the yafray buffer is floating point. Remember that 6 shadowmaps
are created in this case, so can use quite a bit of memory with large
buffer settings.
When 'ray shadow' is enabled for this lamp type, it is possible to set a light
radius to create a spherical arealight source ('spherelight' in yafray),
when this is 0, it is exported as a pointlight instead.
Blender Spot: as in Blender now supports 'halo' rendering.
Halo spots always use shadowbuffers, so when enabled the buttons for shadowmap
settings will appear. The 'ray shadow' button can still be used to disable
shadows cast onto other objects, independent of halo shadows.
One thing to remember, halo's don't work with empty backgrounds, something must
be behind the spotlight for it to be visible.
And finally, the photonlight:
probably the most confusing (as more things related to yafray), the photonlight
is not a real lightsource, it is only used as a source to shoot photons from.
Since indirect lighting is already supported (and looks better as well)
only caustics mode is supported.
So to be able to use this properly other lightsources must be used with it.
For the photonlighting to be 'correct' similar lightsettings as for the 'source'
light are needed.
Probably the best way to do this, when you are happy with the lighting setup
you have, and want to add caustics, copy the light you want to enable for
caustics (shift-D) and leave everything as is, then change the mode to
'Photon'.
To not waiste any photons, the photonlight behaves similar to the spotlight,
you can set the width of the beam with the 'angle' parameter. Make sure
that any object that needs to cast caustics is within that beam, make
the beam width as small as possible to tightly fit the object.
The following other parameters can be set:
-photons: the number of photons to shoot.
-search: the number of photons to search when rendering, the higher,
the blurrier the caustics.
-depth: the amount of photon bounces allowed, since the primary use is for
caustics, you probably best set this to the same level as the 'ray depth'
parameter.
-Blur: this controls the amount of caustics blur (in addition to the search
parameter), very low values will cause very sharp caustics, which when used
with a low photonnumber, probably lead to only some noisy specks being rendered.
-Use QMC: Use quasi monte carlo sampling, can lead to cleaner results, but also
can sometimes cause patterns.
Since the photonlight has no meaning to Blender, when using photonlights and
switching back to the internal render, the light doesn't do anything, and no
type button will be selected. The lightsource can still be selected, but unless
switching to yafray, no parameters can set.
Apologies to Anexus, I had no time to really do something with your code,
I'll still look at it later, to see if I can improve anything in my implementation.
2004-07-28 22:37:12 +00:00
|
|
|
|
|
|
|
// cast_shadows flag not used with softlight, spherelight or photonlight
|
|
|
|
if ((!is_softL) && (!is_sphereL) && (lamp->type!=LA_YF_PHOTON)) {
|
|
|
|
string lpmode="off";
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
// Shadows only when Blender has shadow button enabled, only spots use LA_SHAD flag.
|
|
|
|
// Also blender hemilights exported as sunlights which might have shadow flag set
|
|
|
|
// should have cast_shadows set to off (reported by varuag)
|
|
|
|
if (lamp->type!=LA_HEMI) {
|
|
|
|
if (R.r.mode & R_SHADOW)
|
|
|
|
if (((lamp->type==LA_SPOT) && (lamp->mode & LA_SHAD)) || (lamp->mode & LA_SHAD_RAY)) lpmode="on";
|
|
|
|
}
|
Major update, all implemented a bit in a hurry, and probably will need bugfixes at some point.
Extended the range of the depth and cdepth parameters as reqested by leope.
Bumpmapping should now be a bit more similar to the Blender render.
Added support for all remaining lightsources in yafray, tried to make use of
as much of the existing Blender parameters as possible.
Blender Lamp: added switch to enable rendering with shadowbuffer ('softlight' in yafray).
All other parameters are similar to the Blender settings, for yafray both the
bias parameter and the shadowbuffer size can be lower than equivalent Blender
settings, since the yafray buffer is floating point. Remember that 6 shadowmaps
are created in this case, so can use quite a bit of memory with large
buffer settings.
When 'ray shadow' is enabled for this lamp type, it is possible to set a light
radius to create a spherical arealight source ('spherelight' in yafray),
when this is 0, it is exported as a pointlight instead.
Blender Spot: as in Blender now supports 'halo' rendering.
Halo spots always use shadowbuffers, so when enabled the buttons for shadowmap
settings will appear. The 'ray shadow' button can still be used to disable
shadows cast onto other objects, independent of halo shadows.
One thing to remember, halo's don't work with empty backgrounds, something must
be behind the spotlight for it to be visible.
And finally, the photonlight:
probably the most confusing (as more things related to yafray), the photonlight
is not a real lightsource, it is only used as a source to shoot photons from.
Since indirect lighting is already supported (and looks better as well)
only caustics mode is supported.
So to be able to use this properly other lightsources must be used with it.
For the photonlighting to be 'correct' similar lightsettings as for the 'source'
light are needed.
Probably the best way to do this, when you are happy with the lighting setup
you have, and want to add caustics, copy the light you want to enable for
caustics (shift-D) and leave everything as is, then change the mode to
'Photon'.
To not waiste any photons, the photonlight behaves similar to the spotlight,
you can set the width of the beam with the 'angle' parameter. Make sure
that any object that needs to cast caustics is within that beam, make
the beam width as small as possible to tightly fit the object.
The following other parameters can be set:
-photons: the number of photons to shoot.
-search: the number of photons to search when rendering, the higher,
the blurrier the caustics.
-depth: the amount of photon bounces allowed, since the primary use is for
caustics, you probably best set this to the same level as the 'ray depth'
parameter.
-Blur: this controls the amount of caustics blur (in addition to the search
parameter), very low values will cause very sharp caustics, which when used
with a low photonnumber, probably lead to only some noisy specks being rendered.
-Use QMC: Use quasi monte carlo sampling, can lead to cleaner results, but also
can sometimes cause patterns.
Since the photonlight has no meaning to Blender, when using photonlights and
switching back to the internal render, the light doesn't do anything, and no
type button will be selected. The lightsource can still be selected, but unless
switching to yafray, no parameters can set.
Apologies to Anexus, I had no time to really do something with your code,
I'll still look at it later, to see if I can improve anything in my implementation.
2004-07-28 22:37:12 +00:00
|
|
|
params["cast_shadows"] = yafray::parameter_t(lpmode);
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
Major update, all implemented a bit in a hurry, and probably will need bugfixes at some point.
Extended the range of the depth and cdepth parameters as reqested by leope.
Bumpmapping should now be a bit more similar to the Blender render.
Added support for all remaining lightsources in yafray, tried to make use of
as much of the existing Blender parameters as possible.
Blender Lamp: added switch to enable rendering with shadowbuffer ('softlight' in yafray).
All other parameters are similar to the Blender settings, for yafray both the
bias parameter and the shadowbuffer size can be lower than equivalent Blender
settings, since the yafray buffer is floating point. Remember that 6 shadowmaps
are created in this case, so can use quite a bit of memory with large
buffer settings.
When 'ray shadow' is enabled for this lamp type, it is possible to set a light
radius to create a spherical arealight source ('spherelight' in yafray),
when this is 0, it is exported as a pointlight instead.
Blender Spot: as in Blender now supports 'halo' rendering.
Halo spots always use shadowbuffers, so when enabled the buttons for shadowmap
settings will appear. The 'ray shadow' button can still be used to disable
shadows cast onto other objects, independent of halo shadows.
One thing to remember, halo's don't work with empty backgrounds, something must
be behind the spotlight for it to be visible.
And finally, the photonlight:
probably the most confusing (as more things related to yafray), the photonlight
is not a real lightsource, it is only used as a source to shoot photons from.
Since indirect lighting is already supported (and looks better as well)
only caustics mode is supported.
So to be able to use this properly other lightsources must be used with it.
For the photonlighting to be 'correct' similar lightsettings as for the 'source'
light are needed.
Probably the best way to do this, when you are happy with the lighting setup
you have, and want to add caustics, copy the light you want to enable for
caustics (shift-D) and leave everything as is, then change the mode to
'Photon'.
To not waiste any photons, the photonlight behaves similar to the spotlight,
you can set the width of the beam with the 'angle' parameter. Make sure
that any object that needs to cast caustics is within that beam, make
the beam width as small as possible to tightly fit the object.
The following other parameters can be set:
-photons: the number of photons to shoot.
-search: the number of photons to search when rendering, the higher,
the blurrier the caustics.
-depth: the amount of photon bounces allowed, since the primary use is for
caustics, you probably best set this to the same level as the 'ray depth'
parameter.
-Blur: this controls the amount of caustics blur (in addition to the search
parameter), very low values will cause very sharp caustics, which when used
with a low photonnumber, probably lead to only some noisy specks being rendered.
-Use QMC: Use quasi monte carlo sampling, can lead to cleaner results, but also
can sometimes cause patterns.
Since the photonlight has no meaning to Blender, when using photonlights and
switching back to the internal render, the light doesn't do anything, and no
type button will be selected. The lightsource can still be selected, but unless
switching to yafray, no parameters can set.
Apologies to Anexus, I had no time to really do something with your code,
I'll still look at it later, to see if I can improve anything in my implementation.
2004-07-28 22:37:12 +00:00
|
|
|
|
2004-06-16 18:44:12 +00:00
|
|
|
// spot specific stuff
|
Major update, all implemented a bit in a hurry, and probably will need bugfixes at some point.
Extended the range of the depth and cdepth parameters as reqested by leope.
Bumpmapping should now be a bit more similar to the Blender render.
Added support for all remaining lightsources in yafray, tried to make use of
as much of the existing Blender parameters as possible.
Blender Lamp: added switch to enable rendering with shadowbuffer ('softlight' in yafray).
All other parameters are similar to the Blender settings, for yafray both the
bias parameter and the shadowbuffer size can be lower than equivalent Blender
settings, since the yafray buffer is floating point. Remember that 6 shadowmaps
are created in this case, so can use quite a bit of memory with large
buffer settings.
When 'ray shadow' is enabled for this lamp type, it is possible to set a light
radius to create a spherical arealight source ('spherelight' in yafray),
when this is 0, it is exported as a pointlight instead.
Blender Spot: as in Blender now supports 'halo' rendering.
Halo spots always use shadowbuffers, so when enabled the buttons for shadowmap
settings will appear. The 'ray shadow' button can still be used to disable
shadows cast onto other objects, independent of halo shadows.
One thing to remember, halo's don't work with empty backgrounds, something must
be behind the spotlight for it to be visible.
And finally, the photonlight:
probably the most confusing (as more things related to yafray), the photonlight
is not a real lightsource, it is only used as a source to shoot photons from.
Since indirect lighting is already supported (and looks better as well)
only caustics mode is supported.
So to be able to use this properly other lightsources must be used with it.
For the photonlighting to be 'correct' similar lightsettings as for the 'source'
light are needed.
Probably the best way to do this, when you are happy with the lighting setup
you have, and want to add caustics, copy the light you want to enable for
caustics (shift-D) and leave everything as is, then change the mode to
'Photon'.
To not waiste any photons, the photonlight behaves similar to the spotlight,
you can set the width of the beam with the 'angle' parameter. Make sure
that any object that needs to cast caustics is within that beam, make
the beam width as small as possible to tightly fit the object.
The following other parameters can be set:
-photons: the number of photons to shoot.
-search: the number of photons to search when rendering, the higher,
the blurrier the caustics.
-depth: the amount of photon bounces allowed, since the primary use is for
caustics, you probably best set this to the same level as the 'ray depth'
parameter.
-Blur: this controls the amount of caustics blur (in addition to the search
parameter), very low values will cause very sharp caustics, which when used
with a low photonnumber, probably lead to only some noisy specks being rendered.
-Use QMC: Use quasi monte carlo sampling, can lead to cleaner results, but also
can sometimes cause patterns.
Since the photonlight has no meaning to Blender, when using photonlights and
switching back to the internal render, the light doesn't do anything, and no
type button will be selected. The lightsource can still be selected, but unless
switching to yafray, no parameters can set.
Apologies to Anexus, I had no time to really do something with your code,
I'll still look at it later, to see if I can improve anything in my implementation.
2004-07-28 22:37:12 +00:00
|
|
|
bool has_halo = ((lamp->type==LA_SPOT) && (lamp->mode & LA_HALO) && (lamp->haint>0.0));
|
|
|
|
if (lamp->type==LA_SPOT) {
|
2004-06-16 18:44:12 +00:00
|
|
|
// conversion already changed spotsize to cosine of half angle
|
|
|
|
float ld = 1-lamp->spotsi; //convert back to blender slider setting
|
|
|
|
if (ld!=0) ld = 1.f/ld;
|
Major update, all implemented a bit in a hurry, and probably will need bugfixes at some point.
Extended the range of the depth and cdepth parameters as reqested by leope.
Bumpmapping should now be a bit more similar to the Blender render.
Added support for all remaining lightsources in yafray, tried to make use of
as much of the existing Blender parameters as possible.
Blender Lamp: added switch to enable rendering with shadowbuffer ('softlight' in yafray).
All other parameters are similar to the Blender settings, for yafray both the
bias parameter and the shadowbuffer size can be lower than equivalent Blender
settings, since the yafray buffer is floating point. Remember that 6 shadowmaps
are created in this case, so can use quite a bit of memory with large
buffer settings.
When 'ray shadow' is enabled for this lamp type, it is possible to set a light
radius to create a spherical arealight source ('spherelight' in yafray),
when this is 0, it is exported as a pointlight instead.
Blender Spot: as in Blender now supports 'halo' rendering.
Halo spots always use shadowbuffers, so when enabled the buttons for shadowmap
settings will appear. The 'ray shadow' button can still be used to disable
shadows cast onto other objects, independent of halo shadows.
One thing to remember, halo's don't work with empty backgrounds, something must
be behind the spotlight for it to be visible.
And finally, the photonlight:
probably the most confusing (as more things related to yafray), the photonlight
is not a real lightsource, it is only used as a source to shoot photons from.
Since indirect lighting is already supported (and looks better as well)
only caustics mode is supported.
So to be able to use this properly other lightsources must be used with it.
For the photonlighting to be 'correct' similar lightsettings as for the 'source'
light are needed.
Probably the best way to do this, when you are happy with the lighting setup
you have, and want to add caustics, copy the light you want to enable for
caustics (shift-D) and leave everything as is, then change the mode to
'Photon'.
To not waiste any photons, the photonlight behaves similar to the spotlight,
you can set the width of the beam with the 'angle' parameter. Make sure
that any object that needs to cast caustics is within that beam, make
the beam width as small as possible to tightly fit the object.
The following other parameters can be set:
-photons: the number of photons to shoot.
-search: the number of photons to search when rendering, the higher,
the blurrier the caustics.
-depth: the amount of photon bounces allowed, since the primary use is for
caustics, you probably best set this to the same level as the 'ray depth'
parameter.
-Blur: this controls the amount of caustics blur (in addition to the search
parameter), very low values will cause very sharp caustics, which when used
with a low photonnumber, probably lead to only some noisy specks being rendered.
-Use QMC: Use quasi monte carlo sampling, can lead to cleaner results, but also
can sometimes cause patterns.
Since the photonlight has no meaning to Blender, when using photonlights and
switching back to the internal render, the light doesn't do anything, and no
type button will be selected. The lightsource can still be selected, but unless
switching to yafray, no parameters can set.
Apologies to Anexus, I had no time to really do something with your code,
I'll still look at it later, to see if I can improve anything in my implementation.
2004-07-28 22:37:12 +00:00
|
|
|
params["size"] = yafray::parameter_t(acos(lamp->spotsi)*180.0/M_PI);
|
|
|
|
params["blend"] = yafray::parameter_t(lamp->spotbl*ld);
|
|
|
|
params["beam_falloff"] = yafray::parameter_t(2.0);
|
|
|
|
// halo params
|
|
|
|
if (has_halo) {
|
|
|
|
params["halo"] = yafray::parameter_t("on");
|
|
|
|
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?
|
Some small modifications.
Absorption and Dispersion parameters now only visible when 'Ray Transp'
enabled. WardIso specular amount scale to match Blender output.
Updated halo spotlight 'samples' to use new yafray syntax.
Quick addition for access to another yafray feature:
When using HDR backgrounds for lighting ('SkyDome' of 'Full' GI methods),
it is currently not always possible to get smooth lighting results.
Especially HDR images with small lightsource can be very noisy,
because currently yafray still relies on brute force random sampling.
As a temporary simple solution (better options will be available in the
'next generation' yafray), yafray can do some processing on the
image to smooth out all (or most) noise.
Besides smooth lighting, this also has
the advantage that AA will have less work to do,
GI quality can be set to the lowest level and still get reasonably
good results. Disadvantage however is that shadow definition is lost.
To switch on this option, set the world image texture filter parameter
to any value greater than 1.0
When 'filter' is 1.0 or less, normal hdr sampling is done as before.
So, current fastest possible render settings for IBL:
set texture image filter parameter of the background image to any value
greater than 1.0, set GI to 'SkyDome' type, enable 'Cache',
(possibly enable 'NoBump' when scene uses lots of bumpmapping),
set 'Quality' menu to 'Use Blender AO settings',
make sure AO is enabled in blender World buttons and set there the number
of AO samples to 1.
Should at least be good enough for previews.
2005-06-10 00:12:42 +00:00
|
|
|
// halo 'samples' now 'stepsize'
|
|
|
|
// convert from old integer samples value to some reasonable stepsize
|
|
|
|
params["stepsize"] = yafray::parameter_t(1.0/sqrt((float)hsmp));
|
Major update, all implemented a bit in a hurry, and probably will need bugfixes at some point.
Extended the range of the depth and cdepth parameters as reqested by leope.
Bumpmapping should now be a bit more similar to the Blender render.
Added support for all remaining lightsources in yafray, tried to make use of
as much of the existing Blender parameters as possible.
Blender Lamp: added switch to enable rendering with shadowbuffer ('softlight' in yafray).
All other parameters are similar to the Blender settings, for yafray both the
bias parameter and the shadowbuffer size can be lower than equivalent Blender
settings, since the yafray buffer is floating point. Remember that 6 shadowmaps
are created in this case, so can use quite a bit of memory with large
buffer settings.
When 'ray shadow' is enabled for this lamp type, it is possible to set a light
radius to create a spherical arealight source ('spherelight' in yafray),
when this is 0, it is exported as a pointlight instead.
Blender Spot: as in Blender now supports 'halo' rendering.
Halo spots always use shadowbuffers, so when enabled the buttons for shadowmap
settings will appear. The 'ray shadow' button can still be used to disable
shadows cast onto other objects, independent of halo shadows.
One thing to remember, halo's don't work with empty backgrounds, something must
be behind the spotlight for it to be visible.
And finally, the photonlight:
probably the most confusing (as more things related to yafray), the photonlight
is not a real lightsource, it is only used as a source to shoot photons from.
Since indirect lighting is already supported (and looks better as well)
only caustics mode is supported.
So to be able to use this properly other lightsources must be used with it.
For the photonlighting to be 'correct' similar lightsettings as for the 'source'
light are needed.
Probably the best way to do this, when you are happy with the lighting setup
you have, and want to add caustics, copy the light you want to enable for
caustics (shift-D) and leave everything as is, then change the mode to
'Photon'.
To not waiste any photons, the photonlight behaves similar to the spotlight,
you can set the width of the beam with the 'angle' parameter. Make sure
that any object that needs to cast caustics is within that beam, make
the beam width as small as possible to tightly fit the object.
The following other parameters can be set:
-photons: the number of photons to shoot.
-search: the number of photons to search when rendering, the higher,
the blurrier the caustics.
-depth: the amount of photon bounces allowed, since the primary use is for
caustics, you probably best set this to the same level as the 'ray depth'
parameter.
-Blur: this controls the amount of caustics blur (in addition to the search
parameter), very low values will cause very sharp caustics, which when used
with a low photonnumber, probably lead to only some noisy specks being rendered.
-Use QMC: Use quasi monte carlo sampling, can lead to cleaner results, but also
can sometimes cause patterns.
Since the photonlight has no meaning to Blender, when using photonlights and
switching back to the internal render, the light doesn't do anything, and no
type button will be selected. The lightsource can still be selected, but unless
switching to yafray, no parameters can set.
Apologies to Anexus, I had no time to really do something with your code,
I'll still look at it later, to see if I can improve anything in my implementation.
2004-07-28 22:37:12 +00:00
|
|
|
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);
|
|
|
|
params["fog_density"] = yafray::parameter_t(lamp->haint*0.2f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (is_softL) {
|
|
|
|
// softlight
|
|
|
|
params["res"] = yafray::parameter_t(lamp->YF_bufsize);
|
|
|
|
params["radius"] = yafray::parameter_t(lamp->soft);
|
|
|
|
params["bias"] = yafray::parameter_t(lamp->bias);
|
|
|
|
}
|
|
|
|
else if (is_sphereL) {
|
|
|
|
// spherelight
|
2004-08-01 22:21:22 +00:00
|
|
|
int psm=0, sm = lamp->ray_samp*lamp->ray_samp;
|
Major update, all implemented a bit in a hurry, and probably will need bugfixes at some point.
Extended the range of the depth and cdepth parameters as reqested by leope.
Bumpmapping should now be a bit more similar to the Blender render.
Added support for all remaining lightsources in yafray, tried to make use of
as much of the existing Blender parameters as possible.
Blender Lamp: added switch to enable rendering with shadowbuffer ('softlight' in yafray).
All other parameters are similar to the Blender settings, for yafray both the
bias parameter and the shadowbuffer size can be lower than equivalent Blender
settings, since the yafray buffer is floating point. Remember that 6 shadowmaps
are created in this case, so can use quite a bit of memory with large
buffer settings.
When 'ray shadow' is enabled for this lamp type, it is possible to set a light
radius to create a spherical arealight source ('spherelight' in yafray),
when this is 0, it is exported as a pointlight instead.
Blender Spot: as in Blender now supports 'halo' rendering.
Halo spots always use shadowbuffers, so when enabled the buttons for shadowmap
settings will appear. The 'ray shadow' button can still be used to disable
shadows cast onto other objects, independent of halo shadows.
One thing to remember, halo's don't work with empty backgrounds, something must
be behind the spotlight for it to be visible.
And finally, the photonlight:
probably the most confusing (as more things related to yafray), the photonlight
is not a real lightsource, it is only used as a source to shoot photons from.
Since indirect lighting is already supported (and looks better as well)
only caustics mode is supported.
So to be able to use this properly other lightsources must be used with it.
For the photonlighting to be 'correct' similar lightsettings as for the 'source'
light are needed.
Probably the best way to do this, when you are happy with the lighting setup
you have, and want to add caustics, copy the light you want to enable for
caustics (shift-D) and leave everything as is, then change the mode to
'Photon'.
To not waiste any photons, the photonlight behaves similar to the spotlight,
you can set the width of the beam with the 'angle' parameter. Make sure
that any object that needs to cast caustics is within that beam, make
the beam width as small as possible to tightly fit the object.
The following other parameters can be set:
-photons: the number of photons to shoot.
-search: the number of photons to search when rendering, the higher,
the blurrier the caustics.
-depth: the amount of photon bounces allowed, since the primary use is for
caustics, you probably best set this to the same level as the 'ray depth'
parameter.
-Blur: this controls the amount of caustics blur (in addition to the search
parameter), very low values will cause very sharp caustics, which when used
with a low photonnumber, probably lead to only some noisy specks being rendered.
-Use QMC: Use quasi monte carlo sampling, can lead to cleaner results, but also
can sometimes cause patterns.
Since the photonlight has no meaning to Blender, when using photonlights and
switching back to the internal render, the light doesn't do anything, and no
type button will be selected. The lightsource can still be selected, but unless
switching to yafray, no parameters can set.
Apologies to Anexus, I had no time to really do something with your code,
I'll still look at it later, to see if I can improve anything in my implementation.
2004-07-28 22:37:12 +00:00
|
|
|
if (sm>=25) psm = sm/5;
|
|
|
|
params["radius"] = yafray::parameter_t(lamp->YF_ltradius);
|
|
|
|
params["samples"] = yafray::parameter_t(sm);
|
|
|
|
params["psamples"] = yafray::parameter_t(psm);
|
|
|
|
params["qmc_method"] = yafray::parameter_t(1);
|
|
|
|
}
|
|
|
|
else if (lamp->type==LA_YF_PHOTON) {
|
|
|
|
string qmc="off";
|
|
|
|
if (lamp->YF_useqmc) qmc="on";
|
|
|
|
params["photons"] = yafray::parameter_t(lamp->YF_numphotons);
|
|
|
|
params["search"] = yafray::parameter_t(lamp->YF_numsearch);
|
|
|
|
params["depth"] = yafray::parameter_t(lamp->YF_phdepth);
|
|
|
|
params["use_QMC"] = yafray::parameter_t(qmc);
|
|
|
|
params["angle"] = yafray::parameter_t(acos(lamp->spotsi)*180.0/M_PI);
|
|
|
|
float cl = lamp->YF_causticblur/sqrt((float)lamp->YF_numsearch);
|
|
|
|
params["fixedradius"] = yafray::parameter_t(lamp->YF_causticblur);
|
|
|
|
params["cluster"] = yafray::parameter_t(cl);
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
2004-07-12 03:20:31 +00:00
|
|
|
|
|
|
|
// transform lamp co & vec back to world
|
2004-07-26 00:48:28 +00:00
|
|
|
float lpco[3], lpvec[3];
|
2004-07-12 03:20:31 +00:00
|
|
|
MTC_cp3Float(lamp->co, lpco);
|
|
|
|
MTC_Mat4MulVecfl(iview, lpco);
|
|
|
|
MTC_cp3Float(lamp->vec, lpvec);
|
2004-07-26 00:48:28 +00:00
|
|
|
MTC_Mat4Mul3Vecfl(iview, lpvec);
|
2004-07-12 03:20:31 +00:00
|
|
|
|
|
|
|
// position, (==-blendir for sun/hemi)
|
|
|
|
if ((lamp->type==LA_SUN) || (lamp->type==LA_HEMI))
|
|
|
|
params["from"] = yafray::parameter_t(yafray::point3d_t(-lpvec[0], -lpvec[1], -lpvec[2]));
|
|
|
|
else
|
|
|
|
params["from"] = yafray::parameter_t(yafray::point3d_t(lpco[0], lpco[1], lpco[2]));
|
Major update, all implemented a bit in a hurry, and probably will need bugfixes at some point.
Extended the range of the depth and cdepth parameters as reqested by leope.
Bumpmapping should now be a bit more similar to the Blender render.
Added support for all remaining lightsources in yafray, tried to make use of
as much of the existing Blender parameters as possible.
Blender Lamp: added switch to enable rendering with shadowbuffer ('softlight' in yafray).
All other parameters are similar to the Blender settings, for yafray both the
bias parameter and the shadowbuffer size can be lower than equivalent Blender
settings, since the yafray buffer is floating point. Remember that 6 shadowmaps
are created in this case, so can use quite a bit of memory with large
buffer settings.
When 'ray shadow' is enabled for this lamp type, it is possible to set a light
radius to create a spherical arealight source ('spherelight' in yafray),
when this is 0, it is exported as a pointlight instead.
Blender Spot: as in Blender now supports 'halo' rendering.
Halo spots always use shadowbuffers, so when enabled the buttons for shadowmap
settings will appear. The 'ray shadow' button can still be used to disable
shadows cast onto other objects, independent of halo shadows.
One thing to remember, halo's don't work with empty backgrounds, something must
be behind the spotlight for it to be visible.
And finally, the photonlight:
probably the most confusing (as more things related to yafray), the photonlight
is not a real lightsource, it is only used as a source to shoot photons from.
Since indirect lighting is already supported (and looks better as well)
only caustics mode is supported.
So to be able to use this properly other lightsources must be used with it.
For the photonlighting to be 'correct' similar lightsettings as for the 'source'
light are needed.
Probably the best way to do this, when you are happy with the lighting setup
you have, and want to add caustics, copy the light you want to enable for
caustics (shift-D) and leave everything as is, then change the mode to
'Photon'.
To not waiste any photons, the photonlight behaves similar to the spotlight,
you can set the width of the beam with the 'angle' parameter. Make sure
that any object that needs to cast caustics is within that beam, make
the beam width as small as possible to tightly fit the object.
The following other parameters can be set:
-photons: the number of photons to shoot.
-search: the number of photons to search when rendering, the higher,
the blurrier the caustics.
-depth: the amount of photon bounces allowed, since the primary use is for
caustics, you probably best set this to the same level as the 'ray depth'
parameter.
-Blur: this controls the amount of caustics blur (in addition to the search
parameter), very low values will cause very sharp caustics, which when used
with a low photonnumber, probably lead to only some noisy specks being rendered.
-Use QMC: Use quasi monte carlo sampling, can lead to cleaner results, but also
can sometimes cause patterns.
Since the photonlight has no meaning to Blender, when using photonlights and
switching back to the internal render, the light doesn't do anything, and no
type button will be selected. The lightsource can still be selected, but unless
switching to yafray, no parameters can set.
Apologies to Anexus, I had no time to really do something with your code,
I'll still look at it later, to see if I can improve anything in my implementation.
2004-07-28 22:37:12 +00:00
|
|
|
// 'to' for spot/photonlight, already calculated by Blender
|
|
|
|
if ((lamp->type==LA_SPOT) || (lamp->type==LA_YF_PHOTON)) {
|
|
|
|
params["to"] = yafray::parameter_t(yafray::point3d_t(lpco[0] + lpvec[0],
|
|
|
|
lpco[1] + lpvec[1],
|
|
|
|
lpco[2] + lpvec[2]));
|
|
|
|
if (has_halo) params["fog"] = yafray::parameter_t(yafray::color_t(1.0, 1.0, 1.0));
|
|
|
|
}
|
|
|
|
|
2004-06-16 18:44:12 +00:00
|
|
|
// color
|
|
|
|
// rgb in LampRen is premultiplied by energy, power is compensated for that above
|
Major update, all implemented a bit in a hurry, and probably will need bugfixes at some point.
Extended the range of the depth and cdepth parameters as reqested by leope.
Bumpmapping should now be a bit more similar to the Blender render.
Added support for all remaining lightsources in yafray, tried to make use of
as much of the existing Blender parameters as possible.
Blender Lamp: added switch to enable rendering with shadowbuffer ('softlight' in yafray).
All other parameters are similar to the Blender settings, for yafray both the
bias parameter and the shadowbuffer size can be lower than equivalent Blender
settings, since the yafray buffer is floating point. Remember that 6 shadowmaps
are created in this case, so can use quite a bit of memory with large
buffer settings.
When 'ray shadow' is enabled for this lamp type, it is possible to set a light
radius to create a spherical arealight source ('spherelight' in yafray),
when this is 0, it is exported as a pointlight instead.
Blender Spot: as in Blender now supports 'halo' rendering.
Halo spots always use shadowbuffers, so when enabled the buttons for shadowmap
settings will appear. The 'ray shadow' button can still be used to disable
shadows cast onto other objects, independent of halo shadows.
One thing to remember, halo's don't work with empty backgrounds, something must
be behind the spotlight for it to be visible.
And finally, the photonlight:
probably the most confusing (as more things related to yafray), the photonlight
is not a real lightsource, it is only used as a source to shoot photons from.
Since indirect lighting is already supported (and looks better as well)
only caustics mode is supported.
So to be able to use this properly other lightsources must be used with it.
For the photonlighting to be 'correct' similar lightsettings as for the 'source'
light are needed.
Probably the best way to do this, when you are happy with the lighting setup
you have, and want to add caustics, copy the light you want to enable for
caustics (shift-D) and leave everything as is, then change the mode to
'Photon'.
To not waiste any photons, the photonlight behaves similar to the spotlight,
you can set the width of the beam with the 'angle' parameter. Make sure
that any object that needs to cast caustics is within that beam, make
the beam width as small as possible to tightly fit the object.
The following other parameters can be set:
-photons: the number of photons to shoot.
-search: the number of photons to search when rendering, the higher,
the blurrier the caustics.
-depth: the amount of photon bounces allowed, since the primary use is for
caustics, you probably best set this to the same level as the 'ray depth'
parameter.
-Blur: this controls the amount of caustics blur (in addition to the search
parameter), very low values will cause very sharp caustics, which when used
with a low photonnumber, probably lead to only some noisy specks being rendered.
-Use QMC: Use quasi monte carlo sampling, can lead to cleaner results, but also
can sometimes cause patterns.
Since the photonlight has no meaning to Blender, when using photonlights and
switching back to the internal render, the light doesn't do anything, and no
type button will be selected. The lightsource can still be selected, but unless
switching to yafray, no parameters can set.
Apologies to Anexus, I had no time to really do something with your code,
I'll still look at it later, to see if I can improve anything in my implementation.
2004-07-28 22:37:12 +00:00
|
|
|
params["color"] = yafray::parameter_t(yafray::color_t(lamp->r, lamp->g, lamp->b));
|
2004-06-16 18:44:12 +00:00
|
|
|
yafrayGate->addLight(params);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// write main camera
|
|
|
|
void yafrayPluginRender_t::writeCamera()
|
|
|
|
{
|
|
|
|
yafray::paramMap_t params;
|
|
|
|
params["name"]=yafray::parameter_t("MAINCAM");
|
2004-07-12 03:20:31 +00:00
|
|
|
if (R.r.mode & R_ORTHO)
|
|
|
|
params["type"] = yafray::parameter_t("ortho");
|
|
|
|
else
|
|
|
|
params["type"] = yafray::parameter_t("perspective");
|
2004-06-16 18:44:12 +00:00
|
|
|
params["resx"]=yafray::parameter_t(R.r.xsch);
|
|
|
|
params["resy"]=yafray::parameter_t(R.r.ysch);
|
|
|
|
|
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.
2004-11-08 03:55:44 +00:00
|
|
|
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);
|
|
|
|
params["focal"] = yafray::parameter_t(mainCamLens/(f_aspect*32.f));
|
|
|
|
params["aspect_ratio"] = yafray::parameter_t(R.ycor);
|
2004-07-13 19:22:41 +00:00
|
|
|
|
|
|
|
// dof params, only valid for real camera
|
2005-05-09 03:46:21 +00:00
|
|
|
float fdist = 1; // only changes for ortho
|
2004-07-13 19:22:41 +00:00
|
|
|
if (maincam_obj->type==OB_CAMERA) {
|
|
|
|
Camera* cam = (Camera*)maincam_obj->data;
|
2005-05-09 03:46:21 +00:00
|
|
|
if (R.r.mode & R_ORTHO) fdist = cam->ortho_scale*(mainCamLens/32.f);
|
2004-07-13 19:22:41 +00:00
|
|
|
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");
|
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.
2004-11-08 03:55:44 +00:00
|
|
|
// bokeh params
|
|
|
|
string 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";
|
|
|
|
params["bokeh_type"] = yafray::parameter_t(st);
|
|
|
|
st = "uniform";
|
|
|
|
if (cam->YF_bkhbias==1)
|
|
|
|
st = "center";
|
|
|
|
else if (cam->YF_bkhbias==2)
|
|
|
|
st = "edge";
|
|
|
|
params["bokeh_bias"] = yafray::parameter_t(st);
|
|
|
|
params["bokeh_rotation"] = yafray::parameter_t(cam->YF_bkhrot);
|
2004-07-13 19:22:41 +00:00
|
|
|
}
|
|
|
|
|
2004-06-16 18:44:12 +00:00
|
|
|
params["from"]=yafray::parameter_t(
|
2004-07-12 03:20:31 +00:00
|
|
|
yafray::point3d_t(maincam_obj->obmat[3][0], maincam_obj->obmat[3][1], maincam_obj->obmat[3][2]));
|
2004-06-16 18:44:12 +00:00
|
|
|
params["to"]=yafray::parameter_t(
|
2004-07-12 03:20:31 +00:00
|
|
|
yafray::point3d_t(maincam_obj->obmat[3][0] - fdist * R.viewmat[0][2],
|
|
|
|
maincam_obj->obmat[3][1] - fdist * R.viewmat[1][2],
|
|
|
|
maincam_obj->obmat[3][2] - fdist * R.viewmat[2][2]));
|
2004-06-16 18:44:12 +00:00
|
|
|
params["up"]=yafray::parameter_t(
|
2004-07-12 03:20:31 +00:00
|
|
|
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]));
|
2004-07-13 19:22:41 +00:00
|
|
|
|
2004-06-16 18:44:12 +00:00
|
|
|
yafrayGate->addCamera(params);
|
|
|
|
}
|
|
|
|
|
|
|
|
void yafrayPluginRender_t::writeHemilight()
|
|
|
|
{
|
|
|
|
yafray::paramMap_t params;
|
Second and final commit for this version of the yafray export code (probably, you never know
of course...)
Not quite complete, but due to lack of time as good as it will get for now.
From the previous commit, forgot to report that basic fog is supported as well. Though because I had not much time to complete the code, it is sort of unfinished, and you will have
to tweak parameters specifically for yafray again. It uses only the world horizon color, and
only uses the Blender mist distance setting.
Textures now support checker clip mode.
Fixed possibly all 'duplilist non-empty' errors, though it could hide the real cause of the
error.
AA is no longer enabled automatically for certain GI quality settings, I thought it best to
leave it to the user to decide.
SkyDome GI mode now supports cache as well. There is a new option in the GI quality menu 'Use
Blender AO settings', which will as it says use the most important AO settings for the
skydome parameters. The only AO parameters used are 'Samples', 'Dist' and the random sampling
switch, which unlike in Blender you might want to use more often, since the QMC sampling used
in yafray can result in visible patterns or a dithering type look. 'Random' is not completely
random in yafray however, it is actually jittered (stratified) sampling.
Using an occlusion cache, doesn't necessarily mean that you will always get much shorter
render times. As with 'full' GI and cache, one problem is bumpmaps, when using bump (or
normal) maps, the sampling will be much more dense, using lots more rendertime.
As a temporary fix there is a button 'NoBump', but this also has the side effect that in
areas of total indirect light (or when used with SkyDome cache) no bumpmapping will be
visible. It is therefor best used with some direct light as well.
For SkyDome with cache, and strong bumpmapping it might actually not make much difference,
since for low distance values you can usually get away with low sample values as well.
The entire material panel is now replaced by another panel to show only the parameters
important to yafray and add some new ones as well.
Since lots of users (especially yafray beginners) have had problems getting certain material
aspects right, there is now a material preset menu available to hopefully solve some of the
most common "How do I do this? It doesn't work!" questions seen in various forums.
Choosing an option from this menu will set the required parameters to default
values for yafray, and you can work your way from there to tweak it something you want.
Most buttons are copies of the same Blender parameters, with some variations. Just like
Blender 'Ray Mirror' enables reflection, 'Ray Transp' enables refraction. You can use
'ZTransp' for materials that have texture maps with alpha channels.
Again, same as Blender 'rayMir' sets the amount of reflection. Next button 'frsOfs' however
controls fresnel offset, meaning that when this is set to 1, you will get no fresnel effect
and when set to 5, reflection is totally determined by fresnel, which is important for
realistic glass/metals/etc.
IOR is self-explanatory (...), same as Blender.
When you have 'Ray Transp' enabled, the blender 'filter' button will appear next to the IOR
button. This has the same effect as in Blender.
Below that there are some new parameters, 'Ext.Color' sets the extinction color for
transparent materials. Usually, in real transparent materials, light loses some of it's
energy the further it has to travel through the object. This effect can be simulated with
this parameter. Thing to look out for is that it specifies the color which will be
REMOVED after traveling through the object. What this means is that say you have a clear
white glass sphere, and set the extinction color to a strong blue, the result will be a
very yellow object when rendered.
Next to the color sliders, there is another set of three parameters, with which you can
enable color dispersion for transparent objects. 'Pwr' sets the amount of dispersion,
the higher, the more dispersion (the more colorful the result).
(For real world materials, this number can be found or derived from data in various glass catalogues)
The 'Samples' button below that sets the number of samples used, minimum values are around
7-10, and for very strong dispersion you might need a lot more.
As usual, this also means an increase in render time of course, but to simulate
realistic materials, you shouldn't really need more than 25 samples.
In addition to that, when using low sample numbers, but to still get a good spread of colors,
you can enable the jitter button, but this will also add noise.
Point/soft(point with shadowbuffer) or sphere lights (light with radius), have a new option
to add a simple glow effect, so that lights can be made visible.
NOTE: just like spotlight halo's, glow is not visible against the background, there must be
another object behind it. Simplest solution is to use a large black shadeless plane behind
your scene.
The glow intensity can be set with the 'GlowInt' parameter (use very low values around 0.01
even lower), and you can choose from two different types with the 'GlowType' button (which
don't look much different, but type 1 is probably better, type 0 faster).
And that's it, with apologies for the still missing features and
full support in general, but this will have to do for now.
2005-05-22 22:46:17 +00:00
|
|
|
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) {
|
2005-05-28 02:50:55 +00:00
|
|
|
// use minimum of 4 samples for lowest sample setting, single sample way too noisy
|
|
|
|
params["samples"] = yafray::parameter_t(3 + world->aosamp*world->aosamp);
|
Second and final commit for this version of the yafray export code (probably, you never know
of course...)
Not quite complete, but due to lack of time as good as it will get for now.
From the previous commit, forgot to report that basic fog is supported as well. Though because I had not much time to complete the code, it is sort of unfinished, and you will have
to tweak parameters specifically for yafray again. It uses only the world horizon color, and
only uses the Blender mist distance setting.
Textures now support checker clip mode.
Fixed possibly all 'duplilist non-empty' errors, though it could hide the real cause of the
error.
AA is no longer enabled automatically for certain GI quality settings, I thought it best to
leave it to the user to decide.
SkyDome GI mode now supports cache as well. There is a new option in the GI quality menu 'Use
Blender AO settings', which will as it says use the most important AO settings for the
skydome parameters. The only AO parameters used are 'Samples', 'Dist' and the random sampling
switch, which unlike in Blender you might want to use more often, since the QMC sampling used
in yafray can result in visible patterns or a dithering type look. 'Random' is not completely
random in yafray however, it is actually jittered (stratified) sampling.
Using an occlusion cache, doesn't necessarily mean that you will always get much shorter
render times. As with 'full' GI and cache, one problem is bumpmaps, when using bump (or
normal) maps, the sampling will be much more dense, using lots more rendertime.
As a temporary fix there is a button 'NoBump', but this also has the side effect that in
areas of total indirect light (or when used with SkyDome cache) no bumpmapping will be
visible. It is therefor best used with some direct light as well.
For SkyDome with cache, and strong bumpmapping it might actually not make much difference,
since for low distance values you can usually get away with low sample values as well.
The entire material panel is now replaced by another panel to show only the parameters
important to yafray and add some new ones as well.
Since lots of users (especially yafray beginners) have had problems getting certain material
aspects right, there is now a material preset menu available to hopefully solve some of the
most common "How do I do this? It doesn't work!" questions seen in various forums.
Choosing an option from this menu will set the required parameters to default
values for yafray, and you can work your way from there to tweak it something you want.
Most buttons are copies of the same Blender parameters, with some variations. Just like
Blender 'Ray Mirror' enables reflection, 'Ray Transp' enables refraction. You can use
'ZTransp' for materials that have texture maps with alpha channels.
Again, same as Blender 'rayMir' sets the amount of reflection. Next button 'frsOfs' however
controls fresnel offset, meaning that when this is set to 1, you will get no fresnel effect
and when set to 5, reflection is totally determined by fresnel, which is important for
realistic glass/metals/etc.
IOR is self-explanatory (...), same as Blender.
When you have 'Ray Transp' enabled, the blender 'filter' button will appear next to the IOR
button. This has the same effect as in Blender.
Below that there are some new parameters, 'Ext.Color' sets the extinction color for
transparent materials. Usually, in real transparent materials, light loses some of it's
energy the further it has to travel through the object. This effect can be simulated with
this parameter. Thing to look out for is that it specifies the color which will be
REMOVED after traveling through the object. What this means is that say you have a clear
white glass sphere, and set the extinction color to a strong blue, the result will be a
very yellow object when rendered.
Next to the color sliders, there is another set of three parameters, with which you can
enable color dispersion for transparent objects. 'Pwr' sets the amount of dispersion,
the higher, the more dispersion (the more colorful the result).
(For real world materials, this number can be found or derived from data in various glass catalogues)
The 'Samples' button below that sets the number of samples used, minimum values are around
7-10, and for very strong dispersion you might need a lot more.
As usual, this also means an increase in render time of course, but to simulate
realistic materials, you shouldn't really need more than 25 samples.
In addition to that, when using low sample numbers, but to still get a good spread of colors,
you can enable the jitter button, but this will also add noise.
Point/soft(point with shadowbuffer) or sphere lights (light with radius), have a new option
to add a simple glow effect, so that lights can be made visible.
NOTE: just like spotlight halo's, glow is not visible against the background, there must be
another object behind it. Simplest solution is to use a large black shadeless plane behind
your scene.
The glow intensity can be set with the 'GlowInt' parameter (use very low values around 0.01
even lower), and you can choose from two different types with the 'GlowType' button (which
don't look much different, but type 1 is probably better, type 0 faster).
And that's it, with apologies for the still missing features and
full support in general, but this will have to do for now.
2005-05-22 22:46:17 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
|
|
|
yafrayGate->addLight(params);
|
|
|
|
}
|
|
|
|
|
|
|
|
void yafrayPluginRender_t::writePathlight()
|
|
|
|
{
|
2004-08-11 23:32:13 +00:00
|
|
|
if (R.r.GIphotons)
|
2004-06-16 18:44:12 +00:00
|
|
|
{
|
|
|
|
yafray::paramMap_t params;
|
Second and final commit for this version of the yafray export code (probably, you never know
of course...)
Not quite complete, but due to lack of time as good as it will get for now.
From the previous commit, forgot to report that basic fog is supported as well. Though because I had not much time to complete the code, it is sort of unfinished, and you will have
to tweak parameters specifically for yafray again. It uses only the world horizon color, and
only uses the Blender mist distance setting.
Textures now support checker clip mode.
Fixed possibly all 'duplilist non-empty' errors, though it could hide the real cause of the
error.
AA is no longer enabled automatically for certain GI quality settings, I thought it best to
leave it to the user to decide.
SkyDome GI mode now supports cache as well. There is a new option in the GI quality menu 'Use
Blender AO settings', which will as it says use the most important AO settings for the
skydome parameters. The only AO parameters used are 'Samples', 'Dist' and the random sampling
switch, which unlike in Blender you might want to use more often, since the QMC sampling used
in yafray can result in visible patterns or a dithering type look. 'Random' is not completely
random in yafray however, it is actually jittered (stratified) sampling.
Using an occlusion cache, doesn't necessarily mean that you will always get much shorter
render times. As with 'full' GI and cache, one problem is bumpmaps, when using bump (or
normal) maps, the sampling will be much more dense, using lots more rendertime.
As a temporary fix there is a button 'NoBump', but this also has the side effect that in
areas of total indirect light (or when used with SkyDome cache) no bumpmapping will be
visible. It is therefor best used with some direct light as well.
For SkyDome with cache, and strong bumpmapping it might actually not make much difference,
since for low distance values you can usually get away with low sample values as well.
The entire material panel is now replaced by another panel to show only the parameters
important to yafray and add some new ones as well.
Since lots of users (especially yafray beginners) have had problems getting certain material
aspects right, there is now a material preset menu available to hopefully solve some of the
most common "How do I do this? It doesn't work!" questions seen in various forums.
Choosing an option from this menu will set the required parameters to default
values for yafray, and you can work your way from there to tweak it something you want.
Most buttons are copies of the same Blender parameters, with some variations. Just like
Blender 'Ray Mirror' enables reflection, 'Ray Transp' enables refraction. You can use
'ZTransp' for materials that have texture maps with alpha channels.
Again, same as Blender 'rayMir' sets the amount of reflection. Next button 'frsOfs' however
controls fresnel offset, meaning that when this is set to 1, you will get no fresnel effect
and when set to 5, reflection is totally determined by fresnel, which is important for
realistic glass/metals/etc.
IOR is self-explanatory (...), same as Blender.
When you have 'Ray Transp' enabled, the blender 'filter' button will appear next to the IOR
button. This has the same effect as in Blender.
Below that there are some new parameters, 'Ext.Color' sets the extinction color for
transparent materials. Usually, in real transparent materials, light loses some of it's
energy the further it has to travel through the object. This effect can be simulated with
this parameter. Thing to look out for is that it specifies the color which will be
REMOVED after traveling through the object. What this means is that say you have a clear
white glass sphere, and set the extinction color to a strong blue, the result will be a
very yellow object when rendered.
Next to the color sliders, there is another set of three parameters, with which you can
enable color dispersion for transparent objects. 'Pwr' sets the amount of dispersion,
the higher, the more dispersion (the more colorful the result).
(For real world materials, this number can be found or derived from data in various glass catalogues)
The 'Samples' button below that sets the number of samples used, minimum values are around
7-10, and for very strong dispersion you might need a lot more.
As usual, this also means an increase in render time of course, but to simulate
realistic materials, you shouldn't really need more than 25 samples.
In addition to that, when using low sample numbers, but to still get a good spread of colors,
you can enable the jitter button, but this will also add noise.
Point/soft(point with shadowbuffer) or sphere lights (light with radius), have a new option
to add a simple glow effect, so that lights can be made visible.
NOTE: just like spotlight halo's, glow is not visible against the background, there must be
another object behind it. Simplest solution is to use a large black shadeless plane behind
your scene.
The glow intensity can be set with the 'GlowInt' parameter (use very low values around 0.01
even lower), and you can choose from two different types with the 'GlowType' button (which
don't look much different, but type 1 is probably better, type 0 faster).
And that's it, with apologies for the still missing features and
full support in general, but this will have to do for now.
2005-05-22 22:46:17 +00:00
|
|
|
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);
|
2004-06-16 18:44:12 +00:00
|
|
|
yafrayGate->addLight(params);
|
|
|
|
}
|
|
|
|
yafray::paramMap_t params;
|
Second and final commit for this version of the yafray export code (probably, you never know
of course...)
Not quite complete, but due to lack of time as good as it will get for now.
From the previous commit, forgot to report that basic fog is supported as well. Though because I had not much time to complete the code, it is sort of unfinished, and you will have
to tweak parameters specifically for yafray again. It uses only the world horizon color, and
only uses the Blender mist distance setting.
Textures now support checker clip mode.
Fixed possibly all 'duplilist non-empty' errors, though it could hide the real cause of the
error.
AA is no longer enabled automatically for certain GI quality settings, I thought it best to
leave it to the user to decide.
SkyDome GI mode now supports cache as well. There is a new option in the GI quality menu 'Use
Blender AO settings', which will as it says use the most important AO settings for the
skydome parameters. The only AO parameters used are 'Samples', 'Dist' and the random sampling
switch, which unlike in Blender you might want to use more often, since the QMC sampling used
in yafray can result in visible patterns or a dithering type look. 'Random' is not completely
random in yafray however, it is actually jittered (stratified) sampling.
Using an occlusion cache, doesn't necessarily mean that you will always get much shorter
render times. As with 'full' GI and cache, one problem is bumpmaps, when using bump (or
normal) maps, the sampling will be much more dense, using lots more rendertime.
As a temporary fix there is a button 'NoBump', but this also has the side effect that in
areas of total indirect light (or when used with SkyDome cache) no bumpmapping will be
visible. It is therefor best used with some direct light as well.
For SkyDome with cache, and strong bumpmapping it might actually not make much difference,
since for low distance values you can usually get away with low sample values as well.
The entire material panel is now replaced by another panel to show only the parameters
important to yafray and add some new ones as well.
Since lots of users (especially yafray beginners) have had problems getting certain material
aspects right, there is now a material preset menu available to hopefully solve some of the
most common "How do I do this? It doesn't work!" questions seen in various forums.
Choosing an option from this menu will set the required parameters to default
values for yafray, and you can work your way from there to tweak it something you want.
Most buttons are copies of the same Blender parameters, with some variations. Just like
Blender 'Ray Mirror' enables reflection, 'Ray Transp' enables refraction. You can use
'ZTransp' for materials that have texture maps with alpha channels.
Again, same as Blender 'rayMir' sets the amount of reflection. Next button 'frsOfs' however
controls fresnel offset, meaning that when this is set to 1, you will get no fresnel effect
and when set to 5, reflection is totally determined by fresnel, which is important for
realistic glass/metals/etc.
IOR is self-explanatory (...), same as Blender.
When you have 'Ray Transp' enabled, the blender 'filter' button will appear next to the IOR
button. This has the same effect as in Blender.
Below that there are some new parameters, 'Ext.Color' sets the extinction color for
transparent materials. Usually, in real transparent materials, light loses some of it's
energy the further it has to travel through the object. This effect can be simulated with
this parameter. Thing to look out for is that it specifies the color which will be
REMOVED after traveling through the object. What this means is that say you have a clear
white glass sphere, and set the extinction color to a strong blue, the result will be a
very yellow object when rendered.
Next to the color sliders, there is another set of three parameters, with which you can
enable color dispersion for transparent objects. 'Pwr' sets the amount of dispersion,
the higher, the more dispersion (the more colorful the result).
(For real world materials, this number can be found or derived from data in various glass catalogues)
The 'Samples' button below that sets the number of samples used, minimum values are around
7-10, and for very strong dispersion you might need a lot more.
As usual, this also means an increase in render time of course, but to simulate
realistic materials, you shouldn't really need more than 25 samples.
In addition to that, when using low sample numbers, but to still get a good spread of colors,
you can enable the jitter button, but this will also add noise.
Point/soft(point with shadowbuffer) or sphere lights (light with radius), have a new option
to add a simple glow effect, so that lights can be made visible.
NOTE: just like spotlight halo's, glow is not visible against the background, there must be
another object behind it. Simplest solution is to use a large black shadeless plane behind
your scene.
The glow intensity can be set with the 'GlowInt' parameter (use very low values around 0.01
even lower), and you can choose from two different types with the 'GlowType' button (which
don't look much different, but type 1 is probably better, type 0 faster).
And that's it, with apologies for the still missing features and
full support in general, but this will have to do for now.
2005-05-22 22:46:17 +00:00
|
|
|
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))
|
2004-06-16 18:44:12 +00:00
|
|
|
{
|
|
|
|
switch (R.r.GIquality)
|
|
|
|
{
|
Second and final commit for this version of the yafray export code (probably, you never know
of course...)
Not quite complete, but due to lack of time as good as it will get for now.
From the previous commit, forgot to report that basic fog is supported as well. Though because I had not much time to complete the code, it is sort of unfinished, and you will have
to tweak parameters specifically for yafray again. It uses only the world horizon color, and
only uses the Blender mist distance setting.
Textures now support checker clip mode.
Fixed possibly all 'duplilist non-empty' errors, though it could hide the real cause of the
error.
AA is no longer enabled automatically for certain GI quality settings, I thought it best to
leave it to the user to decide.
SkyDome GI mode now supports cache as well. There is a new option in the GI quality menu 'Use
Blender AO settings', which will as it says use the most important AO settings for the
skydome parameters. The only AO parameters used are 'Samples', 'Dist' and the random sampling
switch, which unlike in Blender you might want to use more often, since the QMC sampling used
in yafray can result in visible patterns or a dithering type look. 'Random' is not completely
random in yafray however, it is actually jittered (stratified) sampling.
Using an occlusion cache, doesn't necessarily mean that you will always get much shorter
render times. As with 'full' GI and cache, one problem is bumpmaps, when using bump (or
normal) maps, the sampling will be much more dense, using lots more rendertime.
As a temporary fix there is a button 'NoBump', but this also has the side effect that in
areas of total indirect light (or when used with SkyDome cache) no bumpmapping will be
visible. It is therefor best used with some direct light as well.
For SkyDome with cache, and strong bumpmapping it might actually not make much difference,
since for low distance values you can usually get away with low sample values as well.
The entire material panel is now replaced by another panel to show only the parameters
important to yafray and add some new ones as well.
Since lots of users (especially yafray beginners) have had problems getting certain material
aspects right, there is now a material preset menu available to hopefully solve some of the
most common "How do I do this? It doesn't work!" questions seen in various forums.
Choosing an option from this menu will set the required parameters to default
values for yafray, and you can work your way from there to tweak it something you want.
Most buttons are copies of the same Blender parameters, with some variations. Just like
Blender 'Ray Mirror' enables reflection, 'Ray Transp' enables refraction. You can use
'ZTransp' for materials that have texture maps with alpha channels.
Again, same as Blender 'rayMir' sets the amount of reflection. Next button 'frsOfs' however
controls fresnel offset, meaning that when this is set to 1, you will get no fresnel effect
and when set to 5, reflection is totally determined by fresnel, which is important for
realistic glass/metals/etc.
IOR is self-explanatory (...), same as Blender.
When you have 'Ray Transp' enabled, the blender 'filter' button will appear next to the IOR
button. This has the same effect as in Blender.
Below that there are some new parameters, 'Ext.Color' sets the extinction color for
transparent materials. Usually, in real transparent materials, light loses some of it's
energy the further it has to travel through the object. This effect can be simulated with
this parameter. Thing to look out for is that it specifies the color which will be
REMOVED after traveling through the object. What this means is that say you have a clear
white glass sphere, and set the extinction color to a strong blue, the result will be a
very yellow object when rendered.
Next to the color sliders, there is another set of three parameters, with which you can
enable color dispersion for transparent objects. 'Pwr' sets the amount of dispersion,
the higher, the more dispersion (the more colorful the result).
(For real world materials, this number can be found or derived from data in various glass catalogues)
The 'Samples' button below that sets the number of samples used, minimum values are around
7-10, and for very strong dispersion you might need a lot more.
As usual, this also means an increase in render time of course, but to simulate
realistic materials, you shouldn't really need more than 25 samples.
In addition to that, when using low sample numbers, but to still get a good spread of colors,
you can enable the jitter button, but this will also add noise.
Point/soft(point with shadowbuffer) or sphere lights (light with radius), have a new option
to add a simple glow effect, so that lights can be made visible.
NOTE: just like spotlight halo's, glow is not visible against the background, there must be
another object behind it. Simplest solution is to use a large black shadeless plane behind
your scene.
The glow intensity can be set with the 'GlowInt' parameter (use very low values around 0.01
even lower), and you can choose from two different types with the 'GlowType' button (which
don't look much different, but type 1 is probably better, type 0 faster).
And that's it, with apologies for the still missing features and
full support in general, but this will have to do for now.
2005-05-22 22:46:17 +00:00
|
|
|
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);
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
Second and final commit for this version of the yafray export code (probably, you never know
of course...)
Not quite complete, but due to lack of time as good as it will get for now.
From the previous commit, forgot to report that basic fog is supported as well. Though because I had not much time to complete the code, it is sort of unfinished, and you will have
to tweak parameters specifically for yafray again. It uses only the world horizon color, and
only uses the Blender mist distance setting.
Textures now support checker clip mode.
Fixed possibly all 'duplilist non-empty' errors, though it could hide the real cause of the
error.
AA is no longer enabled automatically for certain GI quality settings, I thought it best to
leave it to the user to decide.
SkyDome GI mode now supports cache as well. There is a new option in the GI quality menu 'Use
Blender AO settings', which will as it says use the most important AO settings for the
skydome parameters. The only AO parameters used are 'Samples', 'Dist' and the random sampling
switch, which unlike in Blender you might want to use more often, since the QMC sampling used
in yafray can result in visible patterns or a dithering type look. 'Random' is not completely
random in yafray however, it is actually jittered (stratified) sampling.
Using an occlusion cache, doesn't necessarily mean that you will always get much shorter
render times. As with 'full' GI and cache, one problem is bumpmaps, when using bump (or
normal) maps, the sampling will be much more dense, using lots more rendertime.
As a temporary fix there is a button 'NoBump', but this also has the side effect that in
areas of total indirect light (or when used with SkyDome cache) no bumpmapping will be
visible. It is therefor best used with some direct light as well.
For SkyDome with cache, and strong bumpmapping it might actually not make much difference,
since for low distance values you can usually get away with low sample values as well.
The entire material panel is now replaced by another panel to show only the parameters
important to yafray and add some new ones as well.
Since lots of users (especially yafray beginners) have had problems getting certain material
aspects right, there is now a material preset menu available to hopefully solve some of the
most common "How do I do this? It doesn't work!" questions seen in various forums.
Choosing an option from this menu will set the required parameters to default
values for yafray, and you can work your way from there to tweak it something you want.
Most buttons are copies of the same Blender parameters, with some variations. Just like
Blender 'Ray Mirror' enables reflection, 'Ray Transp' enables refraction. You can use
'ZTransp' for materials that have texture maps with alpha channels.
Again, same as Blender 'rayMir' sets the amount of reflection. Next button 'frsOfs' however
controls fresnel offset, meaning that when this is set to 1, you will get no fresnel effect
and when set to 5, reflection is totally determined by fresnel, which is important for
realistic glass/metals/etc.
IOR is self-explanatory (...), same as Blender.
When you have 'Ray Transp' enabled, the blender 'filter' button will appear next to the IOR
button. This has the same effect as in Blender.
Below that there are some new parameters, 'Ext.Color' sets the extinction color for
transparent materials. Usually, in real transparent materials, light loses some of it's
energy the further it has to travel through the object. This effect can be simulated with
this parameter. Thing to look out for is that it specifies the color which will be
REMOVED after traveling through the object. What this means is that say you have a clear
white glass sphere, and set the extinction color to a strong blue, the result will be a
very yellow object when rendered.
Next to the color sliders, there is another set of three parameters, with which you can
enable color dispersion for transparent objects. 'Pwr' sets the amount of dispersion,
the higher, the more dispersion (the more colorful the result).
(For real world materials, this number can be found or derived from data in various glass catalogues)
The 'Samples' button below that sets the number of samples used, minimum values are around
7-10, and for very strong dispersion you might need a lot more.
As usual, this also means an increase in render time of course, but to simulate
realistic materials, you shouldn't really need more than 25 samples.
In addition to that, when using low sample numbers, but to still get a good spread of colors,
you can enable the jitter button, but this will also add noise.
Point/soft(point with shadowbuffer) or sphere lights (light with radius), have a new option
to add a simple glow effect, so that lights can be made visible.
NOTE: just like spotlight halo's, glow is not visible against the background, there must be
another object behind it. Simplest solution is to use a large black shadeless plane behind
your scene.
The glow intensity can be set with the 'GlowInt' parameter (use very low values around 0.01
even lower), and you can choose from two different types with the 'GlowType' button (which
don't look much different, but type 1 is probably better, type 0 faster).
And that's it, with apologies for the still missing features and
full support in general, but this will have to do for now.
2005-05-22 22:46:17 +00:00
|
|
|
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");
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch (R.r.GIquality)
|
|
|
|
{
|
Second and final commit for this version of the yafray export code (probably, you never know
of course...)
Not quite complete, but due to lack of time as good as it will get for now.
From the previous commit, forgot to report that basic fog is supported as well. Though because I had not much time to complete the code, it is sort of unfinished, and you will have
to tweak parameters specifically for yafray again. It uses only the world horizon color, and
only uses the Blender mist distance setting.
Textures now support checker clip mode.
Fixed possibly all 'duplilist non-empty' errors, though it could hide the real cause of the
error.
AA is no longer enabled automatically for certain GI quality settings, I thought it best to
leave it to the user to decide.
SkyDome GI mode now supports cache as well. There is a new option in the GI quality menu 'Use
Blender AO settings', which will as it says use the most important AO settings for the
skydome parameters. The only AO parameters used are 'Samples', 'Dist' and the random sampling
switch, which unlike in Blender you might want to use more often, since the QMC sampling used
in yafray can result in visible patterns or a dithering type look. 'Random' is not completely
random in yafray however, it is actually jittered (stratified) sampling.
Using an occlusion cache, doesn't necessarily mean that you will always get much shorter
render times. As with 'full' GI and cache, one problem is bumpmaps, when using bump (or
normal) maps, the sampling will be much more dense, using lots more rendertime.
As a temporary fix there is a button 'NoBump', but this also has the side effect that in
areas of total indirect light (or when used with SkyDome cache) no bumpmapping will be
visible. It is therefor best used with some direct light as well.
For SkyDome with cache, and strong bumpmapping it might actually not make much difference,
since for low distance values you can usually get away with low sample values as well.
The entire material panel is now replaced by another panel to show only the parameters
important to yafray and add some new ones as well.
Since lots of users (especially yafray beginners) have had problems getting certain material
aspects right, there is now a material preset menu available to hopefully solve some of the
most common "How do I do this? It doesn't work!" questions seen in various forums.
Choosing an option from this menu will set the required parameters to default
values for yafray, and you can work your way from there to tweak it something you want.
Most buttons are copies of the same Blender parameters, with some variations. Just like
Blender 'Ray Mirror' enables reflection, 'Ray Transp' enables refraction. You can use
'ZTransp' for materials that have texture maps with alpha channels.
Again, same as Blender 'rayMir' sets the amount of reflection. Next button 'frsOfs' however
controls fresnel offset, meaning that when this is set to 1, you will get no fresnel effect
and when set to 5, reflection is totally determined by fresnel, which is important for
realistic glass/metals/etc.
IOR is self-explanatory (...), same as Blender.
When you have 'Ray Transp' enabled, the blender 'filter' button will appear next to the IOR
button. This has the same effect as in Blender.
Below that there are some new parameters, 'Ext.Color' sets the extinction color for
transparent materials. Usually, in real transparent materials, light loses some of it's
energy the further it has to travel through the object. This effect can be simulated with
this parameter. Thing to look out for is that it specifies the color which will be
REMOVED after traveling through the object. What this means is that say you have a clear
white glass sphere, and set the extinction color to a strong blue, the result will be a
very yellow object when rendered.
Next to the color sliders, there is another set of three parameters, with which you can
enable color dispersion for transparent objects. 'Pwr' sets the amount of dispersion,
the higher, the more dispersion (the more colorful the result).
(For real world materials, this number can be found or derived from data in various glass catalogues)
The 'Samples' button below that sets the number of samples used, minimum values are around
7-10, and for very strong dispersion you might need a lot more.
As usual, this also means an increase in render time of course, but to simulate
realistic materials, you shouldn't really need more than 25 samples.
In addition to that, when using low sample numbers, but to still get a good spread of colors,
you can enable the jitter button, but this will also add noise.
Point/soft(point with shadowbuffer) or sphere lights (light with radius), have a new option
to add a simple glow effect, so that lights can be made visible.
NOTE: just like spotlight halo's, glow is not visible against the background, there must be
another object behind it. Simplest solution is to use a large black shadeless plane behind
your scene.
The glow intensity can be set with the 'GlowInt' parameter (use very low values around 0.01
even lower), and you can choose from two different types with the 'GlowType' button (which
don't look much different, but type 1 is probably better, type 0 faster).
And that's it, with apologies for the still missing features and
full support in general, but this will have to do for now.
2005-05-22 22:46:17 +00:00
|
|
|
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);
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
yafrayGate->addLight(params);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool yafrayPluginRender_t::writeWorld()
|
|
|
|
{
|
|
|
|
World *world = G.scene->world;
|
|
|
|
if (R.r.GIquality!=0) {
|
|
|
|
if (R.r.GImethod==1) {
|
|
|
|
if (world==NULL) cout << "WARNING: need world background for skydome!\n";
|
|
|
|
writeHemilight();
|
|
|
|
}
|
|
|
|
else if (R.r.GImethod==2) writePathlight();
|
|
|
|
}
|
|
|
|
if (world==NULL) return false;
|
Second and final commit for this version of the yafray export code (probably, you never know
of course...)
Not quite complete, but due to lack of time as good as it will get for now.
From the previous commit, forgot to report that basic fog is supported as well. Though because I had not much time to complete the code, it is sort of unfinished, and you will have
to tweak parameters specifically for yafray again. It uses only the world horizon color, and
only uses the Blender mist distance setting.
Textures now support checker clip mode.
Fixed possibly all 'duplilist non-empty' errors, though it could hide the real cause of the
error.
AA is no longer enabled automatically for certain GI quality settings, I thought it best to
leave it to the user to decide.
SkyDome GI mode now supports cache as well. There is a new option in the GI quality menu 'Use
Blender AO settings', which will as it says use the most important AO settings for the
skydome parameters. The only AO parameters used are 'Samples', 'Dist' and the random sampling
switch, which unlike in Blender you might want to use more often, since the QMC sampling used
in yafray can result in visible patterns or a dithering type look. 'Random' is not completely
random in yafray however, it is actually jittered (stratified) sampling.
Using an occlusion cache, doesn't necessarily mean that you will always get much shorter
render times. As with 'full' GI and cache, one problem is bumpmaps, when using bump (or
normal) maps, the sampling will be much more dense, using lots more rendertime.
As a temporary fix there is a button 'NoBump', but this also has the side effect that in
areas of total indirect light (or when used with SkyDome cache) no bumpmapping will be
visible. It is therefor best used with some direct light as well.
For SkyDome with cache, and strong bumpmapping it might actually not make much difference,
since for low distance values you can usually get away with low sample values as well.
The entire material panel is now replaced by another panel to show only the parameters
important to yafray and add some new ones as well.
Since lots of users (especially yafray beginners) have had problems getting certain material
aspects right, there is now a material preset menu available to hopefully solve some of the
most common "How do I do this? It doesn't work!" questions seen in various forums.
Choosing an option from this menu will set the required parameters to default
values for yafray, and you can work your way from there to tweak it something you want.
Most buttons are copies of the same Blender parameters, with some variations. Just like
Blender 'Ray Mirror' enables reflection, 'Ray Transp' enables refraction. You can use
'ZTransp' for materials that have texture maps with alpha channels.
Again, same as Blender 'rayMir' sets the amount of reflection. Next button 'frsOfs' however
controls fresnel offset, meaning that when this is set to 1, you will get no fresnel effect
and when set to 5, reflection is totally determined by fresnel, which is important for
realistic glass/metals/etc.
IOR is self-explanatory (...), same as Blender.
When you have 'Ray Transp' enabled, the blender 'filter' button will appear next to the IOR
button. This has the same effect as in Blender.
Below that there are some new parameters, 'Ext.Color' sets the extinction color for
transparent materials. Usually, in real transparent materials, light loses some of it's
energy the further it has to travel through the object. This effect can be simulated with
this parameter. Thing to look out for is that it specifies the color which will be
REMOVED after traveling through the object. What this means is that say you have a clear
white glass sphere, and set the extinction color to a strong blue, the result will be a
very yellow object when rendered.
Next to the color sliders, there is another set of three parameters, with which you can
enable color dispersion for transparent objects. 'Pwr' sets the amount of dispersion,
the higher, the more dispersion (the more colorful the result).
(For real world materials, this number can be found or derived from data in various glass catalogues)
The 'Samples' button below that sets the number of samples used, minimum values are around
7-10, and for very strong dispersion you might need a lot more.
As usual, this also means an increase in render time of course, but to simulate
realistic materials, you shouldn't really need more than 25 samples.
In addition to that, when using low sample numbers, but to still get a good spread of colors,
you can enable the jitter button, but this will also add noise.
Point/soft(point with shadowbuffer) or sphere lights (light with radius), have a new option
to add a simple glow effect, so that lights can be made visible.
NOTE: just like spotlight halo's, glow is not visible against the background, there must be
another object behind it. Simplest solution is to use a large black shadeless plane behind
your scene.
The glow intensity can be set with the 'GlowInt' parameter (use very low values around 0.01
even lower), and you can choose from two different types with the 'GlowType' button (which
don't look much different, but type 1 is probably better, type 0 faster).
And that's it, with apologies for the still missing features and
full support in general, but this will have to do for now.
2005-05-22 22:46:17 +00:00
|
|
|
|
2004-07-12 03:20:31 +00:00
|
|
|
yafray::paramMap_t params;
|
2004-12-05 03:51:01 +00:00
|
|
|
for (int i=0;i<MAX_MTEX;i++) {
|
2004-07-12 03:20:31 +00:00
|
|
|
MTex* wtex = world->mtex[i];
|
|
|
|
if (!wtex) continue;
|
|
|
|
Image* wimg = wtex->tex->ima;
|
2005-05-28 02:50:55 +00:00
|
|
|
// now always exports if image used as world texture (and 'Hori' mapping enabled)
|
|
|
|
if ((wtex->tex->type==TEX_IMAGE) && (wimg!=NULL) && (wtex->mapto & WOMAP_HORIZ)) {
|
2004-07-12 03:20:31 +00:00
|
|
|
string wt_path = wimg->name;
|
|
|
|
adjustPath(wt_path);
|
Added some backward compatibility with old yafray blendershader. Because of missing
parameters the material preset menu won't be as useful. Both glass presets will look the same
because there is no 'filter' parameter in the old yafray for instance.
So using the new Blender version with an old yafray version should work a bit better,
though the other way around, using the new yafray with an old blender version, will generally
not work as well.
I added a few extra things. In 'yafray' panel re-arranged some buttons, and added a new
button 'Clamp RGB'. This button will be enabled by default and helps to improve AA on
high contrast edges in the image. When using bokeh however, it is best to switch this off,
otherwise lens shaped highlights will be quite a bit less visible.
Changed the 'extinction' parameter name to the probably more correct term 'absorption',
though mathematically it works out the same. Also changed the behaviour of this color,
it no longer specifies a color that will be removed as I wrote in the previous commit,
but instead the actual color at one (blender) unit of distance. The 'Ds' (distance scale)
button below the color sliders controls the scaling of this unit distance.
What this means is that if you take the standard blender cube, which covers two units of
distance by default, setting the distance scale button to 2.0 will make sure that the color
you specified is exactly that color at that distance (provided the base color itself is white
of course, or 'filter' is 0, otherwise it will be filtered by the base color too).
Beyond this distance the color will get darker.
The glow option for point/soft/sphere lights has a new parameter 'GloOfs', or glow offset.
Setting this to a higher value then 0 will soften the central peak of the glow.
Another unreported bug fix: For xml export, when yafray failed to render the xml file
for some unknown reason, or because of other problems, the export code would still load
the previously rendered image, this causes problems however if the image resolution is
not the same as the current Blender buffer, and so could cause memory corruption or crashes.
This is now taken into account.
World image backgrounds now use the blender mapping settings as well, but only the
'AngMap', 'Sphere' and 'Tube' settings. But in yafray those last two, unlike Blender, cover
the whole view, not just the upper half, so is not really fully compatible with yafray.
So now you have to set one of these buttons too when loading a hdr lightprobe image.
btw, something I forgot to mention in previous commits is that the exposure control using
the texture brightness slider is no longer restricted to integer values. It is now a
floating point value, so you're not restricted to the 0 1 and 2 slider positions anymore,
anything in between will work too.
And finally, display updating is now more like Blender, using the mouse cursor as frame
counter for animation, etc.
2005-05-27 17:52:53 +00:00
|
|
|
params["type"] = yafray::parameter_t("image");
|
|
|
|
params["name"] = yafray::parameter_t("world_background");
|
|
|
|
// exposure_adjust not restricted to integer range anymore
|
|
|
|
params["exposure_adjust"] = yafray::parameter_t(wtex->tex->bright-1.f);
|
|
|
|
if (wtex->texco & TEXCO_ANGMAP)
|
2004-07-12 03:20:31 +00:00
|
|
|
params["mapping"] = yafray::parameter_t("probe");
|
Added some backward compatibility with old yafray blendershader. Because of missing
parameters the material preset menu won't be as useful. Both glass presets will look the same
because there is no 'filter' parameter in the old yafray for instance.
So using the new Blender version with an old yafray version should work a bit better,
though the other way around, using the new yafray with an old blender version, will generally
not work as well.
I added a few extra things. In 'yafray' panel re-arranged some buttons, and added a new
button 'Clamp RGB'. This button will be enabled by default and helps to improve AA on
high contrast edges in the image. When using bokeh however, it is best to switch this off,
otherwise lens shaped highlights will be quite a bit less visible.
Changed the 'extinction' parameter name to the probably more correct term 'absorption',
though mathematically it works out the same. Also changed the behaviour of this color,
it no longer specifies a color that will be removed as I wrote in the previous commit,
but instead the actual color at one (blender) unit of distance. The 'Ds' (distance scale)
button below the color sliders controls the scaling of this unit distance.
What this means is that if you take the standard blender cube, which covers two units of
distance by default, setting the distance scale button to 2.0 will make sure that the color
you specified is exactly that color at that distance (provided the base color itself is white
of course, or 'filter' is 0, otherwise it will be filtered by the base color too).
Beyond this distance the color will get darker.
The glow option for point/soft/sphere lights has a new parameter 'GloOfs', or glow offset.
Setting this to a higher value then 0 will soften the central peak of the glow.
Another unreported bug fix: For xml export, when yafray failed to render the xml file
for some unknown reason, or because of other problems, the export code would still load
the previously rendered image, this causes problems however if the image resolution is
not the same as the current Blender buffer, and so could cause memory corruption or crashes.
This is now taken into account.
World image backgrounds now use the blender mapping settings as well, but only the
'AngMap', 'Sphere' and 'Tube' settings. But in yafray those last two, unlike Blender, cover
the whole view, not just the upper half, so is not really fully compatible with yafray.
So now you have to set one of these buttons too when loading a hdr lightprobe image.
btw, something I forgot to mention in previous commits is that the exposure control using
the texture brightness slider is no longer restricted to integer values. It is now a
floating point value, so you're not restricted to the 0 1 and 2 slider positions anymore,
anything in between will work too.
And finally, display updating is now more like Blender, using the mouse cursor as frame
counter for animation, etc.
2005-05-27 17:52:53 +00:00
|
|
|
else if (wtex->texco & TEXCO_H_SPHEREMAP) // in yafray full sphere
|
|
|
|
params["mapping"] = yafray::parameter_t("sphere");
|
|
|
|
else // assume 'tube' for anything else
|
|
|
|
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");
|
Some small modifications.
Absorption and Dispersion parameters now only visible when 'Ray Transp'
enabled. WardIso specular amount scale to match Blender output.
Updated halo spotlight 'samples' to use new yafray syntax.
Quick addition for access to another yafray feature:
When using HDR backgrounds for lighting ('SkyDome' of 'Full' GI methods),
it is currently not always possible to get smooth lighting results.
Especially HDR images with small lightsource can be very noisy,
because currently yafray still relies on brute force random sampling.
As a temporary simple solution (better options will be available in the
'next generation' yafray), yafray can do some processing on the
image to smooth out all (or most) noise.
Besides smooth lighting, this also has
the advantage that AA will have less work to do,
GI quality can be set to the lowest level and still get reasonably
good results. Disadvantage however is that shadow definition is lost.
To switch on this option, set the world image texture filter parameter
to any value greater than 1.0
When 'filter' is 1.0 or less, normal hdr sampling is done as before.
So, current fastest possible render settings for IBL:
set texture image filter parameter of the background image to any value
greater than 1.0, set GI to 'SkyDome' type, enable 'Cache',
(possibly enable 'NoBump' when scene uses lots of bumpmapping),
set 'Quality' menu to 'Use Blender AO settings',
make sure AO is enabled in blender World buttons and set there the number
of AO samples to 1.
Should at least be good enough for previews.
2005-06-10 00:12:42 +00:00
|
|
|
if (wtex->tex->filtersize>1.f) params["prefilter"] = yafray::parameter_t("on");
|
Added some backward compatibility with old yafray blendershader. Because of missing
parameters the material preset menu won't be as useful. Both glass presets will look the same
because there is no 'filter' parameter in the old yafray for instance.
So using the new Blender version with an old yafray version should work a bit better,
though the other way around, using the new yafray with an old blender version, will generally
not work as well.
I added a few extra things. In 'yafray' panel re-arranged some buttons, and added a new
button 'Clamp RGB'. This button will be enabled by default and helps to improve AA on
high contrast edges in the image. When using bokeh however, it is best to switch this off,
otherwise lens shaped highlights will be quite a bit less visible.
Changed the 'extinction' parameter name to the probably more correct term 'absorption',
though mathematically it works out the same. Also changed the behaviour of this color,
it no longer specifies a color that will be removed as I wrote in the previous commit,
but instead the actual color at one (blender) unit of distance. The 'Ds' (distance scale)
button below the color sliders controls the scaling of this unit distance.
What this means is that if you take the standard blender cube, which covers two units of
distance by default, setting the distance scale button to 2.0 will make sure that the color
you specified is exactly that color at that distance (provided the base color itself is white
of course, or 'filter' is 0, otherwise it will be filtered by the base color too).
Beyond this distance the color will get darker.
The glow option for point/soft/sphere lights has a new parameter 'GloOfs', or glow offset.
Setting this to a higher value then 0 will soften the central peak of the glow.
Another unreported bug fix: For xml export, when yafray failed to render the xml file
for some unknown reason, or because of other problems, the export code would still load
the previously rendered image, this causes problems however if the image resolution is
not the same as the current Blender buffer, and so could cause memory corruption or crashes.
This is now taken into account.
World image backgrounds now use the blender mapping settings as well, but only the
'AngMap', 'Sphere' and 'Tube' settings. But in yafray those last two, unlike Blender, cover
the whole view, not just the upper half, so is not really fully compatible with yafray.
So now you have to set one of these buttons too when loading a hdr lightprobe image.
btw, something I forgot to mention in previous commits is that the exposure control using
the texture brightness slider is no longer restricted to integer values. It is now a
floating point value, so you're not restricted to the 0 1 and 2 slider positions anymore,
anything in between will work too.
And finally, display updating is now more like Blender, using the mouse cursor as frame
counter for animation, etc.
2005-05-27 17:52:53 +00:00
|
|
|
yafrayGate->addBackground(params);
|
|
|
|
return true;
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-07-12 03:20:31 +00:00
|
|
|
params.clear();
|
|
|
|
params["type"] = yafray::parameter_t("constant");
|
|
|
|
params["name"] = yafray::parameter_t("world_background");
|
|
|
|
// if no GI used, the GIpower parameter is not always initialized, so in that case ignore it
|
|
|
|
// (have to change method to init yafray vars in Blender)
|
Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).
Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.
The new noise functions for procedural textures are now supported in yafray,
but is not quite completed yet, still undergoing changes.
(needs yafray from cvs).
The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.
Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
|
|
|
float bg_mult = (R.r.GImethod==0) ? 1 : R.r.GIpower;
|
2004-06-16 18:44:12 +00:00
|
|
|
params["color"]=yafray::parameter_t(yafray::color_t(world->horr * bg_mult,
|
|
|
|
world->horg * bg_mult,
|
|
|
|
world->horb * bg_mult));
|
|
|
|
yafrayGate->addBackground(params);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "RE_callbacks.h"
|
|
|
|
|
2004-12-30 01:34:42 +00:00
|
|
|
bool blenderYafrayOutput_t::putPixel(int x, int y, const yafray::color_t &c,
|
|
|
|
yafray::CFLOAT alpha, yafray::PFLOAT depth)
|
2004-06-16 18:44:12 +00:00
|
|
|
{
|
2004-12-30 01:34:42 +00:00
|
|
|
unsigned int px = ((R.recty-1)-y)*R.rectx;
|
|
|
|
unsigned char* bpt = (unsigned char*)R.rectot + (px<<2);
|
|
|
|
int x4 = x<<2;
|
|
|
|
int temp = (int)(c.R*255.f+0.5f);
|
|
|
|
if (temp>255) temp=255;
|
|
|
|
bpt[x4] = temp;
|
|
|
|
temp=(int)(c.G*255.f+0.5f);
|
|
|
|
if (temp>255) temp=255;
|
|
|
|
bpt[x4+1] = temp;
|
|
|
|
temp=(int)(c.B*255.f+0.5f);
|
|
|
|
if (temp>255) temp=255;
|
|
|
|
bpt[x4+2] = temp;
|
|
|
|
temp=(int)(alpha*255.f+0.5f);
|
|
|
|
if (temp>255) temp=255;
|
|
|
|
bpt[x4+3] = temp;
|
|
|
|
|
|
|
|
// float buffer
|
|
|
|
if ((R.r.mode & R_FBUF) && R.rectftot) {
|
|
|
|
float* fpt = R.rectftot + (px<<2);
|
|
|
|
fpt[x4] = c.R;
|
|
|
|
fpt[x4+1] = c.G;
|
|
|
|
fpt[x4+2] = c.B;
|
|
|
|
fpt[x4+3] = alpha;
|
|
|
|
}
|
2004-11-18 05:22:18 +00:00
|
|
|
|
|
|
|
// depth values
|
2005-01-07 15:40:57 +00:00
|
|
|
int* zbuf = R.rectz + px;
|
Added nearly full support for Blender's procedural textures, with the exception
of 'envmap', 'magic', and 'plugin' modes.
The stucci texture also is not exact match, since it cannot be fully
emulated in yafray because of implementation issues. It will work best
for low turbulence values (which is actually not taken into account
in the export code).
Also, since Blender's static noise is basically just direct random number
output, don't expect the exact same result when rendered in yafray, but in this
case that probably shouldn't be that much of a problem...
(needs yafray from cvs)
(btw, on a side note, I put this in the comments once when working on the noise
stuff for Blender, but noise is affected by the 'depth' parameter, and there
is no way to control this directly from the GUI, can only be done by temporarily
switching to 'clouds' for instance.)
2004-11-28 02:13:57 +00:00
|
|
|
depth -= R.near;
|
|
|
|
float mz = R.far - R.near;
|
|
|
|
if (depth<0) depth=0; else if (depth>mz) depth=mz;
|
2004-12-30 01:34:42 +00:00
|
|
|
if (mz!=0.f) mz = 2147483647.f/mz;
|
2005-01-07 15:40:57 +00:00
|
|
|
zbuf[x] = (int)(depth*mz);
|
2004-11-18 05:22:18 +00:00
|
|
|
|
2004-06-16 18:44:12 +00:00
|
|
|
out++;
|
Part one of the final yafray commit.
Totally updated blender shader in yafray, hopefully better matches blender
results. Though ramps are now partially supported, they cannot work in all
cases properly in yafray, and in fact are a bit useless probably as far as
yafray is concerned. In fact the 'Result' ramp input mode is not supported
at all, because it works on the total lighting result, and in a yafray
shader this is not possible since it works per light.
Also, since Blender and Yafray have totally different lighting models,
the 'Energy' ramp input mode also won't generally give the same results
as in Blender, since it works with light energy and in yafray this is
different from Blender. Even worse, the only ramp shader that will work
properly when used with GI is the 'Normal' ramp input mode.
As contradictory as this might seem, at various stages of the GI process,
lighting is not known, so properly getting light (ramp 'energy' mode)
or shader information (ramp 'shader' mode, which depends on lighting)
is not possible. Which all means that when the ramp is in 'energy' or
'shader' mode and using it with GI enabled, yafray can only 'see' the
underlying material color, not the ramps, which results in a mix of the
ramp colors (from direct light) with the material color (from indirect light).
There is currently nothing that can be done about that.
The supported texture mapping modes now includes raymir as well, transparency
as far as texturing is concerned now works similar to Blender, with the
exception that you still have to set alpha to a low value to get any
transparency effect at all in yafray. So the Blender 'filter' parameter
now also will affect yafray.
All texture blending modes are now supported (same for ramps).
'Translu' and 'Amb' texture modulation are not supported.
Texture interpolation can be switched off ('InterPol' switch in blender
image texture button section).
All Blender brdf models (aka 'shaders' for the Blender users) are now supported,
and again, you won't necessarily get the same results as in Blender.
The reason for that is partially of course the lighting differences, but also,
not all Blender 'shader' implementations are actually correct, and copying
those errors just for the sake of matching Blender results doesn't really
seem like a good idea...
Though this really is only the case for WardIso, less so for Minnaert and
Blinn, which in yafray are more or less (but not totally) a copy of
the Blender code.
In any case, in practice those differences might not be
too noticable at all (I hope).
Continue to the next part...
2005-05-21 20:49:24 +00:00
|
|
|
if (out==4096)
|
2004-06-16 18:44:12 +00:00
|
|
|
{
|
Added some backward compatibility with old yafray blendershader. Because of missing
parameters the material preset menu won't be as useful. Both glass presets will look the same
because there is no 'filter' parameter in the old yafray for instance.
So using the new Blender version with an old yafray version should work a bit better,
though the other way around, using the new yafray with an old blender version, will generally
not work as well.
I added a few extra things. In 'yafray' panel re-arranged some buttons, and added a new
button 'Clamp RGB'. This button will be enabled by default and helps to improve AA on
high contrast edges in the image. When using bokeh however, it is best to switch this off,
otherwise lens shaped highlights will be quite a bit less visible.
Changed the 'extinction' parameter name to the probably more correct term 'absorption',
though mathematically it works out the same. Also changed the behaviour of this color,
it no longer specifies a color that will be removed as I wrote in the previous commit,
but instead the actual color at one (blender) unit of distance. The 'Ds' (distance scale)
button below the color sliders controls the scaling of this unit distance.
What this means is that if you take the standard blender cube, which covers two units of
distance by default, setting the distance scale button to 2.0 will make sure that the color
you specified is exactly that color at that distance (provided the base color itself is white
of course, or 'filter' is 0, otherwise it will be filtered by the base color too).
Beyond this distance the color will get darker.
The glow option for point/soft/sphere lights has a new parameter 'GloOfs', or glow offset.
Setting this to a higher value then 0 will soften the central peak of the glow.
Another unreported bug fix: For xml export, when yafray failed to render the xml file
for some unknown reason, or because of other problems, the export code would still load
the previously rendered image, this causes problems however if the image resolution is
not the same as the current Blender buffer, and so could cause memory corruption or crashes.
This is now taken into account.
World image backgrounds now use the blender mapping settings as well, but only the
'AngMap', 'Sphere' and 'Tube' settings. But in yafray those last two, unlike Blender, cover
the whole view, not just the upper half, so is not really fully compatible with yafray.
So now you have to set one of these buttons too when loading a hdr lightprobe image.
btw, something I forgot to mention in previous commits is that the exposure control using
the texture brightness slider is no longer restricted to integer values. It is now a
floating point value, so you're not restricted to the 0 1 and 2 slider positions anymore,
anything in between will work too.
And finally, display updating is now more like Blender, using the mouse cursor as frame
counter for animation, etc.
2005-05-27 17:52:53 +00:00
|
|
|
RE_local_render_display(0, R.recty-1, R.rectx, R.recty, R.rectot);
|
Part one of the final yafray commit.
Totally updated blender shader in yafray, hopefully better matches blender
results. Though ramps are now partially supported, they cannot work in all
cases properly in yafray, and in fact are a bit useless probably as far as
yafray is concerned. In fact the 'Result' ramp input mode is not supported
at all, because it works on the total lighting result, and in a yafray
shader this is not possible since it works per light.
Also, since Blender and Yafray have totally different lighting models,
the 'Energy' ramp input mode also won't generally give the same results
as in Blender, since it works with light energy and in yafray this is
different from Blender. Even worse, the only ramp shader that will work
properly when used with GI is the 'Normal' ramp input mode.
As contradictory as this might seem, at various stages of the GI process,
lighting is not known, so properly getting light (ramp 'energy' mode)
or shader information (ramp 'shader' mode, which depends on lighting)
is not possible. Which all means that when the ramp is in 'energy' or
'shader' mode and using it with GI enabled, yafray can only 'see' the
underlying material color, not the ramps, which results in a mix of the
ramp colors (from direct light) with the material color (from indirect light).
There is currently nothing that can be done about that.
The supported texture mapping modes now includes raymir as well, transparency
as far as texturing is concerned now works similar to Blender, with the
exception that you still have to set alpha to a low value to get any
transparency effect at all in yafray. So the Blender 'filter' parameter
now also will affect yafray.
All texture blending modes are now supported (same for ramps).
'Translu' and 'Amb' texture modulation are not supported.
Texture interpolation can be switched off ('InterPol' switch in blender
image texture button section).
All Blender brdf models (aka 'shaders' for the Blender users) are now supported,
and again, you won't necessarily get the same results as in Blender.
The reason for that is partially of course the lighting differences, but also,
not all Blender 'shader' implementations are actually correct, and copying
those errors just for the sake of matching Blender results doesn't really
seem like a good idea...
Though this really is only the case for WardIso, less so for Minnaert and
Blinn, which in yafray are more or less (but not totally) a copy of
the Blender code.
In any case, in practice those differences might not be
too noticable at all (I hope).
Continue to the next part...
2005-05-21 20:49:24 +00:00
|
|
|
out = 0;
|
2004-06-16 18:44:12 +00:00
|
|
|
}
|
Added some backward compatibility with old yafray blendershader. Because of missing
parameters the material preset menu won't be as useful. Both glass presets will look the same
because there is no 'filter' parameter in the old yafray for instance.
So using the new Blender version with an old yafray version should work a bit better,
though the other way around, using the new yafray with an old blender version, will generally
not work as well.
I added a few extra things. In 'yafray' panel re-arranged some buttons, and added a new
button 'Clamp RGB'. This button will be enabled by default and helps to improve AA on
high contrast edges in the image. When using bokeh however, it is best to switch this off,
otherwise lens shaped highlights will be quite a bit less visible.
Changed the 'extinction' parameter name to the probably more correct term 'absorption',
though mathematically it works out the same. Also changed the behaviour of this color,
it no longer specifies a color that will be removed as I wrote in the previous commit,
but instead the actual color at one (blender) unit of distance. The 'Ds' (distance scale)
button below the color sliders controls the scaling of this unit distance.
What this means is that if you take the standard blender cube, which covers two units of
distance by default, setting the distance scale button to 2.0 will make sure that the color
you specified is exactly that color at that distance (provided the base color itself is white
of course, or 'filter' is 0, otherwise it will be filtered by the base color too).
Beyond this distance the color will get darker.
The glow option for point/soft/sphere lights has a new parameter 'GloOfs', or glow offset.
Setting this to a higher value then 0 will soften the central peak of the glow.
Another unreported bug fix: For xml export, when yafray failed to render the xml file
for some unknown reason, or because of other problems, the export code would still load
the previously rendered image, this causes problems however if the image resolution is
not the same as the current Blender buffer, and so could cause memory corruption or crashes.
This is now taken into account.
World image backgrounds now use the blender mapping settings as well, but only the
'AngMap', 'Sphere' and 'Tube' settings. But in yafray those last two, unlike Blender, cover
the whole view, not just the upper half, so is not really fully compatible with yafray.
So now you have to set one of these buttons too when loading a hdr lightprobe image.
btw, something I forgot to mention in previous commits is that the exposure control using
the texture brightness slider is no longer restricted to integer values. It is now a
floating point value, so you're not restricted to the 0 1 and 2 slider positions anymore,
anything in between will work too.
And finally, display updating is now more like Blender, using the mouse cursor as frame
counter for animation, etc.
2005-05-27 17:52:53 +00:00
|
|
|
|
|
|
|
if (RE_local_test_break()) return false;
|
2004-06-16 18:44:12 +00:00
|
|
|
return true;
|
|
|
|
}
|