Conventions and standards re: Use of materials? also specular maps

Posted this in another thread, but it’s kind of more suitable here.

I’ve made an object with three distinct parts. One part is matte grey plastic, one is shiny metal, and one is (very slightly) shiny rubber.

Up until now my thinking was to prebake these and use normal/specular maps within unity. However i’ve just realised that i have the capability to implement these things with realtime rendering, by using unity’s material system instead.

my question is, what’s the best idea. what kind of performance costs are involved? And especially, what’s the performance cost involved in importing three materials from blender, versus reusing three generic materials within unity.

Also related, i don’t actually see any support for specular maps in unity’s material system. do they exist? how can i determine varying specularity over an object’s surface?
Bitmap 2 material allows me to create “metallic” maps for objects, is that the same thing?

To answer your first question, you can either assign and export different materials /material ID’s for each material type, which can still share UV’s and texture, then set their specularity and other material/shader parameters independently inside Unity by editing the material for each in the inspector.

To answer the last question - if you wish to determine sub-polygon level material types, e.g. within the textures, your best way might be to set differing values in the alpha channel of the diffuse map and choose a specular shader for the material. In other words in most of the built in Unity 4.x shaders can make use of a specular/gloss map which needs to be saved in the alpha channel of the diffuse as defined in the documentation, for example with the bumped specular:

For physically based shaders describing surface properties in more detail with specular and smoothness or metallic and smoothness you may want to try Marmoset Skyshop or our upcoming standard shader in 5.0

In terms of drawcalls and other performance considerations, to answer your second question - as there are so many considerations from target platform, polygons on screen and transparency to name but a few, your best bet is to use the profiler to asses the different options:

1 Like

This I did not know, thank you!

As for the rest, i’ll probably try to not go too deep into materials until the public release of U5

1 Like

so i how exactly am i supposed to do alpha if the specular map is using the alpha channel?

How can i do alpha and specular together?

It depends on the shader, if you check the documentation for example the Transparent Specular does both with the alpha:

If this is not what you require check out the other built in shaders or you can find/write your own :slight_smile:

http://wiki.unity3d.com/index.php/Shaders