Search Unity

Baking with GPU Nvidia

Discussion in 'Global Illumination' started by PauloPedullo, Aug 9, 2018.

  1. PauloPedullo

    PauloPedullo

    Joined:
    Jul 23, 2018
    Posts:
    16
    Hi everyone,

    I am new to unity and this is my first post. I am building a scene and it is baking with my CPU (i3-4170), it is taking currently 55 hours to finish it, but I have a GTX 1070, how do I use my gpu to bake?

    I tried to find an answer but i just finded a plugin GPU Bakery, unity doesnt bake with GPU natively?
     
  2. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,536
    You cannot natively GPU bake at this time.
     
  3. PauloPedullo

    PauloPedullo

    Joined:
    Jul 23, 2018
    Posts:
    16
    thanks for the reply LaneFox.

    I think i going to buy the GPU Bakery, because my CPU is too weak for this.
     
  4. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    If your scene takes around 55 hours to finish baking, there must be some issues with your scene setup and lightmap parameters. Even with a GPU lightmapper you would still have to wait a considerable amount of time, as the speed increase is not 100-fold.

    Please attach couple of screenshots to this thread showing your lighting settings, so I could give you some more relevant advice.
     
  5. PauloPedullo

    PauloPedullo

    Joined:
    Jul 23, 2018
    Posts:
    16
    Sorry for taking so long to respond, i was working on my own to try and solve the problem.

    Well i made some progress, i tweaked with the lightmapping settings and now my scene it is baking in 3 to 4 hours.

    My problem now it is that after the bake, unity does other things, like visibility, clustering, etc...
    This other things it is taking really long to complete, like 4 hours after it finish the baking time.

    I have many questions, first question: all my lights are realtime, so it is really necessary to generate light? if i don´t generaty light, the light inside of my houses arent equal in my prefabs (i am putting images of my scene here in the post, all the images are without generate light)

    Second: it is my scene too big? my idea it is to build a city, but one block is really getting difficult to work with the light, i am a noob in unity, i thought it was possible to build a city in one scene only, i guessing that i tought really wrong. (image of whole scene below)

    Third: my lightmapping settings are good? i mean, it will look nice? because i have done some baking and inside the house, some prefabs (specially next to 90 degrees curves, like to walls making 90 degress with one another) the light still stranges.

    Final question: the visibility and clustering it is taking really long time, like 4 hours, unity some times even crashs in this part of the process, and i have increased pagefile in windows because my 16gb ram wasnt enought, it was giving me a error of insufficiente memory, is this normal?

    Well i guessing that i am doing something really wrong, or my scene is too big or i build it wrong, If you guys have any tips for me, I'll be very grateful. front_house.png inside_house.png light_settings.png scene.png
     
  6. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    1. Regarding the realtime lights: if you want to make use of the realtime GI, then yes, you have to use realtime lights in your scene. If you want to make use of baked GI, then you should consider using mixed/baked lights instead. The biggest drawback of realtime lights can be performance - especially if they cast shadows. This issue can be mitigated by switching to deferred rendering path.
    2. Your scene size seems to be fine.
    3. The biggest problem with your lighting settings is that you have both Realtime and Baked GI enabled. For the best performance and for shortest baking times, consider choosing one or the other - not both.
    4. Please refer to our official Light Optimization Tutorial for more guidance on how to achieve good looking results and short bake times - https://unity3d.com/learn/tutorials/topics/graphics/introduction-precomputed-realtime-gi
    In addition, that tutorial does an excellent job at explaining various realtime GI concepts and best practices.

    I hope this helps.
     
    YuHeLong and PauloPedullo like this.
  7. PauloPedullo

    PauloPedullo

    Joined:
    Jul 23, 2018
    Posts:
    16
    Thanks a lot kristijonas_unity,

    I will try to use baked and then realtime to see what will look best, but i think i will choose realtime because my player will do not have shadows if i choose baked only.
    I will look the toturial too.

    Thanks.
     
  8. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    WildStyle69 and PauloPedullo like this.
  9. PauloPedullo

    PauloPedullo

    Joined:
    Jul 23, 2018
    Posts:
    16
    Thanks for the help guys, I am doing some tests here, when i finish i will post if my problems are solved.

    In performance matter, i am buiding a game for desktop, my GTX 1050 TI is running this scene in an average of 30FPS in 1080p in ultra, and every light is realtime, so i think is ok.
     
  10. PauloPedullo

    PauloPedullo

    Joined:
    Jul 23, 2018
    Posts:
    16
    Hi everyone,

    After a long research and testing, i think i am finally getting there, I tested the realtime, baked and mixed light modes, the difference in the scene wasn't so noticeable between baked and realtime, but how i am targgeting high end desktop or maybe a ps4 and xbox one in the future i will go with realtime lighting.

    I optimized the scene so small and dynamic objects doenst need to be precomputed by unity; set open doors like floor, grass, trees etc to render in verylow settings and the rest of the scene to render in medium lightmap parameters, with the indirect resolution of 0.5.

    With this configurations i was able to complete the row generate lighting in about 80 minutes, much better now, and the quality of the lighting in the scene is good.

    I just have one problem left reggarding the ilumination, and i thing it is because of UV charts or maybe clusters. My problem is that the light calculeted and applied over my prefabs, sometimes doesnt match the prefab by its side, and in uv charts view mode, i can see that the charts is distorting in some prefabs, but changing the UV max angle and distance did not solved it, sometimes it helps, but still different.

    anyone knows how to fix it or maybe a link to a tutorial that may help me? i am putting printscreen of my scene with this problem below (also my scene now it is at night, i think i will build my game in night time)

    Thanks for the help guys, the tutorials links was very usefull.


    unity4.png
    unity5.png
    unity.png unity2.png unity3.png