Announcement

Collapse
No announcement yet.

Getting weird artifacts in UE4 when baking hipoly mesh to normal map in Blender

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

    Getting weird artifacts in UE4 when baking hipoly mesh to normal map in Blender

    I've looked for a solution on the forums and online but haven't found anything about this particular problem.

    I created a model (low poly and high poly versions) in Wings3D. I imported these in Blender (through Wavefront .obj) to bake the normal and AO maps, and imported them in UE4 (through .fbx of course). In UE4, I get weird normal artifacts.

    Here is the lowpoly mesh in UE4 with a plain material (no normalmap):
    Click image for larger version

Name:	aalofaL.png
Views:	1
Size:	789.4 KB
ID:	1138934

    And here is the mesh with normals applied. There are artifacts on what should be smooth faces near the top and middle:
    Click image for larger version

Name:	OgxmzEM.png
Views:	1
Size:	836.7 KB
ID:	1138935

    This is what the lowpoly mesh (http://i.imgur.com/kzd6sZd.png) and hipoly mesh (http://i.imgur.com/72uOx0p.png) look like in Blender. The render produces this normalmap (http://i.imgur.com/z2phuGZ.png) which, when used as an actual normalmap along with lighting, produces this (correct) render: http://i.imgur.com/APWTcXf.png

    #2
    Have you already flipped the green channel -> in the texture properties + set the texture type to normal map

    Comment


      #3
      Urgh, firefox ate some of my post. Yes, I flipped the green channel in GIMP (I had also mentioned that the Wings3D model is triangulated so there's no issue with Blender and UE4 doing it differently).

      What do you mean by "texture type"? It seems to have imported as a normal map, since its LOD Group is "WorldNormalMap" and its compression is "TC Normalmap".

      Comment


        #4
        can you add a pic of just the normal map texture?

        Comment


          #5
          Here's the texture: http://i.imgur.com/AzASzyN.jpg (this is 2048x2048 while the source is 4096x4096, there are also jpg artifacts from imgur - if you need to see the source version I'll upload that)
          Last edited by Shivan Hunter; 09-29-2014, 04:26 AM.

          Comment


            #6
            have you tried applying flat shading to the large flat surfaces of the high poly model before baking the normal map.

            Comment


              #7
              Yes, the second Blender screenshot shows the hipoly mesh with an edgesplit modifier.

              Comment


                #8
                When you imported the mesh did you Import Normals and Tangents or did you calculate them? You always need to export tangents from blender, and import both normals and tangents in UE4. This is because the normal map is generated based on the tangent spaces in blender, and if you let unreal calculate its own tangents then you'll probably end up with different tangent spaces and your mesh will look all wrong. Also, you'll want to add a triangulate modifier on anything you bake to and/or intend to import for two reasons: UE4 may split the quads differently to blender and this will also mess up your tangents, and the exporter doesn't support exporting tangents on faces with more than 4 vertices.

                So do this:
                Add a triangulate modifier to your low poly mesh.
                Re-bake the normal map.
                Export the low poly mesh with Export Tangents checked.
                Import to UE4 with Import Normals and Tangents option.
                Last edited by The Beej; 09-29-2014, 06:45 AM.

                Comment


                  #9
                  I already mentioned that I triangulated the original mesh.

                  Wings3D does not have an option to "Export tangents" in either the .fbx or .obj exporters. I'll look for an .fbx plugin for Blender and see if I can get the mesh to UE4 from there.

                  [EDIT] That did it, thanks! There's still a few artifacts but they're barely noticeable and can most likely be covered up by texturing.
                  Last edited by Shivan Hunter; 09-29-2014, 03:20 PM.

                  Comment


                    #10
                    There's nothing wrong with the highpoly mesh. But there's only one smoothing group for all polygons in the lowpoly mesh . It gives you to much curvature in the lowpoly surface which is hard for normal map to compensate in the engine. So you get those gradients in the baked normal map which is bad (gives you compression banding artefacts in the engine). I would suggest you try the following:

                    1. Select your lowpoly mesh and set Smooth Shading for all the polygons, clear all sharp edges and seams if you have any;
                    2. Enter Edit mode > Go to Select > Sharp Edges > Ctrl+E > Mark Seam + Mark Sharp > Exit Edit mode;
                    3. Assign Edge Split modifier and uncheck "Edge Angle" so it will sharpen only those edges you marked as sharp. Basically every hard edge needs to have a uv split on it so you get some padding on bake;
                    4. Unwrap your lowpoly using the seams you get from previous steps and pack it with enough padding. You'll get lots of pieces but that's Ok so don't worry;
                    5. Make a triangulated copy of your low-poly for baking and bake your normal map with padding set to 8 at least;
                    6. Export to fbx, make shure to uncheck "Apply modifiers" if you're using Blender 2.71 or newer (daily builds).

                    You should get a normal map with almost no gradients for the flat areas which is how it should be. And that's the way hard-surface baking works, eliminating any chance of errors and artifacts. There's much more on that in the Polycount forums, I suggest you visit it. Or post here, glad to help =)

                    PS. Save baked textures to targa (.tga). Unreal imports it correctly and applies TC_Normalmap compression, which it doesn't if you use png for example. And there's almost no to none advantage in using 16 bit png, but you'll have to set compression options yourself instead of Unreal doing it for you if you import tga files.

                    Cheers, Anton.

                    Comment


                      #11
                      Hello everyone. The problem I have is probably exactly the same. I've tried a lot of different methods and to what it does not. AntonBoiko your advice too tried and nothing! I bake texture in cycles further check in the viewport internal. Exported to fbx with parameters as in the picture.In the picture on top is perfect in a blender and the bottom in UE4. How to get the same result as in the blender?
                      Attached Files

                      Comment


                        #12
                        Here's a link to the file. http://blender3d.org.ua/forum/beginn...rmaltest.blend
                        Please help to solve this problem. I did not even know what to do. Already spent so much time and trouble as was and remains

                        Comment


                          #13
                          Hi FoxReinar,

                          I opened your FBX in 3Ds Max and took just the arm rest and baked out a Normal Map. I ditched the other geometry and only focused on the arm rest. I did increase the UV space for it to get a better bake as well.

                          Here are the results I've got. It's still a little messy with the bake though just because I rushed a bit.

                          Click image for larger version

