i’m making a mobile game on unreal 4.25.1 and i have some shadow troubles. I don’t think the issue comes from mobile because i have the same when i play in the editor. Here is the issue :
As you can see, the shadows on the first level are pretty OK but the further you go through the levels, the less the shadow reacts correctly.
The lighting is done by a static directionnal light and all levels are in the same map, i just move the camera to the appropriate level.
I also have another problem that may be related to this one: When I start the game or reload the level, you can see shadows on each cube before they disappear, but that only happens on mobiles. (it’s a bit like the 3rd pic but shadows are a lot darker, it’s the same when i build the level on the editor)
Thank you for your help ! I wonder if in terms of performance, is it better to have several big levels for each world (e.g. one world = 30 levels in a map) or 30 small levels * the number of worlds each in a different map?
and how about moving all the blocks instead of the camera, will that fix the problem ?
When it’s over, a level will be 1,900x60,000 (x.y)
Yes i think we also can use streaming level for mobile, but I don’t see how streaming levels would help, would each level have its own origin and its own light?
60000 might be over. I you move the blocks closer to the origin and rebuild the light and it looks ok, then that’s it.
Like I say you can fiddle around with origin re-basing, I helped someone with that recently, but they had no other option.
With level streaming you just have lots of separate levels and they are added to one central level ( the persistent ). You can stream any level when you want. They can all have separate lighting / everything. I think it’s the way to go, and I know about it
You’ll need to do the streaming with blueprint ( a lot of tutorials assume you’ll be using streaming volumes, but that’s more of an open world thing ).
Tell me if you’re interested and I’ll show you how to set it up…
I’ve already read a little bit about that but I’ve never really gone any further so I think your help and experience could help me a lot !
There’s also the fact that with the current system, I could slide from one level to another by moving the camera and I’d like to keep this “advancing” effect or anything that could simulate or reproduce this effect, do you think it would be possible ?
That’s the great thing about streaming. You can keep the camera in the persistent and just load levels as you scroll around.
Try this: You can make a new empty persistent level, then open the ‘levels’ tab ( window -> levels ). You can add a couple of your existing levels ( there’s an already existing option ).
You’ll see they appear in the persistent, just like you’ve opened the map, but they’re both in there at the same time.
You can work with a sort of grid area, big enough to have the camera scrolling effect, but small enough to be very manageable. Frankly 2x2 would do it.
You can turn the levels on and off with the eye icon next to the name.
Watch out, any changes you make here will actually affect your level maps!
I’m gonna go a look up static lighting with streaming in the meantime…
EDIT: Ok, checked. You need to use ‘lighting scenarios’, it’s a way of being able to build light in all the submaps:
I’d suggest trying it with a couple of simple sublevels first, see if it works and is efficient.
I’m not sure I understand how to handle the scrolling, is the camera going to have to move? But in that case we’ll keep the problem relative to the origin. Or do I move the levels but then I have to move all the actors and it will have an impact on the performance if I don’t say stupid things?
I’ll start implementing this solution, I’ll let you know when I’m done or if I’m stuck, thank you very much for your help !
Let’s say you have level X loaded at the origin. The player completes level X, you load X+1 just out of shot and move the camera over. While the player is on X+1 you load X+2 at the origin ready to move the camera back.
So you only ever have two spots you load levels in and move the camera between them
Another possibility is to always load at the origin, but when a level is complete, set the camera off to the left, stream the level and then move right again with the camera. You could do it so it basically looks the same as what you have now ( little difficult to describe ).
Once you get it working it will be fine.
I think it’s better than origin re-basing, because with that you always have everything loaded, which on a mobile is not good.
Tell me if it’s not working, I can knock something up and show you the code…
EDIT: don’t spend too much time on it though, I’m not sure lighting scenarios work on mobile ( can’t find anything on that ).
Also, could you use dynamic light if you know you only have to load one level at a time?
I did it a little bit differently, I created my basic level with the ball and the camera and then I created all the other levels that I stream as I went along. I put a static light in each level but I have exactly the same problem as at the beginning, always the same shadow problem. A new problem has been added: it looks like the lights are overlapping so the intensity of the light is increased in each level.
Here’s my persistent level with the 3 levels (i start with only the first one streamed)
](filedata/fetch?id=1788272&d=1594763091)
If I go back and forth between 2 levels, I would still have a light problem on the right level I think because the problem already happen on the second level.
Maybe I didn’t configure the lights properly, is there an option to build the lights only by level?
EDIT : I managed to solve the problem of “overlaying” of lights thanks to the lighting scenarios but I still have this problem of shadows that appears at level 2
Each level consists of the level itself with a size of 19x10 cubes and another scaled cube of the same size to make the intersections between the levels. So the total size of a level is 1900 x 2000.
If it’s really too big, I can rescale everything without too many worries I think.
EDIT : I’ve changed a bit the way I build levels, I don’t put the cube separately anymore but I build instances to optimize the performance a bit. However by doing this and putting a static light in each level, the result is even worse than before, this is what level 2 looks like and you can already see the shadow artifacts in the first level
Were the lightmaps generated in the mesh editor for all the cubes? or at least for the initial cube that was then instanced? It might require generating lightmaps for every cube to avoid shadow inconsistencies with lighting. And actually, I think that lighting / shading on the 19x10 cubes looks cool. Don’t see it in a mobile game too often, or perhaps ever lol.
I didn’t change much in the settings for the lights, I changed:
in World Settings : static Lighting Level Scale → 0.2 (to have a smoother transition between the shadows)
Overriden Light Map res of the InstancedStaticMesh, in fact by default it’s 64 but i have a warning message when building who says “The total lightmap size for this Instanced… is large”. But if i reduce it, the problem is bigger and if i increase it, it’s just a very little bit better but OK at all and I have the warning message.
I don’t think I’ve touched anything else, I’ve done a lot of tests but considering the results, I’m back to the beginning.
I think I’m going to redo a new clean project before going too far in the game to restart on a healthy basis and see if the problem is still there.
Do you have any advice for creating this type of level(instanced mesh, size, light, lightmap, etc?) to avoid falling back into this kind of problems and gain fluidity?
What is the size of each cube? Starting smaller might help in a new project, but by a modest fraction, not at 1/100th of before.
Do not use the base (default) material for cubes or floor. If using the simple one, add scalar parameters to Metallic, Specular, Roughness, Emissive, Normal, and Ambient Occlusion. Being able to modify those properties on-the-fly could help correct lighting / shadowing artifacts or problems. So, if it’s an ambient occlusion texture, then multiply it by a scalar parameter and convert the texture sample into a parameter (enables changing of the texture used, and intensity of the effect when plugged into ambient occlusion pin). I’d advise only using a texture for ambient occlusion, normal, and perhaps roughness if there’s a different surface type than the regular, smooth one in the mobile game.
The cubes have a size of 100x100x100, may I use a scale of 0,1 and adapte the width of the camera to do as at present?
I don’t use the default material, i create my own but I just put a base color to begin but even that just doesn’t work
The instancied mesh seem like a good idea for this kind of level? I can’t use them for the plane where the ball roll because I have to be able to change the material of each. Isn’t there a way to make one big block that makes all the cubes? Apart from creating a level on a software like Blender and importing it as a mesh directly ?