Search Unity

  1. We've closed the job boards. If you're looking for work, or looking to hire check out Unity Connect. You can see more information here.
    Dismiss Notice
  2. We're running great holiday deals on subscriptions, swag and Asset Store packages! Take a peek at this blog for more information!
    Dismiss Notice
  3. Check out our Unite Austin 2017 YouTube playlist to catch up on what you missed. More videos coming soon.
    Dismiss Notice
  4. Unity 2017.2 is now released.
    Dismiss Notice
  5. The Unity Gear Store is here to help you look great at your next meetup, user group or conference. With all new Unity apparel, stickers and more!
    Dismiss Notice
  6. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice
  8. Unity 2017.3 beta is now available for download.
    Dismiss Notice

Combine Lights and Clamp intesity.

Discussion in 'General Graphics' started by IsGreen, Apr 27, 2015.

  1. IsGreen

    IsGreen

    Joined:
    Jan 17, 2014
    Posts:
    206
    The scene has 4 identical spot lights, which produce the following effect:

    [​IMG]

    As shown in the image, the combination of lights produces areas with different intensity.

    Could limit the intensity?

    I thought about light probes. But work at runtime, can you change position/color, or the light intensity for different groups?.

    I've also thought of using a vertex color shader to create ambient light on the object, and change color, clamp intensity through its vertex color. Is there a shader like this?
     
    Last edited: Apr 27, 2015
  2. Zicandar

    Zicandar

    Joined:
    Feb 10, 2014
    Posts:
    388
    The old (pre Unity5) deferred would in theory have the capability to clamp the intensity of lights after they have been added up. ( I think command buffers might give easy acess to doing this, but if your relying on the standard shader I'm not sure that the result will be worth it due to limiations for the old deferred).
    The current deferred could be used to do a single full-screen pass with all the lights you want to calculate, and that would allow clamping. (Or if you want them to only be clamped within a group you can optimize by combining and sending in bounding objects to limit the amount of pixels you calculate them for.)
    The current deferred could also be used (with command buffers), to write out all your lights to 2 buffers, 1 for spec strength, 1 for diffuse, (both need RGB), then clamp your lights, then multiply with the spec color and the diffuse color when combining it back in, more or less the same as unity's old deferred with the difference of not needing double geometry passes in exchange for a bunch of extra bandwidth/memory needed for 2 floating point buffers! (6 halfs would likely be needed!...)
    The only other way I can think of would require all lights you want to be clamped together to be sent in a single pass.
    (Vertex lit sends 8 lights in 1 pass I belive, in theory that info could be read in a pixel shader).
    Or instead of a single pass a tiled/clusterd approach could work.
    Or extra per-renderer data that is used in the ForwardBase pass.
    There are quite a few options for this in unity 5, none of them obvious.