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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Purpose of Precomputed Realtime GI?

Discussion in 'Global Illumination' started by ArachnidAnimal, May 19, 2015.

  1. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,727
    After reading the Unity manuals and forums and such it is still unclear to me what exactly "Precomputed real-time GI" is or what it is intended to do. I understand what baked GI is though.
    Can someone give an example of when you would need precomputed GI?

    Currently I have a static realtime light whose only purpose is to provide glossiness and specularity to the static baked surfaces using the Unity 5.0 standard shader. The light is not dynamic, casts no shadows, and doesnt "bounce". Would it be beneficial to use precomputed real-time GI? Or is the precomputed GI used for another purpose?

    It would help to have an example of when someone could benefit from it.
    Thanks.
     
  2. Findus

    Findus

    Joined:
    Jun 23, 2012
    Posts:
    111
    Like the name says, it's realtime.
    Once the scene is precomputed, which itself is relatively fast, you can move around, change, or even add lights, and GI will update in realtime, or at least pretty fast.
    Since it's so fast, it would probably make sense to use it to setup your lighting, at least roughly, even when you plan to use traditionally baked GI later.
    Shadows are rendered in realtime, though, (at least to my knowledge.)
    and shadows from non directional lightsources don't even influence GI. So GI will bleed through walls right now.

    In your example you might want to take a look at baked directional lightmaps with specular. (Though one light like you describe might be "cheaper" to compute.)
     
    ArachnidAnimal likes this.
  3. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,727
    So what this does is pre-calculates light bounces from any realtime lights in any location in the scene?

    i will take a look at the baked directional lightmaps with specular to see if I can avoid using the realtime light, but I do not want to loose the specularity.

    At this point I don't even know if baked GI or realtime GI is even necessary for my scene. I can understand why these techniques are needed for Mobile devices. But is this worth it for something as powerful as an Xbox one? This is what i hope to figure out.
     
  4. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,727
    I got the directional lightmaps with specular to work.

    I ran a quick test on a PC:
    scenario 1: realtime light, no shadows
    scenario 2: realtime light, realtime shadows
    scenario 3: baked light, baked shadows, and with the directional lightmap with specular

    in scenario 1, I got 220 FPS
    in scenario 2, I got 180 FPS
    in scenario 3, I got 270 FPS

    so it definitely proves to me so far that it is worth lightbaking
     
  5. Findus

    Findus

    Joined:
    Jun 23, 2012
    Posts:
    111
    Something like that, yes. As I understand it, it maps the geometry of the scene in a way that distribution of any light can be calculated on the fly.

    Realtime GI is more likely to work on something like a Xbox one than a Mobile, in my opinion (especially older ones). Same is probably true for directional specular normal maps. ( Didn't look that up, though, just going by what I picked up here and there. E.g. for some of those things you need newer shader models that you usually don't find on mobile. )
    Also GI (Global Illumination) can greatly enhance the look of your scene. You sometimes can fake a bit of GI with realtime lights or cubemaps, but especially for indoors you'll need extra time and knowledge for that and in most cases it won't look as good as simply pressing the button for realtime GI. Baked GI you get more or less for "free" when you're baking your shadows anyway.
    I'm guessing you're mainly thinking of baking shadows, when asking if it's worth it for something like Xbox one, because the question if GI is worth it, is mainly one of aesthetics, not of making your game faster to render.

    Thanks for those figures. Just be sure to test it on all your target platforms.
     
    ArachnidAnimal likes this.
  6. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,727
    Im mainly concerned with the baked shadows as I am having difficulty with the specular directional map:

    specularLMissue.png
    I am getting "black light" in areas of some baked lights. i may have to limit myself to only one shadow-casting light per room or worse, only one baked light per room. it takes more troubleshooting. This is why i planned on allowing myself 2 months to test the light baking, as I read other people's horror stories about baking on the forums.
     
  7. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,727
    so apparently replacing the point light with a spotlight corrects the problem. replcement.png
     
  8. Findus

    Findus

    Joined:
    Jun 23, 2012
    Posts:
    111
    Nice!
    Are your normals compressed? The specular seems a bit pixelated.

    edit: or is that from the directional map?
     
    Last edited: May 20, 2015
    ArachnidAnimal likes this.
  9. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,727
    all textures were compressed, but uncompresing them did not help. the issue seemed to be the bounce intensities was set too high.

    but, after at least 200 bakes and 3 days straight, i think i found the best possible reasonable settings to get this result:
    bestpossiblebake.png
    so im happy with this. the light maps are only 13Mb for this room.
    this kind of looks like SH4 apartment shadows
    so this entire room does not rely on any realtime lights.
    This definitely takes time and patience, this is a whole artform itself just for the light baking,
    thanks for your help explaining the GIs, i might not have figured it out.
     
  10. Findus

    Findus

    Joined:
    Jun 23, 2012
    Posts:
    111
    No problem!
    Now the bouncelight seems to be completely gone? Maybe a compromise?

    You could also try to set some padding for your lightmap uv's or even provide your own lightmap uv's (since control over lightmap uv's in Unity seems to be poor at the moment. ) Some of the seams have pretty visible bleeding.
     
    ArachnidAnimal likes this.
  11. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,727
    im not sure what you mean by set padding.
    Im not sure what you mean by "set padding" What is that?
     
  12. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,727
    the blender mesh i was using was all messed up. I had duplicate vertices and edges all over the place. im suprised that unity was even able to interpret it. now the bleeding is gone.

    withrefprobs.png
    its still not perfect but i dont feel like spending anymore time on this.
    now that i have all the lights baked i hope i can get away with a reflection probe
     
  13. Findus

    Findus

    Joined:
    Jun 23, 2012
    Posts:
    111
    You can set padding for the lightmap UVs when importing meshes and between objects on a lightmap in the
    baked GI settings in the lightmapping panel. It means that Unity leaves a bit of space between UVs so they don't bleed into each other so easily. (Right now they don't seem to actually dilate the pixels though. If that's an oversight or due to to their timetable or if there maybe some other trickery is going on, I don't know. )
    Anyways, glad you could solve it!
     
    ArachnidAnimal likes this.
  14. macdude2

    macdude2

    Joined:
    Sep 22, 2010
    Posts:
    686
    Not to derail the thread, but anyone know how to eliminate aliasing in specular reflections? I have found that when using tiles, there is a ton of aliasing between each that can be extremely disturbing. In the first image between the various tiles, this effect is quite apparent. Anyone know how this could be fixed?
     
    ArachnidAnimal likes this.
  15. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,727
    there are still different shades of shadows being placed on separate triangles on meshes with have planes which are perfectly aligned in the mesh.
    shadows.png
    all of these triangles and vertices have the same Y-value. So I dont understand why this occurs.
    Ill try the padding to see if it helps.
     
  16. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,727
    this was eliminated by reducing the Smoothness bar for the material when using the Standard shader.
     
  17. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,727
    actually i didnt notice that until you pointed it out. I now reduced the intensity of the normal map from 1.0 to 0.2. Now the aliasing is gone. The normal map was too strong. it lost some depth but the aliasing is gone.

    I used CrazyBump which can be very aggressive at creating normal maps
     
  18. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,727
    setting the padding didnt seem to help anything. but i did go back into the blender file and set the shading to Flat for the top of the sink. now the shading is better for the top part of the sink.
    flatshading.png
    this is probably just an issue of the mesh not being detailed enough?. i was just learning Blender so i rushed to complete it.
    noround.png
     
  19. Findus

    Findus

    Joined:
    Jun 23, 2012
    Posts:
    111
    Basically, yes. You can either add more geometry around areas where the surface curves, which means also adding e.g. a loop around the hollow of the sink on the flat surface (so the shading is blended between the walls and the top inside that ring, not over the whole flat surface like before, if you know what I mean), or you could do a highpoly and bake that to normals. That's a whole new can of worms, though, with many potential problems.
     
    ArachnidAnimal likes this.
  20. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,727
    ok. i think im just going to leave it as is because it looks OK with the reflection probe. it could be improved but i need to move on. thanks for your help.
     
  21. JosephDoud

    JosephDoud

    Joined:
    Sep 3, 2015
    Posts:
    1