lassade / Sprite2DBakedLighting

Unity enlighten does not bake lighting into sprites. This script reaplace (temporarily) every sprite in the open scenes by a mesh so the ligth can be baked and then transfered for the SpriteRenderer.
MIT License
30 stars 3 forks source link

Mixed lighting #3

Open ollieurso opened 6 years ago

ollieurso commented 6 years ago

First off, thank you so much for making this! It's been a lifesaver.

Onto the issue - this works really well with baked lights, but I haven't managed to make it work with mixed lights, even though they're mentioned in the readme. I'm a newbie to lighting in Unity and no tutorials I've found have made me understand what could be the issue here.

Basically, if I set lights to Mixed instead of Baked, they don't appear at all on the lightmap. Moving them around changes the light even on static objects. Do I have to adjust something in the Lighting settings to make them work, or is it a different issue entirely?

Thanks!

lassade commented 6 years ago

I'm having some trouble in using mixed lighting mode now. Back when I wrote this add-on mixed lighting was working, but I don't remember if I fully tested it.

Some of my mixed lights in the Demo scene disappear (go figure). There is also another issue #2 that I did not patch but the issue was solved.

I'm also not very experienced with lighting at all, and for the looks of it mixed lighting serves as a way of having some kind of indirect lighting for lights that aren't static. Since your game is 2D (I presume) maybe considering using baked/real-time lights could be a good idea?

ollieurso commented 6 years ago

Thanks for the quick reply! I've been experimenting with a mixture of baked and real-time lights and it seems I can get most of the effects I want with this combination. Any mixed lights that I attempt to use simply don't show up on the lightmap and appear to act more or less like real-time lights instead, so I guess in the end the visual look is more or less the same. The only other issue I've encountered so far is that any sprites in draw mode "tiled" that have their "width" or "height" property changed reset back to default width/height during the mesh conversion process. Reverting them to sprites after baking results in the lightmap being slightly off, since the extended part of the sprite that was tiling was hidden during baking. sprite_01 sprite_02 sprite_03

lassade commented 6 years ago

I never considered "tiled" sprites in my tests so it's not supported right now, but I'm pretty sure it's not that hard to implement.

What you have to is basically use both width and height properties to create a bigger mesh (change the scale of the mesh), the texture may look stretched while in "mesh mode" but it should look right once you convert back the sprites.

ollieurso commented 6 years ago

Okay, I'll give that a try - thank you!