Shadow Casting Point Light
tracked
Dreaming Mole
We need this feature to bring more realism to the way point lights behave and avoid light leaks such as this one: https://gyazo.com/7118f6d694c39a9d83acbfe0ea62153a
Log In
Spidey Linden
tracked
Issue tracked. We have no estimate when it may be implemented. Please see future updates here.
elfteam6redleader Resident
I doubt it's the tech behind shadows that's the problem so much as it's the shear amount of mesh on the screen. Like certain types of reflections, I suspect that each shadow casting light requires a camera, which must put up with all the crappy stuff we put in SL (1M tri t-shirts that say LOL). If the world is static, you could "bake" the shadows and lighting in, it would be brutally complicated to program into a legacy app like this, but at least there wouldn't be a devastating performance hit on the user. Whether you can stomach not casting shadows yourself, however is another question. Vampires of SL rejoice!
The simple solution, though... that uses a camera and... each camera you add will have fun consequences on your FPS - even though the replacement shader in use is relatively simple. Moreover SHARP shadows are even harder to achieve. For directional lights you can use cascading shadow maps, but I'm not sure if there is an equivalent for point lights. Instead you might end up just cranking up the camera resolution to avoid "pixelaxed" shadows that twitch horribly across the ground. AI up-scaling tech might be useful for that, however.
Compare all of the work for that to just a point light source... which is probably just a added as a location uniform, looped through and each shader does a N dot L calculation... or maybe they're using the Disney BRDF since they moved over to PBR? Even still, shadows are not cheap - I mean, there are entire books written on this subject and this subject alone.
That is probably necessary reading before trying ANYTHING like this. It's 2024 and game engine dev is still hard as H-E-Double Hockey Sticks!
EDIT: Also, because it's a camera, instead of doing a quick calculation inside of each shader, you will also be doing a texture lookup - which is significantly more expensive. XD I get it, but I also get why they might not...
Kuuko Shan
Definitely a must have. It's 2024 and we still haven't those. It's not like asking for extreme high tech innovation after all.
We also should start moving onto different types of shadows. Cascade shadows are very limited in functionality and quality. And, while isn't necessary to convert every point light into a casting shadows one automatically, we should have the option there.
Vincent Nacon
Projected Light is what you need... but we're currently limited to 2 projected shadow casts at a time.
Point light is basically the "omni light", which by design, is intended not to have any shadow casting at all. Ideally, you should be using the omni lights with limited cutoff range, so that it doesn't bleed into another room.
Jenni Darkwatch
Vincent Nacon The problem with projected lights, at the moment, is that they're limited to just under 180⁰ which can be a problem.
In addition, if you only need shadow-casting light, without the added texture projection part, it might be faster? Not sure, I don't know how this is implemented in code.
It'd also be nice to have the number of shadow-casts configurable anyway, though I don't know if this would be in scope of this request.
Kuuko Shan
Vincent Nacon not sure of the purpose of your comment. It doesn't adds to the subject and you are misleading the type of light, which I guess you mean spot light instead.
The issue here isn't wether we can have shadows or not with "projectors", it's that we can't have them with the point lights. It has been decades since point lights cast shadows in games. Other than performance reasons, there is no other point to not have them. And performance it's something that should be decided by users. Having the option there won't hurt.
Vincent Nacon
Kuuko Shan Spot light and Projected light are actually the same thing. It's what being called in SL anyway. A bit strange naming choice in my opinion. 🤷♂️
The main purpose with the point light not having the ability to cast shadow is because of the performance cost, and it still is, even by today standard.
Most games design every room with a specific limit of lights that can only be contained in that room. That's why you will never see a window, letting you see many more lights with shadow in other places while being in the same room with so many light+shadow at the same time. I can't really imagine everyone gonna do this properly in SL. Not everyone is experienced as a game environment designer, a lot can go wrong and easily add up when we don't have a proper culling system or some sort of hard rules that dictate what a room is.
There is a shadow budget which is the number of the maximum amount of shadow maps allowed to be rendered in a frame. Usually, the closest lights are prioritized, but screen space area occupancy could also be taken into account.
Most modern games are cheating a bit with pre-baked lightmapping. We could do this, but once it's done, you can't change the world without uploading another lightmap texture to reflect that changes. This method is not dynamic. If we were to make SL do the baking, every item in your world must be loaded in and freeze for an hour or so (really depends on your hardware), so the viewer can render the baked shadows in the background. Save to local cache and then load it into your world. Move any static item and then the viewer have to repeat this process again. Not ideal. Unreal Engine and Unity Engine does this and still take them hours to render, depending on what lightmap's texture resolution they will use. There are faster methods, but that requires De-noising, which ironically will take further time to process.
We can ask for lightmap support, but we can't expect them to make it dynamically to the world in realtime.
If you wondered about using raytracing method... SL uses OpenGL and we'd need Vulkan to make that happen. That's no small feat for the developers.
Kuuko Shan
Vincent Nacon I know how lights and shadows work, I work with other engines so I am used to them.
Baking lights have nothing to do with this subject though, actual games rarely rely on baked lighting when they have dynamic illumination.
Still, point lights with shadows is available widely. And even if it have to be limited for performance reasons, it's still not enough weight to not include them nowadays. I don't think anyone is asking to get every single point light to cast a shadow, but those enabled and more relevant. Projectors already do this being limited to two, no sense to not do the same with point lights.
Vincent Nacon
Kuuko Shan Yeah I get that, both of them would be using the same shadow casting code if point light were to get the cast. As for why it's currently limited to 2... I don't know why. This topic does come up often at open office meeting over the years. I'm more convinced it might not be a hardware limitation thing, but rather it's something else.
Kuuko Shan
Vincent Nacon performance reasons probably. And I am fine with that but wouldn't hurt to have also point lights to cast shadows even if it's also limited to two and shared with projectors. I rather have the feature and option to use it than not. Limitations on numbers it's also something that could be seen later on.
Nowadays lights casting shadows are virtually unlimited in certain scenarios using virtual shadows. Those are definitely some major words, but we are moving towards Vulkan so a more update environment will happen eventually. If by then we have point lights casting shadows, they could be opened even more raising limitations and quality. But we have to start somewhere and even extremely old games have those.