Notas de la versión 0.0.8 para usuarios de Blender
By Claus Andersen and Alvaro Luna.
May 2006
Traducción al español por Luis Fernando Ruiz.
Hay disponible una traducción al polaco de este documento, realizada por
ZoltanPL:
http://www.emergencyart.com/yafray/zmianyYafRay.html
Algunos de los modelos utilizados en estas notas se pueden encontrar en el
Blender Model Repository, sección YafRay:
http://www.katorlegaz.com/index.php?a=thumbs&c=Blender_3D_Model_Repository&p=yafray
Iluminación:
Opciones de la "Point Light"
Aunque en el interfaz de Blender se muestra como un único tipo de luz, la realidad es que YafRay puede traducir la configuración de un
Lamp al menos en tres tipos de luz,
dependiendo de las tres posibles configuraciones de los botones de sombreado (shadow buttons).
- Si no están activados ni Ray Shadow ni Buf.shadow, YafRay lo traducirá en un bloque 'pointlight'.
- Si el botón Ray Shadow está activado, cuando el valor de radius es 0, es exportado como una 'pointlight', siempre arrojando sombras duras. La configuración sobre las muestas (samples) es ignorada. Si el radio es diferente de 0, entonces es exportada como 'spherelight', que puede arrojar sombras suaves. En esta ocasión la configuración de Sample controla la calidad de las sombras. La 'spherelight', cuando es usada con fotones, podría no funcionar bien ya que sólo muestrea desde la supercie de la esfera. Funciona mejor utilizarla junto con un objeto emisor (esfera) en la misma posición, de manera análoga al método del 'arealight'. El botón Radius controla el tamaño de la 'spherelight'.
Ejemplo de una spherelight de YafRay utilizada junto a una esfera emisora:
- Si e botón Buf.Shadow está activado, es exportada a YafRay como una 'softlight', que es una 'pointlight' que utiliza mapas de sombras (shadowmaps). Esto se puede utilizar para falsear sombras suaves, que es más rápido que utilizar luces de area (arealights). Aunque los parámetros son similares a los de Blender, para YafRay tanto el parámetro bias como shadowbuffersize puede ser más bajo que en la configuración de Blender equivalente. Recuerde que en este caso se crean 6 shadowmaps, por lo que puede utilizar bastante memoria con unos ajustes de buffer grandes.
Opción Glow
Las luces puntuales (
Pointlights) ahora tienen una opción de resplandor (
glow) básica, una forma sencilla para hacer las luces visibles. El efécto básico para luz en niebla.
- 'glow_intensity' controla la intensidad y el tamaño del glow , generalmente valores muy bajos son suficientes (menos de 0.01), aunque también depende de la propia intensidad de la luz.
- 'glow_offset' afecta al brillo central del glow, al establecer el valor más alto, tendremos un glow menos acentuado, siendo mayormente un fundido con un ténue efecto de niebla alrededor de la luz.
- 'glow_type' se pueden establecer dos tipos, que aunque puedan parecer similares el tipo dos es mejor, aunque más lento. El primer tipo es un pequeño truco que simplifica el método, el segundo está basado en una idea descrita por Han-Wen Nienhuys en RTNews7v3 (también utilizada en MegaPov).

