TheGameCreators / GameGuruRepo

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

GameGuru MAX - Bug - Issues with More than 5 Point Lights #2021

Closed MonkeyFrogStudio closed 2 years ago

MonkeyFrogStudio commented 2 years ago

If you have more than 5 point lights in a scene, then the furthest from the camera will stop casting shadows. As you add even more point lights, others will stop casting shadows, even though they are close to the camera.

https://user-images.githubusercontent.com/36735507/153081583-3deb29f3-c805-49db-a223-733c1c469788.mp4

synchromesh62 commented 2 years ago

Only the nearest 4 lights can cast shadows at one time .. This is currently by design

MonkeyFrogStudio commented 2 years ago

That's ... terrible. Why? And in my video, 5 are casting shadows ... ;)

I mean, I get it that shadows can be heavy. But only 4 or 5? Especially with no lightmapper? Wow. I don't have this limitation in other systems that I use.

synchromesh62 commented 2 years ago

Even the Cellar demo does it. Its always been that way .. If you fill a corridor with lights the 4 behind stop casting shadows and the 4 in front will start casting shadows. To overcome this they added a cast shadow tick box to lights so you could only have shadows where you really want them although not sure if its enabled yet.

cast shadow

UltraVox001 commented 2 years ago

@ArgentArts

That's ... terrible. Why? And in my video, 5 are casting shadows ... ;)

A few more shadows were added in the latest build. But obviously that's not enough.

synchromesh62 commented 2 years ago

And in my video, 5 are casting shadows ... ;) That may be a bug and need putting back to 4. Just kidding :) Im going by the info Preben gave me when i asked him about the very same issue with my first Max Demo so maybe its been upped to 5 lights since then ?

UltraVox001 commented 2 years ago

The answer is here : https://github.com/TheGameCreators/GameGuruRepo/issues/1830

synchromesh62 commented 2 years ago

The answer is here : #1830 Not the same issue. We are referring to the amount of lights that can cast shadows at any one time.

LeeBamberTGC commented 2 years ago

We limit the POINT LIGHT shadows to process the nearest FIVE as they should be used deliberately and with care due to their performance hit (they render the scene SIX times per point light). Here is a typical shot of point and spot lights:

image

MonkeyFrogStudio commented 2 years ago

However, since MAX doesn't have a lightmapper, if we want to build indoor levels, we need more than 5 lights that cast shadows. Honestly, it should be up to the person(s) creating their game how many lights casting shadows they want to put in each of their levels. They can already control which ones cast shadows and which ones don't via the Cast Shadow toggle. Let the game-developer decide how many is too many instead of imposing a limit on the game engine itself. Warn them via the documents about how heavy a hit shadows are, but let the game-developer make the call, not the engine. What if I want/need six or seven for my game? I am running a fairly high-end system and perhaps I am targeting fairly high-end systems. I don't want to be restricted just because someone with a GTX970 wants to use MAX.

The solution is not restriction (i.e. forcing a restriction on how many lights can cast shadows), but either having both static and dynamic lights (and, thus, some sort of lightmapping for the static lights) or freeing up how many shadow casting lights there can be and sternly warning the end-user of the consequences of using too many.

I don't see TGC limiting the poly count of models or limiting the number of textures/materials used even though these, too, can really slow things down. Why place a limit here?

LeeBamberTGC commented 2 years ago

@ArgentArts Shadows rendered for the "nearest FIVE", you can have hundreds over the course of your level. I am currently fixing a bug so the cast shadow flag in the light properties works, before it was not connected up, thus not very useful for level design.

MonkeyFrogStudio commented 2 years ago

I know that it renders the nearest five. But there are instances where a level designer needs more than 5 ... a lot more than five. This is why most engines provide both STATIC and DYNAMIC lighting, so you can get as many static shadows as you require to bring your level to life, casting shadows from every little light source.

LeeBamberTGC commented 2 years ago

When you stated: "it should be up to the person(s) creating their game how many lights casting shadows they want to put in each of their levels" I assumed you referred to lights that can cast shadows for the whole level. Users can have every light they put down, cast a shadow, in fact this is the default. Most games that rely entirely on dynamic real-time lighting manage this resource carefully for performance considerations, and any solution needs to consider a level designed on a high-end rig running on a low-end rig. I think it will be a few more years before game developers can throw away the consideration of performance when lighting their scenes.

Perhaps you can send me a scene that needs more than five nearby lights, all casting shadows, and I will have a think about how this can be achieved in real-time (perhaps as a high-end only option). There are no current plans to use lightmapping for MAX but Wicked Engine does support a decent if basic light mapper so there might be options too for the lower end users down the road.

