lewa-j / Unity-Source-Tools

Plugin to import resources from the Source engine in Unity3D.
GNU General Public License v2.0
109 stars 23 forks source link

TODO: Re-implement Commented Out Light Code #35

Open Fronkln opened 5 years ago

Fronkln commented 5 years ago

I recently have re-implemented commented out lighting code to recreate lighting entities and have it only apply to objects that are not a part of the map lightmap the results are very nice. Should be worth to have it added to this

Before: image After: image

Note: the bloom effect comes from Post-Processing Stack v2

lewa-j commented 5 years ago

SaracenOne already did that https://github.com/SaracenOne/Unity-Source-Tools

Fronkln commented 5 years ago

That applies to everything on scene though, it's not gonna look pretty, lightmaps are gonna become even brighter

Fronkln commented 5 years ago

Addittionally, i have written extra code regarding this that will help with spotlights as well

Fronkln commented 5 years ago

Another thing i have noticed, it "assumes" certain values of lights, not trying to make the best out of the data provided by BSP so it's more flexible

Fronkln commented 5 years ago

The fact that SaracenOne's applies to the entire map is VERY unoptimized as well, i'm guessing lights would constantly flicker (due to pixel light size and that the lights apply to ENTIRE map)

Let's assume that he raised the pixel light count to 60, at this point the game will start lagging due to calculating so much lights at once, his method can work on pre-loaded maps but it will absolutely KILL optimization if used at real-time

Now let's take a look at my method:

Light's are only applied to a few select layers (and never the entire map!) so unless there is like 30-60 entities wandering around the entire map, light flickers (Unity transitioning pixel light to vertex light) can NEVER be noticeable, my method also doesn't need to raise the pixel light count to disgusting amounts (like 30-60) and can work with 2-6.

Hope that clears it up.

SaracenOne commented 4 years ago

You're quite right about it being woefully unoptimised, but if I recall, I was enabling them with a very specific purpose, which was to simply use them for someone baking out entirely new lightmaps and probes from scratch.