Search Unity

  1. We've closed the job boards. If you're looking for work, or looking to hire check out Unity Connect. You can see more information here.
    Dismiss Notice
  2. We're running great holiday deals on subscriptions, swag and Asset Store packages! Take a peek at this blog for more information!
    Dismiss Notice
  3. Check out our Unite Austin 2017 YouTube playlist to catch up on what you missed. More videos coming soon.
    Dismiss Notice
  4. Unity 2017.2 is now released.
    Dismiss Notice
  5. The Unity Gear Store is here to help you look great at your next meetup, user group or conference. With all new Unity apparel, stickers and more!
    Dismiss Notice
  6. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice
  8. Unity 2017.3 beta is now available for download.
    Dismiss Notice

How do I write a normal decal shader using a newly added (Unity 5.2) "finalgbuffer" modifier?

Discussion in 'Shaders' started by bac9-flcl, Sep 22, 2015.

  1. bac9-flcl

    bac9-flcl

    Joined:
    Dec 5, 2012
    Posts:
    569
    All variations already use albedo from a packed map. If you want Standard shader style RGB albedo, use Split shader type included in the repo, it should allow that.
     
  2. wafflesnbiscuits

    wafflesnbiscuits

    Joined:
    Feb 1, 2016
    Posts:
    2
    Thank you for the reply, and I do apologize, but I may not have been as clear in my original question as I meant to. I want to be able to use all the awesome features your shader has, but also be able to use a specific albedo map for labels/stickers and such.

    I'm hoping to be able to use the shader for all the awesome normal details that you show in your examples, but also use it for things like text, warning stickers, labels, insignia, etc...
     
  3. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,117
    Any progress on the Asset Store submission?
     
  4. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    3,085
    Just in case you overlooked it, you can already download it from the repository:
     
  5. bac9-flcl

    bac9-flcl

    Joined:
    Dec 5, 2012
    Posts:
    569
    It was rejected from the store because I forgot to fill the publisher info, and I hasn't bothered to resubmit it yet. :D Will do it once more if I'll solve the issues described in the repository main page, I guess.
     
  6. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,117
    I saw the repository, thanks.

    Actually, it is not just the publisher information they want. If you just fill in your publisher info and submit it again, you can be sure it will be rejected again. There is an undocumented requirement to have your own webpage, and put some prior work onto it. I found this out the hard way and so did many other people. There are some serious issues at the Asset Store department :(
     
    Martin_H likes this.
  7. bac9-flcl

    bac9-flcl

    Joined:
    Dec 5, 2012
    Posts:
    569
    Ha, thanks for the info. I wonder how artists selling their assets fill that out - with portfolio page links, I guess?
     
  8. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    6,698
    This is not an undocumented requirement - its just a requirement - just as it is a requirement to have a customer support email address.
    When you sign up as a publisher there is a customer support fill in which lists a url and email address. The url can even link to your twitter account which several have done. Others have setup a simple blog or wordpress site that only has a link to the email - to provide for customer support.
    I even saw an asset where the publishers customer support url links directly back to the Asset Publisher Page which only has an email address listed.
    There is no requirement to have a website that has prior work on it.
     
    Martin_H likes this.
  9. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,117
    That is great news! Because initially I just had an Asset Publisher Page which only has an email address listed and I got this email:

    But just to be sure, where did you get that info from and how old is that?
     
    Last edited: Feb 5, 2016
  10. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    6,698
    Admittedly it has been some time ago - I'd say since Unity 5 came out. When all asset publishers received the notice of cleaning up assets and the asset store and deprecating some of the content.
    The email you received might be related to that update - regarding publishers not having proper support channels for there customers, though they seem to be mostly concerned with the authenticity of the content submitted.
    Here is just a quick selection of links - to facebook, linkedin, a site with a 2 pictures, and a dead link & link to a site that looks to be maybe? related - just to name a few.
    https://www.assetstore.unity3d.com/en/#!/content/55354
    https://www.assetstore.unity3d.com/en/#!/content/55255
    https://www.assetstore.unity3d.com/en/#!/content/55277
    https://www.assetstore.unity3d.com/en/#!/content/55225
     
  11. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,117
    Yeah, I think they are more strict now. I also thought that they where worried about me or my asset, but as it turns out, everyone gets the same message if you don't show your prior work. The same thing happened to Scrawk when he published Ceto for example.
     
    theANMATOR2b likes this.
  12. GreyDesigns

    GreyDesigns

    Joined:
    Apr 25, 2014
    Posts:
    8
    This is a great shader, thank you so much for creating it, and sharing it with everyone. As with wafflesnbiscuits, I was wondering how hard it would be to create a version with an albedo bitmap input. Instead of just the RGB value. That would be a really useful addition. That way if I had a more dynamic decal like a vent for example, I could have different colours for the different parts. Or stickers, etc. But awesome work, It was exactly what I was looking for! :D

    I'm guessing as it is right now, I will need to duplicate the shader and have different materials to have different colours. Which isn't ideal.
     
  13. bac9-flcl

    bac9-flcl

    Joined:
    Dec 5, 2012
    Posts:
    569
    Err, there already is a version with completely separated inputs, including albedo. It's not a good idea to use it, since it wastes a ton of texture samplers vs. a packed approach, but it works as an example. Recheck the included files. :)

    • Path: Shading / Assets / Packages / HardsurfaceShading / Shaders / HCDecalDeferredSplit.shader
    • Input: _ColorMain ("Dielectric albedo/Metal specular", Color)
     
  14. GreyDesigns

    GreyDesigns

    Joined:
    Apr 25, 2014
    Posts:
    8
    I had a go at making a version myself, haha. It works well enough for what I need I think. :)
     

    Attached Files:

  15. GreyDesigns

    GreyDesigns

    Joined:
    Apr 25, 2014
    Posts:
    8
    I'm probably being stupid, but when I try and use that shader I only get the RGB picker? -
     

    Attached Files:

  16. bac9-flcl

    bac9-flcl

    Joined:
    Dec 5, 2012
    Posts:
    569
    Ah, right, sorry - forgot I set it up that way since overwriting albedo with a map makes it almost pointless to use deferred decals over traditional alpha blended decals. I'll see about adding a split variety with an albedo map if I'll have the time.
     
    theANMATOR2b likes this.
  17. GreyDesigns

    GreyDesigns

    Joined:
    Apr 25, 2014
    Posts:
    8
    I just wanted to come back and say thanks again for all your work on this, I was using it to do my art test for Foundry 42 so that I could get a similar style, and it was a massive help - I am about to start my second week there as a 3D Vehicle Artist!

    If you have a paypal, let me know and I will fire you some 'beer money' when I get paid, haha! :D
     
  18. bac9-flcl

    bac9-flcl

    Joined:
    Dec 5, 2012
    Posts:
    569
    Hey! Glad to hear my repo has helped you. Can you, by any chance (if it's not under NDA), show me your Unity work based on that shader? I'm yet to receive a single example back from all the others using the repo, so it would be fun to take a look.

    My PP is paypal.me/bac9, but I'm not sure if foreign transfers even work anymore (since the crackdown on payment systems using foreign currencies in Russia), so don't worry about it. I'm glad to help!
     
    zyzyx likes this.
  19. GreyDesigns

    GreyDesigns

    Joined:
    Apr 25, 2014
    Posts:
    8
    Hey sorry for the delay, I'm not very punctual!

    Have you got an email I could contact you through?
     
  20. bac9-flcl

    bac9-flcl

    Joined:
    Dec 5, 2012
    Posts:
    569
    Sure thing, it's artyom.zuev at gmail.
     
    GreyDesigns likes this.
  21. Froxi

    Froxi

    Joined:
    Feb 13, 2014
    Posts:
    1
    Hey first of all, awesome shader, thank you for providing this!
    I have a question, does someone know if something like this is possible in forward rendering? We're currently working on a VR Game and we really need Antialiasing, so Deffered Rendering is a no go performance wise.
     
  22. bac9-flcl

    bac9-flcl

    Joined:
    Dec 5, 2012
    Posts:
    569
    Nope, there is no way to do anything similar since in forward rendering every surface shader directly outputs the final on-screen pixel color. There are no intermediate buffers with PBR values to hijack.

    Your best bet would probably be packing decals into the same mesh, mapping them to a secondary UV channel, and writing a surface shader that first draws the surface and then draws the decals. Obviously, that will limit the decals, making them able to overlay only their own mesh/material seamlessly - no fancy tricks with separate meshes blending over dozens of materials possible. Better than nothing, though.
     
  23. DouglasPotesta

    DouglasPotesta

    Joined:
    Nov 6, 2014
    Posts:
    49
    I know this is a really old thread, but I literally come back here weakly for information on deferred rendering shader magic. Just wanted to actually say thank you to all participants on here for the information.
     
    arnoob likes this.
  24. Zenchuck

    Zenchuck

    Joined:
    Jun 2, 2010
    Posts:
    262
    How is dirt or wear added?
     
  25. bac9-flcl

    bac9-flcl

    Joined:
    Dec 5, 2012
    Posts:
    569
    Personally, I prefer to use a low resolution curvature/AO bake mapped through UV2 to the main body and driving dirt/wear through masks dervied from those bakes. But you can also do this with more decals (that's what Star Citizen artists do).
     
    theANMATOR2b and Zenchuck like this.
  26. Zenchuck

    Zenchuck

    Joined:
    Jun 2, 2010
    Posts:
    262
    For creating the decal layer are you duplicating the main body and cutting parts of it away? I am interested in the modelling technique. Also, have you tried implementing a similar shader in Unreal? I will be studying these example shaders to try and understand how this effect is achieved. Thank you for providing the files to the community. This is an excellent technique.
     
  27. bac9-flcl

    bac9-flcl

    Joined:
    Dec 5, 2012
    Posts:
    569
    You can duplicate the body and cut it, but I prefer modeling a library of small details and using normal-aligned placement to insert them.

    [​IMG]

    That leaves seams and other nonstandard shape-dependent detail, which I like to make by drawing edges on top of the main body, extruding a cylinder over that path, then using it to cut part of the main body into a new mesh - that creates very nice strips of uniform width and uniform intersection volume, ideal for mapping of seams.

    You can definitely prepare some modular seam parts, though - for instance, I like to model some turns, place them with normal aligned move tool, and join them with stretched straight segments.

    [​IMG]

    [​IMG]
     
    theANMATOR2b, Xira and Zenchuck like this.
  28. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    542
    @bac9-flcl
    Nice tool for placing these decals. Is that your own creation or some plugin for Blender/Max/Maya/Modo/whatever?
     
  29. bac9-flcl

    bac9-flcl

    Joined:
    Dec 5, 2012
    Posts:
    569
    Nah, it's just standard toolset in SketchUp (plane-aligned instances). It goes beyond normal snapping, even cutting holes for inset shapes, as you can see on the gif. It creates surprisingly clean geometry, so I use it as my main hardsurface modeling tool. I don't do much more than material splits and base geometry there, though - I run some custom scripts in Unity to create UVs, bake stuff, merge meshes and materials and so on.

    Another artist on our team is using Modo, which, I'm told, has good normal-snapping support and easy ways of cutting decal strips from base geometry.
     
    Marco-Sperling likes this.