Search Unity

UBER - Standard Shader Ultra

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

  1. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Seems like your UBER version doesn't match your Unity version. Check _verinfo.txt. It's not supposed to be dedicated for Unity2017 (which introduced UNITY_POSITION define in their HLSLSupport.cginc file). You need version marked for Unity 5. Redownload UBER from Unity 5.6.4. For me it works.

    Tom
     
    magique likes this.
  2. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    723
    And it does not compile again. Seriously. I hate Unity so much at the moment. So many crashes. Does not compile again (same error as described above)....

    Edit: Deleted library and obj again and it compiled. SO MUCH HATE. Unity is wasting so much time of my life right now....
     
    Last edited: Jan 6, 2018
  3. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    @tomaszek : Hey, just letting you know for the newest update (2017.3) and your newest update, the uber material is broken - well I mean it works. But the material has no sense of structure, every single variable for the shader is exposed with no formatting, E.G. - Parallax Mapping check box doesn't exist - none of the check boxes exist and all of them have their values exposed line by line.

    Example (SOME stuff the material is exposing/showing).

    Bottom cut value = 0.
    Depth per vertex = 0
    Extrude mesh = 0
    POM precomputed = 0
    Type of curvature mapping = Basic (Enum value).
    depth reduction distance = 85.3
    Curvature custom u = 0
    Curvature custom V = 0
    Curvature mult U = 1
    Curvature mult V = 1
    Tex U to Object space = 1
    Tex V to Object space = 1
    Tex U to Object space mult = 1
    Tex V to Objectspace mult = 1
    UV Clip = 1
     
  4. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    723
    @tomaszek Do you have any idea how I could fix

    upload_2018-1-8_1-21-36.png

    Now even deleting Library and obj did not help any more.

    Unity 2017.3.0f3 with UBER
    upload_2018-1-8_1-22-58.png

    Edit: Updated to the f version. Now it compiled
     
    Last edited: Jan 8, 2018
  5. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Definitely 1.2f version only has stable fix for this error. So, Unity wasn't that much guilty (still can drive one crazy - I already had problems with shader cache stored in their Library folder - rebuilding of which helped)...

    Must go with companionof script error (that handles GUI) I believe. Any console output available?

    Tom
     
  6. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    I got it figured out just now, with the help of your message.
    However, I'm not sure if this came at my own fault or if it was a bug.

    I had a previous version in my project, so I deleted the old version so I could then install the new version.
    And some how, some way - it didn't import any of the script files or editor files. I went to my old Uber folder I still had in trashcan luckily, checked the folders to see any difference and yeap, script and editor files weren't imported.

    I could have sworn I did both the installer packages.

    But yeah that's how I fixed my issue just now.
    Not sure if that was at my own doing or what, but at least you know, so you can at least try to reproduce it.

    And no, there wasn't any errors in console.
     
  7. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    723
    @tomaszek yeah I saw the change in the diff. I simply reported the e version wrongly because the version file is not stored in the package file but part of the asset download :oops:

    However, it was definetly unitys fault to F*** something up with the cache because either a shader compiles. Or it doesn't. A shader does not compile "every second time" :D
     
  8. dearamy

    dearamy

    Joined:
    Mar 17, 2015
    Posts:
    68
    Is there any way to use this shader renderer the mesh wireframe?
     
  9. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    UBER is not all-in-one. You need special kind of shader to draw wireframe. There are solutions for such purpose available.

    Tom
     
  10. CosmosBear

    CosmosBear

    Joined:
    Aug 2, 2012
    Posts:
    67
    I assume that on PSVR, Uber shaders fallback to forward rendeing even if camera renderpath is set to defered I edited UBER_ForwardFogType.cginc and now it works just fine. First time I see this kind of behavior and we've tested on PS4, XboxONE, MAC, Linux and Shield...

    Anyway it's fixed now thanks.
     
  11. nbac

    nbac

    Joined:
    Jul 7, 2015
    Posts:
    267
    tomaszek likes this.
  12. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    (Don't even tell me how many ms SSR takes here for its supersampled settings... even though its v2 which is faster ;) ).
     
  13. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,080
    I have a dream for a long time to use Wrinkle maps shader offered by Unity and Uber translucency system!

    I chose Uber to create my character skin because it's support translucency in deferred mode and it cool. But also I need Wrinkle maps method offered by unity. Now I need to ask is that possible to use Uber translucency when I use Wrinkle maps shader?

    This is the shader that supports Wrinkle maps system.
    Is that possible make this shader to work with Uber translucency?
    Thanks.
    Code (CSharp):
    1. Shader "Volund/Standard Character (Specular, Surface)" {
    2.     Properties {
    3.         _Color("Color", Color) = (1,1,1,1)
    4.         _MainTex("Albedo", 2D) = "white" {}
    5.  
    6.         _Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
    7.  
    8.         _Glossiness("Smoothness", Range(0.0, 1.0)) = 0.5
    9.         _SpecColor("Specular", Color) = (0.2,0.2,0.2)
    10.         _SpecGlossMap("Specular", 2D) = "white" {}
    11.  
    12.         _BumpScale("Scale", Float) = 1.0
    13.         _BumpMap("Normal Map", 2D) = "bump" {}
    14.  
    15.         _Parallax ("Height Scale", Range (0.005, 0.08)) = 0.02
    16.         _ParallaxMap ("Height Map", 2D) = "black" {}
    17.  
    18.         _OcclusionStrength("Strength", Range(0.0, 1.0)) = 1.0
    19.         _OcclusionMap("Occlusion", 2D) = "white" {}
    20.  
    21.         _EmissionColor("Color", Color) = (0,0,0)
    22.         _EmissionMap("Emission", 2D) = "white" {}
    23.  
    24.         _DetailMask("Detail Mask", 2D) = "white" {}
    25.  
    26.         _DetailAlbedoMap("Detail Albedo x2", 2D) = "grey" {}
    27.         _DetailNormalMapScale("Scale", Float) = 1.0
    28.         _DetailNormalMap("Normal Map", 2D) = "bump" {}
    29.  
    30.         [Enum(UV0,0,UV1,1)] _UVSec ("UV Set for secondary textures", Float) = 0
    31.  
    32.         // Blending state
    33.         [HideInInspector] _Mode ("__mode", Float) = 0.0
    34.         [HideInInspector] _SrcBlend ("__src", Float) = 1.0
    35.         [HideInInspector] _DstBlend ("__dst", Float) = 0.0
    36.         [HideInInspector] _ZWrite ("__zw", Float) = 1.0
    37.  
    38.         // Volund properties
    39.         [HideInInspector] _CullMode ("__cullmode", Float) = 2.0
    40.         [HideInInspector] _SmoothnessInAlbedo ("__smoothnessinalbedo", Float) = 0.0
    41.         [HideInInspector] _SmoothnessTweaks ("__smoothnesstweaks", Vector) = (1,0,0,0)
    42.         _SmoothnessTweak1("Smoothness Scale", Range(0.0, 2.0)) = 1.0
    43.         _SmoothnessTweak2("Smoothness Bias", Range(-1.0, 1.0)) = 0.0
    44.         _SpecularMapColorTweak("Specular Color Tweak", Color) = (1,1,1,1)
    45.     }
    46.  
    47.     SubShader {
    48.         Tags { "RenderType"="Opaque" "Special"="Wrinkles" "PerformanceChecks"="False" }
    49.         LOD 300
    50.  
    51.         Blend [_SrcBlend] [_DstBlend]
    52.         ZWrite [_ZWrite]
    53.         Cull [_CullMode]
    54.  
    55.         CGPROGRAM
    56.         // - Physically based Standard lighting model, specular workflow
    57.         // - 'fullforwardshadows' to enable shadows on all light types
    58.         // - 'addshadow' to ensure alpha test works for depth/shadow passes
    59.         // - 'keepalpha' to allow alpha blended output options
    60.         // - 'interpolateview' because that's what the non-surface Standard does
    61.         // - Custom vertex function to setup detail UVs as expected by Standard shader
    62.         // - Custom finalcolor function to output controlled final alpha
    63.         // - 'nolightmap' and 'nometa' since this shader is only for dynamic objects
    64.         // - 'exclude_path:prepass' since we have no use for this legacy path
    65.  
    66.         #pragma surface SurfSpecular StandardSpecular fullforwardshadows addshadow keepalpha interpolateview vertex:StandardSurfaceVertex finalcolor:StandardSurfaceSpecularFinal nolightmap nometa exclude_path:deferred exclude_path:prepass
    67.  
    68.         // Use shader model 3.0 target, to get nicer looking lighting (PBS toggles internally on shader model)
    69.         #pragma target 3.0
    70.  
    71.         // This shader probably works fine for console/mobile platforms as well, but
    72.         // these are the ones we've actually tested.
    73.         #pragma only_renderers d3d11 d3d9 opengl glcore
    74.  
    75.         // Standard shader feature variants
    76.         #pragma shader_feature _NORMALMAP
    77.         #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
    78.         #pragma shader_feature _SPECGLOSSMAP
    79.         #pragma shader_feature _DETAIL_MULX2
    80.  
    81.         // Standard, but unused in this project
    82.         //#pragma shader_feature _EMISSION
    83.         //#pragma shader_feature _PARALLAXMAP
    84.  
    85.         // Volund additional variants
    86.         #pragma multi_compile _ WRINKLE_MAPS
    87.         #pragma multi_compile UNITY_SAMPLE_FULL_SH_PER_PIXEL
    88.  
    89.         // Volund uniforms
    90.         uniform sampler2D    _NormalAndOcclusion;
    91.         uniform half3         _SpecularMapColorTweak;
    92.         uniform half2        _SmoothnessTweaks;
    93.  
    94.         // Need screen pos if wrinkle maps are active
    95. #ifdef WRINKLE_MAPS
    96.         struct SurfaceInput {
    97.             float4    texcoord;
    98.     #ifdef _PARALLAXMAP
    99.             half3    viewDir;
    100.     #endif
    101.             float4    screenPos;
    102.         };
    103.         #define Input SurfaceInput
    104. #endif
    105.  
    106.         // Include all the Standard shader surface helpers
    107.         #include "UnityStandardSurface.cginc"
    108.  
    109.         // Our main surface entry point
    110.         void SurfSpecular(Input IN, inout SurfaceOutputStandardSpecular o)
    111.         {
    112.             StandardSurfaceSpecular(IN, o);
    113.  
    114.             // Apply specular color tweak if we sampled spec color from a texture
    115. #ifdef _SPECGLOSSMAP
    116.             o.Specular *= _SpecularMapColorTweak;
    117. #endif
    118.  
    119.             // Optionally sample smoothness from albedo texture alpha channel instead of sg texture
    120. #ifdef SMOOTHNESS_IN_ALBEDO
    121.             o.Smoothness = tex2D(_MainTex, IN.texcoord.xy).a;
    122. #endif
    123.  
    124.             // Apply smoothness scale and bias (always active)
    125.             o.Smoothness = saturate(o.Smoothness * _SmoothnessTweaks.x + _SmoothnessTweaks.y);
    126.  
    127.             // Sample occlusion and normals from screen-space buffer when wrinkle maps are active
    128. #ifdef WRINKLE_MAPS
    129.             float3 normalOcclusion = tex2D(_NormalAndOcclusion, IN.screenPos.xy / IN.screenPos.w).rgb;
    130.             o.Occlusion = normalOcclusion.r;
    131.     #ifdef _NORMALMAP
    132.             o.Normal.xy = normalOcclusion.gb * 2.f - 1.f;
    133.             o.Normal.z = sqrt(saturate(1.f - dot(o.Normal.xy, o.Normal.xy)));
    134.     #endif
    135. #endif
    136.         }
    137.         ENDCG
    138.     }
    139.  
    140.     CustomEditor "VolundMultiStandardShaderGUI"
    141.     FallBack "Diffuse"
    142. }
     
    Last edited: Jan 18, 2018
  14. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    This surface shader is forward one, so translucency routines need to be copied from Uber to this shader. In deferred it would be more easy - shader would simply encode translucency setup index and translucency intensity and write it into gbuffer3.a channel. In forward strating point would be looking at UBER_StandardCore.cginc and find forward fragment function (fragForwardBase). There a few moments we handle translucency. The main one is this:

    Code (csharp):
    1. half3 TL=Translucency(s, mainLight, translucency_thickness, i.vertex_color);
    It is call to Translucency function which takes surface parameters (s) like normals, mainLight (we need it's color, direction), intensity of translucency and vertex color where we can store translucency mask). Find Implementation of Translucency() which is also placed in UBER_StandardCore.cginc.
    In following code we handle diffuse color and attenuation (shadows, falloff which would be applied in forward add passes). Before the shader returns color we simply add TL multiplied by light color. So you need to implement surface output (custom lighting) function as well to integrate it.

    Tom
     
    ksam2 likes this.
  15. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,080
    Thanks, I'm noob in this kind of matter don't know what's going on :D is that possible to make one of Uber shader to support unity wrinkle maps system? this can be known as Uber skin shader.
     
  16. AntonBertelsen

    AntonBertelsen

    Joined:
    Oct 13, 2014
    Posts:
    37
    Hi there. I'm just curious as to what the new SRP API will mean to UBER and your other packages? :)
     
  17. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    The strom is coming ... for every shader package in the UAS. Maybe Unity will make kind of surface shader implementation to work if SRP HD to make things simplier. Currently I'm only aware of graph tool that produces SRP Lite/HD compatible shaders.

    Generally SRP is meant to be something configurable and moves responsibility of the rendering pipeline from engine to app developer. If you tweak SRP HD or make your own - there's no way that compatibility of any existing shaders can hold true.

    UBER is part of essential pack that can be claimed by Unity Plus&Pro users so (I'm affraid) if I'd like to stay solid I can't afford not making it SRP HD compatible at some point (in the reasonably ranged future). I haven't decided it yet.

    SRP is kind of tool that is not possible to used by every developer, only some of them...

    Tom
     
  18. AntonBertelsen

    AntonBertelsen

    Joined:
    Oct 13, 2014
    Posts:
    37
    I believe jbooth and Tim-C were discussing something about SRP surface shaders in this thread, and how it potentially should and would work.
    https://forum.unity.com/threads/feedback-wanted-shader-graph.511960/page-2#post-3350125

    You might want to chime in and mention you think it's important :)
     
    Last edited: Jan 19, 2018
  19. Devistute

    Devistute

    Joined:
    Aug 23, 2014
    Posts:
    32
    I'm getting Build Failing errors using newest UBER and Next Gen Soft Shadows.

    Code (CSharp):
    1. Shader error in 'UBER - Specular Setup/ Core': maximum ps_4_0 sampler register index (16) exceeded at Assets/Extensions/UBER/Shaders/Includes/UBER_AutoLightMOD.cginc(159) (on d3d11)
    2.  
    3. Compiling Fragment program with SPOT SHADOWS_DEPTH SHADOWS_SOFT LOD_FADE_CROSSFADE _DETAIL_TEXTURED _TRANSLUCENCY _WETNESS_FULL
    4. 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_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_RGBM_ENCODING
    Code (CSharp):
    1. Shader error in 'UBER - Specular Setup/ Core': maximum ps_4_0 sampler register index (16) exceeded at Assets/Extensions/UBER/Shaders/Includes/UBER_AutoLightMOD.cginc(181) (on d3d11)
    2.  
    3. Compiling Fragment program with POINT_COOKIE SHADOWS_CUBE SHADOWS_SOFT LOD_FADE_CROSSFADE _DETAIL_TEXTURED _TRANSLUCENCY _WETNESS_FULL
    4. 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_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_RGBM_ENCODING
    5.  
     
  20. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Sampler limit (which is 16) of textures used has been exceeded. Simply too many features + Unity lighting (a lot of textures as well like refl. probe 3d tex volume, refl. probes, shadowmaps) sum up to something over 16. You would need to cut something. Hard to tell what actually (wetness dropelts?, reflection probe blending?). You would need to decide.

    Tom

    P.S. It's not unsolvable in general because actual texture limit is much higher. It's about samplers that are assigned to all textures separately instead of reusing some of them. Fixing this issue would need some rearrangement in shader code though which I plan to do in following months.
     
  21. Devistute

    Devistute

    Joined:
    Aug 23, 2014
    Posts:
    32
    Problem here is that this behaviour is mostly random.. One minute it builds fine, and then suddenly throws the said errors without any good reason. Deleting Light Sources or Reflection Probes only work temporarily.

    *Actually right now as i'm writing this, the game decided to build without the errors.. Remains to be seen if next build will too.
     
  22. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    If everything works fine in editor means - resources required are sufficient for what game actually requires. The problem is that Unity can't tell if game "don't plan" to use additional resources (adding some ligh by script, managing shadows, lighting scenarios dynamically). That's why when publishing all possible shader variants are built. Some of them can exceed resources. Hard to tell how Unity determines "all variants" needed (because they of course are not all, but what Unity considers to be).

    Tom
     
  23. EddieChristian

    EddieChristian

    Joined:
    Oct 9, 2012
    Posts:
    725
    I was just wondering if you are planning to support the new Scriptable Rendering Pipeline??
     
  24. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    At some point I could try to introduce some UBER goodies in SRP HD. The problem with SRPs is that they are meant to be used and handled by developers that are capable of customizing it. SRP HD itself uses its own deferred gbuffer setup which would need to be changed by me. It's much more than affecting Unity Standard shader itself. Everytime Unity change SRP HD I need to reimplement UBER again. If a user wants to customize it (which is the point in using SRPs) he would need to do it along with UBER layer (UBER modified SRP HD).

    This is potentially a lot of headache. I could think about modifying SRP HD "Standard Shader" with some selected features though.

    Tom
     
    Corvwyn, one_one and Lex4art like this.
  25. EddieChristian

    EddieChristian

    Joined:
    Oct 9, 2012
    Posts:
    725
    I hope you continue. My biggest issue with the new build is losing all the great shaders I have come to depend on.. :)
     
  26. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    After resubmitting my other product (RTP) good news that I've decided to set it on very attractive price - $40 (not sure for how long).

    I keep crossgrade price UBER 2 RTP for as low as $15 now ! Both products are $65, so buy UBER for $50, grab RTP for $15. Or buy RTP for $40 and grab UBER for $25.

    Tom
     
    led_bet likes this.
  27. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    This is problem with all shaders... Maybe Unity can come up with kind of "SRP surface shader" so that current surface shaders might be translated to SRP HD with ease. AFAIK there's at least discussion on this topic.
     
    led_bet likes this.
  28. led_bet

    led_bet

    Joined:
    May 5, 2015
    Posts:
    83
    Hey Tom!

    Not sure if you're aware, but when the Emission color is set in Uber (in my experience, either specular or metalic core variant), whatever color value is initially selected gets "stuck" at that value until you close the color picker and reopen it again. It's a small bug, but I figured you'd want to know.
     
  29. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Can not reproduce the issue under newest UBER. With an UBER material I can set emission color to any value in picker. Changes are reflected realtime (in scene view and in material inspector).

    Tom
     
  30. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    723
    @tomaszek, is there any support for WebGL 2.0 planned? We just made a quick test and it seems UBER does not compile for Web at the moment.
     
  31. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    @tomaszek , what would be the best way to implement lod for the uber shaders?

    For example : I want to use height map pom shader for PC and then non pom version for some other platforms. I can ofcourse have 2 different set of materials and then swap them during run time... but I was wondering if there is any smarter way of handling it from the shader side.

    I know about the shader LOD feature, But seeing the Uber shader is a lot more complex than just a single standard shader, I would ask you.
     
  32. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Keeping 2 sets of materials is overshoot. But you'd need to store array of materials you'd like to control LOD for. Then simply handle shader keywords per material in your settings. For higest LOD it would set _PARALLAX_POM_SHADOWS keyword, for lower you'd disable above keyword and enable _PARALLAX_POM or yet another - _PARALLAXMAP or disable all parallax effects. Figuring list of keywords is rather simple as you take a look at any UBER shader code.

    Shader lod levels - it's also an idea that could work globally but UBER does not introduce set of subshaders with decreasing LODs. You'd need to do it yourself.

    Tom
     
  33. Gruguir

    Gruguir

    Joined:
    Nov 30, 2010
    Posts:
    340
    @tomaszek i have an artifact with baked distance mapped POM after renaming with _POM_Baked suffix, where the depth distance end. I can see behind objects. I use one texture for multiple objects. Unity 2017.3p1, i tried to tweak the various settings i can think of.
     

    Attached Files:

  34. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Seems like bottom cut set to 0 still "too high" due to some rounding errors at your material "bottoms". Open shader and find this:

    Code (csharp):
    1. _POM_BottomCut ("Bottom cut value", Range(0,1)) = 0
    Set range to something like (-0.001, 1) then save shader and experiment with this param.

    Tom
     
  35. Gruguir

    Gruguir

    Joined:
    Nov 30, 2010
    Posts:
    340
    I don't get it, could you develop ? Is there something i can do on my side - regarding mesh (i use simple quads) or textures ? I tried your workaround and while it occludes a little more the issue is still here. Thanks for your help.
     
  36. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    It might be related to what's actually prepared in mesh after adding _POM_Baked prefix which causes my script to preprocess mesh storing some "magic values" in vertex data. But as far as I can see you don't use need bottom cut feature so you could set threshold to some "very low" value Range(-9999999,1) and set the param to minimum. Does it help?

    Tom
     
  37. ghostaegis

    ghostaegis

    Joined:
    Dec 1, 2016
    Posts:
    19
    So I've been using the shader for a little while and I love it, the rain effects in particular are fantastic. Thank you for putting this on the asset store!

    I've noticed a very odd issue with the Two Layers variant though, which I hoped to use extensively. The height blending is very off.

    Here's an example, using the demo textures. Standard result gives this, with the rock in slot 1 and the metal panel in slot 2:

    UBER-heightblend-current.jpg

    Note how the shader seems to be prioritizing the deepest areas of the second texture, rather than the highest areas.

    Now, I tried inverting the values of the metal panel texture's heightmap, and got this:
    UBER-heightblend-invert.jpg

    Which is accurate. The deeper parts of the metal paneling get fill first, creating a more natural look. But now the dirt has a correct height map, with white as highest, and the metal panel doesn't, with black being highest.

    Also odd, textures with deeper sections only seem to blend correctly if they are in the 2nd slot (regardless of the heightmap invert issue, I think, but I can't tell).

    It wouldn't be so bad if I just had to invert the 2nd heightmap manually everywhere I mean to use this, but obviously that completely screws up the rain effect and the actual height map visual offset effect, both of which I hoped to use. Any help or fix on this you can provide would be appreciated.

    Also, the support link on the asset store for Uber links to the RTP v3 forum page instead of here right now.
     
  38. Gruguir

    Gruguir

    Joined:
    Nov 30, 2010
    Posts:
    340
    Yep that was just me being dumb at wake up, trying to set min value to -0.000001 instead of -1... thank you :)
     
  39. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    This probably mean that 2-layer blending feature is buggy. Inverting blending in the sahder formula would be very quick fix though. I'll get back to you after testing it again a bit.

    Tom
     
  40. ghostaegis

    ghostaegis

    Joined:
    Dec 1, 2016
    Posts:
    19
    Understood, thank you for looking into it!
     
  41. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Indeed this renders inverted logic. Not only on 2nd layer heightmap but overall treatment. For you to have it correct I can give a quick tip to solve it. Open UBER_StandardCore.cginc in VS and Ctrl+F for this:

    Code (csharp):
    1. __VERTEX_COLOR_CHANNEL_LAYER=control.x
    When using "find in entire project" search option you should find it in 3 files - above + tessellation one and utils2 includes.
    Correct formula is:

    Code (csharp):
    1. __VERTEX_COLOR_CHANNEL_LAYER = 1 - control.x
    Remember that vertex color is inverted as well - let's don't touch it though. It means - full value (1) reveals layer2, low value (0) reveals layer1.

    After saving changes to 3 .cginc files reimport all shaders. As you pointed out this inconsistency I theoretically should do the same and release it with new UBER update, but it's risky - people that use 2layer UBER shaders in their project will have changed look after updating package. To handle it I'm introducing a #define switch in my UBER_StandardConfig.cginc file to give them chance to fix it via click (commenting out fix #define).

    Anyway - thank you for sharing the bug! Well, it's been here since ... the very first version of UBER ;).

    ATB, Tom
     
    hopeful likes this.
  42. ghostaegis

    ghostaegis

    Joined:
    Dec 1, 2016
    Posts:
    19
    That did the trick, it blends beautifully now! Thanks so much!

    I don't know if you'd ever consider adding it, but if there was ever a possibility of your adding an "advanced" 3-layer blend variant shader that sacrificed Glitter/Emit/Secondary Maps or required you to store single-channel data for all textures into single images (Like all height maps HAVE to be in one image, metal/smooth HAVE to be to be stored in RG/BA pairs, whatever), I'd use the hell out of that. Being able to use your dynamic rain and snow effects with blended layers is fantastic.
     
  43. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Will consider, but I can't even roughly estimate when it could be done as I'm burried with work on dronethegame now...
    If you're concerned about dynamic rain.snow effects together with blending more textures you could take a look at my RTP. There is a standalone shader included (triplanar) that can blend 4 layers and handles snow/rain effects very similar way to how it's done in UBER. It does not handle separate metallic maps (assuming it's for terrain where we have dielectrics only).

    For UBER users it's very cheap to crossgrade to RTP.

    Tom
     
  44. AlexanderElert

    AlexanderElert

    Joined:
    May 31, 2017
    Posts:
    37
    Hi Tom!
    I use the Snow feature to fake a "Mossy effect" on my materials, because sometimes i need to use the secondary maps.
    (plus the snow feature can make the moss look very more natural than a simple masked texture).

    I been create some uber snow material presets to have color variations on my moss.

    We can change the snow properties preset per object if they shared the same material? Or i need to have a copy of this material with different preset asigned?

    PD: I use bitmap2material3.sbsar for unity

    Thanks!

    1.jpg 2.jpg 3.jpg 4.jpg 5.jpg
     
    tomaszek and Lex4art like this.
  45. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    I mreally like the way you use the feature. But I'm not sure what's the issue you're facing. What do myou like to achieve? Preset holds properties. Materials can reference to a preset. Then we can apply (copy) preset properties to material with single click. You'd,like to apply presets to multiple materials at once maybe?

    Tom
     
  46. Yuki-Taiyo

    Yuki-Taiyo

    Joined:
    Jun 7, 2016
    Posts:
    72
    Is it Dynamic Decals you're using ? I have it too. How have you done to integrate UBER to it ?
     
  47. ghostaegis

    ghostaegis

    Joined:
    Dec 1, 2016
    Posts:
    19
    I appreciate that! And regardless of whether or not you add it eventually, I'm thoroughly loving using UBER. It's been a huge asset to our pipeline. And I'll take a look at RTP, that triplanar shader might close the gap for what we need for now. Thanks again for your help!
     
  48. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    938
    I'm having a problem with the presets collections/selection. Whenever i change one of my assets and save them to there own selection all the other uber assets/materials in the scene change too.

    How do I keep each individual preset?
     
    AlexanderElert likes this.
  49. AlexanderElert

    AlexanderElert

    Joined:
    May 31, 2017
    Posts:
    37
    Let's take the example that I have a prefab of a rock that uses an uber material.
    I would like to reuse that prefab and its respective material but using different presets of snow, can this be achieved without having to duplicate my materials?

    maybe being able to create several prefabs with different type of snow but sharing the same base material.
    this would prevent me from having to double or triple the amount of materials in my project.

    example of 4 diferent snow properties to fake the "moss" (diferent materials obviously):
    snow-as-moss.jpg
     
  50. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Preset functionality is meant for quick sharing and reusing parameters, not to reduce material count. During rendering you need separate materials anyway if you need different behaviour on your rocks. The only thing that might look like "workaround" here would be usage of Unity's MaterialPropertyBlock functionality that allows some parameters for shading are stored not in material. Still we would need to have MaterialPropertyBlock functionality implemented via script. MaterialPropertyBlock object is coupled with renderer. Single prefab would represent single rock mesh with its renderer +material+materialpropertyblock. MaterialPropertyBlock parameters override these stored in material.

    To have separate variation of rock present in scene you need separate object in scene. That's unavoidable. More variations = more unique set of parameters that feed shader at rendering stage which means worse batching efficiency.

    I assume you'd like to keep your project clean and not overcrowded with viariations. Still - at scene you'll have a lot of object copies (no matter materials or materialpropertyblock assigned to rendrer). Simpliest way to copy material t scene level is to make such assignment at script level:

    aRenderer.sharedMaterial = aRenderer.material;

    Beause accessing .material property makes unique copy while sharedMaterial is reference (that for prefabs is material object stored in project). At scene you can store objects that are not assets (materials present in project folder) - they are saved with scene and such scene can reference them (cross scene references can't be saved scene files).

    Tom
     
    AlexanderElert likes this.