- Home /
How to combine several Materials into one?
Hello,
I want to use a highlight/outline shader on interactable objects. As soon as I look at an interactable object it adds a border around the mesh.
This all works, but I have a problem with some models.
For example if I have a weapon with attachments. Let's say I have a weapon as GameObject, A silencer and a scope as Child GameObjects.
I noticed the highlights worked seperately, which is obvious. So I used Blender to combine the Meshes. Now the weapon, silencer and scope are combined and are in one GameObject.
The problem now is that the highlight only works (I think) on the last Material. Then I noticed that the Mesh has 3 SubMeshes. Yes this is another example (Not my model)
Then I tried to put all the UV Maps in one with Blender. When I did that, the Materials weren't shown correctly.
I know I am missing a step and that is probably exporting the UV Map and combine all the Textures into one. I am not really experienced with the 3d and 2d aspects of game development so I prefer to fix this by code.
I haven't really found a solution on the internet. I found many similiar topics, but many didn't solve my problem.
Thanks,
Tim
[Edit] Example of what I want to achieve: https://youtu.be/qbLXNR0n8Ag?t=29s
If you want to use only one texture, you have to combine the texture images into one and then remap the UVs accordingly in Blender. The remapped model can then be exported to Unity.
@cherno First I would like to thank you for your reply. I know that's an option, but I really hope there's another solution, but I guess not.
If there isn't another solution, can you suggest me some good tutorials/documentation about combining textures into one? (I didn't search the internet yet)
Thanks,
Tim
You would use any kind of image editing application for that, like GI$$anonymous$$P or Photoshop. However, an easier option would be to just keep the submeshes and multiple materials, and use an outline shader that works right. Try the Silhouette Outline shader from the user wiki. Just use this shader for all materials on an object. You can also try this outline shader, or my modified version of it.