Name:	Normal_ArmRest.PNG
Views:	1
Size:	315.4 KB
ID:	1060396

                          Here is a link to the asset I tweaked. I didn't change anything with the geometry.

                          Ultimately, you may want to redo the topology for the low poly to get better results as this is where the issues appear to be.


                          Tim
                          Tim Hobson | Learning Resources | Epic Games
                          UE4 Documentation

                          Comment


                            #14
                            an impossible goal

                            Thanks for the reply Tim! I looked at your option, and yes the result was better than I was. I translated the mesh triangles exported corrected green channel corrected TC normalmap place for TC default. And here's the result. Yes already much better but at length from the bottom seen strange shading. It's like a little texture resolution .4096 * 4096 where much more? Why I do not want much stretch UV so the answer is simple, there are other parts that are also necessary to place. Look at the option that gives the blender. I do think it's possible to get a result like this in a blender or UNREAL? Maybe I just want to get something UNREAL simply can not reproduce? Of course you can rebuild the polygons and if not satisfied rebuild again and so on increasing the number .but even so why in the blender without this good result? Just want to understand.

                            And the thought came. Why not make your system creating Normal maps in the engine?
                            Most of the questions in the network would be lost because of different standards is an attempt to fit a normal map that uses a standard engine UNREAL. Would not have long to sort out the options.
                            Attached Files
                            Last edited by FoxReinard; 10-30-2014, 03:41 PM. Reason: error

                            Comment


                              #15
                              screenshot

                              Another screenshot to accurately convey what I would like to see. Just want that picture to be as better.
                              Attached Files

                              Comment

                              Working...
                              X