How to export a mesh + materials (as texture) from Blender?

Hello
I have made a mesh in Blender and put some materials on its faces.
I also have made UV unwrapping for the mesh in Blender.
But I do not know how to transfer the selected face materials to the UV unwrapping image, so I can export it to Roblox?

Thank you in advance

3 Likes

To transfer shader materials onto a texture to be used in Roblox, you have to bake the textures.

I’ll assume you know the basics of UV mapping and navigating around Blender, so here you go:

Quick note: some of the settings and options might look different on your version of blender, I’m using E-Cycles RTX 3.0 client, but your blender should have all the same options available.

So, first, make sure you are using CYCLES render engine. EEVEE and Workbench don’t support texture baking.
image

When you have finished your mesh, unwrap its UVs and make sure the UVs don’t overlap at all.
It takes more time to manually unwrap UVs on complex objects, but it’s worth the effort. Make sure your UVs fill as much free space on the image as possible to save detail.

You can find a lot of tutorials on UV unwrapping and how to do it well, so if you are interested, look it up. For now, I’m just going to be using a cube with a simple UV map and a material from Ducky 3D’s Real-time Material blender addon.

Now, go to the shader editor, add an empty image texture node, and create a new image in the resolution you want the texture to be in. Remember that Roblox compresses all (larger) images to 1024x1024px if I remember correctly, so baking to a larger resolution is useless if you are only going to use it in Roblox.

Don’t connect this image texture to any other nodes, just keep it as is.

Now, go to the render tab, find the bake drop down, chose what contributors you want to affect the baked texture (usually just diffuse) but decide what influencers you want, eg, a light source. This will just bake the light shining on the object directly onto the texture, so it will have a clear bright spot on it.

These are the bake settings I chose:
image

The output margin is set to 16 pixels because sometimes when you apply textures to objects in Roblox, the texture fades a bit as you get further away, and sometimes you can see some color on the edges of the UV islands.
This just prevents that from happening by extending the color at the edge of the island a few pixels outside of the UV island boundary.

When you are all set and all the settings are as you want them to be, select the object in the viewport and select the image texture node in the shader editor (select both at once), and hit bake.

Now you wait for it to bake!

Depending on the complexity of your material, it can be either really fast or really slow, but it’ll get there eventually.

For me, the result looks like this.

So now I would just select the mesh, duplicate it, remove the material on the duplicated mesh, make a new material with the base color being the texture we just baked, and see the results.

https://gyazo.com/8f43057affa78afc1813332ec48fcb01

If it looks well and good, then select the mesh, go to file > export > export as FBX

In the export settings, check “Selected objects” and change “Scale” to 0.01 to keep the scale of the object as it is in Blender. If you don’t need to change any other settings for what you are doing, don’t. After this, you can export it!

The texture will be packed together with the mesh.

Now in Roblox Studio go to view, open Asset Manager, and press the bulk import button to import the files.

Find the exported FBX file of your mesh, select and import it.

Uncheck all the boxes in the popup unless you know you need them enabled.

Now, you can right-click the mesh in the Asset Manager and import it as is or import with location. Usually with location. If you selected multiple parts when exporting, they all will be imported as separate objects which is really helpful.

You can select all the objects and insert them with location and they will be positioned correctly relative to each other.

image

And that’s it! It automatically uploaded the texture and applied it to the MeshPart. You should be good to go!

You might want to anchor the MeshPart as well, as by default it is unanchored.

I hope this helped. Good luck.

12 Likes

Hello @MechanicalCore
Thank you for your detailed explanation.
I tried to follow the steps, but I have a question.
I made a simple Cube and I put on it 2 materials (from BlenderKit add-on) - 1 material on 1 face and another material for the other 5 faces.
Each material consists of complex map having multiple nodes (including textures).
In which of the 2 node maps I must create the new output “baking node”?
Or I must create a third material, only to put in it the output node?
For some reason I always get “Circular reference warning” and I cannot get the desired output.
It seems that Blender tries to bake the output in 1 of the existing texture nodes, not in the one which I created, although I keep it selected on the screen…

Just select the whole object(s), go to edit mode and unwrap the object with smart UV project or Lightmap pack, or by hand if you want more control over the UV’s. Make sure no faces overlap. This is more of an issue if you have 2, 3 or more objects to bake with the same texture.

Go to each material, add a image texture with the same image in them, don’t connect it to any other node just as before.

Then just bake the texture.

2 Likes

Thank you
I managed to bake the texture :slight_smile:
I have to admit that the texture baking in Blender is not very intuitive :slight_smile:

One more question:
After a mesh is uploaded to Roblox, can I update it later with a new version?
Or it will create a second mesh with a different id?
And if it creates a second mesh, can I delete the first one?

Thanks

Hey do you know how I can bake a texture with transmission and roughness?