HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: Here's How the New HDR Lighting Works  (Read 4826 times)

HE-Cooper

  • *****
  • Posts: 2221
    • View Profile
Here's How the New HDR Lighting Works
« on: Dec 18, 12, 05:31:02 PM »

I had been hoping to ship a video tutorial alongside HE2 for working with the new lighting, but alas, I just haven't found the time. So here's a quick and dirty breakdown to tide you over.

All lighting can be modified via the Environment Panel, and the settings are stored in each Environment Scheme

Overview of HDR in the HeroEngine:

Key takeaway for HDR and lighting: these settings simulate the eye's reaction to lighting. In other words, the level of ambient lighting in a game world is often artificially high in order to provide some baseline of uniform visibility. When HDR is enabled, ambient lighting is really polluting the luminance and tone of the scene, and should be reduced as far as possible or acceptable. As you look towards bright lights (intensity > 1), tone mapping simulates your eye adapting the rest of the scene to appear darker with less detail. Conversely, as you look into dark areas with low ambient light, your eye will adapt to see more detail in the darkness.

HDR: rendering to a framebuffer that allows a higher dynamic range of color and lighting, outside the typical [0, 1] range of a low dynamic range (LDR) renderer.

Tone Mapping: To quote wikipedia, "Tone mapping addresses the problem of strong contrast reduction from the scene radiance to the displayable range while preserving the image details and color appearance important to appreciate the original scene content." It also simulates our eyes adaptation to brightness and darkness. http://en.wikipedia.org/wiki/Tone_mapping

Blue Shift: a tone mapping modifier that shifts the color to simulate the affect of darkness on our eyes rods and cones. Best used at night, or in dark environments like a cave or dungeon.

Glare Type: the type of glare "smear" that is applied to lighting (usually seen as a star pattern)

Key Value: also known as the middle grey value, this is the bottom cutoff for luminance

Adaptation Multiplier: increases or decreases the rate at which the tone mapping and luminance calculation occur

Bloom Scale: effectively, a multiplier of the brightness of the glare

Star Scale: effectively, a multiplier of the size of the glare

_____________________________________________________

What Does that All Mean?

Well, basically, you just need to understand what you're looking at. 95% of games will launch with HDR and tone mapping enabled. So let's go through the various settings with those settings.

Glare Type is entirely an aesthetic choice. Fantasy glowy games tend to have a cross pattern varying from full to spectral, while sci-fi and cinematic games are all about the Michael Bay / Mass Effect bright blue horizontal glare.

Key Value: This basically just says how much of the spectrum should be luminous. So at a value of one, pretty much everything other than black is going to bloom/glow/streak, etc. How much of a value you set this to is entirely dependent on other values, like light intensity, and ambient color tone, and bloom and star scale.

Adaption Multiplier: The higher this value, the faster the tone mapping will kick in. Meaning you are looking at a black wall, then you spin your camera to stare at a bright light. HDR will fill the screen with luminescence, and then tone mapping will kick in to balance the scene. This is how our own eyes work as we adjust to new light. If you set the adaption value to a low number, then the transition will be visible as the "glow" is reduced and adjusted.

Bloom Scale: Just modifies how much glowyness you want.

Star Scale: Just modifies how severe the glare effect is.


____________________________________________________

Now for the Other Values you Care About

I'm just going to deal with Ambient Diffuse Lighting, and avoid 3 point lighting for now, which is more complicated, and more likely to provide output you won't like or won't understand until you're well versed with the tech.

Ambient Color: you'll need to adjust how dark or light the ambient color is (meaning, how close to black, or close to white it is) as part of tuning the brightness of a scene, especially with regards to shadows, because if your ambient color is too bright, then tone mapping will adjust the scene in ways that won't feel realistic to the shadow color. But you might also want that if you're world is on Mars, etc.

Diffuse Color: this is just the overall color tinting of the scene. Most warm natural environments will have this set to pinkish, or orangish, but changing this to unexpected colors, or darkness can still have fun and interesting results.

Light Intensity: This is just how bright the over all lighting is. With HDR and tone mapping enabled, you'll most likely want this at .5 or below for a natural looking scene.

Skydome/skybox: We recommend having a skybox in place, even if you're using dynamic sky, as it's an easy anchor for lighting values in the scene, but if you don't use a skybox, just be aware of what tone mapping will try to do when you're, for instance, in a completely black sky area. In many situations the overall scene will become brighter or more intense, so you'll need to counteract the lighting values.


Note: Tone Mapping also introduces one of the first HeroEngnine features that doesn't update on the checkbox being clicked. This is because of the nature of how a renderer works and saves tone values, and blah blah blah. So you won't immediately see the scene change when you enable or disable tone mapping. It will update the next time the renderer refreshes, which is on resize or reload. This has been a point of confusion for many devs as they spend some large amount of time editing values after having enabled or disabled tone mapping, and then think something has gone haywire when they next open a panel, or restart the blade, and their screen becomes a glowy ball of fire.

___________________________________________________

Beyond The Environment Panel

The Environment panel has most of what most developers will need, but also keep in mind that shaders have a major impact on how things look and light, and render, and that they are all customizible. And there is also a separate value for "Character Bloom Adjustment" that you can play with in the content tab of the render options panel, and that allows you to individually adjust essentially the brightness of just the character itself. For most situations the default value of 1 will be what you want, but some crazy zones, or space missions, or whatever, might find you wanting to specifically make adjustments to that value.
« Last Edit: Dec 11, 16, 01:49:14 PM by HE-SARRENE »
Logged

