Tutorial : Realistic rendering of a car with YafRay

Not yet published. No comment.
Filed under materials rendering yafray

After my previous tutorial, Realistic Clay Render with YafRay and Blender, here is another article dedicated to rendering in YafRay a Blender model.

This tutorial focus on two rendering styles : outdoor and studio.

For each one, it explains how to build the scene. And then it explains the settings of YafRay and their impacts on your rendered picture.

Scene setup for studio style

This first section focuses on setting up a scene to achieve a studio render. For an outdoor render, proceed to the "Scene setup for outdoor style" section.

INSERT STUDIO PIC HERE

This is how must look a typical studio rendering : it mimics the real studio where real photographers takes pictures of real cars.

The key features of a studio are :
  • Neutral background, often black or dark grey.
  • Neutral ground, with plain colour.
  • One or more lighting surfaces, to have something to be reflected by the car paint.

These features are quite easy to simulate with YafRay !

For the background :

In the Shading panel (F5), under World buttons, select black as horizon colour (#000000) The zenith colour is useless as the background is uniform for our studio.

If you want, you can try an alternate setting : black as zenith colour, and dark grey for horizon (#666666)

For the ground :

Create a big plane under the car. As I always model my cars at Z>0, this ground plane should be located at Z=0. Anyways, put it just under the bottom of the tires, to give the illusion the tires are on the ground.

Go to the Shading panel again (F5), create a new Material for the ground. Let's make it a mat grey : so you can keep the default settings, and just put Spec to 0.

For the lighting surfaces :

Create a plane above the car : put 3D cursor at origin (ShiftC), go in TopView (NUMPAD7) and create a plane (SPACEBAR, Add >> Mesh >> Plane) Size it to have it about the size of the car.

In Edit mode (TAB), move the vertices upward, at something like Z=3meters.

Then you have to reverse normals, as the normal of the plane controls the way the plane will emit light. By default, normal will be toward the zenith. So you must inverse normal of the plane : select all vertices, then press "FlipNorms" in Editing Panel (F9). This way now the normal should be directed to the bottom of the scene. You can verify it by clicking "ShowNormals" in Editing Panel.

Now let's create some light : go to the Shading panel again (F5), create a new Material to light the scene from the plane. Set its colour to pure white (#FFFFFF) and add some emissivity to it : set Emit to 0.1.

Now it's time to proceed with YafRay configuration for the actual rendering : continue reading at the "Setting up YafRay" section.

Scene setup for outdoor style

To be written !

Setting up YafRay

It's time to configure YafRay before actually launching it.

In Scene Panel (F10), choose YafRay in the list right below the big "Render" button. This shows 2 additionnal panels behind "Render" : "YafRay" and "YafRay GI".

Go to the first panel, "YafRay". Deactivate the XML button, so you can follow the progress of the render. Otherwise, YafRay is called in batch mode, and the rendered picture is only shown when completely finished.

Go the second panel, "YafRay GI". Here you can choose quality settings for your render. For a studio render, you must choose "Full" as Method :

  • None deactivate global illumination : this is not what you want, otherwise you wouldn't being using YafRay !
  • SkyDome ignores any light emitter except the sky.
    • In studio setup : as our sky is black, it casts not light at all. And all the light we have comes from an emitter. So get away from this setting.
    • In outdoor setup : you can use it, but it will be lower quality than next one.
  • Full takes care of every emitter in the scene, including sky.
    • In studio setup : this is what we need to take account of our light plane above the sky.
    • In outdoor setup : better quality than with "SkyDome", but really time consuming !

Depending on your hardware, and on how you are impatient, you have to choose a value between "None" and "Best" for quality. I advise you to start at "Medium" : get lower if rendering time is too high, otherwise try higher settings until you think it takes too long.

It usually speeds up when you activate "Cache" button : actually, YafRay will perform two renders. The first one, being only for its own use, will show you how your scene is lighted. The second one will be the real one, i.e. what you expect.

You're ready to render. Press the big "Render" button in "Render" panel. When done, you get something like that, for outdoor settings :

 Marcos render 004 Marcos render 006

And for studio settings :

INSERT STUDIO RENDER PIC HERE - INSERT OUTDOOR RENDER PIC HERE

Tuning the result

You may now need to adjust render settings to improve the render. Below are some tracks to help you. But be warned that it will take you some time to get to a satisfying render.

  • If the renders is too dark, you can either increase the emissivity of the white plane (Emit in Shading Panel, F5), or its size (SKEY while in Edit Mode with all four vertices selected), or artificially increase the light in YafRay (GI Pwr in "YafRay GI" in Scene Panel (F10))
  • If the indirectly lighted areas in your model are black or too dark, you should try to increase maximum number of bounces YafRay is allowed to compute for indirect lighting. As it's a biased renderer, it works with a maximum value for such a setting. So set it higher, by increasing "Depth" in "YafRay GI" in Scene Panel (F10)
  • If you think areas behind glasses or transparent parts are black or too dark, you should try to increase maximum number of bounces YafRay is allowed t compute for caustics in glass / transparent materials. For the same reason as above, you should try to increase the "CDepth" in "YafRay GI" in Scene Panel (F10), where C stands for Caustics.
  • For the two preceding settings : if you think there is no effect in your render when you increase Depth or CDepth, you maybe have reached another "maximum setting" in YafRay : the total number of bounces YafRay is allowed to compute for each ray of light. So you should try to increase this value, "Raydepth" in "YafRay" in Scene Panel (F10).

Happy tuning with YafRay ! Again, it's time consuming but the results you'll get are worth the time you will spend on it.

Getting farther

Here're some tracks to give you some ideas to further enhance your result and its realism.

Render studio

The studio scene I've shown is really basic. Of course, you can use more than one single lighting plane.

The ground plane is also rather simple. Having it so simple produces very simple background : that is, very simple things to be reflected by the car paint. It really improves the scene to replace this simple plane by a more elaborated ground : for example, a curved floor, just like if the car were inside a huge cup. This way, you'll have smooth transition between lightened area and darkness, resulting in better-looking reflections on the car.

Outdoor studio

As of writing, the integration of the car in the scene is not that good. The most visible example is the shadows beneath the car.

The reason for that is the following : YafRay doesn't support use of a ground plane as a shadow receiver only, like Blender internal renderer does. With Blender, you can use a scene like the one I've shown above, and have the ground plane used only to darken the floor in HDRI background. YafRay can't. And I use YafRay for Global Illumination, that Blender internal renderer is unable to perform so far.

A way to fix it may be to use a green ground plane, and to perform darkening of HDRI floor at post processing (either using Photoshop/GIMP/etc or using nodes to achieve the effect automatically, in Blender)

Comments

No comment yet. Add a comment
 
 

links

Blender Open, free and excellent
Yafray Open, free and wonderful renderer
BlenderNation Powerful news site dedicated to Blender
ScratchMadeCars Forum with great works inside and lots of blueprints
Blender Guide Repository for hundreds of Blender ressources