HDRI Lighting in Unreal Engine

HDRI Lighting in Unreal Engine

I will be taking 3ds Max and Vray lighting workflow as a reference to recreate the same in Unreal Engine 4. Main focus will be on Unreal Engine, just giving reference to 3ds max and Vray settings. (It’s not a 3ds Max and Vray Tutorial)

General Lighting methods prevailing in Arch-Vis industry using 3ds Max and Vray –

  1. Exteriors (Combinations)
  • VraySun + VraySky
  • VrayDomelight with HDRI + Directional Light (For simulating sun, if required)
  • Artificial Lights as per requirement (mainly in Dusk shots)
  1. Interiors (Combinations)
  • VraySun + VraySky + Vray Skyportals
  • VrayDomelight with HDRI
  • Artificail lights as per requirement (used as fill lights or sometime required to create a desired mood)

 

* Artificial lights – Any Vray light (Area, point, IES etc) used as fill light or to create any specific mood.

I will be recreating this workflow concerned with HDRI and Directional light as SUN light for Interiors and Exteriors. It is imperative that we first know how to use HDRI correctly to simulate proper lighting with correct exposure.

In above scenarios (Exterior and Interior) VrayPhysical Camera plays a vital role in simulating DSLR exposure with physically accurate lighting values (Real life light intensity values in Luminance or Radiance).

It is important to know why we use Physical Camera features in any Rendering Engine. In real life, human eye plays a critical role in compensating for difference in light intensities we encounter on daily basis by controlling amount of light entering, through increasing or decreasing iris size.

Eye FuctionImage Source – http://www.abpischools.org.uk/page/modules/nervoussystem/nervous7.cfm?coSiteNavigation_allTopic=1

When it comes to simulating human eye behavior technically, DSLR Cameras come really close to do so with ample amount of control and as we are already using these cameras to take photographs of our surroundings, it is easy if we recreate those settings virtually in our rendering engines also. It’s a well-known fact that to render virtual images/environments, basic knowledge of photography and light behavior plays a critical role.

Reading these articles will certainly help a lot (highly recommended)

http://www.cambridgeincolour.com/tutorials/cameras-vs-human-eye.htm

http://petapixel.com/2012/11/17/the-camera-versus-the-human-eye/

When we take photographs with DSLR camera on “Manual mode”, we start to get an idea about the settings concerned to capture “what we are seeing in real time” and “what we are getting as photograph” ( not too bright or too dark). I will not be divulging much into DSLR and Manual settings more, but that does not mean I will leave it here as it is – for all the techno freak guys, reading this material will certainly help (I highly recommend going through this) –

http://digital-photography-school.com/megapost-learning-how-to-use-your-first-dslr/

Question – Why the hell I am reading about human eye and DSLR camera in a blog concerned with light setup in Unreal Engine?

Answer – It’s always important to understand basics that are concerned with lighting workflow irrespective of application and also Unreal Engine got this awesome “Eye Adaptation” already incorporated in the form of “Auto Exposure”. But to understand that properly, it’s important to get some basic idea first.

In Unreal Engine when we create a scene, which covers both exteriors and interiors simultaneously, controlling light balance becomes somewhat difficult due to variation in light intensities concerning exterior and interior environment. Also as character moves like a real human being in interactive environment, it’s wise to simulate human eye adaption in Engine itself to create realistic feel and workflow. All the information regarding the Auto exposure is given in the following link –

https://docs.unrealengine.com/latest/INT/Engine/Rendering/PostProcessEffects/AutomaticExposure/index.html

“Auto Exposure” settings are in the Post Process Volume.

“I will try to persuade EPIC to include Physical Camera settings in Engine. It will make the Engine’s Lighting workflow as per with other render engines, which in turn will be super easy to migrate and understand.”

Post Process Settings

Now as we have some basic understating about the exposure settings in the Engine, we will proceed with creating a simple scene only lit by HDRI. I am assuming that my readers have some basic knowledge of Unreal Engine, so will skip some fundamental steps.

Open Unreal Engine and create a new project by selecting “First Person Template”

Creatingunrealproject

In this project we will create a new “empty level” for our HDRI workflow (save it before starting work).

Creatingemptylevel

Now import your geometry/meshes into content folder of Unreal Engine (For more details about elaborate steps involved – see this tutorial)

Importingmeshes

Disable Auto Exposure from project settings

Disablingautoexposure

After that we will create “Lightmass Importance Volume” covering all of our meshes in the level which are going to render.

LightmasscreationNext step will be of creating Box Reflection Capture wrapping entire meshes. This is very important for simulating correct reflections on objects inside and outside the building, you can also use large sphere reflection capture in exteriors (results want change that much).

BoxReflectioncreationNow it’s time setup HDRI as our environment background and create “Skylight” that will use the same HDRI for lighting but before that we have to import our HDRI into Engine. There are several methods to do so but we will go for the easiest one i.e. Drag and Drop.

I am using HDRI’s from – http://noemotionhdrs.net/ It’s one of the best free resource for HDRI.

HDRI Drag and Drop

