Home Technical Talk

[UE 4] Lightmap black spots

Filip5
polycounter lvl 9
Offline / Send Message
Filip5 polycounter lvl 9
Hey guys, my list of issues with modeling goes on and on. This time, I got black spots in UE4, which I am fighting since UDK. To make this short, no Idea why they appear - textures are ".sbsar " files, so no twisted normals, I increased light map resolution from 64 to 256 already, which created new black spots on model.



It pretty much happens on more of my models, but I am not sure if it can be cause by my UV's.


This pillar is a simple object, but I can't afford so much space between other meshes. Although I keep in mind that you have to have free space around unwrapped parts.
What would you suggest ?

Replies

  • Neox
    Offline / Send Message
    Neox godlike master sticky
    you could definitely straighten your uvs and balance the pieces more. for instance why are pieces closer to the ahell above them, than the one below? you definitely have plenty of space to balance it better.
  • Filip5
    Offline / Send Message
    Filip5 polycounter lvl 9
    I definitely do, but what causes black spots then ?
  • musashidan
    Offline / Send Message
    musashidan high dynamic range
    Black spots are caused by light map bleeding. The shadow from one shell bleeding across to the adjacent shell. You should repack with more padding. With lightmap UVs, it doesn't matter if the shells are distorted. What's important is to ensure sufficient padding.

    Also, whacking your LM res up to 256 isn't the solution(as you've seen) as doing this on all assets will have a big perf hit.

    But I feel your pain. There are times when I set everything up properly for LM, follow all the rules, and no matter what I do I get artifacts.

    I always set my sun/skylight to dynamic(moveable) which eliminates the need for lightmap calculations but, this comes at a cost and will depend on the project complexity/amount of lights in the scene.

    Mockup of your scene. Sun/Skylight set to dynamic. Point light set to stationary. LM res default 64. LM UVs.





  • Filip5
    Offline / Send Message
    Filip5 polycounter lvl 9
    So I went ahead and tried to set the scene as suggested. Dynamic skylight, stationary point light. LM set back to 64. I am using only one UV channel for my model. I went super crazy, set padding to 1 (just to test it), which is total waste of space, but I got no reports from engine about overlapping textures. This is what I got :



    Black spots are still there. The round part is just attached to top and bottom, so it is not welded together. Could it be the reason ? 
  • musashidan
    Offline / Send Message
    musashidan high dynamic range
    For LMs you want at least a padding of 2-4. It's not that they'll be overlapping but bleeding across islands(the same way a texture bleeds when it mips)

    Having the mesh as multiple unwelded elements is fine.

    Could you upload the mesh in .fbx so I can have a mess with it?
  • Filip5
    Offline / Send Message
    Filip5 polycounter lvl 9
    Sure, here is the max scene and fbx mesh :
    http://www.filedropper.com/pillar        (max scene)
    http://www.filedropper.com/pillar_1    (fbx)
  • musashidan
    Offline / Send Message
    musashidan high dynamic range
    Links are broken. :)
  • Filip5
    Offline / Send Message
    Filip5 polycounter lvl 9
    Reuploaded, no idea where the mistake was

    https://files.fm/u/wnev37kj
  • musashidan
    Offline / Send Message
    musashidan high dynamic range
    Your example is actually an interesting one because it shows a case of distorting LM UVs, in this case making the shells with diagonal lines square. Here's your mesh after re-unwrapping the LM UVs. In the image below you'll see that there are no LM artifacts. Sometimes I find it hard to tell so I add a 'blowout light' which tells me for certain that it is not a shadow bleed. Scene lit with baked lighting(no dynamic lights)


    For the UVs I snapped them to a a 64x64 grid(as this is the LM res) - Note that this isn't always necessary but it ensures that seams don't fall between texels, which can cause artifacts. You'll also notice that I skewed the non-square shells to square corners in order to snap diagonal edges to the grid.

    A great workflow to speed up this snapping process is to create a custom checker pattern texture at any res(64x64/32/32/etc) and display that texture in the UV editor. Now if you turn on snap to pixel, your UV shells will auto-snap to your checker pixels. They will even dynamically change shape to respect the snapping.(this also eliminates the need to calculate the grid size and is a far superior approach imo)



    The most important thing, as I mentioned above, is to have at LEAST a 2 pixel border between shells and UV 0-1 borders. The UVs above are far from optimised(lots of wasted space) but they are just to serve a purpose for this example.

    This is also interesting, and well worth a read:

    https://www.reddit.com/r/UE4Devs/comments/246whl/the_most_important_thing_about_lightmaps/

    Personally I detest lightmaps, and long for the day when technology eradicates them from the anals of CG. :) As I said above, you can use fully dynamic lighting to bypass the annoyance of lightmaps but this can limit lighting quality in a lot of cases. And if you're lucky, sometimes you can get away with LM errors when fully textured/shaded. ;)

  • Filip5
    Offline / Send Message
    Filip5 polycounter lvl 9
    Your answer is a very useful one. I will go ahead and try to adjust lightning based on your response. But, bare with me for a second. If those black spots are not caused by lightmap, what are they ? 
Sign In or Register to comment.