Search Unity

Decals using Standard Shader? (image heavy)

Discussion in 'General Graphics' started by Shushustorm, Aug 12, 2016.

  1. Shushustorm

    Shushustorm

    Joined:
    Jan 6, 2014
    Posts:
    1,084
    Hello everyone!

    I have taken a look at the official Unity documentation, but there is very little information on this.
    Even generally online, nobody seems to really cover this topic.

    Is there a way to apply a single decal on a tiled material using the Standard Shader?
    I thought this would be easy, but either I am missing something or it really proves being a difficult task.

    Here are some images of what I tried in a test scenario:

    In Unity:
    unity.jpg

    Textures: textures.PNG

    Mesh in Blender: blender.jpg

    Also, changing the secondary map's UVs to UV0 or UV1 doesn't change anything.

    Many thanks already for any tips,
    Best wishes,
    Shu
     
  2. fffMalzbier

    fffMalzbier

    Joined:
    Jun 14, 2011
    Posts:
    3,276
    The detail mask has the same tiling as the albedo map -> 10x tiling for albedo = albedo 10x detail mask.
    That will make the decals in just one spot impossible.
    Doing decals this way seems very limited.

    If you like you can download the build in shader and do a version of the standard shader that does have a separate tiling option for the detail mask independent form the other maps.
     
    Shushustorm and theANMATOR2b like this.
  3. Shushustorm

    Shushustorm

    Joined:
    Jan 6, 2014
    Posts:
    1,084
    Thank you for your reply!
    I see! But doesn't that mean the whole detail mask thing is pretty much useless?
    Because if I want to blend in certain colors or bumps, I could have done that with the albedo or normal map before even importing it into Unity, right? So basically, the only use case for this is when you actually want to use the same texture in your game over and over again with only some changes in details? (Not sure if it can be used other than I can imagine right now, though)

    Anyway, shouldn't the UV set of the secondary maps let me do what I want?
    I can scale the unwrap in Blender just as I want so that the decal should only show up on one of the faces and be scaled / offset as I want it to. Then, I shouldn't even need a detail mask. Just to clarify: On UV1, I unwrapped all the faces that shouldn't have the decal on it and scaled them down so they only use a tiny space on the UV map. Then, I put those faces to a place where the texture's alpha is 0. So those faces shouldn't have any secondary texture on them. Afterwards, I unwrapped the face that should have the decal on it.
    The only issue there, Unity doesn't seem to care about UV1 and it seems to use UV0 for secondary maps either way.
    Is this a bug or behaviour that is to be expected?
     
    Last edited: Aug 13, 2016
  4. Shushustorm

    Shushustorm

    Joined:
    Jan 6, 2014
    Posts:
    1,084
    I just figured out: It does work after all, at least to some extent.

    The only issue here is that Albedo detail doesn’t work with RGBA. It can use RGB only, which means I cannot use Albedo detail for decals?

    If I try to do so anyway, these are the results:

    (Note that without transparency, the overall albedo color changes, which it shouldn’t, while with transparency enabled, the whole thing is flooded in albedo2 color.)

    Without Albedo2 at all:
    image1.jpg

    With Albedo2, no transparency:
    image2.jpg

    With Albedo2, transparency enabled:
    image3.jpg

    Any hackish ideas to use this for decals anyway? It really seems to only lack the alpha channel for albedo2 to do this.

    EDIT:
    Using a 50% grey instead of alpha helps. At least, it doesn't change albedo1's colors. But now, albedo2 won't cover albedo1, but rather be mixed into it:

    image4.jpg

    EDIT2:
    Also, the mixing itself seems pretty weird:
    image5.jpg
    Black covers, white brightens bright areas. Red and green mix their colors into bright areas and further darken dark areas while blue seems to actually cover, too. Doesn't make sense to me unless the mixing itself even depends on the hues on albedo1, too.
    Any information on how this mixing works could be useful.
     
    Last edited: Aug 14, 2016
  5. LyesBourahla

    LyesBourahla

    Joined:
    May 30, 2017
    Posts:
    2
    the 50% gray tip is awesome it did the thing because what i was going to do is to tile a texture on my GameObject then to add some dirt and painted hand-made occlusion and lighting areas to an other texture that i added as detail albedo so if anyone didn't catch how to do it from the last comment of Shushustorm here's the complete steps on how to do it :
    1- go to your software where you are making the textures for this example it's gonna be Blender
    2- make a new texture
    3- set it as defuse
    4- turn off the Alpha
    5- set the background color to 50% gray "R : 0.5 ,G : 0.5 , B : 0.5"
    6- if the UV is not refreshed refresh it by going into "slots" then click on the name of your texture under "available paint slots "
    7- start drawing your details
    8- don't forget to save your image as often as possible
     
  6. jzzja

    jzzja

    Joined:
    Sep 28, 2017
    Posts:
    43
    You can use full alpha you just need to add a main detail mask that is the same image as the secondary detail map.