Search Unity

Feature Request Glaring light

Discussion in 'High Definition Render Pipeline' started by EvilEcho, Oct 24, 2022.

  1. EvilEcho

    EvilEcho

    Joined:
    Oct 8, 2020
    Posts:
    4
    I need to be able to create some very bright point lights under C# control. Specifically I need to alter the intensity and the range to match. Examples in my project are simulating illumination rounds - large parachute-equipped flares fired by mortars and howitzers, a second case being the glare generated by a nuclear weapon's fireball.

    The editor does allow for point lights to be set high enough. For example I select "lux", enter upwards of 38,000 and set the "at" distance to 1,000 - then set the range to 48,000. The result is quite satisfactory for a 5 kiloton nuke. But attempts to do the same via C# fail. For one thing there is just "intensity". No sign of light units nor that intensity-at parameter. Setting numbers to high values in that intensity property are ignored, my script steps through the changes while the light fails to brighten or fade. I have similar trouble with the illumination round, the random changes in intensity simulating flicker flame would not work.

    My suspicion is that this may need new code support, making the above a request for enhancement.

    Relevant Unity details - version 2022.1.20f1, High Definition Render Pipeline.
     
  2. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    766
    My suspicion is that you are using the "Light" component whereas in HDRP you have to use the "HDAdditionalLightData" one. In there there's also intensity and
    lightUnit variable etc... (see api doc link)

    There's documentation about how to do it properly.
     
  3. EvilEcho

    EvilEcho

    Joined:
    Oct 8, 2020
    Posts:
    4
    Thank you, chap-unity. I did read the referred documentation. While it explains a little about HDAdditionalLightData, the section is incomplete in coverage. My original posting mentions lux and setting an at-distance for the illumination level I am trying to achieve - no mention of how that is done.

    I have stumbled through the HDAdditionalLightData API with some limited success in the last few hours. Your post suggests strongly that only access through the new data type is needed, not both the old and new. I will take that under advisement; the referenced documents are vague on that matter.

    The documents also suggest the use of prefabricated lights to affect changes in intensity. This is both too expensive in terms of storage and too inflexible for the range of effects I am trying to provide - procedural effects were the method of choice in earlier versions of my work. I'd prefer to continue work using modified code if at all possible.

    Next i need to fiddle with layers and shader types for bright light and for objects in or partially in the radius of the emitting sphere in order to prevent eclipsing my light - either partially or totally. Both of which will require ample amounts of Luck as well as perseverance in order to find a combination that will render properly. Unity has never fully explained what the various shaders accomplish, leaving those of us less familiar with shader technologies to fumble around until we chance on the right setting - if there is one. A few tables detailing things would go a long way.
     
  4. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    766
    Hey, in the scripting API you can find the property luxAtDistance that should do what you want to do.
    And yes in HDRP, I can understand it's not very straightforward but when modifying your lights at runtime, you need to be using this class, not the Light class (as we do in built-in).
     
  5. EvilEcho

    EvilEcho

    Joined:
    Oct 8, 2020
    Posts:
    4
    Yes, found that. Thank you again.
    Could the documents be adjusted to reflect ( no pun intended ) what needs to be done when using HDRP? I've come to the right answer in a very round-about fashion here. If this matter was not clear to me, a retired programmer, it is likely even more obtuse to newcomers.
     
    chap-unity and PutridEx like this.
  6. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    766
    I agree it can be confusing, I'll se what we can do to make it even clearer on this documentation page.
    Thanks for the feedback.
     
  7. EvilEcho

    EvilEcho

    Joined:
    Oct 8, 2020
    Posts:
    4
    Thank you for you patience, respectful conversation and useful answers. I now have the lighting effect I need.

    Nuke Glare.png

    I have been a long time fan of Unity, my game engine of choice for over 13 years. I've used the ability to create custom displays in your editor to enhance the output of my polyaxial variables ( these variables can accept/provide data in a myriad of units - for example distance can be in meters, centimeters, kilometers, miles, feet, etc. And variables can be set to display a "best fit" unit so that .00159 sec becomes 1.59 ms ). All of which is extremely convenient when dealing with formula that use US imperial units or worse, mixed metric and imperial. Unity's editor interface has made coding under difficult conditions much more pleasant. THANK YOU!!
     
    chap-unity and pierred_unity like this.