Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

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

Discussion in 'General Graphics' started by Nanako, Dec 11, 2014.

  1. Nanako

    Nanako

    Joined:
    Sep 24, 2014
    Posts:
    1,047
    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?
     
  2. OllyNicholson

    OllyNicholson

    Unity Technologies

    Joined:
    Jun 17, 2011
    Posts:
    142
    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:

    http://docs.unity3d.com/Manual/shader-NormalBumpedSpecular.html

    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

    http://blogs.unity3d.com/2014/10/29/physically-based-shading-in-unity-5-a-primer/
    https://www.assetstore.unity3d.com/en/#!/content/8880

    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:

    http://docs.unity3d.com/Manual/Profiler.html
     
    Nanako likes this.
  3. Nanako

    Nanako

    Joined:
    Sep 24, 2014
    Posts:
    1,047

    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
     
    OllyNicholson likes this.
  4. Nanako

    Nanako

    Joined:
    Sep 24, 2014
    Posts:
    1,047
    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?
     
  5. OllyNicholson

    OllyNicholson

    Unity Technologies

    Joined:
    Jun 17, 2011
    Posts:
    142
    It depends on the shader, if you check the documentation for example the Transparent Specular does both with the alpha:

    http://docs.unity3d.com/Manual/shader-TransSpecular.html

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

    http://docs.unity3d.com/Manual/Built-inShaderGuide.html
    https://www.assetstore.unity3d.com/en/#!/category/146/page/1/sortby/popularity
    http://docs.unity3d.com/Manual/SL-Reference.html
    http://forum.unity3d.com/forums/shaders.16/
    http://wiki.unity3d.com/index.php/Shaders