NOTE: Como el halo de la
spotlight,
glow no es visible contra el fondo, tiene que existir otro objeto detrás de él. La solución más simple es utilizar un gran plano negro, sin sombras, al fondo de tu escena.
Ejemplo del uso de la opción
glow 'Concep 17' by
TjGk:
GI Skydome
IRRADIANCE CACHE
Cuando la Irradiance Cache es activada, estamos de hecho utilizando iluminación global (
Full Global Illumination) (
pathlight) pero en 'occlusion' mode.
En el XML,
pathlight tiene un nuevo parámetro 'mode' (modo), que puede establecerse a 'occlusion', en cuyo caso tendremos sólo sampleado para
occlusion en vez de
Ilumninación Global completa.
<light type="pathlight" name="path_LT" power="3.000000" mode="occlusion"
cache="on" use_QMC="on" threshold="1.000000" cache_size="0.033333"
shadow_threshold="0.950000" grid="82" search="35"
ignore_bumpnormals="off" samples="2048" > </light>
La principal ventaja es la posibilidad de utilizar irrandiance cache. Una cache de irradiancia aumenta la velocidad de renderizado de los renders con iluminación global, mediante el renderizado de un paso previo para determinar las mejores áreas de la imagen para tomar muestras. En una superficie grande y plana, por ejemplo, se puede asumir que la ilumnización difusa será ténue, por lo que necesitarías menos muestras. Mientras que en una esquina, la iluminación puede cambiar drásticamente, requiriendo más muestras. La irradiance caché dice al render final con ilumnación global (IG) cuales son los mejores lugares para muestrear.
Ejemplo de irradiance cache:
USO DE LOS AJUSTES AO DE BLENDER (maxdistance)
Hay una nueva opción en el menu
quality (calidad) de IG, 'Use Blender AO settings', que como dice utiliza los ajustes más importantes de AO para los parámetros de
skydome. Los únicos parámetros utilizados para AO son 'Samples' y 'Dist'
Una muestra de
Blender AO es equivalente a 32 muestras de YafRay, por lo que 16 muestras de Blender en AO (el máximo) equivalen a 512 muestras en YafRay. Ten en cuenta que
la mejor calidad en YafRay (Best Quality) es de 2048 muestras.
Puede que el valor más interesante de
Blender AO a tener en cuenta sea
Distance.
Distance establece la longitud de los rayos de oclusión y define cómo de lejos otras caras toman el efecto oclusivo.
En el XML, tanto 'hemilight' como 'pathlight' en modo 'occlusion' tienen un nuevo parámetro, 'maxdistance', con el que se puede establecer la máxima distancia para detectar la oclusión. Esto significa que, tal y como sucede con el Ambient Occlusion de Blder, se puede utilizar también para escenas anteriores.
Esto es un ejemplo de cómo se traducen los parámetros del AO de Blender a un bloque Pathlight. Blender AO samples=5 y Blender AO Distance=10. Fíjate en los tags
samples y
maxdistance:
<light type="pathlight" name="path_LT" power="3.000000" mode="occlusion"
cache="on" use_QMC="on" threshold="1.000000" cache_size="0.033333"
shadow_threshold="0.100000" grid="82" search="35"
ignore_bumpnormals="off"
samples="160" maxdistance="10.000000" >
</light>
BUMPNORMALS (SkyDome y Full GI)
Con IG completa, 'full', e irradiance cache, uno de los problemas son los bumpmaps. Cuando usamos un
bumpmap (o
normalmap), el sampleado será mucho más denso, utilizando mucho tiempo de render.
Como solución temporal, tenemos el botón 'NoBump', pero tiene el efecto colateral que en areas de *luz indirecta total+ (o cuando se utiliza con SkyDome cache) el bumpmapping no será visible. Por tanto es mejor utilizarlo también con algún tipo de iluminación directa. Para SkyDome con cache y con mucho bumpmapping, podría de hecho no haber mucha diferencia, ya que para distancias cortas puedes solucionarlo con un muestreo bajo.
Yafray FOG (NIEBLA).
La niebla básica también está soportada. Aunque, quizás por que no hay mucho tiempo para completar el código, está inacabado y puede que tengar que ajustar parámetros específicamente para YafRay de nuevo. Sólo utiliza el color del horizonte en 'world' y la distancia 'mist' de Blender.
En el XML, hay dos nuevos parámetros dentro del bloque de renderizado, que son
fog_density value y
fog_color r
<render camera_name="MAINCAM"
raydepth="5" gamma="1.500000" exposure="0.000000"
AA_passes="4" AA_minsamples="4"
AA_pixelwidth="1.500000" AA_threshold="0.050000"
background_name="world_background"
>
<fog_density value="0.1" />
<fog_color r="0.85" g="0.85" b="0.95" />
<outfile value="c:\Documents and Settings\Alvaro\Escritorio\YBtest.tga" />
</render>
Sombreado (Shading)
Mirror Transp Presets
Dado que muchos usuarios (especialmente los que se inician con YafRay) han tenido problemas para conseguir un aspecto adecuado de ciertos materiales, existe ahora un nuevo menú con materiales predefinidos para, con suerte, solventar algunas de las preguntas más frecuéntes del estilo: "¿Como hago esto? ¡No funciona!". Eligiendo una opción de este menú podremos establecer los valores requeridos por defecto para YafRay, y desde aquí podrás empezar a trabajar para conseguir lo que desees.
La mayor parte de los botones son copias de los mismos parámetros de Blender, con algunas variaciones. Como en Blender, 'Ray Mirror' activa la reflexión, 'Ray Transp' la refracción. Puedes utilizar 'ZTransp' para los materiales con mapas de texturas que tengan canales alpha.
De nuevo, al igual que en Blender, 'rayMir' establece la "cantidad" de reflexión. El siguiente botón, 'frs0fs', sin embargo controla el desplazamiento del fresnel (fresnel offset), es decir, que cuando está a 1 no tendrás efecto fresnel y cuando está a 5, la reflexión estará totalmente determinada por el fresnel, lo que es muy importante para resultados fotorrealistas en vidrios, metales, etc.
Qué es Fresnel?:
http://www.hash.com/am2004/Rendering/Fresnel%20Term/Fresnel%20Term.htm
IOR es auto-explicativo, lo mismo que en Blender. Cuando tienes activado el 'Ray Transp', el botón 'filter' de Blender aparece al lado del de IOR. Esto tiene el mismo efecto que en Blender.
More information about filtering:
http://www.blender3d.org/cms/Transparent_Filtering.514.0.html
Absorption Dispersion
En óptica,
dispersión es un fenómeno que causa descomposición de una onda en componentes del espectro con distintas longitudes de onda. Esto es lo que sucede cuando ves un arcoiris después de una tormenta. También es visible al mirar un prisma o una esféra de cristal. YafRay es capaz ahora de simular esto o bien editando el XML de tu escena o bien directamente desde Blender.
<dispersion_power value="0.800000" />
<dispersion_samples value="30" />
<dispersion_jitter value="off" />
Si quieres dispersión en el suelo de tu escena, necesitas una 'pothonlight' (en el siguiente ejemplo no se usa photonlight)
Absorción es, resumiendo, cuando un material absorve cierta longitud de onda de la luz, dejando que las otras componentes pasen o reflejen. Por ejemplo, un objeto que absorve la luz azul, verde y amarilla será rojo bajo la luz blanca. Para obtener este efecto cambia las siguientes variables en tu fichero XML:
<absorption r="0.000000" g="5.000000" b="7.000000" />
Esta configuración está también disponible desde la interfaz de Blender, así:
Dispersión
- Pwr: Potencia de dispersión, a valor más alto, más dispersion. 0 = sin dispersión.
- Samples: (muestras) Utilizar muy pocas muestras puede funcionar en objetos de un sólo color, o por lo menos objetos no representados en color verdadero. Para materiales más realista, un máximo de 25 deberían ser suficientes.
- Jitter: Activa la vibración de las longitudes de onda - añade ruido.
Absorción
- DS: Absorpsion distance scale, Distancia de la escala de absorción.
=Una descripción mucho más técnica se puede encontrar (en inglés) en el changelog de YafRay 0.0.8 =
http://projects.blender.org/viewcvs/viewcvs.cgi/yafray/src/shaders/blendershader.cc?cvsroot=yafray
Texture modulation and blending modes
All texture modulation modes with the exception of 'Amb' and 'Translu' are now supported. 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.
All blending modes are supported as well.
Diffuse and Specular modes
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.
Image texture
In XML language, the interpolation of Image textures has been changed, instead of the former on/off switch, it can now be set to three types of interpolation, 'none' for no interpolation, 'bilinear'(default) for bilinear interpolation, and for special cases 'bicubic'. The latter is a bit expensive and is best saved for things like low resolution backgrounds, or highly zoomed in textures, where it can considerably improve the otherwise blocky artifacts of bilinear interpolation.
From Blender point of view, when 'Interpol' button is activated in the image loader panel, YafRay will interpret it as "bilinear"(default), while if 'Interpol' button is not activated, YafRay will interpret it as "none" for no interpolation. If your want to use the third method "bicubic", you'll have to edit manually the XML file. Remember, the possible options are "bilinear", "none" and "bicubic". Notice the
interpolate value tag in the below shader block:
<shader type="image" name="IMrembrandt-03.jpg" >
<attributes>
<filename value="F:\2006\rembrandt-03.jpg" />
<interpolate value="none" />
</attributes>
</shader>
More info about interpolation:
http://www.dpreview.com/learn/?/key=interpolation
HDRI as texture
High dynamic range images are now supported as texture images.
(just make sure YafRay is compiled with OpenEXR support -
http://www.openexr.com/ )
Utilizing this can make objects illuminate a scene.
Both HDR and OpenEXR images can be applied as normal textures in Blender (and in the XML scenefile):
<shader type="image" name="IMStageEnvLatLong.exr" >
<attributes>
<filename value="../StageEnvLatLong.exr" />
<interpolate value="bilinear" />
</attributes>
</shader>
Sphere textured with an HDRI-probe.
Sphere textured with an EXR-image:
HDRI as background
Some minor changes have occured. Concerning Blender, 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.
Besides, 'Hori' must now be enabled for probes to work.
In YafRay XML language, though still supported for backwards compatability, backgrounds of type 'HDRI' can now completely be replaced by the 'image' type background (see XML in HDRI Prefiltering below). The image background now has the exact same functionality, including the 'exposure_adjust', which replaces the 'power' parameter (still supported but deprecated).
The 'mapping' parameter now also includes 'angular' though it is just another name for 'probe' mapping.
Exposure control is now a floating point value so anything in between 0 1 and 2 will work too.
Example of 'exposure_adjust' by
Hassan:
HDRI Prefiltering
An overlooked feature is the 'prefilter' parameter. Setting 'Filter' (under image texture) higher than '1' will activate this option and then there's actual XML-editing. Applying it will get rid of lighting artifacts often experienced when working with HDR images:
<background type="image" name="world_background" exposure_adjust="0.000000" mapping="probe" >
<filename value="/hdri/stpeters_probe.hdr" />
<interpolate value="bilinear" />
<prefilter value="on"/> < !-- here! -- >
</background>
Examples of "on/off" prefiltering option:
Clipmode
YafRay supports all of Blender Clipmodes. In fact, XML tags are called "cube", "clip", "clipcube", "checker" and "repeat" as in Blender.
This is an example of a
blendermapper, where clipping parameters are defined, such as
clipping value,
checker_mode value and
checker_dist value:
<shader type="blendermapper" name="MAMaterial.002_map0">
<attributes>
<input value="IM060ppr.jpg" />
...
<clipping value="checker" />
<checker_mode value="odd" />
<checker_dist value="0.000000" />
<cropmin_x value="0.000000" />
<cropmin_y value="0.000000" />
<cropmax_x value="1.000000" />
<cropmax_y value="1.000000" />
<rot90 value="off" />
</attributes>
</shader>
Procedurals
Most Blender procedural textures are now supported, though stucci does not (and cannot) totally work the same as in Blender, and related to that, for similar reasons, the Blender 'nabla' bumpmap parameter is not used either, it will match Blender best if the default setting of 0.025 is used.
In XML language, besides the existing procedural shaders (marble, woods, clouds), there are aswell five new procedural shaders, which are:
- voronoi
- musgrave
- distorted_noise
- gradient
- random_noise
Furthermore, inside every procedural shader, there are at least two new parameters:
- noise_type which controls the noise type, as in Blender.
- shape which controls the kind of wave to produce bands, as in Blender
In the
noise_type field you can input the following noisetypes:
"blender", "stdperlin", "newperlin", "voronio_crackle",
"voronoi_f1", "voronoi_f2", "voronoi_f3", "voronoi_f4",
"voronoi_f2f1" and "cellnoise"
Shape can now be set to
"sin", "saw", and
"tri" as in the Blender settings.
Inside the XML file, the order of several shader blocks in order to produce, for instance, a procedural marble material would be:
- First the Procedural shader, where noise_type and shape are defined, apart from other procedural parameters.
<shader type="marble" name="example_procedural" >
<noise_type value="blender" />
<shape value="saw" />
...
- Second, the Blender mapper shader, where the texturing is defined, along with the procedural shader as input.
<shader type="blendermapper" name="example_textura">
<input value="example_procedural" />
...
- And finally the Blender shader, where the material final aspect is defined, using the Blender mapper shader as input.
<shader type="blendershader" name="example_material" >
<input value="example_textura" />
...
Kam has written an excellent YAFRay v0.0.8 Procedural Shader Reference, with lots of examples:
http://www.geocities.com/kam_b_lai/tutorials/procedural/yashader_ref.htm
Ramps
Though Blender ramps are now partially supported, they cannot work in all cases the same in YafRay, since Blender and Yafray have totally different lighting models. The main issues are:
- 'Result' ramp input mode is not supported at all.
- 'Energy' ramp input mode also won't generally give the same results as in Blender.
- The only ramp shader that will work properly when used with GI is the 'Normal' ramp input mode.
- When 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).
- All blending modes are supported.
The basic purposes of Blender ramps are still applicable to YafRay. You'll find more information about ramps in the Blender Wiki:
http://mediawiki.blender.org/index.php/Manual/PartIII/Ramp_Shaders
Example of YafRay Ramps, by
Jendrzych:
In XML language, Yafray Ramps are defined first by
colorband shaders, one for each type of Ramps (color and specular), where color and modulators (ramp steps) are defined:
<shader type="colorband" name="MAMaterial_difframp" >
<attributes>
</attributes>
<modulator value="0.000000" >
<color r="0.000000" g="0.000000" b="0.000000" a="0.000000" />
</modulator>
<modulator value="1.000000" >
<color r="0.000000" g="1.000000" b="1.000000" a="1.000000" />
</modulator>
</shader>
<shader type="colorband" name="MAMaterial_specramp" >
<attributes>
</attributes>
<modulator value="0.000000" >
<color r="0.000000" g="0.000000" b="0.000000" a="0.000000" />
</modulator>
<modulator value="1.000000" >
<color r="0.000000" g="1.000000" b="1.000000" a="1.000000" />
</modulator>
</shader>
Finally there should be a
blendershader block, where previous
colorband shaders are called, respectively, in
diffuse_ramp value and
specular_ramp value tags. There are several ramps parameters in the
blendershader block as well:
<shader type="blendershader" name="MAMaterial" >
<attributes>
<color r="0.800000" g="0.800000" b="0.800000" />
<specular_color r="1.000000" g="1.000000" b="1.000000" />
<mirror_color r="1.000000" g="1.000000" b="1.000000" />
<diffuse_reflect value="0.800000" />
<specular_amount value="0.500000" />
<alpha value="1.000000" />
<emit value="0.000000" />
<matmodes value="traceable shadow" />
<diffuse_brdf value="lambert" />
<specular_brdf value="blender_cooktorr" />
<hard value="50" />
<diffuse_ramp value="MAMaterial_difframp" />
<diffuse_ramp_mode value="shader" />
<diffuse_ramp_blend value="mix" />
<diffuse_ramp_factor value="1.000000" />
<specular_ramp value="MAMaterial_specramp" />
<specular_ramp_mode value="shader" />
<specular_ramp_blend value="mix" />
<specular_ramp_factor value="1.000000" />
</attributes>
</shader>
Anisotropic models
In XML, all you really need to do is set the
specular_brdf tag to either 'ward' or 'ashikhmin'. To control the specular shading there are two parameters for the u & v directions,
u_roughness and
v_roughness respectively. If they both have the same value, the shader looks similar to other specular shaders like phong or blinn (specularity is 'isotropic'). So for anisotropic shading, they both should have different values.
In xml this would look something like:
<specular_brdf value="ward" />
<u_roughness value="0.8" />
<v_roughness value="0.15" />
If you use Blender, you could just export a scene which uses the ward specular, and then edit the xml to XML change the u & v roughness params, or set the specular_brdf to 'ashikhmin'.
In case anyone would want to do that, lets say you would want to recreate images as seen in the ashikhmin paper, which refers to the parameters
Nu and
Nv to control the anisotropic shading. For consistency the YafRay u & v roughness are always in the range 0 to 1, but the paper uses numbers from 0 to infinity. To convert those numbers for use with yafray, simply set 'u_roughness' to
1/Nu and 'v_roughness' to
1/Nv. So if
Nu=10 and
Nv=1000, set 'u_roughness' to 0.1 and 'v_roughness' to 0.001. So the larger
Nu/Nv, or as far as YafRay is concerned, the smaller u/v roughness, the sharper the specular shading.
To get a similar look as the 'ward' example above (for a simple sphere at least), the xml code could look something like:
<specular_brdf value="ashikhmin" />
<u_roughness value="0.8" />
<v_roughness value="0.015" />
Then about controlling the anisotropic directions of the shading. We'll spare you the details of the how & why, which probably would only confuse, but in any case, that is a rather complicated issue when dealing with polygons, so it probably all will still sound rather confusing nevertheless. There are two ways the tangent axes can be controlled, either by texture coordinates (uv or orco), or just let yafray 'guess'. Both have their pro's & cons.
Using texture coordinates has the advantage that the anisotropic directions will 'stick' to the surface, they will not change when the mesh is deformed, on the other hand, shading can have artifacts if the mesh is not sufficiently tesselated (low-poly models). Another disadvantage of using uv coords is that it is probably very difficult to set up if you really want to exactly control the directions. But in Blender, probably the most common one, u aligned to X, v aligned to Y, can be more or less achieved by using 'cylinder' uv-mapping assigned from front view. Yet another disadvantage is that there is only one set of uv (or orco) coordinates, so it might not be possible to use other textures on the same object, unless they happen to use the exact same mapping.
Things are 'simpler' when using nurbs or surface patches in Blender, then by enabling the 'uv orco' button ('Curve and Surface' panel, editing section), Blender will assign the exact correct parametric texture orco cords for these shapes. But parametric surfaces are not used very often in Blender.
Then you can also just let yafray 'guess' the tangents, this has the advantage that the shading is always smooth, but then again, also has the disadvantage that the anisotropic directions are fixed to a main axis, so shading will change when the mesh deforms or rotates. Of course all this might be less of an issue if you're not doing animation.
There is also an additional parameter available in yafray, called
anisotropic_angle, which allow you to rotate the tangents, the value is in degrees.
Yes, We know, it's all giant confusing mess, isn't it...
Subsurface Scattering
Render by
oort
SubSurface Scattering is now supported in Yafray - It is by no means physical correct but rather a quick hack. A new version that will replace the current one is under way. SSS is only accessable by XML editing your scenefile. In the example below, in first place there is a
sss block where SSS parameters are defined. In second place there is a
blendershader block, where the
sss block is called in the
environment value tag. Yafray shaders are located at the beginning of XML files:
<shader type="sss" name="w_ssstest_10">
<attributes>
<color r="1.0" g="1.0" b="0.0"/>
<radius value="1.5"/>
<samples value="100"/>
</attributes>
</shader>
<shader type="blendershader" name="MAamarillo" >
<attributes>
<color r="1.000000" g="1.000000" b="0.000000" />
<specular_color r="1.000000" g="1.000000" b="1.000000" />
<mirror_color r="1.000000" g="1.000000" b="1.000000" />
<diffuse_reflect value="0.800000" />
<specular_amount value="0.500000" />
<alpha value="1.000000" />
<emit value="0.000000" />
<matmodes value="traceable shadow" />
<diffuse_brdf value="lambert" />
<specular_brdf value="blender_cooktorr" />
<hard value="50" />
<environment value="w_ssstest_10" />
</attributes>
</shader>
Finally, objects to have the SSS look will call the
blendershader block in the
shader_name tag:
<object name="OBCube" shadow="on" shader_name="MAamarillo" >
<attributes>
</attributes>
<mesh autosmooth="0.1" has_orco="off" >
<points>
<p x="12.030326" y="4.124888" z="3.882569" />
<p ...
A short description on Subsurface Scattering can be found on wikipedia.org:
http://en.wikipedia.org/wiki/Subsurface_scattering
Conetrace block
A much overlooked feature of Yafray is it's ability to create blurry reflections without the use of bumpmaps.
It is used to get reflections or transmitted color from environment.
It must be noted that this isn't an anisotropic shader, nor is it fully correct, it can however produce very good renders.
To get the effect a few steps must be taken:
1. Create your scene and apply a normal reflective material to your object just as you nomally would.
2. Export your scene to XML and open it for editing.
3. Copy/Paste the conetrace block into the XML
before the reflective objects shaderblock. (this is essential)
Note the name of the conetrace-block.
4. Now find your object material and enter the name of the conetrace-block as an 'environment value'
(just before "/attributes")
<environment value="env" />
5. Tweak (look below for explanation) the values of the conetrace-block, save and launch 'yafray scenefile.xml'
XML example of chromeball with conetrace:
<shader type="conetrace" name="env" reflect="on" angle="7" samples="5" IOR="1">
<attributes>
<color r="0.5" g="0.5" b="0.5" />
</attributes>
</shader>
<shader type="blendershader" name="MAball" >
<attributes>
<color r="0.800000" g="0.800000" b="0.800000" />
<specular_color r="1.000000" g="1.000000" b="1.000000" />
<mirror_color r="1.000000" g="1.000000" b="1.000000" />
<diffuse_reflect value="0.800000" />
<specular_amount value="1.568463" />
<alpha value="1.000000" />
<emit value="0.000000" />
<IOR value="1.000000" />
<reflect value="on" />
<reflect_amount value="1.000000" />
<fresnel_offset value="0.937500" />
<reflected r="1.000000" g="1.000000" b="1.000000" />
<min_refle value="0.937500" />
<matmodes value="traceable shadow" />
<diffuse_brdf value="lambert" />
<specular_brdf value="blender_cooktorr" />
<hard value="249" />
<environment value="env" />
</attributes>
</shader>
This will render an image similar to this:
Parameters for conetrace:
reflect: 'on' will reflect the ray, 'off' will refract the ray.
angle: determines the distortion/grainyness of the reflection 0 for clear reflections.
samples: samples on the reflection. 0 for none.
IOR: index of refraction. 1 for none.
color: filtering color for incoming light.
Toon Edge
First of all, you just have to make sure that you have also used a 'toon' diffuse shader, because currently the edge shading can not be used separately. It basically works best for a spherical objects, but sometimes it can look good enough on other objects, depending on the sort of effect you are looking for.
Second, you have to edit the XML file to add a 'toondiffuse_edge' parameter to the
blendershader. This extra parameter controls the edge shading thickness, 0 is no edge, 1 is all edge, or in other words a totally black object. This is not an exact edge thickness control, the method used will result on a non-uniform thickness, basically depending on incident angle. There is also currently no way to control the edge color, it is always black.
In XML, the
blendershader could look something like this, the 'toon' shader itself is set here to a very flat shading to make the edge shading more obvious:
...
<diffuse_brdf value="toon" />
<toondiffuse_size value="3.140000" />
<toondiffuse_smooth value="1.000000" />
<toondiffuse_edge value="0.5" />
...
The difficulty maybe is that shadows can be black as well, making the edge difficult to see. But even if you don't use shadows, triangles turned away from the light are still not shaded by yafray either, so are also black. In the example below the Blender toon settings were set to max (Size=3.14, smooth=1) to get a totally flat shading, and the lightsource is more or less somewhere directly behind the camera so there is very little shadowing and the least amount of unshaded triangles are visible. It is just done to make the edge shading more visible.
Rendering
Antialiasing
In XML laguage, the renderer block has an option 'clamp_rgb', which is to be used for normal output (doesn't matter if set for float ouput anyway, is bypassed) so that anti-aliasing around fast high contrast changes in the image will work better, it also tends to speed up AA as well, having to do less work. This is not advisable when using the DoF bokeh options, since it tends to weaken the lens shape details.
In the Blender GUI, this option is controlled by the 'Clamp RBG' button, in the Render panel, by default on.
Note: 'Auto AA' is no longer enabled automatically for certain GI quality settings, we thought it best to leave it to the user to decide.
DOF
Depth of field (DOF) is the distance in front of and behind the subject which appears to be i focus. Yafray can handle this via the Blender interface (or XML editing). When Yafray is selected as renderer, the Edit-buttons for the camera changes to this:
Pressing 'limits' and switching to the 'Yafray DoF' tab shows the clipping distance of the camera and it is this line that helps you set the focal point (notice the yellow cross on the line):
Next option is 'Aperture'. The size of the aperture determines how blurred the out-of-focus objects will be. A rule of thumb is to keep it between .100 and .500.
'Random sampling' does exactly what is says.
'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).
- When Triangle/Square/Pentagon/Hexagon is choosen, 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 the accentuation of the shape.
Three types available, uniform, center or edge, with uniform the default.
Notes on using DoF with Yafray: Enabling and using Dof in Yafray requires higher sampling rate to get a nice blurred effect. In the render-settings for Yafray, disable 'Auto AA' and increase the 'AA Samples' and 'AA Passes'. Here is a few examples to demonstrate the effects of DoF:
Much more generic information on 'DoF' and 'Bokeh' can be found on wikipedia.org
Camera modes
Yafray supports Blender
perpective and
ortho Blender cameras straight from the Blender buttons. Besides that, YafRay also supports two additional camera modes, which can be accesed only by XML editing, which are "spherical" and "lightprobe". These cameras are typically used to produce high dynamic range imaging (HDRI).
In XML language, there are 4 new types of camera, which are "perspective", "ortho", "spherical" and "lightprobe". Both in spherical and in lightprobe mode, view zoom is controlled by the distance between the camera and the objects to render. This is the aspect of a camera block, with the
type tag set to "spherical" mode:
<camera name="MAINCAM" type="spherical" resx="480" resy="480"
focal="1.000000" aspect_ratio="1.000000"
dof_distance="0.000000" aperture="0.000000" use_qmc="on"
bokeh_type="disk1" bokeh_bias="uniform" bokeh_rotation="0.000000" >
<from x="0.000000" y="-10.000000" z="0.000000" />
<to x="0.000000" y="-9.000000" z="0.000000" />
<up x="0.000000" y="-10.000000" z="1.000000" />
</camera>
The output of a "spherical" YafRay camera is a 360º view:
The output of a "lightprobe" YafRay camera have the typical round look of the lightprobes you can find on the Internet:
Render output
Yafray supports current Blender "border" button (Render panel). This feature allows to render a small-cut out the image, instead of rendering it all.
Yafray also supports
exr output. If you want it as simple as possible, then just wait for the next version of Blender, which will support
exr, so you can just use F3 to save to
exr, just like any other image format that blender supports. Saving an image is totally independent of YafRay. If you want to do it now, by editing the xml, that really is also not very hard at all.
<render camera_name="MAINCAM"
raydepth="5" gamma="1.000000" exposure="0.000000"
AA_passes="2" AA_minsamples="4"
AA_pixelwidth="1.5" AA_threshold="0.05" bias="0.001000" clamp_rgb="on"
background_name="world_background"
>
<outfile value="/home/eeshlo/YFexport/YBtest.tga" />
</render>
Now all you need to do to save to the image as an exr file is to add the 'output_type' parameter and set it to 'exr'. It is also helpful to change the extension type of the file as set in the outfile parameter, not really needed, it is still an exr file, but it might be confusing if the file still looks like a .tga file. So for the above example, change YBtest.tga to YBtest.exr. You can add the extra 'output_type' parameter in one of two ways, here is one:
<render camera_name="MAINCAM"
raydepth="5" gamma="1.000000" exposure="0.000000"
AA_passes="2" AA_minsamples="4"
AA_pixelwidth="1.5" AA_threshold="0.05" bias="0.001000" clamp_rgb="on"
background_name="world_background"
>
<output_type value="exr" />
<outfile value="/home/eeshlo/YFexport/YBtest.exr" />
</render>
And that really is all that there is to it. Now render the xml file with 'yafray YBtest.xml' or whatever the name of your file is, and you will find the exr in the directory as set by the 'outfile' parameter. Exposure & gamma correction are both bypassed when 'hdr' or 'exr' is the output type. That's it.
More info about EXR:
http://www.openexr.com/
to top