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. Dismiss Notice

basic rendering issues / bugs

Discussion in 'General Graphics' started by blizzzz, Oct 4, 2016.

  1. blizzzz

    blizzzz

    Joined:
    Jun 22, 2016
    Posts:
    15
    New to Unity but have many years experience in lighting and rendering for AAA game production using proprietary tools and also experience in Unreal.

    Started with a simple Cornell box setup and seeing obvious rendering issues. I hope that I'm missing something basic here. It would be great if someone could point me in the right direction or to some documentation with known rendering bugs. Having confidence in a solid foundation of accurate rendering is vital when embarking on a project. I don't want this sort of thing to send our team down rabbit holes of debugging later.

    Some specifics on the setup:

    Unity Version - 5.5.0b4

    Reflection probe
    Single refleciton probe positioned in the center of the box
    • Box Projection - Enabled
    • Resolution - 512
    • Type - Baked
    Geometry
    All geometry is using cube object types scaled and moved into place
    • Static Flag - Enabled
    • Shader - Standard
    Lighting
    • Type - Directional
    • Baking - Realtime
    • Shadow Type - Hard Shadows
    • Resolution - High Resolution
    Quality Settings
    • Pixel Light Count - 4
    • Two Cascades
    • Shadow Distance - 20
    • Shadows - Hard Shadows Only
    • Shadow Resolution - High Resolution
    Camera Settings
    • Rendering Path - See attached images (forward vs deferred)
    • Occulsion Culling - Enabled
    • HDR - Enabled
    Lighting Scene Settings
    • Reflection Intensity - 1
    • Reflection Bounces - 3
    • Precomputed Realtime GI - Disabled
    • Baked GI - Enabled
    • Ambient Occulsion - Enabled
    • Final Gather - Enabled
    • Denoising - Enabled
    • Directionality Mode - Non-Directional
    Rendering Issues
    When using the Forward rendering path (see attached cornell_forward.1.jpg), the ceiling and the red wall look correct, but the back wall, left wall, and the floor are completely black. It's almost like the lightmaps are not being modulated in the shader correctly. Possible issue regarding shader optimization? Punctual lights are hitting these surfaces so the shader calculation ignores the lightmap? User error? When I view the baked lighting information that looks correct. (see attached cornell_baked.1.jpg)

    Rotating Directional Light
    Rotating the directional light will cause other parts of the cube to render correctly, but the issue just migrates from one surface to another, I can never achieve lighting to be correct on all surfaces when using Forward rendering path.

    Reflection Probe Rendering Bug
    The reflection probe is also rendering incorrectly. (see attached cornell_reflection_probe.1.jpg) If you look at the probe the shadowed areas are completely black. The probe doesn't even match the incorrectly rendered scene?

    Forward vs Deferred
    Switching from Forward to Deferred and the scene magically looks correct! (see attached cornell_deferred.1.jpg) Well.. almost correct, the probes still look incorrect regardless of Forward or Deferred. I've tried clearing lightmaps and gi cache data and re-building lighting multiple times, with various settings but no luck.

    Realtime vs. Baked
    It gets more interesting. Switching the directional light to Type - "Baked" solves the lightmapping and reflection probe issues in either Forward or Deferred. (see attached cornell_directional_baked.1.jpg) This is not valid solution, I can't rely on a fully baked directional light solution for this project.

    Mixed
    Switching the directional light to Type - "Mixed" causes even more issues with shadows from Mesh flagged as "static" vs. "non static". This issue seems to have been around since 2014 via various posts on the forums etc. Can't attach another image to this thread. :(

    I don't want to use deferred as this is a VR project but looks like the forward renderer is broken at this basic level. Thoughts or advice from seasoned Unity veterans is much appreciated.

    cornell_forward.1.JPG cornell_deferred.1.JPG cornell_reflection_probe.1.JPG cornell_baked.1.JPG cornell_directional_baked.1.JPG
     
  2. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,887
    Forward rendering mode should work fine, but why not use Deferred if you're using realtime lights? It costs maybe 1ms. I wouldn't use an early beta to test anything like this. Use Unity 5.4.x.

    If your light is realtime, then you only need Precomputed Realtime GI enabled in the Lighting window. If your lights are Baked then you only need Baked GI enabled. Mixed is unsupported - they're working on a new system you can test here - https://forum.unity3d.com/threads/mixed-mode-fixes-and-lighting-window-preview-1-try-it.424991/

    Do you have Linear lighting enabled?
     
    theANMATOR2b likes this.
  3. blizzzz

    blizzzz

    Joined:
    Jun 22, 2016
    Posts:
    15
    Yes I am using the linear lighting option.

    We can't afford realtime GI. This is just a test cornell box scene and is not representative of the complexity of the actual scene.
     
    Last edited: Oct 5, 2016
  4. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,002
    You have precomputed disabled, the directional light GI set to realtime, but you want to move the lights?

    Also, realtime GI is pretty fast if the lights are not moving.

    Also, you're better off testing Unity 5.4. 5.5 is beta and there are bound to be issues.
     
  5. blizzzz

    blizzzz

    Joined:
    Jun 22, 2016
    Posts:
    15
    For the purpose of this test I wanted to use something close to what I will use on the actual project. I don't think that realtime GI will be an option. The project is in VR so rendering performance is a must. The directional light will animate so that's why I'm using the "Realtime" setting for the light type.

    I was just trying to do a simple "ground truth" test to ensure things were working as expected, but clearly there are issues.

    Thanks.. might be a good idea to go back to 5.4 vs. using beta.

    @Stardog I did stumble across the post you referred to.
    and does sound like they are working on fixing many of these issues, but I didn't realize that things were this broken. :(
     
  6. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,002
    If you are going to animate the light a lot, you either need realtime GI, or no GI at all. Otherwise it will look odd.
     
  7. blizzzz

    blizzzz

    Joined:
    Jun 22, 2016
    Posts:
    15
    Yup, was just going to set Bounce Intensity to 0.0
     
  8. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,002
    If you set bounce intensity to 0 then what does the cornell box have to do with anything?
     
  9. blizzzz

    blizzzz

    Joined:
    Jun 22, 2016
    Posts:
    15
    In this cornell box test all I am trying to do is understand the differences in rendering paths and consistency. Why does the forward path have issues? Why does the reflection probe render incorrectly? What should I rely on, and what should I avoid?

    Another subject entirely is the lighting for production. I probably can't afford realtime GI so I will rely on fully baked lights in most cases. For lights that need to move or animate I will just make bounce intensity 0.0. I can either choose to enable it or not.. and it's a matter of picking the lesser of two evils.

    I always start with something simple when learning a rendering package. A cornell box is something we can all relate to and can iterate on quickly. For example: I can easily toggle my directional light "Baked" to "Realtime" and see the results. Realtime lights it do contribute bounce via lightmaps. In some rendering solutions, once you set a light to be dynamic or realtime it stops contributing indirect lighting into the lightmaps. So.. just good info to have.
     
  10. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,238
    For the PSVR title Wayward Sky we use real time lights & shadows with precomputed realtime GI because it was faster than baked lighting(!) (specifically comparing directional or directional specular vs using a per pixel count of 2).
     
  11. blizzzz

    blizzzz

    Joined:
    Jun 22, 2016
    Posts:
    15
    Thanks for the info. That's an interesting detail regarding the comparison of realtime GI vs using Directional / Directional Specular lightmaps. I know those lightmap formats become extremely bloated but didn't really think about their runtime performance. Currently I'm assuming we will be GPU bound so being conservative with Non-Directional. Getting a realtime GI solution would save me from some lighting hacks.. so I'll definitely look into that as a possible solution. Thanks and congrats on Wayward Sky... looking forward to checking it out after launch.