Mixing HDRI image and mr Physical Sky in iRay

Mixing HDRI image and mr Physical Sky in iRay Mixing HDRI image and mr Physical Sky in iRay kcpr raffaEl
17 Jun

Sometimes lighting the scene from HDRI image only is not enough. We get blueish shade and shadows are not that crispy we would like to have.

click to enlarge

In other rendering engines we can add mr Physical Sky to environment, to get more sharp light:

click to enlarge

As you know using HDRI image together with mr Physical Sky in iRay wasn't possible.

Well, until now...

In this tutorial I'll show smart workaround to make it possible.

The solution is based on my first article: Unrealistic Sun and Sky with iRay and mr Physical Sky, so if you want to understand this method - just read it ;)

In mental ray this was rather simple - just setting custom bitmap as background in mr Physical Sky settings.

But it doesn't work in iRay.

So the idea is to make environment map as MIX of HDRI and mr Physical Sky.

1. First, we have to proper set-up the environment

Here is material setting how to do it:

click to enlarge

So, in first slot we've got HDRI image, in the second is mr Physical Sky, and mix mask is Output with copy of mr Physical Sky.
click to enlarge
click to enlarge

As you can see on images, mix mask is mr Physical Sky, but with very low Output and removed saturation.

IMPORTANT NOTE: Multiplier and Output settings highly depends on the value of the exposure, and the position of sun (time of day), so you have to work it out "experimental" in order to fit your lighting setup.

2. Second step is to match the mr Sun position with the HDRI.

So, after creating Compass with Daylight System we have to manually setup location of Sun.

First, make sure that all offsets of HDRI is set to 0, then setup viewport background to show environment, with HDRI image as background.

By using orbit tool set the view to show HDRI sun in the center of view:

click to enlarge

Enabling option "Exposure affects background" and changing the exposure will help you to see exact positin of sun.

Remember to revert exposure to your original settings after aligning to achieve correct results during rendering.

Select Daylight, and set Sun Position to Manual. Then move the sun to match its position with sun from HDRI.

Remember that sun position on your screen may be different than in final environment, because sun in environment is "infinitelly" far away.

To make sure everything fits correctly you can change environment background to mr Physical Sky:

click to enlarge

Now - the tricky part: We want to link the HDRI with Daylight/Compass rotation.

This method is explained by Peter Guthrie on his blog.

So, with Compass selected go to Animation -> Wire Paramaters -> Paramater Wire Dialog... in main menu.
In the left side window select Z Rotation of Compass from properties tree. On the right side look for Environment -> Environment Texture Map -> Colour 1 -> Coordinates -> U Offset - as on image below:

click to enlarge

Then enter this equation in right window below: radToDeg(Z_Rotation/360)

Select the direction arrow (as on image) and press Connect.

If everything went OK, rotating Compass along Z axis will rotate HDRI background image too, maintaing mr Sky and HDRI sky match.


Now you can play with sun power, shadow sharpness and sun colour.

For example from this:

You can get warmer sun colour:

click to enlarge

So, Have Fun!!

Last modified on Tuesday, 26 January 2016 20:54


  • kcpr raffaEl Hi Jonny,
    Now everything should be OK with images.
    Tuesday, 26 January 2016 20:57 posted by kcpr raffaEl Report Comment Link
  • Jonny you seem to be missing images regarding stage 1. I dont understand "mix mask is Output with copy of mr Physical Sky" Friday, 22 January 2016 20:47 posted by Jonny Report Comment Link
  • kcpr raffaEl Hi Victor,

    This may be related with low settings of Environment Resolution in iRay.

    You can change it using iRay Manager, for example from here:


    I'll attach scene at some free time, but I can't attach HDRI image bacause it's copyrighted. HDRI is by Peter Guthrie and you can buy it on his Website/SHOP.

    All best,
    Monday, 01 June 2015 15:44 posted by kcpr raffaEl Report Comment Link
  • Victor Im having problems with the HDR resolution. It looks awful. Does its possible to attach the file so I can find whats is wrong with my settings. Thanks!!! Sunday, 31 May 2015 18:49 posted by Victor Report Comment Link
  • Chicago Photographer I figured it out! It has been a huge help, now I can have strong shadows and nice reflections. Thank you! Friday, 15 May 2015 18:15 posted by Chicago Photographer Report Comment Link
  • raffaEl You can do the same using Compact Material Editor.

    If you don't see all names/types of maps make sure that in material map explorer you have "Show Incompatimble Maps" enabled.

    Hope that helps!
    Saturday, 31 January 2015 18:48 posted by raffaEl Report Comment Link
  • joshpabstphoto I can't make any sense of this; I hate the slate material editor - and can't see the whole 'number/name' of maps, so for me, impossible to follow along. Tuesday, 27 January 2015 23:25 posted by joshpabstphoto Report Comment Link
  • kw71 Bravo, bravo, bravo, bravo, bravo!!!!

    More Bravo, bravo, bravo, bravo!!!

    Is sad when you switch from one render engine to another, just to discover that you win many things but lose as much... And you have solved this point.

    Thanks you very much!!!
    Friday, 26 September 2014 04:02 posted by kw71 Report Comment Link

Leave a comment

FaLang translation system by Faboba

Latest in Portfolio