44 Comments

  1. Excellent tutorial, really useful… thank you so much for doing this 🙂


  2. That is really helpful and well explained. Thank you!

  3. hello,
    very ineresting
    how can you control intensity of lightning and shadows of the scene in casewhen hdri is not giving enough light to show mesh/model?
    and how you control scale? to have mesh relating proportions to hdri space ?

    1. Author

      Adding a Post Process volume will do the job. I have added this info above.

  4. Hello,
    I followed your tutorial is great but I wondering it miss some element no ?
    When I import a HDR into Unreal, the compression setting is set to HDR RGB no sRGB and so sRGB is unchecked, and into the material I got error and so I need to put the compression setting to default and check sRGB.
    Then I need to put the HDR at 0.05 in brightness if not it’s only white.
    And I really don’t know how do you get the hdr at this beautiful resolution, I can only get the hdr blurred in 512×512.

    Do I miss something.

    Thanks !!!
    Fabien

    1. Author

      Hi Fabian,

      I have added the information required to get the best resolution out of HDRI, check it above.

      Colour information contained in some HDRI’s tends to blown away the lighting information, as we use HDRI inverse gamma and overall multiplier in VRayHDRI map, you can safely decrease the HDRI brightness as required to get the desired results.

      1. Hello, I am not able to find information to increase the HDRI’s resolution from 512×512 to its original size. Can you please help?

  5. hi,

    nice tutorial, but i also guess there is something missing…i tried to recreate this scene with my own models and it doesn’t look like your endresult….do you have a directional light added? because i don’t see shadows in my scene, but yours is well shadowed…

    how can i adjust the exposure of my hdri? is it possible to change it not in the post processing volume?

    1. Yes he has a directional light included in the scene. But it doesn’t affect the world, so I don’t know why it’s included in the project file

  6. thx you very much for the tutorial file…

  7. than you very much,

    This tutorial are super easy to understand with details explanation.

    Can’t wait for the next tutorial.

  8. HI raghu excelent tut, i want to ask one thing what if i rotate the sky hdri through material constant node will it effect sky light automatically? how do i link hdri sphere to sky light?

  9. hi.
    thx for this tutorial.
    i jot an error when i “sky sphere material”
    – i have import your same HDRI in unreal (drag and drop)
    – in sky sphere material i drag and drop the texture
    – in sky sphere material if i attact “texture sample” box in “emissive color” i get ERROR
    – the errore detail is [SM5]
    – i tried with another HDRI and i get same error

    why?

    1. EXACT same issue here!

      any help pr hint would be appreciated!

      1. The error I got is:

        Error [SM5] (Node TextureSample) Coercion failed: MaterialFloat3 Local4 = (Local1 / Local3);
        : float3 -> float2

        I could get you a screenshot, but appears not to be possible in the comment area

        greets

          1. Hey Raghu,

            I really appreciate your help, I´ve downloaded some “real” HDRs and got it right so far, the problem is now UE4 says when rendering this:

            Error EditorSkySphere Object has overlapping UVs.
            Info EditorSkySphere Lightmap UV are overlapping by 50.0%. Please adjust content – Enable Error Coloring to visualize.

            I used the same EditorSkySphere as you in the EngineContent from UE4…so what to do?

            greets

          2. Hello Raghu,

            Would you be able to re-host your solution? I’m encountering the same problem and hole your solution can address it!

            Thanks!

    2. I have just done this and got the map to display correctly. You need to feed your Normalize node into a LongLatToUV node, then into your HDR texture sample. That goes into the Emissive and the result is as it should be.

      1. That takes us up to the next level. Great potgins.


  10. @peter – I suggest taking a look at the SM_Sky_Sphere; That one does not spit out that overlapping uv error.

  11. HI RAG, GREAT WORK THERE….

    I did as same as your tutorials but when I build lighting I get and error for the SKYSPHERE saying that has overlapped UVs and further saying 50% of bla bla bal…. 🙂

    Please advice me for this…

    Thanks Rag…
    All the best..

  12. I noticed the HDR in the Skylight is very limited range. There are no directional shadows at all. The result is basicallt just tinted occlusion.
    Is there a known way to use ONLY an HDR to light a scene with directional shadows fromt he hotspots int he image – similar to how it is done in the VFX industry

  13. How did you get those shadows?
    Neither SkyLight or Directional Light seems to gerenate the shadows.

    I tried everything in my own tests…


  14. I just cant wait for your next tutorial!! It help so much!! thanks

  15. Thank you so much for your explanation! this is a major help!!

  16. I get and error for the SKYSPHERE saying that has overlapped UVs

  17. Can you align a direct light with the HDRI sun and link to it? (for rotation)

    Thanks!

    1. Author

      Yes you can, I already answered this question in the comments. (reply to SAM)

  18. I followed this to the letter, but am getting 50% overlapping UV errors on the skybox and the scene overall seems very dark. I am also getting issues with overlapping UV’s when importing archmodels assets (10% overlapping UV’s) even after using steamroller and looking at the second UV channel in UE4 as sucessfully flattened. I officially give up!

  19. Hi;
    Thank you for sharing your experience…
    But I have shadows issue, as mentioned in some posts above;
    I opened your project (HDRI_Setup level), added a simple asset, rebuild lighting (Production)… but NO SHADOWS..!! Although there were a directional light in the level
    May be you should post a statement about this issue …
    Best Regards

  20. Thanks for making this tutorial! It’s the only one I could find

  21. A quick tip for someone sticks on the sky sphere uv overlap problem.
    find “M_Procedural_Sky_MASTER_UE4″ material in Content Browser -> Engine Content, use this material for the skysphere, simply replace the texture”cube map” in the material by our own hdri map. the uv problem should be solved.

  22. Maybe im late since the dropbox file is not there anymore someone still have that? Please post it thank you i cannot proceed without those.

Leave a Reply

Your email address will not be published. Required fields are marked *