Home Unity

Enlighten In Unity 5 :/

1
StormyBA
polycounter lvl 9
Offline / Send Message
StormyBA polycounter lvl 9
Very unimpressed so far and thought it'd be worth getting a post up to find out other peoples experiences are. It's a real shame because Enlighten seems great as a real time solution and it looks great in frostbite.

But right now as a baking solution in Unity its very very broken - This is a massive issue for the Unity guys because most people that are using unity are making Mobile games and have no chance of getting games working with real time lighting! We really heavily one the quality of our light bakes to boost the quality of the look of the art work - its a big kick in the teeth when are are unable to produce the quality we saw with Beast in Unity 4.

Guess I'm just curious about how others are finding it, what issues they have and what they are currently doing to work around them. We have now moved onto serious discussions about how we could do our light bakes in Modo or how we can try to hack beast back into Unity 5... We are that desperate.

I'll also share a quick screen grab of front page of the Unity GI sub forum. A lot of people are unhappy - there is a real sense that this tech was added to make a great looking stage demo on a high end PC with very little thought about the end users who's big focus is mobile development.

T9w79RB.jpg

Replies

  • skankerzero
    As my team finishes their first game and are getting ready for the next, this is the subject that scares me the most.
    I really hope they fix all this asap.
  • StormyBA
    Offline / Send Message
    StormyBA polycounter lvl 9
    I think the general thought here is if we had known in advance we would have stuck with Unity 4 and introduced a PBR workflow into Unity 4. We are far to far down the line in production with unity 5 now to switch back.
  • skankerzero
    We're going to be testing the waters with Unity 5 in October. I doubt things will be resolved by then but it would be nice to transition for the next project to take advantage of some of the other new features.
  • Lt_Commander
    Offline / Send Message
    Lt_Commander polycounter lvl 10
    Yeah enlighten has become a thorn in my side. I've been pulled off from doing environment art for our indie game and my job in recent weeks has been almost solely to at least get our assets to not look broken. It seems like every day I run into new and exciting bugs and crashes - just yesterday, environment probes completely broke if they were using HDR. I recognize that image you posted - I was looking for information on that subforum a few hours ago.

    It's frustrating because we don't really have a dedicated tech artist and, as an indie, we don't have much room for an engine wizard. Although I'm best suited to do the work on my team, it's still not my wheelhouse. I'm really hoping my next project is on another engine - I miss playing with UE4. Hell, there are things that the source engine handled better!
  • Eric Chadwick
    Yep, I just dove into this yesterday for a client job. We had to switch to the real-time GI because the lightmapping is so broken. The real-time GI is neat in some ways, great for time-of-day changes. But it leaks like crazy, and has lots of other errors.

    From what I've read, Unity Tech is aware of the problems but they're not high priority. :(
  • Lt_Commander
    Offline / Send Message
    Lt_Commander polycounter lvl 10
    Oh, also, don't trust unity's lightmap UV generator. I was using auto-unwrap for a 12 face object (a ceiling tile) that was repeated a few hundred times per scene, and we were getting lightmap snapshots in the 200 MB range. On a debugging pass, I generated my own lightmap UVs for the mesh and our snapshots went down to 65MB, not to mention faster clustering and bake times, plus the added benefit of intelligent UV densities for the object.
  • Avvi
    Offline / Send Message
    Avvi polycounter lvl 3
    Yeah, Enlighten has many problems. For static scenes, bake quality vs time is in most cases worse than Beast.

    U5 users should remember that now you have to set lightmap resolution of an object in two places: the old slider (which is for baked) and GI resolution (a dropdown list below).

    Lt_Commander: good to know thanks. So you use Preserve UVs tick box? Or it's a different thing you're talking about?
  • Shadownami92
    Offline / Send Message
    Shadownami92 polycounter lvl 7
    We've been having problems on a project I've been working on too. Though our work around is to make a workflow that uses Blender Cycles to bake lightmaps. So far I've had pretty good results on my test scenes with it, though I've had to create a custom shader in Shader Forge to get it to work.

    But the payoff is well enough to work with it I think, With Blender's Texture Atlasing addon it makes things easier and being able to bake quality lightmaps in minutes rather than a day or more is a plus. Also by using blender our team can split the load and we can all bake lightmaps on different computers to get things done faster.

    Here is a screenshot of one of my Cycles Lightmap tests.

    GsoWVhy.png
  • Eric Chadwick
    Trouble with baking externally, is you have to layout your game levels in your 3d app, instead of inside Unity. This makes it a pain to iteratively improve the levels.
  • echofourpapa
    Offline / Send Message
    echofourpapa polycounter lvl 4
    I haven't had much trouble with Enlighten, honestly. It seems to work pretty well if setup correctly.

    The biggest gotcha I've found is the "Auto" or "Continuous Bake" check box(depending on version). If you leave it checked it's a nicer workflow for making changes, but if you are working with a team(over version control) it will not cache the lightmaps with the scene in Assets. You have to uncheck "Auto" and then click bake. It won't rebake(Unless you made changes), it will save the light maps out as .exrs in the scene folder. Now it can be shared with a team. If Auto is left on the other members of the team will have to rebake from scratch.
  • echofourpapa
    Offline / Send Message
    echofourpapa polycounter lvl 4
    Oh, also, don't trust unity's lightmap UV generator. I was using auto-unwrap for a 12 face object (a ceiling tile) that was repeated a few hundred times per scene, and we were getting lightmap snapshots in the 200 MB range. On a debugging pass, I generated my own lightmap UVs for the mesh and our snapshots went down to 65MB, not to mention faster clustering and bake times, plus the added benefit of intelligent UV densities for the object.


    I've run into issues with the auto light map UV settings in Enlighten too, however Unity's FBX imnporter has a Generate Lightmap UV options. On one of the Unity forums people were saying that an angle of 120 gets pretty decent results and so far I can't complain. Rather than manually assigning lightmap UVs in a modeling program, give that a shot. Unity uses a bunch of different channels for different lighting things. When I find the doc link I'll post it.
  • Lt_Commander
    Offline / Send Message
    Lt_Commander polycounter lvl 10
    Yeah, we were using the FBX importer lightmap generator (the checkbox) with default settings and getting those results. I couldn't find anything talking about best practices when I was using it though, so that could have something to do with it.

    Unlike in UE4, I couldn't find any way to look at the generated map flats - I had no idea what the sliders were doing in reality. Because of that and the insane difference between my own vs auto-geneated results, I have lost all faith in that feature.
  • echofourpapa
    Offline / Send Message
    echofourpapa polycounter lvl 4
    Yeah, a layout preview would be nice.
  • echofourpapa
    Offline / Send Message
    echofourpapa polycounter lvl 4
    I thought you were talking about the auto UVs in this feature: http://docs.unity3d.com/Manual/GlobalIllumination.html

    Also, here's what the different UV channels are for: http://forum.unity3d.com/threads/quick-setup-for-starting-enlighten.309609/

    UV0 is typical UVs
    UV1 is Baked GI
    UV2 is Realtime GI
    UV3 is open.
  • Lt_Commander
    Offline / Send Message
    Lt_Commander polycounter lvl 10
    Thanks for the heads up on UV use! I'm guessing realtime GI falls back to UV1 if there is no UV2 - at least I hope so.

    We're doing bakes off of procedural level generation, so I have very little control over the end result of the overall lightmap layout - the plan is to be as hands off for the last pass as possible since we'd ideally want end user servers to generate and bake their own levels as a single button press without our input (hopefully).
  • Avvi
    Offline / Send Message
    Avvi polycounter lvl 3
    I couldn't understand "Preserve UVs". Then I found that it always splits hard edges.
    Thanks for the info on UV2.

    XyrmRor.png
  • StormyBA
    Offline / Send Message
    StormyBA polycounter lvl 9
    Unity 4 we got much much much better results from creating all lightmap UV's manually in MODO. We did all mapping in MODO, we had a custom Unity packing script which helped us get a got 98/99% lightmap usage and the script also forced unity to only use one lightmap. This seriously saved hours and hours of time which was previosly wasted from baking over and over with small adjustments to get us down to one lightmap. Bit of an example below of how much we got out of the lightmaps

    Unity 5 has changed a bunch of packing so our old method of doing these things does not work - along with the general bad quality / broken baking its been a massive kick in the teeth for the team :(

    0077SEa.jpg
  • echofourpapa
    Offline / Send Message
    echofourpapa polycounter lvl 4
    I haven't had much problems in the ways of broken baking. Except for this strange problem of static geometry getting scrambled when sharing over git. I don't know if anyone else has had this same problem, but when I build a scene on one machine cache, save, commit(not the lib, but assets) and push, when I pull it down on another machine the scenes will breakapart and scramble geometry when loaded at run time. They look fine in the editor, but not while playing.

    Probably not entirely related to Enlighten, but it's used at the same time.
  • Avvi
    Offline / Send Message
    Avvi polycounter lvl 3
    echofourpapa: Yeah, we have exactly the same issue. You can try pulling the LightmapSnapshot too, from scene's folder. Remember to do it while Unity is closed. If that doesn't help then well... rebake on each PC. (It's related to static batching somehow, as non-batched meshes don't have the problem.)

    StormyBA: Sad to hear. It sounds like a crazy amount of work.
    We had another packing optimization problem: Beast allowed for rectangle lightmap UVs. Enlighten leaves the rest of the square empty :/
  • StormyBA
    Offline / Send Message
    StormyBA polycounter lvl 9
    We had to hack into unity 4 the ability to have rectangular maps. Bascily we had to create our own packing and light mapping system. A real simple fix for a lot of the problems is to just allow the user to see the packing before the bake.

    Modo makes doing Lightmap UV's mega easy, particularly with buildings and environment props ie, Lots of squares and few organic shapes. Again, made a massive difference to the final quality of the product. All I do.....

    Atlas Unwrap
    Relax
    Rotate Vertical
    Pack
    Done

    Takes about 10 seconds! The UV tools in modo completely blow the competition out of the water. Well worth checking out.
  • echofourpapa
    Offline / Send Message
    echofourpapa polycounter lvl 4
    Avvi: I'm trying to avoid per-machine baking, since our builds are automated on our own build servers. I'm testing out the cache server, in hopes that it will just pull in changes rather than any auto-recalc nonsense happening on re-import after a git pull.

    StormyBA: thanks for the tip. I'm going to have to check that out. Are those in 801? I'm got an 801 floating licence I can grab, I don't use it much though. Also, Max's Flatten Mapping can work well enough most times too.
  • StormyBA
    Offline / Send Message
    StormyBA polycounter lvl 9
    Yea I'm on 801 - sounds like we are waiting for a 901 sale before we jump ship onto the new version.

    To get the best speed out of it you really do need to customize the interface a bit. You can create star menu's much like maya has - I have one with all my UV tools, hit space and it all pops up :)

    There are some other sneaky tricks working with a few different types of pack settings to not adjust scale. You can then say put -50% resolution on unimportant objects and pack again. Its pretty win and got some great results on CSR + Classics.

    So a quick example - bit of a tunnel / car park type env.. Did an atlas, Relax, Rotate to vertical + pack.. This was the results.

    K6aQxEy.jpg

    Another nice feature is you can show relitive scale / distortion in the UV editor... all colour coded for ease of use! Really quickly shows up any dodgy bits of UVing
  • StormyBA
    Offline / Send Message
    StormyBA polycounter lvl 9
    I wonder if it would be possible to use substance as a bit of a bridge to get your lightmap UV's out of unity, bake in an external program and then get back into unity?

    Thoughts? I dont know much about this kind of thing and perhaps some other people do!
  • Eric Chadwick
    I did some research into Unity export tools (to get edited meshes out of Unity).

    Mesh Toolkit is the best I've found.
    https://www.assetstore.unity3d.com/en/#!/content/18552

    There's also Export2Maya, but it failed for me in Unity 5.
    http://forum.unity3d.com/threads/export2maya-export-unity-scene-to-maya-scene-file.235241/

    Also looked at the ExportOBJ sample, but that doesn't support vertex color, which I need.
    http://wiki.unity3d.com/index.php?title=ExportOBJ
  • StormyBA
    Offline / Send Message
    StormyBA polycounter lvl 9
    It's a hard one because it's not just spitting out a mesh - It needs to have all that UV2 data from the unity mapping pack and then it needs to bring that mess back in and know to use the UV2 of that imported mesh without packing it again. I guess you would need to mash your environment into one big mesh and have a separate scene with that munged mesh.

    It'd be great to be able to transfer a mesh from unity 5 into unity 4, maybe bringing the unity 5 lightrig - do a bake and bring it back in? I believe that unity call's in these renders anyrate. It might be that you could reroute unity 5 to use beast.
  • pigselated
    We have found the cause of the splitting. It is basically because during mesh import vertices can be duplicated when there is a hard edge in the mesh. This will cause the packing to consider each side of the edge as separate UV islands. We have a fix for this incoming in Unity 5.3 and depending on the complexity of the fix we might be able to backport to 5.2 also.

    Thanks for reporting this.

    PS: I am compiling a document on UV handling related to GI in Unity (https://goo.gl/bHsCyq)
  • Eric Chadwick
    Fantastic doc! Thanks for sharing this, very helpful so far.
  • StormyBA
    Offline / Send Message
    StormyBA polycounter lvl 9
    Anyone having much luck on this stuff - any new tips + tricks or ways of getting bakes done outside of unity?

    Must say we are still struggling a fair bit, especially now we have important regular builds that need bakes and given the system a real hammering. The results are so random and the quality is still bad.
  • Eric Chadwick
    We're able to use the lightmap baker without too much hassle. Our scenes are very simple though, for mobile. Usually a terrain with less than 50 meshes. We make custom lightmap UVs in 3ds Max, to hide the seams, and many of our meshes use light probes instead of the lightmap. Blob shadows.

    I can definitely see how frustrating it would be with anything more complex than this.
  • monster
    Offline / Send Message
    monster polycounter
    Rendering Baked GI in Unity 5 happens in two phases. The Precompute and the Bake. The Precompute phase happens with both Realtime GI and Baked GI, but the Bake phase only happens with Baked GI.

    The only way to see the complete render time is to open the Unity Editor log file and look for both the Bake time and the Precompute time. You can open the Editor log from the options button of the Console tab.


    Problems for Baked GI:

    1. The main issue we have been facing is render times for Baked GI. Baking a level with Default-VeryLowResolution can take north of 8+ hours for one of our levels. And this is no where near ship quality.

    2. Another huge issue is the number and visibility of seams created at bake time. This is do to the way the second lightmap UV channel is being split. You can see these if you make a simple scene with sphere on a plane and bake. The sphere will have several seams since it's box mapped by default. The "Edge Stitching" from the document above just doesn't work.

    Solution:

    We've been able to get a acceptable bake times and minimal seams with this solution. (Though the results are far from perfect, and no where near Unity 4 quality.)

    To speed up bake times select all Lightmap Static objects, open the Lighting tab, then go to Object, uncheck Preserve UVs and change Auto UV Max Distance from 0.5 to 50 and Angle from 89 to 180. This will reduce quality, but tremendously decrease render time.

    This is because you have reduced the number of UV Charts calculated in lighting. You can see the UV Charts in the render modes at the top left of the Scene view. A better name for UV Charts would be "Light Emitting Surfaces". The UVs are simply used as a way to tag polygons, and have nothing to do to the way textures are applied to the models. A default box is 6 UV Charts, hence it's the cost of 6 lights at render time. Changing it's settings to the above will make it cost one light. In practice this reduced the Precompute phase of one of our levels from 4 hours to 30 minutes. The Bake time remains unchanged about 3 hours.

    This solution also fixes the number of visible seems because each UV Chart is emitting light and the seams are not blended. That's why the sphere in the above example has seems. The seams are not visible if using Realtime GI, but we need Baked GI for performance reasons.

    Other problems:

    3. The Auto UV settings above help bake times and reduce the number of seams, but lighting quality suffers a little. If you have an object half in shadow and half in light in one UV Chart, the entire surface will bounce light from one particular spot instead of averaging the entire UV Charts surface. You can fix this a little by adjusting the Auto UV settings per object, but you'll be re-introducing problem 2.

    4. There seems to be no super-sampling happening at render time. So an object casting a shadow on another object or itself is going to look super jaggy. The only workaround is to up your resolution, but see problem 1.

    5. Ambient Light, unlike every other ambient light feature, cast light inward as if it was a solid color Image Based Light. In Unity 4, Max, and Maya ambient light is more of a minimum light value. If you have an indoor scene, ambient light in Unity 5 is useless.

    6. Realtime lights are baked with Baked GI. This is because Realtime lights affect the Precompute phase, and the Precompute is used in the Bake phase. We had to make a simple script to enable lights on Start().

    7. Light probes don't match Baked GI, but they do match Realtime GI. This problem is intensified the more you use lights above 1 intensity.

    Hope this info helps!
  • passerby
    Offline / Send Message
    passerby polycounter lvl 12
    ya the new lighting system has caused me no end of problems while working in production. I just want the old beast system back.

    The light probes issue is dealt with in 5.3 beta, also lightmapped terrain is broken if doing additive level loading. Since when a new scene loads in, its terrains will reference the wrong lightmap id's
  • cptSwing
    Offline / Send Message
    cptSwing polycounter lvl 11
    After horrible experiences with the new baking system on a project for mobile platforms recently, it's such a massive relief being able to use real time lighting only for our current (PC) project. What a pain it is, and it's been taking them some time to fix, unfortunately!
  • passerby
    Offline / Send Message
    passerby polycounter lvl 12
    cptSwing wrote: »
    After horrible experiences with the new baking system on a project for mobile platforms recently, it's such a massive relief being able to use real time lighting only for our current (PC) project. What a pain it is, and it's been taking them some time to fix, unfortunately!

    well i have direct contact with unity, so been getting them to fix a lot of light related issues blocking my work. Problem is most of these issues they say they cant backport to 5.1 or 5.2, and im not too keen on the idea of using a 5.3 beta for production
  • cptSwing
    Offline / Send Message
    cptSwing polycounter lvl 11
    Well, it's relieving to hear about them fixing things, at least ;)
  • passerby
    Offline / Send Message
    passerby polycounter lvl 12
    cptSwing wrote: »
    Well, it's relieving to hear about them fixing things, at least ;)

    ya the problem with light probes seem to be resolved, giving you results closer to what the lightmaps are. What im still fighting with is issues with light-mapped terrains when doing additive scene loading.
  • skankerzero
    This really makes me scared of using Unity 5 for our next mobile project. Our projects rely heavily on pre-computed lightmaps since we have no real-time lights.
  • Eric Chadwick
    We're using lightmaps/probes only, for iOS, and it's not too horrible.
  • passerby
    Offline / Send Message
    passerby polycounter lvl 12
    This really makes me scared of using Unity 5 for our next mobile project. Our projects rely heavily on pre-computed lightmaps since we have no real-time lights.

    its a rock and a hard place. Since it is really hard to deal with large projects in the old 32bit unity 4 with it always crashing the editor due to lack of memory.

    I can so for the most part, it works now, and 5.3 should resolve a lot of lighting problems. But im still finding issues with doing additive level loading and lightmaps. For levels loaded the normal way everything seems to work ok skankerzero.

    You just need to try and get bake times down, which i did by using probes to light most small objects as opposed to giving them lightmaps, than greatly taking down the lightmap scale on terrians and really customizing light-map scale per object. This helped reduce baking time as well as optimizing the amount of lightmap texture space needed.

    The other issue i have been hitting, is doing 2 sets of lightmaps, since there is a day and night to the games im working on level. This is possible to due but is very hacky and required my own code to do so.
  • Lidfrid
    Offline / Send Message
    Lidfrid polycounter lvl 8
    @Passerby. I feel you.
    I have the exact same problem. Can't use lightprobes cause using Application.LoadLevelAdditiveAsync() makes them totally black. I can't understand why...

    i tried using Lightmapping.BakeLightprobesonly (or something similar) and it doesn't seems to work.
    If you find a solution don't forget me :)
  • passerby
    Offline / Send Message
    passerby polycounter lvl 12
    Never had problems with light probes going black. But you do know Unity cant add to the existing light probes at runtime, and will just use the probes from the first scene loaded.

    To get around this, i have a little editor script that iterates over all my additive scenes, grabs the light probe positions, and the light probe coeffecients, than goes into my first scene and combines all that data into it.
  • Lidfrid
    Offline / Send Message
    Lidfrid polycounter lvl 8
    Then i can't explain to myself the existence of this page: Lightmapping.BakeLightProbesOnlyAsync

    Does your script do the job? :open_mouth:It would be cool to give a look to that script...
  • passerby
    Offline / Send Message
    passerby polycounter lvl 12
    It does what it sounds like, bakes just the lightprobes in async mode so it dosnt block the editor. Just keep in mind that the Lightmapping class is a editor class so cant be used at runtime.
  • StormyBA
    Offline / Send Message
    StormyBA polycounter lvl 9
    Sounds like we are "giving up" on the unity lighting tools and are looking into how we can use modo for the bakes. At the end of the day the lightbake is just an image so no reason not to bake it else where. 

    In terms of light map UV's changing... Sounds like the plan is to bake the environment into one mega mesh, spit that out to freeze all those light map UV's and then bake. Will mean having live working scenes and then game scenes which are baked. Not really ideal but having had conversations with other developers it seems like it is going to be less of a head ache and will achieve better results in the long run. 
  • dzibarik
    Offline / Send Message
    dzibarik polycounter lvl 10
    StormyBA said:


    In terms of light map UV's changing... Sounds like the plan is to bake the environment into one mega mesh, spit that out to freeze all those light map UV's and then bake. 
    do you develop for mobile?
  • StormyBA
    Offline / Send Message
    StormyBA polycounter lvl 9
    The above seems to work pretty welldzibarik said:
    StormyBA said:


    In terms of light map UV's changing... Sounds like the plan is to bake the environment into one mega mesh, spit that out to freeze all those light map UV's and then bake. 
    do you develop for mobile?
    Yes we do. Baking outside of unity has produced great results. Well worth trying.
  • monster
    Offline / Send Message
    monster polycounter
    This is a workflow we tried.



    1. Import models into Unity, generate lightmap UV's on import when necessary.
    2. Construct level.
    3. Do a super low quality bake so that Unity does texture atlasing for the lightmaps and saves ugly lightmap textures.
    4. Our custom OBJ exporter exports the level using the lightmap UV offsets baked in. One giant object per lightmap.
    5. Import into 3ds Max and bake with wonderful Mental Ray networked with Backburner.
    6. Replace the textures.

    It works really well, but we hit a few snags that prevented us from using it in development.

    • The tedium of updating level geometry and sending it through this pipeline.
    • Only the art team has 3ds Max.
    • We lose bounced color from textures and vertex colors.
    • Light Probes didn't match.

    We could have found solutions for all these, but gameplay comes first.
  • StormyBA
    Offline / Send Message
    StormyBA polycounter lvl 9
    Our method is similar - we have a custom UV packer in unity that forces it to use all the space with out going over to a second light map texture. We then have an export for modo button which..


    Creates a dirty lightmap, its just a random color on each object in the uv's
    It spits out an obj file
    Lastly it projects all of our albedo texture detail onto the uv2's and saves into a new texture. This is of course a low resolution representation of the world's detail but it is enough info for the color bouncing.

    From here we just bake in modo.

  • Eric Chadwick
    Do you use light probes? I'm curious how that works with baking in Modo.
  • StormyBA
    Offline / Send Message
    StormyBA polycounter lvl 9
    No we are not using either the unity light of reflection probes. When we tried a wile back they were broken and expensive but we have implemented other tech that gets similar results that are cheaper. All though not as great quality they do a similar job.

    So light probe wise, rather then imaged based lighting we just have a solid color and range. The character can be lit by 2 at any one time but we are traveling through the environment very fast so its easy enough to ground the player.

    For reflections, we have gone down a cube map route. We place an object in the scene to fill the interior of a building for example and bake the cube map for that box. As a player you then travel through that cube map rather then the cube map traveling with you ?hope that makes sense). Our scene will have a bunch of these and the cubemaps blends and switches as you travel through them. Again not as accreate as reflection probes but very cheap and the speed we are traveling means we can get away with it. We are hoping to incorporate this into our pbr workflow soon as well rather then the directional lightmap.

    Correct me if I'm wrong though, would you not be baking light and reflection probes in unity after you have applied the lightmap?
  • Eric Chadwick
    We're using a lightmap and probes, we don't have reflections. Non realism art style.

    Some seams here and there, to solve this I just give those objects a bit more scale in the lightmap, and they disappear.

    With our style we don't need a dense probe grid, so that seems to help keep the cost down.

    The worst issue I've had so far is with shadow bleeds, where flat meshes are butting up against flat terrain... i.e. a cliff mesh stuck into a plateau in a terrain. Need to cover with deco meshes I guess. (We convert terrains into meshes too as a pre process, to reduce the cost)

    Otherwise the baker hasn't been bad. We're not stressing it much though. 
1
Sign In or Register to comment.