The unofficial Yafray guide part-2

The unofficial Yafray guide

Page-2 of 3

PART-2 Yafray lights

Instead of instructing you to modify the settings here and there, I thought it might be better to explain the Yafray light types one by one. This will enable you to make informed decisions.

Let there be light. and there was Yafray everywhere

There are five light types used in Blender and of them only four are directly supported in Yafray. On enabling Yafray raytracer from the Render tab, you initially see six lamps types (in the lamp options window F5), of which Yafray makes use of Blender’s lamp, area, spot and the sun. I will come later to the other two lamps listed, Hemi and photons later.

Image7. The scene.

 The scene description: The current scene has two light sources. One is a helper light (the sun, without shadow and at value .200), which is used to provide nondirectional light to increase the ambiance for the scene. The other is the ‘lamp source’ (or light source) which is a placeholder for every light type explained. The lamps positions are static throughout, and ‘Ray Shadow’ (shadow casting) is enabled for all the lamp source that are being used (see image 8).

Image8. The scene as seen in viewport

NOTE: The suggested uses for the light types defined here are general in the usability approach. They are not to be taken as the absolute word for lightening your scene. The lightening varies depending on the scene and artists own vision for the scene. For best results experiment with the lights in your scene to find which works best for you. 

IMPORTANT: The mention of render times in the images is rounded off, it is relative and is used just to give the idea of typical render times for same scene by different lights and settings.

1. Yafray Lamp

This is the simplest light source available, in some ways it is like sun, as it is omni-directional (i.e. shoots light in all directions from the point of its origin) and is spherical in nature. Since it shoots light ray’s in every direction, that means the ray going away from the scene will not make any visible changes in the scene, the light rays will be lost and thus are waste of computation, Although Ray tracers use variety of hack by cutting off the unwanted computations, it is a bit slower than other directional light sources if more part of the light shot come inside the scene view.

The general use of Lamp is for indoor lighting, like rooms and halls, but it is not limited to this use, it is also more commonly used as ‘filler light’ or ‘helper light’ in the scene. Values: When a single lamp is used for the scene in Yafray ( throughout the article when I say Yafray I mean Blender-Yafray), it will generally not provide sufficient lighting to lit up the scene unless it is kept at a higher value. For the sample scene, the value of Lamp was set at 10(maximum) but still there seems to be the need for additional lighting (but we are sticking to it for the sake of understanding). See image 9.

Image9. Rendered with Lamp at default settings. 

The Lamp will cast sharper shadows at default (zero) radius. The radius setting in Lamp is used to increase the area size for shooting the light. If the size of Lamp is bigger than the objects, then the light shot from some parts of the lamp could directly reach to the parts of the scene where the other part of the lamp casts a shadow. This intersection results in the shadow being diluted for that part, thus getting blurred (also called ‘partial shadows). You can observe this phenomenon in the real world (sunlight). LINK for more info on ‘shadow dilution’ or Partial shadows go to Dittohead’s Light tutorial.

Image10. The noise comes when sampling values is low.

The scene above (Image10) was rendered at radius 2 with sampling value at 1, as can be seen, the scene have grainy partial shadows. The use of samples button is only to reduce those grains in shadows, the sampling buttons controls the number of samples used in shadow calculations, increasing the sampling results in smoother shadows. The sampling button is only available in lamp and area light and functions the same for both.

Image11. The increase in sampling to 5 removed the noise.

2. Yafray Area Lamp 

The Area Light is a directional source. The shape of Area Light can be varied from square to rectangular from the drop-down list in the ‘Lamp’ tab. Below the shape selection there is also an option to increase the size of the Area Light

Image12. The basic render from area light at default setting and value of 4.
Image12. The basic render from area light at default setting and value of 4.

Values: For Area Lamp you will need lesser light intensity value for rendering a scene with Yafray. The sample scene is lit by light value at 4, is brighter than the one rendered by the lamp at value 10. This is due to the fact that it is shooting all the light towards a direction from a plane while the lamp shoots the light in every direction distributing energy where it may not be required.

Image13. Although the scene looks similar to image11 but is brighter and have better shadows.
Image13. Although the scene looks similar to image11 but is brighter and have better shadows.

NOTE: One important point to remember is that in the official Build of Blender2.34 using two or more area lights results in error in the renderings, it is a recognized bug and have been patched in some development builds.

3. Yafray Spot Lamp

The spot is also directional light source and as the name suggests it provides a circular spot of light or more appropriately a cone of light. The size of a cone can be controlled by the SpotSi or angle of the spotlight beam. The higher the angle the more nearer it behaves like area light, but with one major difference, It cannot cast partial shadows. Spotlight have a parameter to control the SpotBi or Spot’s edge smoothness only. It can be seen only if the spotlight is inside the scene view, otherwise you will not notice any difference in spot or other lights.

Image14. The Spot lamp renders with default settings.
Image15. Spot lamp with spherical light attenuation. 

Notice the increased brightness at the portion nearer to the lamp in the Image 15 while using the Spherical light attenuation (quad is not supported in Yafray). Increase in the ‘distance value’ the spherical attenuation also increases in radius, for eg the Image15 have default distance value of 20 while Image16 have the distance value at 30. The effect looks like that of typical household lamps where the attenuation is shaper.

NOTE: The light attenuation in Yafray has only quadratic falloff, while blender can have linear, cubic and the mix of these also. That explains relatively sharper light intensity falloff in Yafray renderes.

Image16. Spot lamp with Spherical attenuation enabled.
Image16. Spot lamp with Spherical attenuation enabled.

4. Yafray Sun Lamp 

This is also a directional light source. It tries to emulate sunlight by shooting light of same intensity everywhere in the scene without attenuation (Image17). This results in the environment being lit up with constant ambiance. Its value must be kept lower. The sample scene uses a light intensity value of .100. It is obviously good for outdoor lights,, especially for the sun.
In outdoor scenes, if you do not want sharper shadows you can disable shadow casting for the sun, and use other lamps for shadow generation. But make sure they have sufficient light intensity to cast a shadow.

Image17. The sunlight at value 2. No wonder why this lamp is called the sun.
Image17. The sunlight at value 2. No wonder why this lamp is called the sun.

5. More lamps?

Hemi– Yafray does not support Blenders implementation of Hemi light internally; right now it just uses Yafray’s implementation of sunlight instead, so you can use sunlight instead.

Photon – Last of all, the Photon light source or ‘photons lamp button is not to be confused with any light source. It does not cast any shadow or light, it is only used in Caustics* calculations and requires being placed or directed where you need the caustic calculation. Photon lamp shoots photons in an area, the photons are used by Yafray as the specialized ray elements only to calculate the caustics on passing through the objects like glass or mirrors, which have the property of bending light when passed through them, known as ‘total internal reflection’. Basically, the placement of photon lamp is to allow the user to optimize the rendering. Caustics is one of the most computation-intensive jobs in Ray tracing.

Note: This photon lamp and photons are not to be confused with the photon option in the GI method. Which is explained in Part 3.

Page 2 of 3             2004 © Copyright Gaurav Nawani


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Powered by

Up ↑

%d bloggers like this: