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

Global Illumination Computation (Unity5) ongoing saga

Discussion in 'Global Illumination' started by radiantboy, Mar 4, 2015.

  1. Welby2

    Welby2

    Joined:
    Feb 5, 2014
    Posts:
    31
    I'm having weird artifact too even without compression enabled.. The weird thing is that i've artifact only in one room.

    I'm trying with non-directional GI

     
    Last edited: Apr 17, 2015
  2. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    @KEngelstoft I get that spectacular bug when I update a mesh and don't rebake. Sometimes it's only a material that has changed and the lightmaps look fine. There is a phase in the baking process that says 'creating meshes' or something. I'm guessing it's close enough that Unity tries to re-apply whatever heavy lifting has been done from the cache. It is truly spectacular by the way.
     
    Last edited: Apr 19, 2015
  3. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,593
    Things seem to be working even on my major scene with the latest unity and patch release, im baking on very low resolutions but it works! My CPUs are not driven up to 100C either. I think a huge amount of GI bugs have been fixed!! I dont want to say too much until Ive played for a few days, but things are looking good, everyone should attempt a rebake :)))
     
    GoGoGadget likes this.
  4. Nubeh

    Nubeh

    Joined:
    Oct 7, 2012
    Posts:
    47
    @radiantboy how are your Lighting settings? I have a directional light and some GI settings and it still gets stuck at clustering. How long did you have to wait for the bake?
     
    AlanGreyjoy likes this.
  5. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    I avoided upgrading because the previous parches said WebPlayer builds wouldn't work externally. Is that the case with 5.0.1p1?
     
  6. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    It would be great if you could file a bug report because we should be recreating meshes when they are changed. I suspect we mess up a vertex or indexbuffer when applying the UVs.
     
  7. Nubeh

    Nubeh

    Joined:
    Oct 7, 2012
    Posts:
    47
    ok, I managed to have the lighting bake finish. What I changed in my scene is to have all my models with Scale Factor and File Scale to 1 in the model's inspector and also having the model in my scene scaled to 1,1,1. Before I had my models being too big and I guess that's what was causing issues.
    I read on many threads that scale doesn't matter and that you should just find a scale for your scene and stick to it but I guess that's not true.
    At GDC one of the guys working at Camouflaj said that scaling your models will cause a loss in pixel density and I also noticed that in their Rapublique Asset Store package they have ALL the models at always exactly 1,1,1 scale in both scene and model settings. It would be nice to have better documented guidelines for this stuff.
     
  8. Bugeer

    Bugeer

    Joined:
    Jul 29, 2014
    Posts:
    2
    check the normals of the mesh.
    If the normals of the mesh is none, change the .FBX's Model->Normals to import or caculate in Inspector.
    Rebake.

    It may be fine.
     
  9. Nubeh

    Nubeh

    Joined:
    Oct 7, 2012
    Posts:
    47
    yep the models have all the normals set to Calculate. That said I still have a lot of black patches all over my models.
     
  10. Sidx30

    Sidx30

    Joined:
    Mar 7, 2015
    Posts:
    3
    The scale thing sounds interesting. How did the baking go after you fixed the scales? Was it faster? Did it eat up RAM? My scenes a nature scene so I didn't expect scaling to possibly effect the baking process. I have some things scaled up
    40-70% (rocks and mountain pieces).
     
  11. Nubeh

    Nubeh

    Joined:
    Oct 7, 2012
    Posts:
    47
    In my case the baking was not only faster, but it managed to finish. It actually makes sense because the lightmapping is calculated with "texels per unit" so if your general scale is 10x the one from Unity that means that lightmapping will take much more time to calculate. What did is to drop a Unity cube in the scene and use it as a reference for all my objects as if it was a 1 square meter cube. All my models have Scale Factor and File Scale to 1 in the inspector and when dragged in the scene they are at scale 1,1,1.
    With these settings my lightmap calculation works and doesn't get stuck anymore. It looks ugly and has weird black patches but I think that's a Unity bug that hopefully will be fixed soon.
     
  12. sonic220

    sonic220

    Joined:
    Jan 13, 2012
    Posts:
    35
    I'm having the exact same issue and the same happened to all of my friends following the survival shooter tutorial with me.
    Also the light making seems to take forever with 7 jobs, is it normal?
    lightproblem.gif

    I've also experienced some other strange error like the line renderer material that is a legacy material and self illum. flashing from yellow to black at random

    http://answers.unity3d.com/questions/968098/problem-with-light-baking-in-unity5.html
     
  13. Nubeh

    Nubeh

    Joined:
    Oct 7, 2012
    Posts:
    47
    I would suggest to not use the legacy materials anymore, also, are all your models at scale 1,1,1 both in the model inspector and in the scene transform?
     
  14. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,725
    Not to bring back an old thread, but this issue is still present with the latest version of Unity 5.0.2f.

    My computer ran out of RAM and it nearly crashed my computer. It was completely locked up.

    I have everything on the lowest settings possible and it's still getting my computer to nearly 100% on my CPU. I also have pretty decent computer so this should not be happening.

    This is all with real-time GI.

    My scene has about 200k to 600k tris in scene. It isn't super big but it is dense.
     
  15. Max_Bol

    Max_Bol

    Joined:
    May 12, 2014
    Posts:
    168
    I know this might sound strange, but just to test things out (for Radiant Boy at least), try to reduce the Ambient Occlusion to as low as possible. Unless Unity 5 system got some misleading system reading, the "Failed reading AO file." is pretty much an error with the Ambient Occlusion process. I know because I had some error related to the AO files (with the "Failed reading AO file" notice after the long error code) and turning off the Ambient Occlusion removed the error from appearing. It worth a shot I think until things get fixed. (I didn't try many changes in the setting back then due that the project was a 9 day long learning self-project. Still need to test things out but I don't have access to my power PC)
     
  16. Nubeh

    Nubeh

    Joined:
    Oct 7, 2012
    Posts:
    47

    Hey man, I already mentioned this in one of my previous threads but I fixed the problem by re-exporting all my models to fit the Unity scale to 1,1,1. This means that all my models have now File Scale to 1 and once dropped in the scene I keep their size is 1,1,1 everywhere. Do not scale your models, make sure that if you have something that should be 2m tall, it is as tall as two Unity cubes stacked on top of each other. This fixed the issue for me. I use 60 for the baked resolution with 0.7 of ambient occlusion and it works fine.
     
  17. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,725
    Edited: I tested this on our big scene and converted every model like I did before. It seems to get a little further than before but it will now crash Unity before it finishes. I'm not sure if this is the model's fault or if it's a Unity issue.

    The Scale Factor was .01 what I did was change it to 1 then scale down my model using the scale tool because it was too big.
     
    Last edited: May 30, 2015
  18. Nubeh

    Nubeh

    Joined:
    Oct 7, 2012
    Posts:
    47
    That's the problem. Your File Scale AND Scale Factor should be 1 and once you drop your model into the scene make sure that the model is 1,1,1 and DO NOT modify its scale. If your model is too big/small adjust it in 3d max or Blender. Make sure you export it correctly to fit Unity's units. I did that and now Enlighten bakes my lightmaps without any issues.
     
  19. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,725
    The models are through a developer on the Asset Store. If I keep them at 1,1,1 they're 100's of feet in the air and are as big as the terrain. I'm assuming this is why I'm running out of RAM because the base model is massive.

    I will contract the developer to see if he can rescale the models.
     
  20. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,593
    Ive just upgraded to i7 4790K, 32 gig of ram and Geforce GTX 970. With my old PC jobprocess would push the CPUs beyond their safe limit and the PC would turn off. No way around it, to fix this I wrote a simple app that monitors temperature, if it gets above 90 it unticks continuous baking, and then when it goes below 70, it will retick it for you. So you can leave the house and bake on pcs that turn off due to heat (anyone needs it let me know, it's called AuntyMeltDoon and is written in Java, uses robot class to control your mouse pointer to auto click "continuous baking").

    With my new system I do not have that problem, looks like when the cores hit 100C the load is automatically reduced on them, and thus the temp goes down. So far so good I can actually bake the light and use unity and my computer quite nicely without it stuttering, which is remarkable after my last PC, mind you this new one is up to 10x better, but it really feels awesome now. Light baking still takes forever, although considerably faster than old pc (and cores still at 99C mostly, is that safe!?) but so long as I can use my comp and it wont turn off due to heat Im relatively happy :) I am already baking scenes I did not have the balls to bake before, and its ripping through them comparitively, even the huge scene that caused this thread in the first place, fingers crossed! Only got this beast yesterday..

    So if you are really at the end of your tether, consider an i7 (or Xeon?), fat amounts of ram and a higher end graphics card. I suspect its all down to cpu and mem actually.
     
  21. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    855
    A quick google shows that 99C for an i7 4790K is not a temperature where you want to be for any extended period of time.

    I've got an i73770K/16GB of RAM and still ran into issues last time I tried baking - it seems as though there's some sort of "magic setup" which some people manage to get that actually lets them bake big scenes, but in my case, it's still a dice roll as to whether a scene will bake or not.
     
  22. SpiriTx

    SpiriTx

    Graphics QA Unity Technologies

    Joined:
    Apr 12, 2012
    Posts:
    252
    Best tip is to always start with low resolutions, especially realtime (indirect) one.
    Something like 0.001 - 0.2 is a reasonable final realtime resolution for an outdoor scene based on the size of it.
     
  23. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,593
    Yeh maybe I spoke too soon, Ive been stuck at 12/15 Bake Indirect 363 jobs for last 4 hrs. Im wondering if theres a slow phase before it begins counting down, or whether its just crashed. It would be good if it told you wish part of the level it is working on, so you could turn off dodgy meshes, but it doesnt.

    So far my small scenes bake... Also does anyone else have the rising temperature issue? Its happened to both machine ive tried, and yeh I was thinking keeping it at 100c might be bad but ive been doing it all day anyway and not even made progress on my main level... I will start again with even lower res.
     
  24. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,593
    Yes very low has worked better for me. I dont really know what the resolution refers to, I assumed this meant I would have blocky stuff happening, but Im thinking now its not like that because I see no bad stuff going on, maybe its more like occlusion where the "model" it builds will simply not be as fine grained (lol if you know what I mean). Its one big black box of craziness. And if you are right does that mean that small scenes can look absolutely gorgeous but large scenes have to look a lot worse?.. (Given that on a small scene you can crank it up further and it often works).
     
  25. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,593
    Managed to bake my main scene for the first time ever, using Baked GI 10 (and my new beast i7). There are these big blotchy black squares on some of my models/materials, what is causing that? Seems so easy to make a nice small scene work, my huge scene looks utter crap with the light baked :-( Still a long road ahead to make my once amazing scene compete again.....
     
  26. SpiriTx

    SpiriTx

    Graphics QA Unity Technologies

    Joined:
    Apr 12, 2012
    Posts:
    252
    Usually that's either compression or incorrect UVs/normals
     
  27. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    511
    I switched to 5.1f3 but still have a really strange behaviour: After a bake the scene is fine, no artifacts. I can enter playmode, add new stuff etc nicely. Then I do something that I cannot reproduce yet, like switching the scene back and forth or importing an asset and voila, at the last step of baking it suddenly puts all kinds of black patches all over my geometry. It will disappear if I move any vertex slightly one millimeter (probuilder geometry) which triggeres a rebake and voila, lightmap is fixed again, until after a while it comes back, I change a vertex again... you get my point ;-)

    Any idea what this could be? It is super annoying.

    blackpatches.PNG
     
  28. Nubeh

    Nubeh

    Joined:
    Oct 7, 2012
    Posts:
    47
    Could you elaborate on this a bit more? I haven't compressed my lightmaps but I get black patches. Not sure about the UVs, I read that many people had the same problem about this black patches. I tried to up the lightmap resolution to 60 and the padding to 8 but didn't see any improvements.
     
  29. SpiriTx

    SpiriTx

    Graphics QA Unity Technologies

    Joined:
    Apr 12, 2012
    Posts:
    252
    I haven't noticed anything similar, please inform me if you manage to figure out what does cause this
     
  30. SpiriTx

    SpiriTx

    Graphics QA Unity Technologies

    Joined:
    Apr 12, 2012
    Posts:
    252
    Compression is by default on in Baked GI, so make sure you have that off and check all of your meshes if they have Lightmap UVs checked and Normals/Tangents calculated or imported properly
     
  31. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,593
    Im getting them nasty blotches on lots of models in my main level, never seen them on other levels. It is such a nightmare, you wait 5 days for your i7 to melt down your house virtually, and STILL the results are absolutely god damn awful. Any recognise the issue with these (the game looks weird, just look at the blotches :)) ?





     
  32. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,593
    Weird, Unity crashed and when I reloaded it did a small amount of baking then the blotches were gone!...

    Question: Can you use an animated point light with baked light? Or do they have to be static (not animated) ? It seems none of my cool animated lights have actually shown up even though now it appears to have fully baked 433 non directional lightmaps 1024x1024. In the last image for example it says "R&D" if you can see, its dark, but that should be lit up by a light that cycles through colours using a traditional animation, it works fine when I set it to mixed or realtime (although again more baking takes place ARGGGH) but not baked.
     
  33. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,593
    So I set all my cycling lights to realtime, let it bake again, and boom, it looks amazing! Its a little bit annoying they need to be realtime (for performance) but I dont care anymore so long as it looks good. Im just going to work on the asusmption people will need good hardware to run this. So most if not all of this light is realtime GI

    PS. Ive never had compression on, so them blotches wouldnt have been related to it, curious how a untiy crash and reload solved it...

     
  34. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    511
    I hope my Unity crashes as well ;-)
     
    radiantboy likes this.
  35. rstorm000

    rstorm000

    Joined:
    Aug 19, 2010
    Posts:
    228
    Still getting these errors on 5.1
     
  36. Nubeh

    Nubeh

    Joined:
    Oct 7, 2012
    Posts:
    47
    yes I have compression unchecked and normals and tangents calculated. Still some objects get black patches.
     
  37. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,593
    Pretty much on the verge of giving up again, Unity contacted me saying theyre still working on it. I have also left my i7 for 48 hrs and its still stuck on 119 jobs. One thing some people may forget is to tick "generate light map UVs" in the import settings, it wont work apparently if you dont do that, Unity told me I had not been doing that, but when I checked I had been doing it. So just more confusion all round.. Makes me wonder why it works one day and not the next! And also sometimes I load Unity it remembers all the baking and completes fast, 70% of the time it behaves like ive never done it and starts from scratch. Im at the point where I could just scream at a punch bag for 12 weeks then jump off a cliff, but not before ripping my own hair out and scooping my eyes out with a spoon. That pretty much sums of GI for me.
     
  38. Nubeh

    Nubeh

    Joined:
    Oct 7, 2012
    Posts:
    47

    are all your models at File Scale 1 in the inspector and are of scale 1,1,1 in your scene? That's what caused my baking to get stuck and I've been telling this to many people in the last couple of months and that's usually the issue.
     
  39. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,593
    Oh really! No, I would say almost none of my models are scale 1,1,1 anywhere in my game. It would be impossible to do that really without being the modeller yourself. Im just a coder I have to use what I am given, interesting though!.. Mine is still stuck on 12/15 indirect 1 job, every time I try. But yeh most of my models are random sizes, and probably bad meshes from sketchup and stuff.. Also is there a bulk way to tick "generate lightmap UVs" or do u have to go through each model individually? It seems to me that Unity is not really made for open world games or huge scenes, and this is where my problem lies, that and all the bugs still in the GI. But no doubt they're fixing as we speak......
     
  40. Nubeh

    Nubeh

    Joined:
    Oct 7, 2012
    Posts:
    47
    The Unity guys never made this clear but yes, the scale is your problem. You have to realize that the lightmap resolution says "texels per unit", now if you have a cube that should be 1 sqm and you scale it 100 times that means that you're asking Unity to calculate a lightmap for that cube that is 100 times bigger than necessary. The engine has it's own units and so you have to follow that. That said to just scale a model in Blender or 3d max and then re-export it should be easy enough for you to learn.

    By the way this problem about pixel density of models and why you should never scale them is something I heard at GDC this year from one of the guys working at Camuflaj (the guys that did Republique). He also mentioned the fact that nobody ever says this, which is quite frankly ridiculous, especially considering the amount of blog posts that keep being posted on this forum about lightmaps. For your scene, create a Unity cube with size 1,1,1 and think of it as being 1 sqm and use it as reference for your game world.
     
  41. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,593
    Excellent advice man, I did not even consider this, it is going to be a bit of a nightmare resizing about 1000 models, do you think a fix will ever come for this or is it inherently just going to happen ?
     
  42. Nubeh

    Nubeh

    Joined:
    Oct 7, 2012
    Posts:
    47

    I don't think that's something they can fix, you have to respect their units and they will always bake light and calculate physics based on units. There will always be limits to how big your scene can be, and it's very difficult to know how big it can be without trying it out. That said if you respect the units system I think you can build a pretty big and detailed scene and make it work in a baking time between 1h and 4h maybe (all depends on the resolution, how many reflection probes you have etc.).
     
  43. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,593
    My problem is I havent respected the units, my models have come from all over over the last 3 yrs, its like a very crazy world where some things are probably literally thousands of times scaled up, some scaled down etc. Also if this is the case, how do things like cubes work? Surely a cube will be scaled up many thousands of times in any game. If this really is the answer then I dont think I can actually fix it, I estimate it would take 3 months to rip this apart and put it back and it simply wouldnt ever be the same. I am doubting whether half the models would even load up, and save the same, and with the right textures etc, and also that if I was to copy the scale used in unity that it would actually be the right size. This is pretty bad news for me, but still nice to get an answer. I guess I could try a few models, or maybe there is a way to export a scene as a set of FBX or something automatedly then somehow fix the scale in an external program and bring it back in as a few large meshes or something. Either way I sometimes see great results with the lighting system so it must be working to some degree, I guess if this isnt sorted by the time i release I will just make sure my final build is made in one of those moments where it seems to be working.
     
  44. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,593
    I just got the Unity Labs demo project, none of their meshes are set to "generate light map UVs" in the import settings, shouldnt they all have that ticked? Or is it ok to use precomputed realtime GI only and you dont need it ?
     
  45. Ellenack

    Ellenack

    Joined:
    Feb 16, 2014
    Posts:
    41
    Well, maybe they made the Lightmap UV themselves and import them, rather than let the Engine unfold the UV. You have more controle this way, and it's always better to unfold them yourself. Less problem with the lighting. You can't have clean baked lightning without clean Lightmaps UV. :)
     
  46. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,593
    Some updates from the legends at Unity..

    As for the scale issue mentioned by @Nubeh , this is from UnityQA "No the scaling of your obejcts is not an issue. In your case just make sure you tick "Generate Lightmap UVs" on the importer."

    Looks like I got some long weeks ahead of me of selecting every mesh and ticking Genetate lightmap UVs, I dont think this can even be scripted!!

    And in response to my main GI bug (which includes most of this S*** we spoke of basically "GI is extremely slow to compute even on simple scene"):

    "I'm writing regarding an issue you've submitted a while ago.
    We have fixed it and the fix will be available in the upcoming Unity 5.2 release.
    If you are still able to reproduce it on the mentioned Unity release, please respond to this email."

    So folks, lets hope :) I have not upgraded Unity since last time I did Adventure Creator lost all my cool stuff, so I will wait until 5.2 and try again. Good luck folks!..

    Gaz
     
    Kragh likes this.
  47. mindlessblahs

    mindlessblahs

    Joined:
    Nov 27, 2013
    Posts:
    6
    You know that you can edit this for multiple objects at a time, right? So you can select them all and tick them all at once. I hope this helps :) Btw we do have an import script, which automatically sets all new fbx we import to the values we agreed upon beforehand. I'm no coder, though, so I can't help you with how to do it, but it's possible :)
     
    essimoon2 likes this.
  48. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,727
    In my opinion, people can benefit greatly from a more detailed log file. Currently the log file does not show a whole lot of info regarding the lightbaking process. Why cant it generate a more detailed file so that people can look at this log and see what is going on, what EXACTLY failed, what exactly was it doing at a particular time that it failed?
    Showing a log that simply says "Bake failed" is not sufficient. Or simply saying "doing stage 11/16 " is also not sufficient to TS issues. I have tried lightbaking my scene for a week now and am gradually stripping things out of the scene to isolate the issue.
     
  49. sdmattos

    sdmattos

    Joined:
    Jan 11, 2015
    Posts:
    7
    So lightmapping still broken then? A work around that I got to my scene to bake before was to switch from directional to non direction in the lighting window....but not now since I got 5.1
     
  50. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,593
    @TTTTTa I agree i have been asking for this for a while, I believe a dodgy model could be identified and binned using that!

    @mindlessblahs good point although cant select them all, but I can select large groups of them so maybe it wont be such a bad time I may try that tonight..

    I havent tried latest one again yet, and 5.2 isnt out yet so Im waiiting. When I did try it a lot of my level was lost (not due to unity as such but the upgrade of proj and one asset). But for anyone still having hassles you definitely have ticked generate light map UVs in the import setting of each model used? And lets wait for 5.2 yay!