User:Gazorpo/How to Bake with Blender and xNormal for Skyrim
I am a beginner 3D artist trying to do Arcane University's 3D course. However, the course strangely recommends against the method of baking that it teaches, and it does not teach the basic steps and settings for baking with its recommended free tools. Thus, I will try to share what I have learned to help to fill this knowledge gap.
Requirements:
Contents
Stage 1: retopology
At this stage, make a low poly model based on your high poly model. I will not give steps for this here. Just two notes:
- You might want to revisit this stage after finding issues with your bake
- I found the snapping and Shrinkwrap tools mentioned here in this video very helpful: Retopology for Beginners in Blender
Stage 2: mark sharp edges
Here, mark edges that cause strange shading between faces at angles more than about 80 degrees, which can otherwise result in baking problems.
- In Blender, click the Layout workspace tab
- Of the four Viewport Shading options, select Solid (the second option, which shows basic shading but not materials)
- Select the low poly object
- In Object Mode, right click the object, and click Shade Auto Smooth (Blender 3.3+) or Shade Smooth (Blender <3.3)
- If your model does not have sharp angles, you can try skipping to the next stage after this step
- In the Navigation Bar (right side of screen by default), click the tab with the upside-down green triangle (Object Data Properties tab)
- In the Normals section, ensure that Auto Smooth is ticked and set to 180 degrees
- This lets you see sharp edges affect the smoothing on the object and set all sharp edges manually
- Change the object interaction mode from Object Mode to Edit Mode
- Of the three Select Mode options, select Edge (not Vertex or Face)
- If you see any edges between faces at an angle more than about 80 degrees that have strange shading, select them, right click them, and click Mark Sharp
- This removes the smooth shading at those edges and hopefully makes the shading more natural and cause a better bake
- You might need to experiment here and see what the resulting bake looks like to get results that you are happy with
Stage 3: UV unwrap
This stage is for making a layout for the texture, normal map, etc. I will not list all of the steps here, but take note: you need to mark all sharp edges as seams before unwrapping! You can do this with these steps:
- In Edit Mode and Edge Select Mode, select a sharp edge of your low poly model
- With the sharp edge selected, select all sharp edges by pressing Shift+G and clicking Sharpness
- With all sharp edges selected, right click one of them and click Mark Seam
Stage 4: prep high poly model
Here, we prepare the high poly model for export to xNormal. You only need to do this stage if your high poly model has multiple objects that you want to bake onto a single object.
- Recommended: save your high poly objects before making a merged version, in case you want to change them later
- Duplicate the high poly objects by selecting them and pressing Shift+D then Esc
- Hide and disable the duplicated objects by clicking the pointer and eye icons next to their names in the list of objects (top-right of screen by default)
- Use the unhidden objects for the next step
- Merge the high poly objects:
- Apply each modifier in order in the Modifier Properties tab (blue wrench icon): click the down arrow in the top right, and click Apply
- In Object Mode, select the objects
- Right click one of them, and click Join
Stage 5: prep low poly model
We now prepare the low poly object for export by triangulating faces and applying any modifiers.
- Recommended: save the low poly, in case you want to use it later without triangulated faces and with modifiers
- Duplicate the low poly object by selecting it and pressing Shift+D then Esc
- Hide and disable the duplicated object by clicking the pointer and eye icons next to its name in the list of objects (top-right of screen by default)
- Work with the unhidden object as the low poly object for the remaining steps & stages
- Triangulate faces:
- In Edit Mode with the low poly object selected, change the Select Mode to Face (third option, after Vertex and Edge)
- Select all faces: press A
- Right click a face and click Triangulate Faces
- Apply modifiers (examples: Mirror, Shrinkwrap):
- Set the object interaction mode to Object Mode
- With the low poly object selected, click the Wrench Icon (Modifier Properties) in the Navigation Bar (right side by default)
- From top to bottom, for each modifier:
- With the low poly object selected, click the down-arrow at the top right of the modifier (left of the X button)
- Click Apply from the drop down menu
- If you used Mirror and Shrinkwrap modifiers: ensure vertices along the middle of the mirror axis are welded and centred correctly
- I found that modifier combo had this kind of issue
- In case it helps, if your keyboard has a num pad, you can centre vertices along an axis like this:
- Select the vertices you want to centre
- Start scaling them along the axis along which you want to centre them by clicking and holding the correct part of the gizmo
- Press 0 on the num pad and unclick
- This should align them along that axis
- In the Sidebar (vertical tabs right side of viewport by default), click the Item tab
- Under Transform > Location, set the value of the desired axis to 0
Stage 6: make cage
In this stage, we create a kind of container object called a "cage" that helps baking. If your model is simple and has no sharp angles, then you can try skipping this stage and baking without a cage.
- In Object Mode, ensure that the low and high poly objects are visible and overlapping
- Select the low poly object
- Duplicate it by pressing Shift+D then Esc
- With only the new object selected, change to Edit Mode
- In Edit Mode, change to Face Select Mode
- In Face Select Mode, press A to select all faces
- Expand the cage:
- Press Alt+S to start expanding
- Move the mouse to inflate the cage object so that it just barely contains the low and high poly objects entirely, then click to finish
Stage 7: export meshes
Here, we export the low and high poly meshes, and the cage if applicable, so that we can import them into xNormal in the next stage.
For each of the low and high poly objects and the cage object:
- In object mode, select only that object
- Click File > Export > "Wavefront (.obj)"
- Not "Wavefront (.obj) (experimental)"
- In the export settings of the export window (right side), ensure that Include > Limit to > Selection Only is ticked
- Otherwise, it will export your whole scene instead of just the selected object, which ruins the bake and can crash Blender
- Optional: ensure that Geometry > Write Materials in unticked
- Otherwise, it will export an unneeded material
- Select an export folder and unique file name (example: "lopoly.obj" for the low poly mesh)
- Click the Export OBJ button
- When exporting the high poly mesh, expect Blender to load for a long time and be unresponsive during that time
- Save your Blender scene
Stage 8: bake
Now, we use xNormal to bake the normal map (and possibly other maps) using our exported meshes.
- Open xNormal
- Import high poly mesh:
- Click the "High definition meshes" button on the right
- If there are any table rows except the empty row and header row: right click each row and click "Remove mesh from list"
- Right click the empty row and click "Add meshes"
- Select the high poly mesh OBJ file
- Import low poly mesh and cage:
- Click the "Low definition meshes" button on the right
- If there are any table rows except the empty row and header row: right click each row and click "Remove mesh from list"
- Right click the empty row and click "Add meshes"
- Select the low poly mesh OBJ file
- If you made a cage:
- Right click the filled row, and click "Browse external cage file"
- Select the cage OBJ file
- Ensure that Use Cage is ticked
- Set options:
- Click the "Baking options" button on the right
- Next to Output File, select an output folder and file name
- xNormal will add "_normals" to the end of the normal map file name before the file extension
- Next to Size, choose the number of desired pixels for the width and height of the map
- Next to "Edge padding", enter 4
- See here for an illustration of what edge padding does: https://content.invisioncic.com/Mseclife/image_extract/152096iF87CDC3971417E55.png
- Under "Maps to render", ensure that "Normal map" is ticked
- You might also want to tick "Ambient occlusion" and "Curvature map" for texturing later, but I have not tried this yet
- Next to "Normal map", click the three-dot button
- In the normal map window, next to Swizzle Coordinates, ensure that the second box has Y- selected (not Y+)
- The difference between Y+ and Y- is that the green channel of the normal map is inverted
- Skyrim uses Y- (because it uses software called "DirectX"), but Blender uses Y+ (because it uses software called "OpenGL" instead), so in Blender we will invert the green channel in the material to preview the normal map
- Click the Close button of the normal map window
- Optional: under antialiasing, choose a higher number for less pixelated edges
- Higher numbers take much longer, so consider using 1x or 2x first and then 4x later for a final bake when the bake looks good otherwise
- Keep other settings at their defaults unless you know what you are doing
- Click Generate Maps, and wait until it finishes rendering the map(s) on the screen before going to the next stage
Stage 8: preview
Finally, we preview the resulting normal map in Blender (and Skyrim if desired), and then we go back to a previous stage if we notice any issues caused by what we did at that stage.
- Open the scene in Blender from which you exported the low and high poly objects and cage
- Hide the high poly object and cage
- Select the low poly object
- In the Navigation Bar, click the tab with the circular red icon near the bottom (Material Properties)
- Optional: make a new material for the normal map, so you do not overwrite any other material
- At the top right of the tab contents, click the + button
- If there are any rows beside the button other than the newly created one, remove them: select them and click the - button
- Click the Shading workspace tab (top of screen by default)
- In the Shader Editor viewport (bottom right by default):
- Add the normal map as an Image Texture node:
- Press Shift+A and click Texture > Image Texture
- In the new node, click the Open button
- Select the normal map file generated by xNormal
- In the drop-down menu under the file name, ensure Linear is selected
- Next to Color Space, ensure that Non-Color is selected
- Invert the green channel by adding additional nodes with these connections and settings:
- You can make any of the new nodes by by pressing Shift+A, clicking Search, typing the title at the top of the node in the image above, and clicking the result
- You can connect nodes by clicking and dragging from one input or output dot to another
- Connect the Normal Map node output to the Normal input of the Principled BSDF node
- Add the normal map as an Image Texture node:
- View the baked normal map in Shading workspace's 3D viewport (top right by default) or the Layout workspace with Material Preview selected out of the four Viewport Shading option buttons (top right of the viewport by default)
- Optional: tweak the Principled BSDF material settings for a clearer preview
- I like to just turn Metallic all the way up and leave the other settings at their defaults
- Optional: preview the low poly model in Skyrim with the normal map by following these instructions