Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Shader performance question

Discussion in 'General Graphics' started by o1o101, Sep 7, 2019.

  1. o1o101

    o1o101

    Joined:
    Jan 19, 2014
    Posts:
    639
    Hi guys,

    Just curious, how much cheaper it is when using 2 seperate materials on a single object, each material using 3 texture samples (standard shader using albedo, metal, norm) VS a custom standard shader with 6 texture samples multiplying eachother thus only using 1 material on the object. This object is a single large scale object and will not be rendered multiple times, batched, etc.

    So it is the same amount of texture samples all together, but 1 material, however a more expensive shader because of the extra math for multiplying, etc. does this matter or which method is cheaper? Is it significantly cheaper?

    Targeting modern mobile devices.

    Cheers, hope the question makes sense.
     
  2. Shushustorm

    Shushustorm

    Joined:
    Jan 6, 2014
    Posts:
    1,084
    If I remember correctly, 2 materials on an object will render its geometry twice. Personally, I try to avoid that.
    I'm not sure even if there are scenarios where using 2 materials would make the game run faster, unless you use the materials on other objects, which may or may not result in optimization.
    Especially if the object is only used once, using a high polycount, and there is no batching, I wouldn't assume 2 materials to be the performant choice.