TheGameCreators / GameGuruRepo

The GameGuru Repository For Community Collaboration
http://www.game-guru.com
137 stars 56 forks source link

Support for Static Lights and Baked Lightmaps #4074

Open davetgc opened 1 year ago

davetgc commented 1 year ago

I've seen several uses mention the limitation of dynamic light across the board, especially on very large or complex maps and as we know,it can have a performance hit.

Should we be considering a static light system as well as a dynamic light, where shadows are pre-rendered to a lightmap? There dynamic lights could be used more selectively and to greater effect.

Bear in mind that lightmaps take some time to generate, and so we might want an option to generate via a button, rather than on every test build.

Thoughts welcome?

MonkeyFrogStudio commented 1 year ago

Lightmaps should never auto-generate (in my opinion). Even Unreal lets you know that the lighting has changed and your lightmap needs to be updated instead of just auto-generating a new one. So, yes, lightmaps would be great for many situations, and no, they should not just autogenerate every time someone starts a test game.

Secondly, since the viewport shows us what we see in game graphically (i.e. lights cast shadows in the viewport, etc.), then we should be able to generate and update the lightmap and see it in the viewport, too. Again, engines like Unreal have this feature as standard (that you generate the lightmap and can see the end result in the editor).

ShadowMasterOfGames commented 1 year ago

Even the new wicked engine has that feature the @MonkeyFrogStudio mention above

synchromesh62 commented 1 year ago

Ironically i just did a vid about all of this .. Max allows up to 16 lights to cast shadows in one area ( distance detected ) so you can mix and match lights with enabling " Do not cast shadow " on many you really do not need to use with shadows. As soon as you move far enough away from the area the shadows are turned off and enabled in the new area so no matter how big your map is the most your using is 16 lights with 16 shadows as the vid below shows ... The first section has 18 lights and shows the 2 extra being enabled as i get close ... As you leave the area and enter another you have a new set of 16 lights casting shadows .. https://youtu.be/Npx9JM_AIc0

Kravenwolf commented 1 year ago

I imagine static lights would offer one hell of an optimization for VR games. Pre-calculating static lightmaps instead of doing it twice every frame in real-time for dynamic ones (that is how VR works, yes?).

In any case, I'm a strong believer that ANY feature that is a part of Classic should be carried over into MAX, as was the case with SSAO. There shouldn't be a single case where someone using MAX is looking for a feature from it's 2015 predecessor and realizes it's not an option for them. Nothing "MAX" about that at all.

davetgc commented 1 year ago

I'm putting this out toe @LeeBamberTGC and @ZakJudges . We already have a similar system in Classic, how portable is that?

MonkeyFrogStudio commented 1 year ago

@davetgc Wicked has a lightmapper. At least it did. Even a voxel lightmapper. It seems to me that it would make sense to wait until the DX12/Wicked integration is finished, then we'd have access to Wicked's lightmapper in MAX.

synchromesh62 commented 1 year ago

Have not really ever used the lightmapper in Classic. But from what i remember shadows are static which was fine for Classic as it did not have Dynamic shadows at all. But wont that just mess up the Realtime shadows? Picking up a box, using a flashlight ? If not and the shadows are still active, what would be the point ?

davetgc commented 1 year ago

No, as all non static objects, will use the realtime lighting It would only be static objects that would use the lightmapper. It's possible this could mess with a day and night system, but IMO the benefits outweigh the disadvantages.

Granada1 commented 1 year ago

Great for cutting down on real-time lights in a level

synchromesh62 commented 1 year ago

No, as all non static objects, will use the realtime lighting It would only be static objects that would use the lightmapper. It's possible this could mess with a day and night system, but IMO the benefits outweigh the disadvantages.

Ahh ok i just had visions of the flashlight casting other shadows but still seeing the lightmapped ones etc which to me seemed would look a bit odd plus to cast realtime shadows indoors for movable objects you need a dynamic light which again could look off. Im probably way off but just seemed logical to me that would be the effect when mixing.

davetgc commented 1 year ago

My thinking would be that maybe realtime shadows are used close up, for things like flashlight, day/night, etc, with the baked map used further out. I'm only really putting out ideas atm.

OldFlak commented 1 year ago

Please don't use GGc's light mapper - it never worked properly, not to mention the bloated fpm as a result, and in most cases there would be somewhere on the map that the LM destroyed.

If wicked has one, why not use that?