Home Technical Talk

UVs splitted by material, because of shaders? (Realtime)

polycounter lvl 6
Offline / Send Message
goekbenjamin polycounter lvl 6
Here and there sometimes i have read that people split/separate their uvs by material.

Like:
a Character has a metal-rod, a metal-shield, and wooden armour (what a bad character -.- )
So the uvs would be split like this, Character, Metal, Wood.

Is that really a thing? Is that so because different shaders?
If yes, isnt that obsolet with pbs-shader?

Or is that actually totaly wrong :-D

Replies

  • oglu
    Offline / Send Message
    oglu polycount lvl 666
    I assume thats an outdated workflow. We did that 10 years ago for games.
    But sometimes its needed. If they change shading during the gameplay.
    Or some objects are breakable. If you dont sure  ask the Artist why its done that way on that Projects.


    But its still a thing if you work for cinematics. Offline rendering still follow those rules.
    Cause if you need to override shader attributes per shot you are in big troubles if everything is baked into textures.
    You need the seperation per object. Build it like in real world. Every material is an other object. 

    If there is dirt or blood on objects its getting more complicated but in this case you have multiple textures to switch per shot.
  • goekbenjamin
    Offline / Send Message
    goekbenjamin polycounter lvl 6
    Thanks for the detailed reply @oglu
    Glad to hear that this is outdated (in most cases) for realtime-production.
    So i can go on an merge/split my uvs by a more meaningfull group as i wish.

    Greetings from the other side from austria  :D
  • codyaq2
    Offline / Send Message
    codyaq2 greentooth
    The more you split your mesh, the more draw calls it will create. Although having it all on one texture, and two shaders would be needed to be used for  skin and clothing, then it will create two drawcalls.
    So you should be smart about how you break your your mesh up vs the cost of draw calls.
    Depending on the project, i would most likely splt all my skin materials into once texture sheet, and other stuff into another. It would vary a lot though.
  • gnoop
    Offline / Send Message
    gnoop sublime tool
    Separating UVs still might help if you having too ugly  "metalic" halo,   especially  on low res textures.   If the thing have hard edges it get's lots of UV  splitting anyway.  
    Although I personally sometimes just do rusty/dusty/dirty parts also metal, non metal or half metal to  kill damn halos instead of  messing with UV
  • goekbenjamin
    Offline / Send Message
    goekbenjamin polycounter lvl 6
    gnoop said:
    Separating UVs still might help if you having too ugly  "metalic" halo,   especially  on low res textures.   If the thing have hard edges it get's lots of UV  splitting anyway
    do you mean exactly with the last sentence?
    making seams on hard edge...because it is a hard edge?
  • oglu
    Offline / Send Message
    oglu polycount lvl 666
    The game engine will split the geo if there is an hard edge. So it doesnt matter if you have a shader change on the same edge.
  • gnoop
    Offline / Send Message
    gnoop sublime tool
    gnoop said:
    Separating UVs still might help if you having too ugly  "metalic" halo,   especially  on low res textures.   If the thing have hard edges it get's lots of UV  splitting anyway
    do you mean exactly with the last sentence?
    making seams on hard edge...because it is a hard edge?
    I meant that in many cases you might have a hard edge in between metal and non metal parts. It could be the same pbr shader but you have to split UV islands along hard edges anyway.   And if you don't want to do it for some reason the real time engine would split it nevertheless .
  • sprunghunt
    Offline / Send Message
    sprunghunt polycounter
    gnoop said:
    Separating UVs still might help if you having too ugly  "metalic" halo,   especially  on low res textures.   If the thing have hard edges it get's lots of UV  splitting anyway.  
    Although I personally sometimes just do rusty/dusty/dirty parts also metal, non metal or half metal to  kill damn halos instead of  messing with UV
    UV splitting isn't the same as having two materials in most engines. Two materials draw as two different drawcalls. But a single material , even with UV splits, draws as one drawcall. One drawcall is usually cheaper than two. 

    For an object like a character it's often ok to have 3-4 drawcalls though. Because you're not going to have many characters on the screen at once. If you were making a large army tactical game (like shogun total war) with hundreds of characters you'd want to have a single drawcall.
  • Klunk
    Offline / Send Message
    Klunk ngon master
    one down side splitting uv,  hard edges is it can increase the memory requirement of the model in game as it adds additional vertices (an in game cube for example would require 24 "verts" to display (not the conventional 8, though that is pretty much a worst case scenario)
  • poopipe
    Offline / Send Message
    poopipe grand marshal polycounter
    Practically speaking that really isn't a concern in most situations these days.  Efficiency is important but any semi-modern hardware eats stuff like that for breakfast and there's no reason to save a few tens of verts if it compromises the appearance of a mesh. 

    Adding an unnecessary extra material is a much larger concern as far as performance goes - it's not just the number of materials that's the issue, switching between materials all over the place can royally fuck with the efficiency of a render pipeline.

    It's probably worth mentioning that there isn't always a 1:1 relationship between materials you author and draw calls - graphics programmers/engineers are clever and have worked out ways to mitigate against these issues. 
    Any given engine (or indeed game) will have specific ways of handling this stuff and they're generally pretty unique. 

    From the artist's perspective the best thing to do is use the minimum number of materials/textures required to get the visual result you are looking for.  If you have a specific shading effect to apply to a specific area of your mesh its probably a sensible idea to separate that part off and give it unique textures - otherwise just worry about texel density and making your UVs not shit. 
  • Klunk
    Offline / Send Message
    Klunk ngon master
    True, though they may be some crazy kids out there wanting to face map and facet their entire models ;)
Sign In or Register to comment.