No announcement yet.

I hate UDK lightmaps!

  • Filter
  • Time
  • Show
Clear All
new posts

    I hate UDK lightmaps!

    Hey guys ,, I been messing with light maps and cubes, I get seams even though I'm aligning all of my UV maps exactly to
    the grid and even manually typing in uv cords so that they are precisely on the grid lines in UV editor. (grid is set up as 1 divided by 128)
    My spacing is very gracious with 8 pixels in between each polygon island.

    Anyways,,,,yeah we all know about lightmap light area bleeding with the dark background of the texture which causes the issue.
    The only way that I get rid of 100% the bleeding between boxes in udk is by disabling the smoothing for the light-map textures. ( but we end up with some pretty pixelated maps )

    I wish there were a way we could export the lightmaps and add some padding using photoshop. Orrrrr perhaps there is a hacky way to force udk to generate this extra pixel padding around the rendered islands.
    Any thoughts or ideas on how to work around the Lightmap bleeding issues ?!

    All I can say is, I agree, there should be control of padding in the light map properties. It's near impossible to get rid of every single seam caused by filtering. It's a problem easily fixed by padding, as it is in Max's render to texture.


      Lightmaps are annoying, no doubt about it.
      I made a thread similar to this. Make sure your lightmap resolution is decent depending on the size of your mesh. When making your lightmap create lots of UV Islands, that helped me. Before I did that everything was awful!


        Originally posted by tuxmask75 View Post
        Any thoughts or ideas on how to work around the Lightmap bleeding issues ?!
        I too had issues with Lightmaps (especially with seams) but after following these tutorials i have pretty good lightmaps.

        Tutorial 1 - Basics and Important Principles for creating and using Lightmaps.
        Tutorial 2 - UV Techniques and how to create 2nd UV Channel in Maya.
        Tutorial 3 - How to fix Light bleeds and seams.
        Tutorial 4 - Static Meshes and BSP Lightmap Resolutions.
        Tutorial 5 - Lightmap: Common Problems and Solutions.


          Actually followed these and I snap to grid ( err pixel) all the time when setting up UV maps for lightmaps,, I still get bad seams depending on what direction a light comes does not salve the issue of bleeding all the time, (just sometimes) The only way I can seeto salve the problem was stated above by adding an extra pixel or 2 to the borders of the baked lightmaps just like 3DS max or specific Photoshop filters do.
          its to bad we cant do this in UDK


            Originally posted by tuxmask75 View Post
            Actually followed these and I snap to grid ( err pixel) all the time when setting up UV maps for lightmaps,, I still get bad seams depending on what direction a light comes does not salve the issue of bleeding all the time, (just sometimes) The only way I can seeto salve the problem was stated above by adding an extra pixel or 2 to the borders of the baked lightmaps just like 3DS max or specific Photoshop filters do.
            its to bad we cant do this in UDK
            Can you post a picture of the model in 3dsmax and how it shows up in UDK?


              I agree with tuxmask75. Also, the tutorial shows mapping a cube which is the best case scenario, not the worst case, like you encounter in real games.

              I have been working with UDK for a long time and I know there is no way to fix all problems with light maps. I see problems with light maps in Epic's games. So if there's a way to have no problems, I would think that Epic themselves would do it.

              You sure can get it to acceptable levels though but you can never get it perfectly clean. That's just how it is. I really doubt any of this will change in the UE3 version of the UDK. Who knows of the UE4 version, if this is different or not.

              The simple fact is that you will end up with a seam somewhere at some point, possibly preventable by padding the edges. It's just a fact that without that padding, especially on such low res textures, you're gonna run into some problems. No snapping on per pixel or any of that can prevent that from happening.

              Using snapping in some cases sure can minimize how much it happens, I know this. But not all objects in your game can be snapped like this either, and the fact is, you can spend your life snapping things and never finish them all in time to release the game while people still exist. It's no solution, trust me. Currently there is no solution because, as far as I know anyway, you cannot control padding when rendering light maps, which is the solution for this kind of problem and has been for many years now since the notion of "render to texture" was created.

              There are ways to "hide" the problem in many cases of course through the seam placement and diffuse mapping.. etc. But that also isn't a solution and won't work in all cases, it's just workarounds.


                Hey so,,, im going to show my workflow for shadow maps, which is exactly what was shown in the tutorials above.
                I'll be including a little trick I came up with that will align the Texel's to the edges of a cube as well.

                The project that im working on has over 3600 modular block pieces used to build larger pieces of geometry. Each building block has already been set up for Lightmaping.
                I'm going to use the most basic of the blocks that I made for my game in this example. A Cube! And boy! This cube will make you rip your hair out !

                First things first. the block is 64 x 64 x64 units in max which translates to 64 x64 x64 units in udk. ( this is irrelevant to the following example, just thought I would toss that info in for the hell of it)
                For the UV unwrap I wanted to go with a 128 x 128 texture sooo... I divided 128 into 1 which is 0.0078125 for the UVW map editor grid.. however since the snap functions in max have floating point errors of .00001 or whatever the funk it is. I prefer to use the pixel snap function since it seems to be a more accurate snap than the snap to grid. (I have yet to see the .0001 glitch with snap to pixels..) anyways back to the tutorial !
                So for the pixel snap I made a 128 x 128 checker texture with a pre defined box UV unwrap of 32 x 32 pixels made in MS Paint!

                (Here is the 128 x 128 grid with 32 x 32 Box unwrap!)
                Also note that there is a padding of at least 10 pixels between islands! ( Holy F-ing **** that's crazy right?!)

                (As seen in the UV unwrap editor!)

                (Screen of what this looks like in Max! Funk Man this is so perfect !)

                Anyways my wife and I had a baby last night so I cant finish this post right now...
                Part 2 coming soon!


                  Okay I have some time! here is the result in udk !
                  These are exact pixel snapped / grid snapped if your using grid snapped UVs here! Look at this bleed Sh-T! !

                  Model viewer lightmap resolution:

                  Here is the Texel view of the lightmaps on the cubes! notice how the texels are not aligned with the edge of the block,,

                  Just in case some of you don't know what the texel view is for, Below is a screen of a corner of a cube with a shadow map baked with UDK and yes snapped to grid/pixel in 3ds max. The shadowmap is not using smoothing..
                  Since the texels represent where the pixels of the lightmap will be displayed on the boxes.. notice how the edge pixels are cut off.
                  So yeah all the alignment **** we did in Max UV editor is for nothing.... sort of.. ( if you stick a texture on the same UV's than they will align perfectly)
                  It seems that udk may be doing something strange when baking lightmaps,,, not exactly sure what,, perhaps udk is automaticly shrinking down the UVs we set up by 2 pixels .

                  Part 3 of this showing how to fix the Texel alignment issue coming after I get back home.....


                    use full precision UVs?

                    You don't need that for static environment.
                    Lightmaps is not so really big point and problem to make discussion like this.

                    Also, if you use CSM, this seams will disappear with lightmaps on specified distance.


                      Use full persision UV?! is that a setting in udk or something that I may have missed ? my models use precision UV set up in 3DS max.
                      CSM ? not sure what that is. could you explain a bit more please?.
                      And yes lightmaps are a huge visual problem for my game because of the nature of how things are set up in a modular way there is no way to hide the seams with additional new geometry and or other normal methods used to hide the issue.



                        This is another screen of the model with precision UVs that I've set up in 3ds Max ,,, this time with a normal map and diffuse texture.. you can still see the seams in the shadowed areas due to the lack of proper planning that went into udk's lightmap baking feature!
                        For me it is worth making a discussion over as after I've spent months setting up 1000s of modular models for this game just to have this seam issue **** happen. its pure bull**** !


                          Okay ,, now for my little fix trick that I came up with to get the bleeding issue resolved! ( sort of... i'll explan the sort of part later in another post)
                          Its simple. if you have a UV set up to match a 128 x 128 texture than please go into the static mesh editor and add 2 to the 128 of Light map Resolution so that number is 130

                          Finally When the lightmaps are baked the texels will align with the cube exactly as 32 x 32 pixels and not 31 and 1/2 or pixels using the 128 lightmap setting. ( I say 32 x 32 pixels because that's how many pixels each side of the box was unwrapped to match in max.)
                          Anyways using the 130 instead of the 128 will not effect the overall size of the final light map which will still be a power of 2

                          Notice how perfect the lightmap texels match up to the cube model.

                          You'll still get seams but not the lightmap bleeding seams that were apparent before in shadowed regions! Because now the Texels match up exactly and not hanging half way over the edge like before!


                            however there is a new issue that pops up maybe because of the 130 resize.
                            The new issue becomes apparent with some lighting positing and cube rotation conditions.

                            However This time not a bleed from the actual pixels trying to blend together but it seems that the light map baking itself adds the seams in as new set of pixels usually a new row.
                            this sucks because it could have been the answer I was looking for ,, but yet it has this small issue . The issue can be averted if rotating the light source facing direction but you do not have much leeway room for what direction the lights may face.

                            Check out the image below.. Everything is all good,,, except when the light is facing a certain direction related to the cubes rotation new seams appear! I marked the front of the cubes in the image to show rotation of the cube.
                            Now if we rotate the light to 180 degrees and leave the cubes the same way than the glich appears on the other cubes circled to the right and the cubes on the Left become good.

                            and a close up without smoothing for shadow map. as you can see the texels match perfect with the cube.


                              "Use Full Precision UVs" is a checkbox in the static mesh editor. It will increase the mesh memory but uses 32-bit floats (instead of 16-bit) for the UVs.

                              CSM means Cascaded Shadow Maps and refers to dynamic lighting. With a dominant directional light you can use dynamic lighting up to a certain distance and then let it switch over to baked lighting.