UltraVox001 commented 2 years ago

Personally, I am constantly confronted with this problem of light-shadows. These are not small 3D levels that are easy to make or play, like most simplistic demos are. These are scenes with very complex lights and shadows. The slightest step forward, or backward, makes all the shadows disappear in a very important visual area. It is so blatant that it poses enormous problems.

Maybe we should allow each light to cast shadows differently depending on the player's graphics settings : Low, Medium, High, and finally, Ultra.

Ultra graphics would allow the lights to be set differently than with lower settings intended for smaller machines. It's just a suggestion :)

UltraVox001 commented 2 years ago

Video games like Icarus (new Survival game on Steam) or Star Citizen, don't care about small machines. It is the choice of the developers of these games to be able to play only if you have a PC that runs on nuclear power. :) But it's an assumed choice.

MonkeyFrogStudio commented 2 years ago

Again, I realize that we can have unlimited shadow casting lights throughout our entire level. So, that's not an issue. It's that only the nearest 5 render shadows. In other engines, we have an option to control this by designating the light as a STATIC light or a DYNAMIC light, so we can make decisions, as level designers, what compromises we're willing to make.

As far as a level, just consider some of the interior levels created in GameGuru Classic, where we would place a point light by each light fixture so that it would cast a shadow, baking them in to add realism. Overhead lights, lamps, etc. ... they all affect the environment. But since we don't have a means of baking lighting, we are stuck with creating levels that look something less than they should due to this restriction on shadow-casting lights. You've not even given us SSAO, which WickedEngine has. So, again, the visual quality of our levels, as far as lighting is concerned, suffers.

MAX is a huge step up from Classic in many ways. But it somewhat suffers as Classic does ... though, in this case, in an oddly reversed way. In Classic, we couldn't have any (or more than one) dynamic light casting shadows. It was all about lightmapping. In MAX, it's all real-time lighting and no lightmapping at all. Why not both?

From what I've seen in the latest WickedEngine videos, his lightmapper looks to be a little beyond basic and looks to be pretty fast, too. But it's still being developed. After all, WickedEngine is not even at a full point release yet, but only at v0.6 or so.

LeeBamberTGC commented 2 years ago

@ArgentArts @UltraVox001 Let's look at this again after March, and see if anyone else struggles to create their dynamic scenes.

LeeBamberTGC commented 2 years ago

I will bump the max count to 16 for this weeks build to see if that gives greater wiggle room whilst keeping performance and memory in check (we have been doing work to reduce memory use in the shadow system).

MonkeyFrogStudio commented 2 years ago

Thank you! :) 16 sounds very reasonable. I will run some tests to see how it affects frame rates on my system and report them.

synchromesh62 commented 2 years ago

Thank you! :) 16 sounds very reasonable. I will run some tests to see how it affects frame rates on my system and report them.

16 is more than Leadwerk's so that's awesome plus if Lee enables the tickbox in light preferences for light entities to cast shadows or not that will be a game changer :)

LeeBamberTGC commented 2 years ago

@synchromesh62 Consider it done. Will be in this evenings internal build :)

MonkeyFrogStudio commented 2 years ago

Looking forward to testing it this Friday. :)

MonkeyFrogStudio commented 2 years ago

Did a simple test (not a complex level ... yet). Took the scene shown in my first post and made 16 helmets with lights in them, all casting shadows. I was still get 100fps on this level!

lights_16

I'll try to make time to put together a complex room with that many lights in it and see what happens to the frame rates then. But so far, this is looking good. Especially since I was running that at 3440 x 1440.

Thanks for increasing the shadows!

MonkeyFrogStudio commented 2 years ago

Made a quick (and crappy level) with 12 shadow casting lights and a bunch of MAX models to cast shadows. It's not meant to be pretty, but to just quickly see what my frame rates were. Here's a screen shot:

lights_12

Was still getting consistently 100 fps all through the level.

I'll have to wait until next month (too many work demands at the moment) to test this with an actual level, but it looks like MAX is handling the extra lights/shadows well on my system (1080 ti video card, Intel i9-10900K).

UltraVox001 commented 2 years ago

As I wrote in another post : Since Lee's last changes regarding the Cast Shadow option of lights and the increase up to 16 dynamic lights, some maps were running with 35-45 FPS, now render at 60 FPS constant. Tested on an old i5 with a GTX 1060 (6 Gigas), and 16 Gigas Ram. I congratulate everyone on this spectacular step forward. :) It's a military base in which there are more than 400 3D objects all around me : 60FPS

LeeBamberTGC commented 2 years ago

@ArgentArts Can this be closed?

MonkeyFrogStudio commented 2 years ago

Yes!!!