Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Official Updated (Unity 2021 LTS ed.) - The Definitive Guide to Lighting in the HDRP - e-book, available now

Discussion in 'High Definition Render Pipeline' started by eduardooriz, May 20, 2022.

  1. eduardooriz

    eduardooriz

    Unity Technologies

    Joined:
    May 28, 2018
    Posts:
    55
    Hi,

    The definitive guide to lighting in the High Definition Render Pipeline is now updated with the latest graphics capabilities in Unity 2021 LTS. This e-book was first published late last year as we announced previously in the forum to demonstrate the power of physically based lighting in HDRP for creating high-end lighting effects across PC and console games.

    What’s been added?
    New content has been added for Light Anchors, Clouds, Lens Flares, Dynamic Resolution, and ray tracing updates among many other small tweaks throughout the book.

    >> DOWNLOAD IT HERE <<

    hdrp-21-lts-promo-image-pages.png

    Here’s a quick overview of the topics the e-book covers:
    • HDRP concepts, settings, cameras, and Volumes frameworks
    • Exposure, modes, physical camera settings, and formulas
    • Light units, types, properties, and IES Profiles
    • Creating natural-looking skyscapes with the Physically Based Sky system
    • Refining and modifying shadows, reflections, and real-time lighting effects to add depth to your scenes
    • Best practices for using the Rendering Debugger
    • Ray tracing and post-processing
    Who is the guide for?
    The guide is intended to be a foundational, advanced-level resource for technical artists, lighting artists, and developers working in Unity.

    If you have any feedback or encounter problems accessing the file let us know in this thread :)
     
    Mauri, MPV_James, wilmer_lin and 3 others like this.
  2. maximefourcadet

    maximefourcadet

    Joined:
    Apr 8, 2021
    Posts:
    4
    Hi,

    This guide helped me a lot to understand how to use lighting with HDRP.

    I am currently working on a HDRP project with the objective of simulating real lights using IES files and being able to gather data on intensity, reflection and so on. But unfortunately there seems to be a slight difference between what I get through HDRP and what I got on my own data, the shape is overall the same but the distribution of intensity is a little off:

    upload_2022-5-31_12-12-34.png
    Distribution of intensity on the ground just below the light source (left: Unity, right: Official data)
    I am no expert of Unity lighting and even less of HDRP lighting and I can't seem to understand why the distribution is slightly off like that...

    Do you have any idea of what may be the cause of this ?

    Thanks in advance for your consideration !
     
    Last edited: Jun 1, 2022
    thomas_jacobsen_unity likes this.
  3. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    504
    Can you describe how you've measured the intensity distribution in Unity compared to the official data ?
    The shape indeed looks similar, maybe the issue is that there is some wrong "shift" in intensity happening ? Maybe a linear to gamma correction when reading out from Unity ?
     
  4. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    3,113
    Excellent, thank you very much. A few things for maybe an update that I miss:

    * diffusion profiles
    * how to create godrays ... getting them to even show up requires to fiddle around with very tiny settings ranges of various components (fog etc)

    Would be nice if Unity would provide some defaults that one can try via drag & drop or some wizard to get different atmospheres.
     
    newguy123, EagleG and valarus like this.
  5. eduardooriz

    eduardooriz

    Unity Technologies

    Joined:
    May 28, 2018
    Posts:
    55
    Thanks for sharing those ideas, we took note for the 22 LTS update of the book for both topics.
    In the meantime you can check this forum post on how to create god rays.

    For diffusion profiles, it’s usually eye balled. There is some physics involved behind the Radius value (in world space), but ultimately, it’s an artistic process because we use a very rough approximation (like everybody else). In any case, for 22 LTS there might be new features around this to cover in detail in the next book update.
     
    newguy123 likes this.
  6. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    3,113
    Last edited: Jun 10, 2022
    EagleG likes this.
  7. maximefourcadet

    maximefourcadet

    Joined:
    Apr 8, 2021
    Posts:
    4
    I used a script to get RGB level and convert it to grey level:
    upload_2022-6-14_13-47-57.png

    I used GetPixels32 to get the RGB values and then write the level of grey on "colorfile.txt".
     
  8. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    504
    Thanks!
    I think there is indeed a gamma/linear conversion issue.

    You're creating
    tmpTexture
    as a linear texture, but
    temp2DTexture
    with the default width/height constructor, that by default creates a sRGB texture.
    I suspect that this is the cause of the difference.

    Small detail, but I doubt that the conversion to greyscale is needed, as ies are already greyscale with r=g=b, you could just output the value of the red channel.
     
  9. maximefourcadet

    maximefourcadet

    Joined:
    Apr 8, 2021
    Posts:
    4
    Thanks a lot for your answer !

    I just tried to change some lines in this script but have fallen quite short of any real change...

    I would be delighted if you had any advice on how to measure and save light intensity values with the gamma/linear conversion issue in mind ?
     
    Last edited: Jun 20, 2022
  10. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    504
    What about changing this :
    Texture2D temp2DTexture = new Texture2D(m, n);

    to :
    Texture2D temp2DTexture = new Texture2D(m, n, true, true);


    This should create the texture in linear color space, and should be better ?
     
  11. soleron

    soleron

    Joined:
    Apr 21, 2013
    Posts:
    488
    Maybe I missed it, but perhaps in the next one, it would be nice to mark new/changed features as such for those who are already familiar with HDRP and want to drill exactly at the changes.
     
  12. eduardooriz

    eduardooriz

    Unity Technologies

    Joined:
    May 28, 2018
    Posts:
    55
    good idea, noted for the 22 LTS update ✍️
     
    newguy123 and soleron like this.