Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Baking Direct lighting?

Discussion in 'High Definition Render Pipeline' started by mrd777, Sep 21, 2022.

  1. mrd777

    mrd777

    Joined:
    May 4, 2017
    Posts:
    56
    Hi there,

    From what I can tell, baking is only meant for indirect lighting, weather on HDRP or any other render pipeline?

    Does HDRP bake direct lighting? Or is this not a thing because direct lights are very cheap to render already?


    Thank you!
    Dave
     
  2. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    594

    Cheap depends on whether or not shadows are cast from the DL, and updates in realtime or not, that's where the expense is usually.

    For your main question though, all lighting can be baked if you want.
    All light sources, reflection sources, objects, shadows (2021+), can have mixes of direct or indirect lighting baked, which direction you choose for that largely depends on your projects scope and target hardware / resource limits/

    For Direct Lighting, to switch it to baked
    head to its inspector and change its mode
    upload_2022-9-21_10-45-5.png

    You can find out more about light mode here
     
    tmonestudio likes this.
  3. mrd777

    mrd777

    Joined:
    May 4, 2017
    Posts:
    56
    How does one bake direct lighting? The lighting tab for the scene only gives check boxes to bake indirect light.
     
  4. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    594
    Once your light source is set to baked, the lighting contribution of a light direct and indirect lighting is calculated into light maps.

    if you bake a scene with a directional light set to baked and then after - move the light, you should see this.
     
  5. mrd777

    mrd777

    Joined:
    May 4, 2017
    Posts:
    56
    Yes, but the baking does nothing at all, unless I check on "Baked Global Illumination".

    The thing is, my game doesn't utilize GI due to its stylized lighting.

    So when I hit bake without checking on "Baked Global Illumination", nothing gets generated.

    So it basically wont bake direct lighting unless I bake GI, is what the case seems to be.

    Either my understanding is wrong about baking, or Unity just has a confusing lighting window?
     
  6. mrd777

    mrd777

    Joined:
    May 4, 2017
    Posts:
    56
    BUMP: can anyone answer this part?
     
  7. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    851
    I guess you should look at some basic tutorial about lighting first.
    If you want baked lighting, you need to bake lighting. That’s what baked GI is for. You can mix with real-time lighting. This is what mixed setting of lights is for.
     
  8. mrd777

    mrd777

    Joined:
    May 4, 2017
    Posts:
    56
    I understand you can have baked GI.... my question is, can you have baked direct lighting only? If you CAN, then why doesn't that option present itself in the lighting window?
     
  9. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,631
    You can by having your direct lights set to baked and having 0 bounces for indirect.
     
    ElevenGame likes this.
  10. mrd777

    mrd777

    Joined:
    May 4, 2017
    Posts:
    56
    Thank you. That is a good idea. Will try this.