- Home /
Number of light in URP and in Default, got some problem
I started my project using URP, cause i'm targeting mobile and i read that URP is better for performance. My game is a roguelite/dungeon crawler in a.. dungeon and because of that, the visual that i have in mind is something cool lighted/dark with some lamp with warm light around the map and maybe some cool green light from a venomous water lying on the floor.
My map is procedural generated in runtime and for that i can't bake to generate some lightmap. In URP, as i saw in the settings of the URP, i have max 8 number of light active per scene............ while in the other hand, i tried to disable URP and turn everything in default and each light works fine.
So here my question: 1. is there a way, using URP, to have a lot of number of light (spot, point) in realtime active in the scene? 2. Both URP or default, is it ok to have a lot of lights for a mobile device? 3. using URP is really making some big difference in the mobile or between URP and default pipeline, there isn't that big difference and i can focus on Default pipeline, and "avoid" this problem?
Answer by N-8-D-e-v · Aug 21, 2020 at 03:19 AM
I don't have much experience with mobile, but realtime lights and mobile games don't mix well, baked lightmapping would be the way to go, but as you said, it's not possible with your game Maybe try something like this https://unity.com/how-to/advanced/optimize-lighting-mobile-games#:~:text=The%20best%20approach%20to%20achieve,into%20the%20game%20when%20needed.
Answer by revolute · Aug 21, 2020 at 04:29 AM
Yes and no. You don't really need all the lights in the scene to be lit all the time. Disabling those that you do not need should work decently. However, a workaround is implementing a fake lighting system on top of unity. Pass the lights as an array of vectors, colors.
No. For performance reasons, having excessive lights do not work well on any platform. For visual eye candy lighting calculations are preferred to be done per pixel; simple mobile game with 1440x720p would require at least that amount of pixel calculations. Each light would require a) normal vectors, from mesh or from texture, for correctness, b) normalization of the vector, c) dot product d) lerping of base color to light color multiplied by intensity (which differs from directional light to point light), e) addition of all light color result. Urp shaders have the option to do this on per vertex but this usually produces rather ugly but extremely (usually) efficient light calculation.
URP actually does make a bit of difference. Default pipeline gives you all sorts of tools to use. You can grab pass any time any where but in URP there is no grab pass. URP only supports single pass per shader. URP this and that all comes down to cutting some corners and simplifying certain aspects of the render pipeline. Performance gain is traded off for utility, which you can implement by either modifying URP or using SRP features.
Given your situation, default pipeline or not I can presume that performance on mobile devices would be low.