Search Unity

UBER - Standard Shader Ultra

Discussion in 'Assets and Asset Store' started by tomaszek, Jun 23, 2015.

  1. Deleted User

    Deleted User

    Guest

    Ok, I understand.

    One more question:

    Can I create a stained/colored glass shader with UBER shader? Maybe I'm missing something very obvious, but so far I always used transparency with colored specular to get something that looks roughly like colored glass.
     
  2. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Depending on transparency level I guess diffuse color also counts ? I see no reason you couldn't do so. Use correct alpha transparency channel on albedo/diffuse texture to get metal links opaque.

    Approach that you presented requires to draw object twice anyway (scaled a bit up and with depth comparison as far as I briefly saw). So - additional material means actually the same (object needs to be rendered twice).

    Tom
     
  3. buronix

    buronix

    Joined:
    Dec 11, 2013
    Posts:
    111
    You actually save me tons of time in investigation and development trying to put together this with uber shaders, thanks Tom! , Im pretty ignorant about shaders.
     
  4. Deleted User

    Deleted User

    Guest

    I'm not sure I understand what you mean. Glass has no diffuse component. If I dial in diffuse into a glass material then this material will react to diffuse scene lighting, resulting in a look that doesn't resemble glass. Or did you mean something else?
     
  5. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Stained glass is colored, so it's not completely transparent and reacts to diffuse lighting (of course we don't like it to be exagerrated). Stained glass consists of glass + links (metal) which is opaque. So - we need to use albedo texture anyway (to declare where we'd like the object to be partially transparent (glass) and where opaquye (metal links). That's what I meant.

    Tom
     
  6. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    I'm participating in a nice small Christmas event. Take a look here for more details:

    http://christmas.devdog.io/

    There is a chance to win RTP and UBER (3+3=6 free vouchers in sum) at 1st and 6th of December.

    christmas.jpg

    Good luck, although I'll wish Merry Christmas to all of you a bit later :).

    Tom
     
    Lex4art, nxrighthere and Danirey like this.
  7. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    504
    Nice, thank you for sharing.

    ---

    I have a question, Is it me or the Triplanar tessellation shaders wont work with texture atlases? I am trying to use one of those on my assets but the whole atlas gets displayed on the model.

    Thanks!
     
    Last edited: Nov 29, 2016
  8. Deleted User

    Deleted User

    Guest

    No offline renderer I've ever worked with simulates colored glass with any diffuse whatsoever. They all use a dedicated refraction color for that which doesn't react to diffuse lighting. UBER should have something similar IMO. Using diffuse just doesn't look right for this purpose. It creates a powdery appearance on the outer shell of a material and that's not how colored glass looks even if from purely physical standpoint you might be right with your interpretation of colored glass.

    Is it possible to add a refraction/transparency color to UBER?
     
    Last edited by a moderator: Nov 29, 2016
  9. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    558
    Is UBER really appropriate for mobile yet? Thx.
     
  10. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    They can work but you would need to configure shader to do so (like using atlas in regular RTP scripted version with triplanar via LOD manager is possible). When you drag&drop atlas on one of the diffuse detail slots it would be no good. What's the reason you actually need atlases in triplanar version with tessellation ? Are you talking about standalone version of RTP (material based, not scripting) ?

    Does monkey head example in my package behaves correctly for you ? Of course you can tweak shader code (UBER_StandardCore.cginc) to get desired color treatment, but it's up to user to extend it :).

    Resonably modern GLES3 mobile would work (don't expect advanced expensive features like Parallax Occlusion Mapping) to work fast, but most vanilla features (translucency for example) should work OKish.

    Tom
     
  11. mercior

    mercior

    Joined:
    Sep 21, 2015
    Posts:
    16
    I have been trying all day to be able to toggle on the "Animated Emission" in uber shader via c# with no luck.

    Here is all the things I am trying! (I know I'm setting way more than must be needed, but I am demonstrating all the different things I've tried!)

    Code (CSharp):
    1.         foreach (Renderer m in weaponMaterials) {
    2.             m.material.globalIlluminationFlags |= MaterialGlobalIlluminationFlags.RealtimeEmissive;
    3.             m.material.globalIlluminationFlags &= MaterialGlobalIlluminationFlags.EmissiveIsBlack;
    4.             m.material.EnableKeyword("_EMISSION");
    5.             m.material.EnableKeyword("_EMISSION_TEXTURED");
    6.             m.material.EnableKeyword("_EMISSION_ANIMATED");
    7.             m.material.SetFloat("_Emission", 7f);
    8.             m.material.SetInt( "_PulsateEmission", 1 );
    9.             m.material.SetFloat( "_PulsateEmission", 1 );
    10.             m.material.SetFloat( "_EmissionPulsateSpeed", 6f );
    11.             m.material.SetFloat( "_MinPulseBrightness", 0.001f );
    12.             DynamicGI.UpdateMaterials( m );
    13.             DynamicGI.SetEmissive( m, Color.white );
    14.         }
    Can anyone advise on what I have missed?
     
  12. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Not sure but looking briefly at your code I believe you shold disable _EMISSION, _EMISSION_TEXTURED and enable just _EMISSION_ANIMATED.

    You could set inspector in debug mode (context menu in top right corner of inspector) and compare my amterial where emission (animated) works in example scene with your materials. Animated emission rely on mask (when panning is used) if mask (alpha channel of emission texture) is zero you might not get any result (damped by mask).

    Tom
     
    mercior likes this.
  13. mercior

    mercior

    Joined:
    Sep 21, 2015
    Posts:
    16
    The disabling worked, thank you so much :)
     
  14. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    You're welcome (any single star on AssetStore product page is welcame as well :) ).
     
  15. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    408
    @tomaszek I've had this since day one, but I've never had a chance to use it properly because I've always had shader limits. Installed 5.5 last night and finally set it up in brides. Mate it's a beautiful piece of work, compliments Alloy perfectly, your refraction shader is sooo good for glass, weather effects are amazing, glitter simply wow!. Just had to drop by and thank you - great work bro (dropped you a 5 star review)
     
    tomaszek and hopeful like this.
  16. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    501
    Hi @tomaszek

    I'm using the Triplanar Tessellation Shader and have encountered the following issue.
    Here i have 3 Spheres, with the Transform Scales: 0.5, 5,20. They are all using the same material.

    Shouldn't they all have the same scale on the tessellated "bumps"? The height map doesn't fit the diffuse texture anymore when scaled up since the diffuse tex doesn't stretch in triplanar mode.

    Is this the way it's supposed to be or am i doing something wrong?

     
    Last edited: Dec 2, 2016
  17. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    As I remember we can make triplanar in world or local space, but tiling isn't influenced by object scale (otherwise if you scale object non uniformly we'd have different triplanar tiling too), so you needto use different material then and compensate transform scale by triplanar tiling to have the same results.

    Tom
     
  18. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    558
  19. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    It has instancing but not enabled by now (to decrease shader compilation/package import time). In all shaders (you need) uncomment #pragma multi_compile_instancing

    Objects that are identical and use the same UBER material should get combined by instancing.

    Tom
     
    Lex4art, Mazak and christougher like this.
  20. MartinPRO

    MartinPRO

    Joined:
    Dec 3, 2016
    Posts:
    5
    Hello,

    I'm using the free version of Unity 5 and just bough Uber standard shader. After assigning a material on a cube with a tessellation shader of Uber, my cube and material turn pink. When i use the free version of Tessellation dx11 from the asset store, it works just fine.

    I was googling this problem "simply drag the textures back onto your objects again". This doesnt work, because my material is even pink before dragging it on a cube.

    I hope anyone could help me with this phenomenon :eek:o_O

    Thank you!:)
     
  21. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Give me exact Unity version and UBER version do you use. Give me name of shader used. I'd like to try reproducing it on my side. Meantime - look a few posts above. Sometimes users get U5.4 UBER version from AssetStore which doesn't work with U5.5.

    Tom
     
  22. BHMW

    BHMW

    Joined:
    Feb 8, 2014
    Posts:
    16
    Hi Tom,

    I am having a problem with the instancing. I uncommented #pragma multi_compile_instancing like you said.

    To make sure I was doing it right I made a new scene and made 15 cubes, I created the new unity standard instanced shader and made a new material using it for the 15 cubes. It worked and I got 15 instancing in the profiler. Then I just switch the material to Uber Metallic Core which I already modified like you said and the profiler shows 0 instancing.

    Have you done tests to see that it is working in profiler?

    Thanks for any help, I really could use the instancing.
     
  23. MartinPRO

    MartinPRO

    Joined:
    Dec 3, 2016
    Posts:
    5
    I'm Using Unity 5.5.3 with Uber Shader V1.04
    It's not with a specific shader, its with every shader from Uber. For testing i made a cube en just applied one of your many uber shaders on it. Material gets pink instantly :(

    Thanks for your respond
     
  24. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    You need to get UBER 1.2 from AssetStore that's dedicated for Unity 5.5
     
  25. BHMW

    BHMW

    Joined:
    Feb 8, 2014
    Posts:
    16
    Hi Tom,

    Not sure if you saw my comment above? Any thoughts on the instancing?

    Thanks
     
  26. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    right click the uber folder and reimport the folder, perhaps it didn't recompile.
     
  27. BHMW

    BHMW

    Joined:
    Feb 8, 2014
    Posts:
    16
    I had already reimported the shaders individually that I had changed, but I just reimported the whole folder like you said and I'm still not showing any instancing in the profiler.
     
  28. Chris_Payne_QS

    Chris_Payne_QS

    Joined:
    Jul 16, 2016
    Posts:
    84
    I've just started using UBER 1.2 with Unity 5.5, but none of the UBER specular shaders are showing any albedo texture that I put on them. None of the colour pickers and sliders seem to make any difference to the base colour, which remains grey. The metallic shader set all work fine though. Am I missing something obvious?
     
  29. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Compare with my example scene there are mainly specular shaders used and diffuse working. You need to watch detail map (secondary map) which can overwrite main map with full specular (white) cancelling diffuse effects. Refer to my pdf maybe.

    Will check it ASAP. In U5.4 (where instancing were introduced) it worked for me. Maybe there is something specific in U5.5 or some lighting setup breaks it.

    Tom
     
  30. Chris_Payne_QS

    Chris_Payne_QS

    Joined:
    Jul 16, 2016
    Posts:
    84
    Ah...thanks Tom. It was because the specular defaults to white which washes out the albedo regardless of the smoothness. I had to bring it down to grey to let the albedo through.
     
  31. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Opened UBER1.2 in U5.5.0f2. Put 5 spheres using material with UBER metallic core. In this shader commented out instancing in first pass ("FORWARD"). This is the pass used when we've got lighting solved for main directional light. For me instancing works fine (Unity says it works).

    instancingU5_5.JPG

    You might need to check:
    1. cubes are very low poly so they get dynamically batched (and no instancing would be used) - that's why I tested it on spheres
    2. Make sure you uncommented all multicompile directives in all passes in shader used (For example in deferred instancing wouldn't work as I uncommented it temporarily in fist forward pass for tests above).

    Tom
     
  32. BHMW

    BHMW

    Joined:
    Feb 8, 2014
    Posts:
    16
    Its working now. You were right and I had only uncommented the first pass, with everything uncommented I get the instancing.

    Thanks Tom!
     
  33. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    408
    @tomaszek I've found an issue, in VR single pass mode the translucency is offset, I also think there's a similar problem happening with the refraction although its harder to determine.
     
  34. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Can you post screenshot ? Translucency in deferred is done via offscreen buffer wich is always a pin in VR 9since we'd need two of them separately). Refraction - hard to say if Unity will grab screen buffer for left and right cvamera separately or reuse one of them. The biggest problem is that I've got no VR stuff (yet) to test it on...

    Tom
     
  35. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,294
    Yes, that's a VERY big problem. You should solve it ;)
     
  36. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Something like "Dear Santa, my name is..." should make it :)
     
  37. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    408
    @tomaszek ah yeah no VR would make it tricky to find :) n00body from alloy recently solved what looked like the same issue for me on their shaders, probably the same thing, don't know what he did, but

    his message
    'Okay, so it looks like Unity added a special call to their post-process shader API that I now need to include in our deferred Skin and Transmission code.'

    here's the issue in UBER

     
  38. Deleted User

    Deleted User

    Guest

    @tomaszek
    You need to use "UnityStereoScreenSpaceUVAdjust()" to handle fixing your screen UVs when in single-pass stereo mode. It should be the final call before you sample from the screen texture.

    Example:
    float2 correctedUv = UnityStereoScreenSpaceUVAdjust(IN.uv, _MainTex_ST);

    EDIT:
    GrabPass-based shaders need a different call to work. I recommend you import the standard assets and look at Unity's official examples for Distortion and Image Effects.
     
    Last edited by a moderator: Dec 9, 2016
    Chris_Payne_QS, tomaszek and punk like this.
  39. MaDDoX

    MaDDoX

    Joined:
    Nov 10, 2009
    Posts:
    764
    Hi. I'm guessing if UBER allows for NPR/"artificial" (ie. not light-based) rim lighting? How about BRDF-textures light response or overlay (rendered on top of PBR)? Those are very useful features to have for characters.

    PS.: You should be tired of hearing it, but congratz for the most impressive shader packages in the Asset Store :)
     
  40. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,294
    I would suggest you split the examples into smaller ones instead of having 1 example scene which allows you to switch through several possibilities. Especially since there are hardly tutorials. And the documentation starts with the examples. No mentioning of what you have to do. From the looks of it you have to attach some scripts to a camera, shaders to a gameobject and then do stuff with it.

    I tried to cover a gameobject in snow:



    But this is done manually by simply adjusting a slider which is clearly noticable with the hard steps in snow coverage. How would I go about to do this automatically? Is there a tutorial or a documentation about it?

    ps: UBER is awesome! :D
     
    Arganth likes this.
  41. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Animating snow coverage for your dragon is as simple as animating snow color alpha channel for its material. It's denoted on UBER shader GUI tooltip over snow color (and coverage) + in my docs.

    Generally UBER is StandardShader with additional features. I rely on Unity's BRDF, but it's not hard to modify it. You could do it with customization of UBER_StandardBRDF (in UBER1.1) or paste Unity's StandardBRDF.cginc (in UBER1.2 for U5.5). There you can modify lighting to your needs.

    Tom
     
  42. gian-reto-alig

    gian-reto-alig

    Joined:
    Apr 30, 2013
    Posts:
    756
    Hi Tom

    Trying to upgrade to 5.5 right now, ran into this error with UBER... can you tell me what is going on here?

    Shader error in 'UBER - Specular Setup/ Core': undeclared identifier 'samplerunity_SpecCube1' at Assets/UBER/Shaders/Includes/UBER_GlobalIllumination.cginc(191) (on d3d11)

    Compiling Vertex program with DIRECTIONAL _WETNESS_NONE _OCCLUSION_FROM_ALBEDO_ALPHA
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP


    Upgraded to the newest version of uber from the Asset store. Is UBER 5.5 ready yet? Or should I remove and re-import UBER from scratch?



    EDIT:

    Did a quick search and found this in the 5.4 upgrade doc (been on 5.3 till now) :


    Replaced the UNITY_PASS_TEXCUBE(unity_SpecCube1) part in the UBER_GlobalIllumination.cginc file, and ran into another error

    Shader error in 'UBER - Specular Setup/ Core': not enough actual parameters for macro 'UNITY_PASS_TEXCUBE_SAMPLER' undeclared identifier 'UNITY_PASS_TEXCUBE_SAMPLER' at Assets/UBER/Shaders/Includes/UBER_GlobalIllumination.cginc(191) (on d3d11)

    Compiling Vertex program with DIRLIGHTMAP_COMBINED DYNAMICLIGHTMAP_ON UNITY_HDR_ON _WETNESS_NONE _PARALLAXMAP LIGHTMAP_OFF
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP


    Any idea why this is failing now?



    Thanks and regards

    Gian-Reto
     
    Last edited: Dec 12, 2016
  43. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    You need UBER1.2 deidcated for U5.5 redownloaded from AssetStore. Make sure you remove any old chaced UBER for U5.4 (because Unity might give you U5.4 version instead of U5.5 one).

    Tom
     
  44. gian-reto-alig

    gian-reto-alig

    Joined:
    Apr 30, 2013
    Posts:
    756
    Weird... after reading your message went into the Unity editor again to check the version. UBER Shader is now working, errors gone. Version seems to be correct.

    SEEMS to me that Unity most probably was still not finished recompiling in the background without a notice while I was typing my message here.
    Anyway, stranger things have happened before when upgrading Unity.


    Thanks for the quick response.

    Gian-Reto
     
  45. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    I've been inspecting the issue and bad news we've got... Long story short. In deferred I encode translucency using alpha channel of color/emissive gbuffer. At some stage, using command buffer, I need to copy it to separate buffer before this is overwritten/destroyed by Unity (at reflections stage). It works fine, but I always used some hack:

    BuiltinRenderTextureType.GBuffer3

    This is mentioned in Unity docs as valid GBuffer id. Other buffers work fine (Gbuffer0-2), GBuffer3 actually never worked(!) Instead I used BuiltinRenderTextureType.CameraTarget which seems to be actually the same as GBuffer3. The problem starts with single stereo where CameraTarget render texture is NOT the same as GBuffer3.

    So - until Unity repair the bug of inaccessible Gbuffer3 (where I definitely write right alpha values at GBuffer render stage) we're screwed... :( :( :(

    This is what Unity says when we try to use GBuffer3:

    "CommandBuffer: built-in render texture type 13 not found while executing UBERPropsPrelight (Blit source)"


    Tom

    P.S. oh, crap...
     
  46. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    408
    Oh crap :eek:
     
  47. frbrz

    frbrz

    Joined:
    May 10, 2016
    Posts:
    76
    Hello Tomasz. Sorry to bother you, I need to ask you 3 quick questions because I'm facing a problem with the limitation of 128 shader keywords established by Unity.

    I have an asset wich is used to count shader keywords. Using that asset I have noticed that UBER uses (supposedly) more than 5,000 keywords (according to my count) with more than 17,000 variants in total.

    (see below, right side of the screen)
    uber-default.jpg

    Reading Unity's official manual, I have come to the conclusion that Unity only counts the keywords that are used by an object in a scene, but maybe my conclussion is wrong. Can you please confirm this? (1)

    Additionaly, I don't understand the following: sometimes I get an error telling me that I exceeded their keyword limit but other times I don't get any error and my keyword count is the same. Is that an Unity bug? (2)

    Furthermore: Am I advised to import only the shaders that I think I will use due to the high amount of keywords used by UBER? (3)
     
    Last edited: Dec 17, 2016
  48. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    408
    Unity counts any keyword that is referenced in the shaderKeywords header inside each material in the Asset folder regardless whether it is used in the project or not, I wrote a free tool that can help deal with the issue.
    you can download it here

    if you can use unity 5.5 it has 256 keywords
     
    Last edited: Dec 13, 2016
    Akshara likes this.
  49. frbrz

    frbrz

    Joined:
    May 10, 2016
    Posts:
    76
    So if I have 5,000 shaders but only one shader is used in one material am I using a single keyword right?

    If that's true that error telling me that I exceeded their keyword limit must be definitely a bug.
     
    Last edited: Dec 13, 2016
  50. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    408
    not quite, keywords used in a shader count towards the total, ie if you had 10 shaders and they all used the same keyword, that would be 1. If you apply 1 off those shaders to a material and use that feature, that keyword will be stored in the material header. Now if you delete all the shaders, the keyword will still be in use, because its cached in the material header. So to clear it from the project you'd need to remove it from the material header also.

    if you open up the material in a text editor, you'll see the shaderKeywords tag, this is where the keywords are cached, you can just delete them, the tool I pointed to just does that all for you, by finding all the materials shaderKeywords cached and matching them against all shader keywords in the shaders and then deleting the ones that don't exist anymore, does more than that, but that was the main reason I wrote it
     
    Last edited: Dec 13, 2016
    frbrz likes this.