HE-Cooper

  • *****
  • Posts: 2221
    • View Profile
Re: Here's How the New HDR Lighting Works
« Reply #1 on: Jan 23, 13, 02:59:00 PM »

I'm just restating the note from above about toggling Tone Mapping, as it continues to be a common questions:

Note: Tone Mapping also introduces one of the first HeroEngnine features that doesn't update on the checkbox being clicked. This is because of the nature of how a renderer works and saves tone values, and blah blah blah. So you won't immediately see the scene change when you enable or disable tone mapping. It will update the next time the renderer refreshes, which is on resize or reload. This has been a point of confusion for many devs as they spend some large amount of time editing values after having enabled or disabled tone mapping, and then think something has gone haywire when they next open a panel, or restart the blade, and their screen becomes a glowy ball of fire.
Logged

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: Here's How the New HDR Lighting Works
« Reply #2 on: Nov 24, 13, 08:32:17 PM »

I looked and have not found any way to adjust any of the HDR values via script.  Is that the case or did I miss them? 

In particular, I tried setting glare type to None via HeroBlade in the Edit instance of an area and making sure that it saved.  Yet if I leave and come back to it, or start a new play instance from it, the glare type is set back to something other than None.  So I wonder if that is a setting that only stays if set via script, as the way Time of Day works.
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: Here's How the New HDR Lighting Works
« Reply #3 on: Jul 08, 14, 02:19:38 PM »

Bump.  I am still having this problem of HDR properties not saving with the area.

With further investigation, I found that the checkboxes (Enable HDR, Tone Mapping, and Blue Shify) work properly.  When changed in the edit instance of an area and then moving to a new play instance of that area those check boxes remain changed.

However, for the rest (Glare Type, Key Value, Adaption Multiplier, Bloom Scale, and Star Scale) they do not stay changed when doing the same process.
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

HE-Cooper

  • *****
  • Posts: 2221
    • View Profile
Re: Here's How the New HDR Lighting Works
« Reply #4 on: Jul 10, 14, 01:31:33 PM »

I'm able to modify any of those values and have them persist in all of the worlds I've tried. Maybe I'm missing something. The lighting system would pretty much be broken if none of those settings worked.
Logged

HE-Cooper

  • *****
  • Posts: 2221
    • View Profile
Re: Here's How the New HDR Lighting Works
« Reply #5 on: Jul 10, 14, 03:35:13 PM »

Herb tells me that there is some deep seeded C# issue that we've seen occasionally pop up in the past that could account for this behavior. But it shouldn't be a permanent state for you. Is it?
Logged

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: Here's How the New HDR Lighting Works
« Reply #6 on: Jul 10, 14, 07:01:29 PM »

Quote
permanent state for you
It appears to be.  I have tried a number of our areas where I go to the Edit instance, change glare type, then enter a new play instance and it always goes back to Cross_Screen.  In fact, if I at that point return to the Edit instance it does not even have the changed value.

I also did it with selecting "Force Update All DAT Files" to be sure it was writing the DAT files to the repository first.

Could it have anything to do with our world being one of the oldest ones, and HDR came along later?
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

HE-Cooper

  • *****
  • Posts: 2221
    • View Profile
Re: Here's How the New HDR Lighting Works
« Reply #7 on: Jul 10, 14, 07:18:24 PM »

anything is possible I suppose, but unlikely. I'm assuming this is on your dev world and not the alpha world? I'll jump in tomorrow to check it out on your dev world.
Logged

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: Here's How the New HDR Lighting Works
« Reply #8 on: Jul 10, 14, 07:35:42 PM »

Quote
I'm assuming this is on your dev world
That's correct.

Thanks!
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

Stadi_Thompson

  • General Accounts
  • *
  • Posts: 324
    • View Profile
Re: Here's How the New HDR Lighting Works
« Reply #9 on: Jul 10, 14, 08:44:42 PM »

Quote
permanent state for you
It appears to be.  I have tried a number of our areas where I go to the Edit instance, change glare type, then enter a new play instance and it always goes back to Cross_Screen.  In fact, if I at that point return to the Edit instance it does not even have the changed value.

I also did it with selecting "Force Update All DAT Files" to be sure it was writing the DAT files to the repository first.

Could it have anything to do with our world being one of the oldest ones, and HDR came along later?

You need to save it as an environmental scheme. Go to environment panel>scheme, create a new scheme by clicking  "Add", then click "apply to active room", tweak your settings, then click "Make Global" It will then save your settings including your HDR settings.
Logged

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: Here's How the New HDR Lighting Works
« Reply #10 on: Jul 11, 14, 04:00:34 AM »

Ok, I hadn't thought of that.  I'll try that tomorrow.  Thanks.

EDIT: OK, I have it working now.  Working with a global scheme helped to see what was happening (at least for me).  I observed the ges file in the repo browser and by looking at its Last Modified timestamp, I saw it was only being updated when I changed the HDR checkboxes.  If I only changed something else, such as Glare Type, alone it did not update the ges file.  So to get the changed Glare Type saved I needed to first change it, then uncheck the Enable HDR box to force it to save with that glare type, and then check it again to re-enable it.

I then tried this with a local scheme and found it works the same way, only staying changed if I follow up with a change to a check box.

It's strange if that is only the case for me.  I haven't heard back from a teammate I asked to try it, though it seems unlikely it would be specific to a pc.
« Last Edit: Jul 11, 14, 11:15:41 AM by ScottZarnke »
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.