- Home /
Displacement and gloss on my material from blender is not showing in unity when imported.
I am trying to learn how to use blender and integrate into making unity games. I created a model then made a material involving mixing glossy and diffuse shaders from cycles render. Then using a tutorial I found online made a displacement? thing and connected it to displacement in the material output. The object looked great in blender but when i export it to unity it only keeps the color of the object without any gloss or displacement.
I have no idea why but i think it involves baking and uv unwraping which i know little about.
Blender and Unity don't use the same means of describing materials, and this is true of all 3D modeling tools I know of (I use 3DS $$anonymous$$ax, many use $$anonymous$$aya, some prefer Rhino, etc).
The point here is that, so far as I know, complex material work can't be done in the 3D editor and transported seamlessly into Unity. There would have to be a plugin to the 3D modeler that provided a Unity materials system to do that.
I have the issue constantly. Just lately I'm working on a simulation (a game, yes, but not one for a wide audience, it is for students who build robots to practice strategy for contests, so the game is the simulation of a real world game). The robots are made of metal parts with holes drilled on every bar about 1/2 to 1/4 inch increments. That's too much to model, so I use a material to "simulate" the holes in the bars. There is absolutely no way to get the means by which 3DS $$anonymous$$ax does this to transport into Unity. The best I can do is to establish the mapping, so the holes are the correct size and position on the bars and parts. In Unity, the same materials have no holes, because the means by which an alpha-texture is applied isn't compatible. I have to re-apply Unity materials in the Unity editor.
There just isn't another way without a 3DS $$anonymous$$ax plugin which presents Unity materials in the 3D modeler, and so far I've not found one. I might eventually build one for 3DS $$anonymous$$ax, and perhaps it could become an asset for use with other modelers, but that's a long way off.
Answer by Underpig1 · Mar 28, 2020 at 01:35 AM
@JoshomeJosh, the method you are looking for is Cycles baking. First, you must bake the displacement material into a displacement modifier, which you can then apply to transform it into geometry. A great tutorial for baking displacement can be found here: https://www.youtube.com/watch?v=McALCOr39rY. You must then bake the procedural materials into textures with Cycles, which can then be compiled into a material for Unity. You can follow this tutorial here: https://www.youtube.com/watch?v=ZmZDFdeneoo or to break it down:
First, uv unwrap your mesh (you may want to consider a lightmap pack) using, in edit mode, and select all: UV > Lightmap Pack. Set the resolution to a desired number (best to use a power of two)
Next, create a new image in the UV editor window, and set the resolution to the same as the lightmap pack.
Go to object mode and select your mesh, and go to the render settings in the properties window and press bake. Bake the combined map (if it is well-lit and you prefer lighting influence; if not, bake a diffuse map with only color selected), the normal map, and the glossy map, with only color selected. Save each image in the UV editor.
In Unity, import your mesh and textures. Create a new Autodesk Interactive material, apply the combined/diffuse to the occlusion and albeido. Apply the normal to the normal, and change the normal map's texture type to a Normal Map. Apply the glossy map to the roughness.
You can then apply the material, and it should have both gloss and displacement.
Hope this helps!