Search Unity

Alloy Physical Shader Framework Version 3 For Unity 5

Discussion in 'Assets and Asset Store' started by xenius, Mar 2, 2015.

  1. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,975
    Sweet!! And welcome to 1001 posts for Alloy... that is how AWESOME it is :D
     
    punk likes this.
  2. Plutoman

    Plutoman

    Joined:
    May 24, 2013
    Posts:
    257
    @n00body It wasn't really an alloy-question, but rather I want to build off the existing alloy shaders. It's a custom solution needed, so I wanted to build in the technical aspects while using the visuals, light processing, lot of the features you have.

    It's more of a shader question in related to that I like using Alloy's shaders, and I figured being shader designers, you might have had some ideas!

    No big deal if not though, was mainly just if you had read through it and thought of anything off the top of your head.
     
  3. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    540
    Can I reduce the number of shader keywords used? Is that a matter of just removing unneeded shader files? Or do I need to remove some cginc files too? Is it possible at all?
    It is getting out of control for me, I'm getting that warning about 128 keywords limit even with just 4 assets installed. Ridiculous.
     
    Tethys likes this.
  4. n00body

    n00body

    Joined:
    Dec 17, 2010
    Posts:
    691
    @montyfi
    Unfortunately Unity doesn't make keyword management even remotely simple. It's not the shaders that control the current keyword count, its the materials. Once a material has had a given shader on it, it then has all the keywords that were set for that shader with the combination of features you were using. Those keywords then stay on the material unless the next shader explicitly turns them off. So you can build up an excess of keywords if you materials have had lots of shaders with lots of different keywords over their lifetimes.

    I'm not sure if that is the complete picture, but that is my best understanding of a really murky system. :/
     
    chelnok, Tinjaw, punk and 1 other person like this.
  5. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    381
    Exactly what I've found, it also means that if you try out some shaders which I had many times over the last few years and then delete them, the keywords from those shaders will still remain even tho they are not in the project anymore. I had the exact same problem recently, ended up removing all the keywords in all the materials with notepad++ and then went through the ones I use and just reassigned them by clicking on objects and making sure the Alloy tabs were open in the material rollout
     
    chelnok, n00body and montyfi like this.
  6. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    540
    That looks like a bug, I'm wondering if someone reported it to Unity at some point.
     
  7. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    381
    I don't think it's a bug, it's just not the best implementation, I don't think they were expect ing people to use so many, most commercial game companies wouldn't face the problem, because they're keywords would be shared throughout their project, but cos us Indy devs uses loads of different assets, it gets blown out of control, I've pretty much made a conscious decision, which products to include and which I can live without, but after my big clean out I was surprised how many different products I could use. When checking out a new shader/asset do it in a new project
     
    chelnok and montyfi like this.
  8. Skolstvo

    Skolstvo

    Joined:
    Dec 21, 2015
    Posts:
    107
    If you can't clean up the keywords then that certainly isn't a feature. A keyword cleanup button would be great.
     
    Tethys and punk like this.
  9. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    381
    Sure would be handy!
     
  10. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    583
    At all I don't need specularity, I added it to the metallic map because the blue channel carry this information. Im using roughness and metallic all the time in SP and no specularity. Then I guess I should leave the blue channel empty. I'am an indie developer, I don't have time for SD after SP. I switched back to Standard-Metallic Unity shader and working with ShaderForge, where I created my decal blending shader. Probably I will use your shaders for cut-scenes.
     
  11. Feydwin

    Feydwin

    Joined:
    Jan 11, 2013
    Posts:
    159
    Thank you so much ! A Blessing you guys are there to pick up where Unity is slacking !

    Sorry for asking again, but i could really really use a pointer here :
    Speedtree.jpg

    That specular effects on the leaves... is killing me. Please, anyone .. What in the shader can i modify to get rid of that ??? And if at all possible, what to modify so that shadows don t get 20 times stronger than everything else in the scene.
     
  12. Skolstvo

    Skolstvo

    Joined:
    Dec 21, 2015
    Posts:
    107
    I'm fairly sure I have found a bug with the Alloy core shader. The AO channel lights up the material when the color is slightly darker than white at grazing angles. I think the MIP data is read incorrectly.


    The right sphere uses the Unity standard shader. The left one is Alloy. I'm using Alloy 3.3.5
     
  13. n00body

    n00body

    Joined:
    Dec 17, 2010
    Posts:
    691
    @Skolstvo
    That's not a bug, that's a fake inter-reflection effect that is part of Alloy's specular occlusion system. You see Unity just darkens reflections with the AO, but Alloy uses the AO to calculate a view-dependent term that goes to black at grazing angles. In order to avoid weird black blobs of occlusion, we fill those areas with a fake inter-reflection effect based on the diffuse ambient.
     
  14. n00body

    n00body

    Joined:
    Dec 17, 2010
    Posts:
    691
    @Feydwin
    So I just looked into it, and apparently SpeedTree bakes a per-vertex AO value which is totally accessible in Unity. I didn't know about this because the Unity SpeedTree shader, which was the basis for Alloy's, doesn't access it. I'm going to fix this oversight, and then SpeedTree's AO will be used by our specular occlusion system to fix your specular problem once and for all.
     
    montyfi, John-G and Teila like this.
  15. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,690
    This will be a HUGE help! Thank you. :)
     
  16. Skolstvo

    Skolstvo

    Joined:
    Dec 21, 2015
    Posts:
    107
    @n00body
    I have never noticed any black blotches with the standard shader. I do however notice huge white bloches with Alloy on a metal panel wall that I baked with Xnormal. It looks like fat lines of coke appear in the crevices of my panels. Is there any way I can remove this unrealistic and distracting effect?

    The effect seems downright energy non-conservative.
    i.e the crevices appear to be producing their own emissivness.
     
  17. n00body

    n00body

    Joined:
    Dec 17, 2010
    Posts:
    691
    @Skolstvo
    The "black blotches" I mentioned happen when you use our effect without the fake inter-reflection to fill in those spots. Also, because we use ambient diffuse for that effect, it can sometimes appear too bright when it differs greatly from the ambient specular. Smooth metal with heavy occlusion is the one case where the effect breaks down and requires reworking. The rest of the time it is an indispensable effect that drastically reduces the appearance of specular highlights where they should not appear (cracks, crevices, inner spaces, etc).

    Currently there isn't a way to turn it off.
     
  18. Feydwin

    Feydwin

    Joined:
    Jan 11, 2013
    Posts:
    159
    Man.. if you do that... you were already awesome, but you d go to kung fu panda's master's shiffu awesomness.
     
    Teila likes this.
  19. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,975
    You just gave me an idea and it will cut down on the number of textures in my project :)
     
  20. n00body

    n00body

    Joined:
    Dec 17, 2010
    Posts:
    691
    @KRGraphics @mkgame
    One other option, just fill the Specular map to 127, and slot it into the B slot like you were doing. That will cause equivalent behavior in Alloy to what Substance Painter's shader does by default.
     
  21. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    583
    That sounds good. And explains my problem, SP filled it with white or black by default, but not with gray. Thanks!
     
  22. Skolstvo

    Skolstvo

    Joined:
    Dec 21, 2015
    Posts:
    107
    I experience the complete opposite effect. It isn't the heavy occlusion that causes the ugly unrealistic effect. It's only when the occlusion is very light, as you can see in my image. The problem is that any smooth gradient has light occlusion.

    Do you have any advice for me if I want to use any kind of metallic surface, seeing that Alloy can't handle rendering metals realistically?

    Maybe some other asset pack can handle metals, maybe a shader asset called Polymer or something.
     
  23. n00body

    n00body

    Joined:
    Dec 17, 2010
    Posts:
    691
    @Feydwin @Teila
    Well damn. What a difference that made:

    Wrong AO (current state)
    Wrong.jpg

    Correct AO
    Corrected.jpg
     
    Last edited: Apr 12, 2016
    TeagansDad, Tethys, Teila and 3 others like this.
  24. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,975
    .5? Hmm, I've been using low values like .04 for all of my surfaces. And. 35 for skin... I'm about to try this out.

    EDIT: looks really good. And an exact match to SP. .5 in specular is the default in Unreal
     
    Last edited: Apr 12, 2016
  25. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Hey there, turns out my problem wasn't related to alloy itself so no problem. Just off the top of my head and I know these might be a little too specific and out of the scope of the asset even if not features, but is an ability to have holes in the terrain or parallax in the terrain material considered possible features? This would make alloy extremely convenient to keep parity with the rest of the scene
     
  26. reddotgames

    reddotgames

    Joined:
    Apr 5, 2011
    Posts:
    659
    Any ideas why AO from Unity's Cinematic Image Effects don't work with all Alloy Shaders?

    alloy.jpg

    I noticed it on Transmision shader, also on Car Paint Clear Coat from Alloy Mods.

    Also new Unity's SSR post process don't work on those shaders (screenshot with debug mode "incoming radiance", you can clearly see that SSR kind of skips those models) :

    alloy2.jpg

    Most important for us is to have it working on Car Paint Clear Coat.
     
  27. n00body

    n00body

    Joined:
    Dec 17, 2010
    Posts:
    691
    @reddotgames
    That problem affects all forward-only materials, and is not limited to Alloy. You see, those effects rely on the G-Buffer as the primary input, which is only populated by deferred-compatible shaders. In our demo scene, the map and the candle use the forward-only variant of our Transmission shader. Similarly, the CarPaint Full ClearCoat shader is forward-only due to its multi-pass nature.

    Our regular CarPaint and Transmission shaders are deferred-compatible, at the cost of having less per-material control. So you need to use those shaders if you want the materials to be affected by SSAO+SSRR. For all the forward materials, I believe you have to tag them to be skipped when the effects are applied.
     
  28. n00body

    n00body

    Joined:
    Dec 17, 2010
    Posts:
    691
    @Skolstvo
    The best I can offer is to put a config flag in the next release that you can change to make it to work like Unity.

    If you need artist tips, then get a hold of @xenius.
     
  29. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,975
    Hey guys... quick question... I am looking at the pack map tool and I notice there is a tab caled Unity PM, what is that exactly?
     
  30. n00body

    n00body

    Joined:
    Dec 17, 2010
    Posts:
    691
    @KRGraphics
    Those are just convenience modes for converting Unity Metallic and Terrain Splat maps to our format with Specular AA.
     
  31. Furax

    Furax

    Joined:
    Nov 20, 2013
    Posts:
    5
    Hi, many thanks for this shader pack
    Im working on a scene that needs area lights and i have an issue with 3.3.5 version on deffered rendering
    Im using unity 5.3.4
    Any ideas to fix that ?
     

    Attached Files:

  32. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,975
    Oh cool. I need to test out the packer again. Also what is on the roadmap for stuff like skin, hair and eyes?
     
  33. n00body

    n00body

    Joined:
    Dec 17, 2010
    Posts:
    691
    @Furax
    Are there any errors in the console? Does fiddling with the Length and Width controls do anything? Can you show me screenshots of your light component setup/settings?
     
  34. n00body

    n00body

    Joined:
    Dec 17, 2010
    Posts:
    691
    @KRGraphics
    Currently optimizing the Deferred Skin rendering code.
     
  35. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    441
    I'm using Substance Painter 2 to bake out maps. Do I need an Ambient Occlusion map in the Alloy packed map if I decide to use a SSAO post effect? Won't that "double" the effect on the mesh surface? I gather that SSAO will also add the effect where two separate meshes are near each other which AO maps can't do... but do you just tone down the AO map and then use SSAO as well? Unsure how to proceed here...
     
  36. n00body

    n00body

    Joined:
    Dec 17, 2010
    Posts:
    691
    @Korindian
    You can do both if you want. One option would be to bake micro-occlusion into your material AO, and then use SSAO for you macro occlusion. Or you could just leave the channel set to white and use SSAO for everything. The one big downside of that though is that you won't get specular occlusion from our lighting model.
     
    Korindian likes this.
  37. Furax

    Furax

    Joined:
    Nov 20, 2013
    Posts:
    5
    n00body
    I found why area lights Didn't work on deffered, i have forgotten to put deffered skin on custom shaders.
     
  38. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,331
    Are there any performance or other considerations when I use textures with a different resolution in each slot on a material?
     
  39. n00body

    n00body

    Joined:
    Dec 17, 2010
    Posts:
    691
    @Elecman
    The size of the texture only affects memory storage requirements, and the speed at which the GPU can fetch texels from it for the shader. It's a fairly common optimization for games to try halving the resolution of the base color, material maps, and/or emission maps while keeping the normal map full res. Color data and material properties can usually survive being a little blurry.

    I hope that at least partially answered your question.
     
  40. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,331
    Thanks, that totally answers my question :)

    One other question. Is it possible to have an additional parameter for the emissive channel so that you can turn up or down the amount of emission without making the texture disappear? For example, have the tint only affect the color, not the emission strength. Then have a separate value for the emission strength.

    In our vis-sim project we use a lot of emissive text which acts like a regular decal at daytime (white) but is emissive at night (amber). Currently we bake the text in the diffuse channel to solve this issue, but we could dump the diffuse texture entirely because other than the text it has a uniform color.
     
  41. n00body

    n00body

    Joined:
    Dec 17, 2010
    Posts:
    691
    If you use the Unlit shader, the tint color has an HDR picker.
     
  42. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,331
    But we want to control the amount of emission so it can be zero. At nighttime you should be able to turn the emission down and it should look like any other regular surface (text visible as if it was normal paint).

    One other problem with using an unlit shader is that it requires one material for the panel and another one for the text.
     
    Last edited: Apr 23, 2016
  43. xenius

    xenius

    Joined:
    Sep 30, 2010
    Posts:
    522
    Hi Everyone!

    Wanted to let you all know,
    Our first beta version of Alloy 3.4 (for Unity 5.4 beta 15 and up) is now live on the store
    Release Notes:
    Version 3.4.0
    =====================
    Shaders:
    - Added Unity 5.4 support.
    - Added Light Probe Proxy Volume support to all lit shaders, including particles.
    - Added a "Lite" mode to Main, Secondary, and Oriented Textures to get roughness from the base color map alpha.
    - Fixed "Partices/VertexLit Blended" shader to support 1 Directional Light, 4 Point Lights, and Light Probes (including LPPV).
    - Fixed the vertex lighting code to support the Unity attenuation config flag.
    - Fixed SpeedTree shader to apply AO correctly.
    - Fixed Skin Transmission to not be so much darker than regular transmission.

    Tools:
    - Optimized Deferred Skin rendering.

    Mods:
    - Added "SP Car Paint" shader that is similar to the Substance Painter CarPaint shader.


    Some things to check out in this version that I'm really happy about:
    1) The speed tree shader looks _so_ much better now that it's using the occlusion value that's baked into the geo.
    2) The 'lite' version of the Main Textures is designed especially with VR devs in mind. There are many circumstances where the extra texture for the packed map is... worth dropping for perf, especially for non-composite materials. In this mode the BaseColor Texture has Roughness in its alpha, and you get a normal map. All other properties are simply changed via sliders, so you can make something that's uniformly metal/dielectric. Personally, I plan to use these in simple, matte materials, especially for distant objects, where simplicity is all that's needed.

    As this is a beta on top of a Unity beta, if anything goes wrong, shoot n00body a pm here!

    Cheers!



     
    montyfi, chelnok and punk like this.
  44. n00body

    n00body

    Joined:
    Dec 17, 2010
    Posts:
    691
    Just as a heads up, I'm tentatively planning to deprecate the old forward skin shaders in favor of making new variants that have the similar inputs to the deferred skin shaders. I'm also modifying the deferred skin shaders to hopefully remove the need for an explicit mask in favor of using the transmission map to weight the effect.

    Anyone have any thoughts on these changes?
     
  45. HolyFireGames

    HolyFireGames

    Joined:
    Apr 23, 2014
    Posts:
    116
    Hi there, does the new update that fixes speedtree's work on Unity 5.3.x as well?

    Also, do you think the fix you applied to the speedtree shader would help with this issue?



    Would it be possible for you to take a screenshot of a speedtree with the sun behind it with a low angle to the ground? I know the grass whiting out is a separate issue, but I'm mainly concerned with the tree's. I'm hesitant to pickup Alloy unless I'm sure it will help us with our speedtree issue. We're trying to use linear + deferred but having major issues.

    Thanks!
     
  46. n00body

    n00body

    Joined:
    Dec 17, 2010
    Posts:
    691
    @HolyFireGames
    The SpeedTree shader fix is built against 5.4 where we've made so many code changes to Alloy that backporting it would be too time-consuming.

    As for the issue, I'm not sure. Alloy's lighting pipeline generates specular occlusion where there is already ambient occlusion. It looks like the problem there is happening in parts of the plants with little AO.
     
  47. HolyFireGames

    HolyFireGames

    Joined:
    Apr 23, 2014
    Posts:
    116
    Ok, thanks for the quick response.
     
  48. n00body

    n00body

    Joined:
    Dec 17, 2010
    Posts:
    691
    @HolyFireGames
    No problem. I hope you will consider us again once Unity 5.4 is out the door. ;)
     
  49. HolyFireGames

    HolyFireGames

    Joined:
    Apr 23, 2014
    Posts:
    116
    Definitely, we'd move to 5.4 right now but a few of our assets we're using are having conflicts :)
     
  50. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,975
    I would definitely welcome this... especially since I often bake transmission maps in Knald and modify them in Substance Painter to add details... now will the Transmission Map be used as a separate texture? If so, it would be awesome if it was an RGB texture so I can paint whatever details I want and not have to rely on a tint. And a Subdermal Map would be an excellent addition to this... and the bump smoothness, it would be nice to have that on the material so I can control how much bump is on the characters, like for a kid, I would have the normal map less prominent, versus a very old man where you can see his wrinkles...

    And I can't wait to test the faster deferred skin shader...

    Now I am not using the beta since I have other plugins that may not work correctly. But I am looking forward to the changes.
     
    Last edited: Apr 26, 2016