When using normal maps, for real time lighting, on a paper2D tilemap, the lighting appears completely accurate when running the game in PIE. However, when the game is ran by launching(ship) or by the “standalone game” dropdown, the tilemap will render completely black. The other items in the scene will still render correctly. I’m not sure what would cause a difference between ship and pie lighting only on tilemaps. I’ve tried for a few weeks on and off now to solve this issue on my end with no luck.
Can you reproduce this in a new blank paper 2D project using some simple set up?
I appreciate the screenshots as those helped me visualize the issue, but it might prove to be troublesome to reproduce on my end. Some quick steps will help increase the efficiency of the troubleshooting process.
Sure thing. I just did this and recreated these 10 steps to reproduce the bug from a brand new paper2d project using the starter content assets.
Step 1: Create a new 2D side scroller project. I included the starter content for this project.
Step 2: Open the 2DSideScrollerCharacter blueprint and set the
SideViewCameraComponent to Perspective View(needed for real time lighting)
Step 3: While still in the character, set the sprite material to MaskedLitSpriteMaterial( this automatically comes with a flat normal map).
Step 4: Create a new tileset, I used the 2DBackgroundBlockAtlas texture
located in the 2DSideScroller content. Left all settings to default.
Step 5: Create a new tilemap, edit it and place some tiles in from our tileset created in the previous step.
Step 6: Place the new tilemap in the scene. I placed it at the same location as the player for quick testing.
Step 7: Set the material on the placed tilemap to MaskedLitSpriteMaterial.
Step 8: Add a light to the sceen. I used a directional light and pointed it towards the scene((Pitch=-45.000000,Yaw=-90.000000,Roll=0.000042)). I also gave it an extreme color so that I can clearly see the sprite and tilemap recieving light.
Step 9: Run the game in PIE and notice the lighting shows up on both the character and the tilemap. I used New Editor Window and Selected Viewport to confirm lighting works and it did for both the character and the tilemap.
Step10: Run the game using the Standalone Game option or the Launch button. I used both and confirmed that lighting works on the character, but not on the tilemap in these modes.
Thank you very much for the detailed reproduction steps. I was able to get the issue to occur in three separate versions of the engine. I went ahead and entered a bug report (UE-25994) for the issue. Once the bug has been fixed it will be integrated in an upcoming full engine release or hotfix, and then added to the list of fixed bugs.
Again, thank you for taking the time to report this issue and let me know if you have further questions.
Any Updates to this issue?
I have been working on a project for about 2 months now, and just realised I am having this lighting issue when running the game in standalone
This has been marked to be fixed and integrated for a major upcoming release. It probably will not make it into the 4.11 release as it has been marked for the next iterative version following 4.11.
I found a work around. At the end of the loading your level and actor, retrieve your TileMap object and set visibility to unchecked and then set visibility again to checked. Important, make sure you character is spawned, has default controller and possessed.
I’ve checked in a fix for 4.13 (CL# 3046429 in Dev-Framework, will make it to UE4 main in a week or so). The issue is that the tile map components could read the default tangent basis before it was initialized (only ones created before any sprite or tile map has been rendered once), which is why 4dzirt’s workaround fixes things, as it will cause the render state to get recreated and regenerate the vertex buffer.
When testing this I also found an issue with lit grouped sprites, and fixed that as well, CL# 3046428.