Thursday 17 February 2011

Volumetric Scattering: in luxrender 0.8RC1, Part 1

Created in Lux Render, 0.8RC1 see:Lux Render Wiki the scene was created in blender 2.5 from: Luxrender forum



There are two main uses of Volumetric Scattering:
    • Atmospheric Scattering, (god rays) where light is scatted in the atmosphere or other mediums (eg water).
    • Sub Surface Scattering (SSS) where light is dispersed within the material, (eg skin, plants, organics, some plastics ect)

    Atmospheric Scattering:
    The homogeneous Volumetric Material is used to create this effect:
    (see right default settings as used in the scene above)
    Materials:
    when setting up light rays one can make the entire environment use this volumetric material, however this can lead to much increased render time with very little visual improvement. so it is best to only assign the dusty_air volume where it is used. here in this example. the windows are a null material with the dusty_air set as internal volume, (note the normals are facing out).

    All other materials in this scene have the external material set as air. So only light that has just passed through the null window material will scatter, light that has subsequently bounced will not scatter. (note that if you have a highly reflective/refractive object in the path of a ray, eg a mirror, glass ball etc. i is best to set that objects external material to dust as well since there will be a focus of light coming of it creating volumetric caustics.

    (see bellow right default settings for a Clear volume.)




    In this scene there is a lamp in the background is a simple point source lamp, one could of course use a mesh emitter, this lamp has the dusty_air set as its exterior medium. The lamp shade is the rough Glass Martial and for speed improvements has the Clear air material set.

    There is a sun+sky lamp, this lamp creates the (god ray) effect. however to further improve performance its external medium is air, so that only light that passes though the window will scatter and no light beforehand.






    Setting Up the Scene:
    firstly note that all the external walls+windows are all one joined complete mesh. The makes keeping track of the normals easyer, (luxrender uses the normals to differentiate the internal/external mediums), in this model the normals are all facing out, (eg we are looking at int inside of the mesh. thus the martial on the windows as discussed above has the dusty air set as its internal martial since the windows has no thickness.

    To improves render time, one can place a portal outside of the windows so that the renderer knows to focus its ray-calculations to that portal. thus dramatically improving the chance of finding a ray/light. A portal is just a plane with the normal facing int the desired exit direction of the light, you must check the portal property in the mesh properties panel. (see right mesh settings settings for a portal plain.)

    Rendering Settings:

    When using volumetric scattering the Bi-Directional integrator seems to work best. (see right render settings settings.)

    12 comments:

    1. Thanks for this page, Matthaus. A useful kick-start as I have started playing with Lux again.

      One thing escapes me though. In the first section you say, "the windows are a null material with the dusty_air set as internal volume". That seems to have no effect when I do it.

      The only way I can get the god rays is by adding a cube of null material with internal set as dusty air. This cube has to cover the whole volume where my rays are, otherwise they emerge out into clean air again. Could you explain what you meant in a bit more detail, or post a .blend?

      Thanks again for the blog post. Very handy.

      ReplyDelete
    2. what you need to do is make the 'window glass' be just a plan, so that the normal is facing outwards and thus all light passing into the room is using the internal medium, (if the 'glass' has thickness then it will only have a volumetric effect on the inside of the 'glass' see:http://www.pasteall.org/pic/10349 (a quick dirgram as to how this works)

      ReplyDelete
    3. Crystal clear now, thank you. Works perfectly!

      ReplyDelete
    4. blender es un software muy eficaz cuando se le sabe todo su contenido por eso mi objetivo es que las generaciones presentes y futuras tengan este conocimiento en sus manos .gracias.

      ReplyDelete
    5. I don't understand!!, I followed the tutorial and I just can't get any volumetric lighting, please put a blend. file to this page.??

      ReplyDelete
    6. Thank you from France ! Very useful for me...
      Pepel81

      ReplyDelete
    7. Thanx for this great hint.(Germany)

      ReplyDelete
    8. I couldn't do that. Can you explain more? I put a plane for window with out facing normals. But it didn't work. Can you post the .blend file pls?

      ReplyDelete
    9. soory guys i have lost that file, (was on my external hardrive wich took a tumble off the desk) know its holidays i will redo this one and finaily do the part 2 one on SSS.

      ReplyDelete
    10. can any one tell me ,in render settings how can i give the path

      ReplyDelete
    11. (note that if you have a highly reflective/refractive object in the path of a ray, eg a mirror, glass ball etc. i is best to set that objects external ... 2glassblender.blogspot.com

      ReplyDelete