Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

UBER - Standard Shader Ultra

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

  1. kerrmedia

    kerrmedia

    Joined:
    Nov 4, 2015
    Posts:
    250
    Yikes, just bought it right before the price went up, can't wait to try it out.
     
  2. Yuki-Taiyo

    Yuki-Taiyo

    Joined:
    Jun 7, 2016
    Posts:
    72
    I got UBER many months ago and I have a simple question : How do you set a custom UBER shader to work with World Space Textures ? I'm just lazy about making UVs sometimes and it would be great for previewing.
     
  3. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,816
    When you open UBER_StandardCore.cginc you can find subsequent vertex functions for forward, forward additive, deferred passes (if you use cutoff shader you need also to setup shadowcaster). It's the place where we takve UVs for mesh vertices and push them to fragment function. You could use world space x/z there. To not change the way other UBER shaders are handled use some #define MYWORLDSPACEUVs in shader beginning and #ifdef MYWORLDSPACEUVs ... #endif in code.cginc

    Tom
     
  4. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,745
    @tomaszek : I'm facing an issue with WebGL.Both Metallic and Specular output this error

    Shader error in 'UBER - Metallic Setup/ Core': '' : 'unityShadowCoord' already defined at Assets/UBER/Shaders/Includes/UBER_AutoLightMOD.cginc(13) (on gles)

    Compiling Vertex program with _EMISSION_TEXTURED _WETNESS_NONE
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA
     
  5. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,816
    Please give me Unity version to reproduce the issue. (on gles) suggests that you build for GLES2 (WebGL1.0). UBER shaders don't work for this platform (too many resource restrictions). You could try with WebGL2.0 (remove automatic API for build and leave WebGL2.0 only) - this implies gles3 which is capable of running UBER shaders.

    Tom
     
    Last edited: Aug 11, 2017
  6. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,745
    @tomaszek : I'm on 2017.1f3

    Oh wow I didn't realize WebGL 2.0 was on 2017.1! Here I was sitting here waiting on it hahaha.
    I will try now.
     
    b_game_studios likes this.
  7. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,745
    @tomaszek : works excellent mate! Thanks for letting me know this... Too bad Linear Lighting isn't supported yet though... Or at least it doesn't appear so, everything just goes dark LOL.. (I know unrelated) I was just venting haha.

    Guess that comes in 2017.2..

    thanks again mate, big help!
     
  8. SamSpain

    SamSpain

    Joined:
    Oct 31, 2014
    Posts:
    13
    I've been looking around, searched the documentation, and haven't seen anything about LOD. Is there no implementation for crossfading between LODs?
     
  9. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,816
    Although it's not stated in docs I implemented this (with this screenspace dissolve effect so we've got 2 shader variants thru
    Code (csharp):
    1. #pragma multi_compile _ LOD_FADE_CROSSFADE
    solved
    )

    Tom
     
    SamSpain likes this.
  10. MarkArutyunyan

    MarkArutyunyan

    Joined:
    Dec 14, 2016
    Posts:
    1
    Hi, there.
    I can't seem to find this functionality:
    upload_2017-8-13_20-13-10.jpeg

    Has it been depreciated?
     
  11. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,816
    Its there. Select cutoff in blending dropdown menu. Then you can set edge threshold and emission. You need greyscale mask to be able to have this animating dissolve effect (stored in diffuse aplha).

    Tom
     
  12. ThisGuyThatsHere

    ThisGuyThatsHere

    Joined:
    May 4, 2016
    Posts:
    5
    Hi, I'm thinking about purchasing this shader, it looks amazing, however, what about point light shadows? Does it improve them maybe?
     
  13. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,816
    I dont touch shadows as they are part of Unity standard shading while uber is built on the top of this. As far as I know there is something called next gen pcss shadow system available on UAS and should work with UBER.
     
    hopeful likes this.
  14. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    Is it possible to implement a refraction mask? For example, a black and white texture mask to prevent refraction from occurring elsewhere on a shared texture.
     
  15. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,816
    Not out of the box but is not hard to implement. Refraction code is placed at the beginning of forward pass fragment function in uber_standardcore.cginc
     
  16. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    I really don't have the chops to write something like that. Any chance you would can chalk it up as a feature request for now?
     
    b_game_studios likes this.
  17. b_game_studios

    b_game_studios

    Joined:
    Aug 16, 2017
    Posts:
    12
    Is there any chance you'd make your shader better than pre-integrated skin shader (also found on the UAS)? Your skin shader seems nice, but Pre-Integrated Skin Shader looks more realistic. Also, it would be great if you'd include transmission maps instead of thickness maps.
     
  18. stanislavdol

    stanislavdol

    Joined:
    Aug 3, 2013
    Posts:
    281
    Thanks, I did find this feature, however, I'm struggling to achieve this glowing edge effect. Was it done using post-processing?
     
  19. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    Perhaps I'm missing something: POM occurs in texture space so extrusion occurs within UV shell boundaries. Consequently, flat planar surfaces that contain UV seams will "break" the effect. Is there a way around this, e.g. triplanar POM, or something like this?
     
  20. b_game_studios

    b_game_studios

    Joined:
    Aug 16, 2017
    Posts:
    12
    I would also like to ask if your shader would make SpeedTrees look better.
     
  21. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,816
    Edges can be set to HDR color (brightness >1) then treat by postFX glow effect.

    This is how POM works - it goes thru texture space with no info about object shape. The only exception is advanced POM variant where we store tangents in texture so that corners can be solved (rounded rock cube in my examples). This can not solve discontinuous or atlased heightmaps. This is where tessellation/displacement is the only way to increase detail visually.

    I might consider releasing improved ST shaders in the future as I already use them in our D.R.O.N.E. project. You can;'t expect it very soon though as we're on the early stage of the game developement. Later I could bring some tech developed there to public.

    Tom
     
    Last edited: Aug 21, 2017
    buttmatrix likes this.
  22. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    912
    Finally got around to adding uber to RTP etc. Are any of the shaders instanced or is that not implemented at this time?
     
  23. Yuki-Taiyo

    Yuki-Taiyo

    Joined:
    Jun 7, 2016
    Posts:
    72
    Thanks for your reply, yet I never created any shaders, so I don't understand how to proceed here. Could you simply set a World Space UV setting for a next update, so everyone can enjoy ?
     
  24. Swearsoft

    Swearsoft

    Joined:
    Mar 19, 2009
    Posts:
    1,627
  25. Swearsoft

    Swearsoft

    Joined:
    Mar 19, 2009
    Posts:
    1,627
    Scaling affects how the tessellation works and it ends up being screwed up.
    The script in the thread fixes it.
     
    hopeful likes this.
  26. EddieChristian

    EddieChristian

    Joined:
    Oct 9, 2012
    Posts:
    714
    The PDF says, "Disable MSAA (GPU antialiasing) in Unity quality settings to not break HDR rendering in forward lighting mode".

    Is this only on import? Or should you just not use MSAA at all if using Uber?

    Also what did you use for anti-aliasing the pictures on the first post of this thread.

    Thanks;
    Eddie
     
  27. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,816
    They are all inbstanced but this is not turned on by default to decrese shader compile/import time. Go into a shader code and uncomment all #pragma multi_compile_instancing bits.

    Not sure which features of UBER are most important for you, but I can safely assume they appear to be something for pavement, terrain ? Take a look at my other product RTP where you can find world mapping in 4 layers/triplanar.

    AFAIK when you use MSAA HDR is turned off by Unity while we need HDR to use all UBER features (like translucency in deferred). If you don't use translucency or POM self shadowing, or simply you can go with forward lighting you don't need to worry, but HDR is very welcome as you can get best PBR results with postFX and specular highlights.

    Thanks for point out the issue and solution hint.

    Tom
     
    AndyNeoman likes this.
  28. Yuki-Taiyo

    Yuki-Taiyo

    Joined:
    Jun 7, 2016
    Posts:
    72
    No, this is simply about tiles in interior scenes, and I need the UBER parallax effect, also Two Layers settings for example. I got a simple World texture shader from Cooking with Unity guys on Youtube, but it's Diffuse and Normal maps only.

    World textures actually prevent me from making tiles of planes to have appropriate tiles texturing, which is not optimal at all and make me lose time on designing levels in Blender.
     
    Last edited: Aug 29, 2017
  29. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,816
    What kind of mapping do you actually need? In UBER you have selective/triplanar shaders with local/global selector. You can check it - should work fine for floors/walls.

    Tom
     
    Yuki-Taiyo likes this.
  30. Yuki-Taiyo

    Yuki-Taiyo

    Joined:
    Jun 7, 2016
    Posts:
    72
    I think that's exactly what I needed. Thanks. ;)
     
  31. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    912
    Hi @tomaszek, is there any documentation linking the uber wetness level to your rtp terrain wetness?
     
  32. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,816
    Global wet levels are controlled by script/shader variables of different name. For UBER - look at weather controller (and shader needs to be set to take global control value instead of per material). In UBER it's set by UBER_GlobalParams.cs and Setupit() function:

    Code (csharp):
    1.  
    2.     public void SetupIt() {
    3.         Shader.SetGlobalFloat("_UBER_GlobalDry", 1-WaterLevel);
    4.         Shader.SetGlobalFloat("_UBER_GlobalDryConst", 1-WetnessAmount);
    5.  
    6.         Shader.SetGlobalFloat("_UBER_GlobalRainDamp", 1-RainIntensity);
    7.         Shader.SetGlobalFloat ("_UBER_RippleStrength", FlowBumpStrength);
    8.        
    9.         Shader.SetGlobalFloat("_UBER_GlobalSnowDamp", 1-SnowLevel);
    10.         Shader.SetGlobalFloat("_UBER_Frost", 1-Frost);
    11.         Shader.SetGlobalFloat ("_UBER_GlobalSnowDissolve", SnowDissolve);
    12.         Shader.SetGlobalFloat ("_UBER_GlobalSnowBumpMicro", SnowBumpMicro);
    13.         Shader.SetGlobalColor ("_UBER_GlobalSnowSpecGloss", SnowSpecGloss);
    14.         Shader.SetGlobalColor ("_UBER_GlobalSnowGlitterColor", SnowGlitterColor);
    15.     }
    16.  

    In RTP it's controlled in Refresh() function by ReliefTerrainGlobalSettingsHolder.cs

    Code (csharp):
    1.  
    2. Shader.SetGlobalFloat("TERRAIN_GlobalWetness", TERRAIN_GlobalWetness);
    3.  
    Tom
     
    Tethys, Mr_Dan_O and AndyNeoman like this.
  33. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    912
    Thanks Tom,

    That's a great help, one last thing. Is it possible to control a single material through a similar float.

    I have the uber shader on my main character too and i take this figure for his wetness but I would like to alter his figure compared to the global setting when he is under shelter, so his wetness value would be different to global level?
     
  34. Yuki-Taiyo

    Yuki-Taiyo

    Joined:
    Jun 7, 2016
    Posts:
    72
    And actually, what I was looking at wasn't a World texturing thing in the end, because the texture is indeed projected using the World vector on moving / rotating objects, so it doesn't look nice at all on dynamic assets, and moreover is not good for meshes of generated levels that still need precise texturing.

    Triplanar projection doesn't do this weird effect, so, that's was what I needed, but I'm not familiar with this technique.
     
  35. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,816
    As your character is UBER shaded you can control wetness of this object per material (unsellect global control button in material inspector). For further reference look at my pdf doc for UBER.

    Tom
     
  36. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    912
    EDIT, I fixed the problem thanks.
     
    Last edited: Sep 3, 2017
  37. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    912
    Hi Tom,

    Edit:- Fixed this too lol. I just realised _Wetness is like a bool and needs to 1 for wetness option to be live


    Code (CSharp):
    1. public class PlayerWetnessLevel : MonoBehaviour {
    2.  
    3.     public PlayerVitalsExample playerVitals;    
    4.     float wetness;
    5.     Renderer rend;
    6.  
    7.     // Use this for initialization
    8.     void Start ()
    9.     {
    10.         rend = GetComponent<Renderer>();    
    11.     }
    12.  
    13.     // Update is called once per frame
    14.     void Update ()
    15.     {          
    16.        // Debug.Log(playerVitals.dryness);      
    17.         wetness = System.Math.Abs(playerVitals.dryness - 100);                    
    18.         rend.material.SetFloat("_Wetness", wetness/100);
    19.         rend.material.SetFloat("_WetnessConst", wetness / 100);
    20.         if (playerVitals.isSheltered)
    21.         {
    22.             rend.material.SetFloat("_RainIntensity", 0);
    23.         }
    24.         else
    25.         {
    26.             rend.material.SetFloat("_RainIntensity", WeatherManager.unistormRain/1000);
    27.         }
    28.      
    29.         print(rend.material.GetFloat("_Wetness"));
    30.         print(rend.material.GetFloat("_WetnessConst"));
    31.         print(rend.material.GetFloat("_RainIntensity"));
    32.     }
    33. }
     
    Last edited: Sep 3, 2017
  38. CswiedlerTrion

    CswiedlerTrion

    Joined:
    Dec 6, 2014
    Posts:
    15
    Do UBER shaders work with Unity's mixed lights in shadowmask mode? From what I'm seeing, once I switch to using shadowmasks, no shadows are applied to UBER-shaded objects.
     
  39. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,816
    I need to restore it in U2017. Will be available in next update.

    Tom
     
  40. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    923
    Hi Tom,

    I have noticed a visual problem with the Reflection Triplanar selective with Translucensy (Specular setup)... it seems to be a polygon sort problem.

    I am using 2017.1 but Ihave checked and I have the same problem in 5.6

    Is this a bug or I am missing something?

    Thanks in advance for the support!
    Kenshin
     
  41. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,816
    I'm inspecting this. OK, I've found what's the difference between core and triplanar shader variant. Core one has uncommented depth pass which makes occluded geometry of the object not visible. It's not the case for triplanar. However - in most cases all refraction shader variants should have this pass uncommented because most common scenario we've got models that are concave. You'll include this fix in the next update or you can fix it yourself. Open problematic shader (right click on the popup of shader name in UBER material inspector and select shader to find it quickly). Then search for this:


    Code (csharp):
    1. //uncomment if you'd like to hide back geometry - will write into depth though
    The whole pass is bracketed with /* and */ - remove these lines and save shader. It should work.

    ATB, Tom
     
    Last edited: Sep 11, 2017
  42. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    923
    Hi Tom,

    thanks a lot for the quick answer, it seems work perfectly now.

    Great support!! :)

    Kenshin
     
  43. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,816
    Can you give me more info on this problem? Do you refer to U5.6 or U2017? What's the exact setup to reproduce the issue (all lights, lightmapping, shadows distances and so on)? As I'm testing this here after doing some tweaks on U2017.1.f3 I can get the shadows working for lightmaps set in shadowmask mode.

    Tom
     
  44. CswiedlerTrion

    CswiedlerTrion

    Joined:
    Dec 6, 2014
    Posts:
    15
    This is in 5.6.2, I assume your fix applies to that version too (that's where the new mixed lighting stuff came in, AFAIK). How soon do you think you'll have another update?
     
  45. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,816
  46. CswiedlerTrion

    CswiedlerTrion

    Joined:
    Dec 6, 2014
    Posts:
    15
    Oh, sorry, missed that. This is with Unity 5.6.2. I can try 2017. The use case is basically a cube, a plane, a directional light in mixed mode, and baking shadows in shadowmask-only mode. I'll see if I can get a simple repro project.
     
  47. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,816
    Look at verinfo.txt file in UBER folder.

    EDIT: Check if you try it on the newest version. On UBER 1.2c I can get shadows working on U5.6.1:

    UBER_shadowmask_U5_6_1.JPG

    The same it works here in U2017 (In 2017 we don't have separate distance-shadowmask) with all light types in mixed mode.

    Anyway I'll submit today 1.2d where I fixed some other small glitches.

    Tom
     
    Last edited: Sep 12, 2017
  48. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    509
    Hi Tom,

    It would be great to have an "Enable GPU Instancing" checkmark button on the shaders just like in Unity's Standard shaders from an ease of use standpoint, rather than having to uncomment lines in the shaders, even if it may lead to longer shader compile/import times. Thanks for listening!
     
  49. hmroz

    hmroz

    Joined:
    Jan 28, 2014
    Posts:
    5
    Hi, I have a problem with Uber and Deferred Reflections. When I disable Deferred Reflections in GraphicsSettings all objects with Uber shaders becomes darker as if they don't take reflection from Reflection Probe (materials with Standard shaders are ok). I use Unity 5.4.5 and Uner 1.1c
     
  50. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,816
    Isn't it possible with your project to upgrade both Unity and UBER then check? Ver 1.1 is quite an old one...

    I will also check the issue with new UBER versions anyway.

    Tom
     
    Last edited: Sep 15, 2017
unityunity