Exporting Blender Textures (Baking)
Created by Austin Phan, Spring '23
Exporting textures to other programs is a big benefit of Blender. However, one issue that is regularly encountered, is that not all of the materials are translated over correctly in the new program. Baking is a solution to this issue! Texture baking takes the current state of a material overlaid on an item, and exports it as an image, usuable for materials on other programs. It's far less dynamic, and if you want to change it you'll need to come back to Blender and remake it, but it allows things to translate over correctly. Here's what I mean:
Here's an example terrain that I imported using this guide here. I've applied a simple color gradient as an example texture. Exporting this as a .fbx, and then importing it into Unreal Engine 5 as an asset yields the following result:
The mesh is correct, but the imported material doesn't match the Blender Render at all.
This is where baking comes in! When we bake a material, it exports as a .png file, which we can use to create a new material that we can import correctly into Unreal (or other development tools).
Implementing baking into an existing material.
This one's not too hard! There are two material nodes that you need to add to your exisiting material in order to get baking working. They're called UV Map, and Image Texture. When adding them to your material, they don't need to be connected to anything other than themselves. When adding them to your material, they don't need to be connected to anything other than themselves. See below:
UV Map can be left as is, but you'll need to add something to Image Texture. Press new, for a new image, which will bring up a window. You should know the resolution of the texture you're inputting, so I recommend you use that as the resolution for the new image. Select 32-bit Float, and press OK. Set the other settings to as follows:
Now, ensure that the plane is selected, as well as the two boxes you just added. In the viewport, the object you want to bake should be outlined in orange. The two UV Map and Image Texture boxes should be highlighted Orange/White.
On the right side of the screen, select the 'Scene' button (it looks like the back of a camera). Ensure the Render Engine is set to Cycles. It should look like this:
Scroll down to 'Bake', and expand the menu. Set your settings like this:
Note: If you run into issues where the image is uninitialized, set the 'single image' parameter in the Image Textures box to 'Generated'
Once it's done baking, it should pop up in the bottom left corner. It is not yet saved! Using the hamburger menu it the window with the new window, ensure you select save to save the image.
Here's the new generated baked material (with color, wow!):
We can now take this .png file, and set it as an image texture within Unreal. Here's the corrected result:
All done! The baked textures have been loaded onto the mesh in Unreal, and the work!
Note: It does look a bit different due to changes in lighting environments, but it's more or less the same.