Announcement

Collapse
No announcement yet.

Black spots on mesh after building lighting

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Black spots on mesh after building lighting

    Hello, I'm fairly new to UE4 and game development, so please be patient with me and I apologize in advance for any ignorant questions. I am still learning here.

    I have been having trouble getting my mesh to be lit correctly after building the lighting. Lighting looks perfectly normal before I build the lighting. After I build the lighting, I get these black squares throughout my mesh:
    Click image for larger version

Name:	Annotation 2020-08-05 143814.png
Views:	116
Size:	518.8 KB
ID:	1797495

    I've looked over other forums and the most common issue seems to be revolved around overlapping lightmap issues. I currently don't get any ue4 error messages about overlapping lightmap UVs so I'm not sure where else to look for trying to solve this. I'm assuming it still has something to do with the lightmap, so I'll upload a picture of those settings for this particular mesh.

    Click image for larger version

Name:	Annotation 2020-08-05 144309.png
Views:	167
Size:	46.6 KB
ID:	1797496Click image for larger version

Name:	Lighting.png
Views:	162
Size:	51.0 KB
ID:	1797497
    I consider every bit of advice so any help is welcome and greatly appreciated.
    Attached Files

    #2
    I don't see the black squares anywhere on those meshes / materials. Is there another photo that was not attached that highlights the problem? With the Snipping Tool in Windows 10, you can use a highlighter (pen or marker) to draw arrows or an outline around the problem areas before taking a screenshot.

    The Min Lightmap Resolution is set at 192. It's usually instructed that it needs to be in powers of two, starting at 2...so 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096. One of those values. However, there's also Lightmap Resolution in the mesh's settings (in the mesh editor), which is the actual lightmap resolution used. If that's one of the power-of-2 values, then it's alright. Min LM Res cannot be larger than actual LM Res, otherwise it can cause issues, according to the doc pages. In the mesh's details panel, you can override the Lightmap Resolution by enabling "Overridden Light Map Res" and changing the value (it's currently at 64, which is rather low). Try 256 or 512 at the most.

    Another test fix to try is enabling one or both of two settings in the mesh-editor Build settings for the mesh(es): "Use High Precision Tangent Basis" and "Use Full Precision UVs". These also function in connection with a setting in Project Settings called "Use High Precision Normals" under Rendering, and next to the label "GBuffer Format". I imported a spherioid model once and had terrible pixelation on it. When I enabled one or all of these (don't remember which exactly), it was back to normal how it had displayed in Blender, smooth and accurately reflective.

    Comment


      #3
      Alright. I have changed some of those settings that you recommended. I set the LM res to 256 and enabled the high precision tangent basis, use full precision UVs, and changed the project setting to use high precision normals. The end result is still somewhat similar, althought the black spots on the mesh seem to be in different areas with these new settings. I will attach a picture of how the mesh should look (how it looks in the mesh editor) and how it looks after the baked lighting.

      Correct lighting in the mesh editor:
      Click image for larger version

Name:	Correct Lighting.png
Views:	127
Size:	756.3 KB
ID:	1797823
      After the light bake in my scene (I've added some circles to point out the black areas for what I'm talking about):
      Click image for larger version

Name:	Black lines.png
Views:	107
Size:	663.9 KB
ID:	1797824
      Before I changed those settings, these black spots were on the sides of these rectangles, but they seem to have moved in the front. I haven't changed any of the lighting itslef, only the lightmap stuff you recommended on the mesh.

      Comment


        #4
        I see it now. It wasn't easy to see if it was shadowing in the initial photo and not lighting errors / squares. Did you try the Build settings (Full Precision UVs and High Prec Tangent Basis) each one enabled separately too? What are the Export / Import settings of the mesh(es)? If it's being imported with FBX coordinate system and FBX or the external modeling app's units (Blender is in meters, Unreal is in centimeters), then it could result in the shadows being incorrectly placed and scaled / modified. It's odd that it's correct in the mesh editor. Perhaps it has something to do with the level's lighting that is different from the mesh editor's lighting. Is the scene using stationary / static, or movable lights (directional and skylight)?

        Comment


          #5
          The only lights in the scene are a directional light and a sky light. I started changing the settings on those from static/stationary/moveable. I am able to get the lighting I want when they are both moveable, but as soon as I change the skylight to static, that's where it starts messing up. I was able to have the directional light on static with the skylight on moveable just fine. The issue only happens when the sky light is changed to static. Here is the comparison:

          Directional Light: static / SkyLight: moveable (After bake):
          Click image for larger version

Name:	skylightmoveable.jpg
Views:	109
Size:	79.8 KB
ID:	1797939

          DirectionalLight: Static / SkyLight: stationary (After Bake):
          Click image for larger version

Name:	skylight stationary.jpg
Views:	107
Size:	83.3 KB
ID:	1797940

          You can see how much darker it makes the whole mesh look. Im thinking that just keeping the Skylight on moveable solves the whole problem, so do you think it would be worth my time in trying to make the skylight stationary or static just for optimization's sake? I am still able to run the current game at a full 120fps with the skylight on moveable. Will it impact performance later on in this project the more stuff I add to this scene?
          Attached Files

          Comment


            #6
            It could be perform-heavy with either stationary/static or movable, to be the most accurate about it. Keep it movable, and use the directional light's indirect lighting to get more subtle changes and variations in lighting areas. The skylight lights pretty much everything, and as far as I remember reading, is cheaper than the directional light. You could also utilize post process volumes to create changes to lighting in certain areas and around particular objects, but the priority needs to be set correctly when they're overlapping, along with Blend Weight and Blend Radius which both influence the transition from how things are rendered outside of the volume to within it. For instance, a small PPV (abbreviated form of the post process volume) around a torch that lights up a cannon or an overlook on a castle wall is one way to put colored accent in the lighting without changing the directional light or skylight color, especially if the torch itself isn't getting the entire intended effect. PPVs can also be utilized for stained glass windows, sunlight effects on glass / metal / other materials, and to darken a location such as inside a non-windowed room if it's not dark as it needs to be already. Keeping the skylight movable allows for changing the day / night sky appearance at runtime too, whereas directional light could be a part of that...it's limited in ways the skylight isn't. Using Atmospheric Fog and ExponentialHeightFog actors to create different effects in the atmosphere / air is another option to offset or perhaps hide minor artifacts when they're occurring, and also to get different results from the skylight and directional light in their current settings. Those two fog actors work in conjunction with the skylight in a ton of ways to produce a variety of sky effects, cloud effects, and the look of a scene...so having the skylight movable is far more important for a game than making it static / stationary. Learn to check perf values with the built-in visualizers in-editor and stats commands in the console, as you're building more in the scene / level(s). It's worth reading the docs and not relying too much on forum posts about those topics until it is drastically needed, I think. I bet the darker results from the second photo were due to settings for the directional light and skylight simply not working well for being static / stationary. I've tried a number of times to get correct, accurate lighting with only or mainly static / stationary lights, and it's really difficult. I have almost always encountered a major error or two. Whereas, when I change them to dynamic (movable), things look better overall, and I'm actually able to modify things much easier and usually with no problem in rendering speed.

            Comment

            Working...
            X