Search Unity

  1. New Unity Live Help updates. Check them out here!

    Dismiss Notice

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,775
    Wow, you ask something that has been discussed 3 years ago... ;). No, I haven't introduced LOD (shader max lod level) in UBER. I seemed to be unnecessary in most cases.

    Although your trees don't use UBER, UBER still processes everything under import. As soon as it detects anything that resembles UBER model it goes thru the script. Maybe UBER determines stuff for processing via imported asset name - does any of your trees has "UBER like" bets in their names? Like "POM_Baked_", etc. ?

    Tom
     
  2. Hazneliel

    Hazneliel

    Joined:
    Nov 14, 2013
    Posts:
    185
    Thanks, when you say it seemed to be unnecessary, do you mean that even low end PCs wont suffer performance issues a cause of UBER?
     
  3. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,775
    UBER shader is mostly as performant as Unity standard shader. When you demand hi-end effects like parallax occlusion mapping or weather effects (water/snow) it's surely more expensive. For low-end PCs you need to introduce graphic settings that would manage features used on materials. Which features are generaly essential for you usecase?

    Tom
     
    Hazneliel likes this.
  4. Hazneliel

    Hazneliel

    Joined:
    Nov 14, 2013
    Posts:
    185
    I use it for skin materials with light scattering and suppressing shadows. Light scatter is vert subtle and I suppress shadows to make skin have a natural ambient light.

    Is the computation for this effects very performant? Should I worry about switching to simpler shaders on low settings?

    I appreciate your time clarifying this doubts.
    Regards
     
  5. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,775
    Translucency is on the cheap side. It only brings some modifications in lighting computations which are generaly much more expensive than (GGX specularity) than translucency itself. There's not much to be worry. (the same diffuse scattering effect - it's just a few arithmetic operations added to shader). No extensive texture fetching needed comparing to POM.

    Tom.
     
    Hazneliel likes this.
  6. Aeskyphaz

    Aeskyphaz

    Joined:
    Jun 2, 2017
    Posts:
    47
    Hello, am considering buying UBER and was wondering if it was compatible with the scriptable render pipeline and with some common external assets (Amplify SHaders Editor in mind ) ?

    Thanks in advance,
    Aes
     
  7. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,775
    UBER sticks to Unity standard lighting pipelines. Amplify Editor is visual tool for creating shaders while UBER is ready made one. If you ask how easy would it be to port some UBEr functionalities via Amplify - it wouldn't be easy for non programmer.

    Tom
     
  8. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,001
     
  9. TechnicalArtist

    TechnicalArtist

    Joined:
    Jul 9, 2012
    Posts:
    721
    Hey,
    Uber tessellation shader does not work in iPad 2018, Unity tessellation sample worked.
    Thanks in advance.
     
  10. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,775
    Very hard to check without target platform for tests. Anysshader errors produced on build? AFAIK Mac goes depracating OpenGL, GLES, etc in favor of Metal. What I can do is to select Metal as target trying to compile shader in editor ("actually it's kind of "pseudo-shader") targeting Metal and show its code - then looking for any error messages. You would need to give me exact shader variant that's problematic (with features used maybe). Doesn't it work for any set of features - I mean if tessellation breaks it no matter the other options used in shader.

    Describe how would you exactly prefer it work like. Currently when we have cutout selected we sample main albedi texture, multiply its alpha value by main color alpha then apply cutoff threshold. What would you like to control cutoff?

    Tom
     
  11. TechnicalArtist

    TechnicalArtist

    Joined:
    Jul 9, 2012
    Posts:
    721

    Hi,

    Thanks for reply.

    Any shader support tessellation in uber shader not worked. It's not showing any error in unity editor.
    If you want to test your shader, I will ready to check in iPad.
     
  12. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,775
    As far as I can see Unity can compile tessellation for Metal. Not sure what can introduce the problem. I saw it's been also asked on Amplify ASE because it's not obvious for tessellation shader to work with metal even if it can be compiled. Wondering if it can be shader model tier barrier here. GLES needed 3.1 extension for tessellation. I intentionally commented out #pragma target 5.0 in UBER shaders while on Unity example generated I can see target 4.6. You could test it (with/w/o this pragma).

    Anyway, got the Unity example tess shader, generated simpliest variant code for deferred lighting alone (use it on camera). It's like this:

    Code (csharp):
    1.  
    2. Shader "Tessellation Sample" {
    3.     Properties {
    4.         _Tess ("Tessellation", Range(1,32)) = 4
    5.         _MainTex ("Base (RGB)", 2D) = "white" {}
    6.         _DispTex ("Disp Texture", 2D) = "gray" {}
    7.         _NormalMap ("Normalmap", 2D) = "bump" {}
    8.         _Displacement ("Displacement", Range(0, 1.0)) = 0.3
    9.         _Color ("Color", color) = (1,1,1,0)
    10.         _SpecColor ("Spec color", color) = (0.5,0.5,0.5,0.5)
    11.     }
    12.     SubShader {
    13.         Tags { "RenderType"="Opaque" }
    14.         LOD 300
    15.            
    16.        
    17.    // ------------------------------------------------------------
    18.    // Surface shader code generated out of a CGPROGRAM block:
    19.    
    20.  
    21.    // ---- deferred shading pass:
    22.    Pass {
    23.        Name "DEFERRED"
    24.        Tags { "LightMode" = "Deferred" }
    25.  
    26. CGPROGRAM
    27. // compile directives
    28. #pragma vertex tessvert_surf
    29. #pragma fragment frag_surf
    30. #pragma hull hs_surf
    31. #pragma domain ds_surf
    32. #pragma target 4.6
    33. #pragma exclude_renderers nomrt
    34. #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2
    35. #pragma multi_compile_prepassfinal noshadowmask nodynlightmap nolightmap
    36. #include "HLSLSupport.cginc"
    37. #define UNITY_INSTANCED_LOD_FADE
    38. #define UNITY_INSTANCED_SH
    39. #define UNITY_INSTANCED_LIGHTMAPSTS
    40. #include "UnityShaderVariables.cginc"
    41. #include "UnityShaderUtilities.cginc"
    42. // Surface shader code generated based on:
    43. // vertex modifier: 'disp'
    44. // writes to per-pixel normal: YES
    45. // writes to emission: no
    46. // writes to occlusion: no
    47. // needs world space reflection vector: no
    48. // needs world space normal vector: no
    49. // needs screen space position: no
    50. // needs world space position: no
    51. // needs view direction: no
    52. // needs world space view direction: no
    53. // needs world space position for lighting: YES
    54. // needs world space view direction for lighting: YES
    55. // needs world space view direction for lightmaps: no
    56. // needs vertex color: no
    57. // needs VFACE: no
    58. // passes tangent-to-world matrix to pixel shader: YES
    59. // reads from normal: no
    60. // 1 texcoords actually used
    61. //   float2 _MainTex
    62. #include "UnityCG.cginc"
    63. //Shader does not support lightmap thus we always want to fallback to SH.
    64. #undef UNITY_SHOULD_SAMPLE_SH
    65. #define UNITY_SHOULD_SAMPLE_SH (!defined(UNITY_PASS_FORWARDADD) && !defined(UNITY_PASS_PREPASSBASE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(UNITY_PASS_META))
    66. #include "Lighting.cginc"
    67.  
    68. #define INTERNAL_DATA half3 internalSurfaceTtoW0; half3 internalSurfaceTtoW1; half3 internalSurfaceTtoW2;
    69. #define WorldReflectionVector(data,normal) reflect (data.worldRefl, half3(dot(data.internalSurfaceTtoW0,normal), dot(data.internalSurfaceTtoW1,normal), dot(data.internalSurfaceTtoW2,normal)))
    70. #define WorldNormalVector(data,normal) fixed3(dot(data.internalSurfaceTtoW0,normal), dot(data.internalSurfaceTtoW1,normal), dot(data.internalSurfaceTtoW2,normal))
    71.  
    72. // Original surface shader snippet:
    73. #line 13 ""
    74. #ifdef DUMMY_PREPROCESSOR_TO_WORK_AROUND_HLSL_COMPILER_LINE_HANDLING
    75. #endif
    76. /* UNITY: Original start of shader */
    77.         //#pragma surface surf BlinnPhong vertex:disp tessellate:tessFixed nolightmap exclude_path:forward exclude_path:prepass noinstancing
    78.         //#pragma target 4.6
    79.  
    80.         struct appdata {
    81.             float4 vertex : POSITION;
    82.             float4 tangent : TANGENT;
    83.             float3 normal : NORMAL;
    84.             float2 texcoord : TEXCOORD0;
    85.         };
    86.  
    87.         float _Tess;
    88.  
    89.         float4 tessFixed()
    90.         {
    91.             return _Tess;
    92.         }
    93.  
    94.         sampler2D _DispTex;
    95.         float _Displacement;
    96.  
    97.         void disp (inout appdata v)
    98.         {
    99.             float d = dot(tex2Dlod(_DispTex, float4(v.texcoord.xy,0,0)).rgba,1) * _Displacement;
    100.             v.vertex.xyz += v.normal * d;
    101.         }
    102.  
    103.         struct Input {
    104.             float2 uv_MainTex;
    105.         };
    106.  
    107.         sampler2D _MainTex;
    108.         sampler2D _NormalMap;
    109.         fixed4 _Color;
    110.  
    111.         void surf (Input IN, inout SurfaceOutput o) {
    112.             half4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
    113.             o.Albedo = c.rgb;
    114.             o.Specular = 0.2;
    115.             o.Gloss = 1.0;
    116.             o.Normal = UnpackNormal(tex2D(_NormalMap, IN.uv_MainTex));
    117.         }
    118.        
    119.  
    120. #ifdef UNITY_CAN_COMPILE_TESSELLATION
    121.  
    122. // tessellation vertex shader
    123. struct InternalTessInterp_appdata {
    124.   float4 vertex : INTERNALTESSPOS;
    125.   float4 tangent : TANGENT;
    126.   float3 normal : NORMAL;
    127.   float2 texcoord : TEXCOORD0;
    128. };
    129. InternalTessInterp_appdata tessvert_surf (appdata v) {
    130.   InternalTessInterp_appdata o;
    131.   o.vertex = v.vertex;
    132.   o.tangent = v.tangent;
    133.   o.normal = v.normal;
    134.   o.texcoord = v.texcoord;
    135.   return o;
    136. }
    137.  
    138. // tessellation hull constant shader
    139. UnityTessellationFactors hsconst_surf (InputPatch<InternalTessInterp_appdata,3> v) {
    140.   UnityTessellationFactors o;
    141.   float4 tf;
    142.   tf = tessFixed();
    143.   o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w;
    144.   return o;
    145. }
    146.  
    147. // tessellation hull shader
    148. [UNITY_domain("tri")]
    149. [UNITY_partitioning("fractional_odd")]
    150. [UNITY_outputtopology("triangle_cw")]
    151. [UNITY_patchconstantfunc("hsconst_surf")]
    152. [UNITY_outputcontrolpoints(3)]
    153. InternalTessInterp_appdata hs_surf (InputPatch<InternalTessInterp_appdata,3> v, uint id : SV_OutputControlPointID) {
    154.   return v[id];
    155. }
    156.  
    157. #endif // UNITY_CAN_COMPILE_TESSELLATION
    158.  
    159.  
    160. // vertex-to-fragment interpolation data
    161. struct v2f_surf {
    162.   UNITY_POSITION(pos);
    163.   float2 pack0 : TEXCOORD0; // _MainTex
    164.   float4 tSpace0 : TEXCOORD1;
    165.   float4 tSpace1 : TEXCOORD2;
    166.   float4 tSpace2 : TEXCOORD3;
    167.   float4 lmap : TEXCOORD4;
    168. #ifndef LIGHTMAP_ON
    169.   #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL
    170.     half3 sh : TEXCOORD5; // SH
    171.   #endif
    172. #else
    173.   #ifdef DIRLIGHTMAP_OFF
    174.     float4 lmapFadePos : TEXCOORD5;
    175.   #endif
    176. #endif
    177.   UNITY_VERTEX_INPUT_INSTANCE_ID
    178.   UNITY_VERTEX_OUTPUT_STEREO
    179. };
    180. float4 _MainTex_ST;
    181.  
    182. // vertex shader
    183. v2f_surf vert_surf (appdata v) {
    184.   UNITY_SETUP_INSTANCE_ID(v);
    185.   v2f_surf o;
    186.   UNITY_INITIALIZE_OUTPUT(v2f_surf,o);
    187.   UNITY_TRANSFER_INSTANCE_ID(v,o);
    188.   UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
    189.   o.pos = UnityObjectToClipPos(v.vertex);
    190.   o.pack0.xy = TRANSFORM_TEX(v.texcoord, _MainTex);
    191.   float3 worldPos = mul(unity_ObjectToWorld, v.vertex).xyz;
    192.   float3 worldNormal = UnityObjectToWorldNormal(v.normal);
    193.   fixed3 worldTangent = UnityObjectToWorldDir(v.tangent.xyz);
    194.   fixed tangentSign = v.tangent.w * unity_WorldTransformParams.w;
    195.   fixed3 worldBinormal = cross(worldNormal, worldTangent) * tangentSign;
    196.   o.tSpace0 = float4(worldTangent.x, worldBinormal.x, worldNormal.x, worldPos.x);
    197.   o.tSpace1 = float4(worldTangent.y, worldBinormal.y, worldNormal.y, worldPos.y);
    198.   o.tSpace2 = float4(worldTangent.z, worldBinormal.z, worldNormal.z, worldPos.z);
    199.   o.lmap.zw = 0;
    200. #ifdef LIGHTMAP_ON
    201.   o.lmap.xy = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw;
    202.   #ifdef DIRLIGHTMAP_OFF
    203.     o.lmapFadePos.xyz = (mul(unity_ObjectToWorld, v.vertex).xyz - unity_ShadowFadeCenterAndType.xyz) * unity_ShadowFadeCenterAndType.w;
    204.     o.lmapFadePos.w = (-UnityObjectToViewPos(v.vertex).z) * (1.0 - unity_ShadowFadeCenterAndType.w);
    205.   #endif
    206. #else
    207.   o.lmap.xy = 0;
    208.     #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL
    209.       o.sh = 0;
    210.       o.sh = ShadeSHPerVertex (worldNormal, o.sh);
    211.     #endif
    212. #endif
    213.   return o;
    214. }
    215.  
    216. #ifdef UNITY_CAN_COMPILE_TESSELLATION
    217.  
    218. // tessellation domain shader
    219. [UNITY_domain("tri")]
    220. v2f_surf ds_surf (UnityTessellationFactors tessFactors, const OutputPatch<InternalTessInterp_appdata,3> vi, float3 bary : SV_DomainLocation) {
    221.   appdata v;
    222.   v.vertex = vi[0].vertex*bary.x + vi[1].vertex*bary.y + vi[2].vertex*bary.z;
    223.   v.tangent = vi[0].tangent*bary.x + vi[1].tangent*bary.y + vi[2].tangent*bary.z;
    224.   v.normal = vi[0].normal*bary.x + vi[1].normal*bary.y + vi[2].normal*bary.z;
    225.   v.texcoord = vi[0].texcoord*bary.x + vi[1].texcoord*bary.y + vi[2].texcoord*bary.z;
    226.   disp (v);
    227.   v2f_surf o = vert_surf (v);
    228.   return o;
    229. }
    230.  
    231. #endif // UNITY_CAN_COMPILE_TESSELLATION
    232.  
    233. #ifdef LIGHTMAP_ON
    234. float4 unity_LightmapFade;
    235. #endif
    236. fixed4 unity_Ambient;
    237.  
    238. // fragment shader
    239. void frag_surf (v2f_surf IN,
    240.     out half4 outGBuffer0 : SV_Target0,
    241.     out half4 outGBuffer1 : SV_Target1,
    242.     out half4 outGBuffer2 : SV_Target2,
    243.     out half4 outEmission : SV_Target3
    244. #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4)
    245.     , out half4 outShadowMask : SV_Target4
    246. #endif
    247. ) {
    248.   UNITY_SETUP_INSTANCE_ID(IN);
    249.   // prepare and unpack data
    250.   Input surfIN;
    251.   #ifdef FOG_COMBINED_WITH_TSPACE
    252.     UNITY_EXTRACT_FOG_FROM_TSPACE(IN);
    253.   #elif defined FOG_COMBINED_WITH_WORLD_POS
    254.     UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN);
    255.   #else
    256.     UNITY_EXTRACT_FOG(IN);
    257.   #endif
    258.   #ifdef FOG_COMBINED_WITH_TSPACE
    259.     UNITY_RECONSTRUCT_TBN(IN);
    260.   #else
    261.     UNITY_EXTRACT_TBN(IN);
    262.   #endif
    263.   UNITY_INITIALIZE_OUTPUT(Input,surfIN);
    264.   surfIN.uv_MainTex.x = 1.0;
    265.   surfIN.uv_MainTex = IN.pack0.xy;
    266.   float3 worldPos = float3(IN.tSpace0.w, IN.tSpace1.w, IN.tSpace2.w);
    267.   #ifndef USING_DIRECTIONAL_LIGHT
    268.     fixed3 lightDir = normalize(UnityWorldSpaceLightDir(worldPos));
    269.   #else
    270.     fixed3 lightDir = _WorldSpaceLightPos0.xyz;
    271.   #endif
    272.   float3 worldViewDir = normalize(UnityWorldSpaceViewDir(worldPos));
    273.   #ifdef UNITY_COMPILER_HLSL
    274.   SurfaceOutput o = (SurfaceOutput)0;
    275.   #else
    276.   SurfaceOutput o;
    277.   #endif
    278.   o.Albedo = 0.0;
    279.   o.Emission = 0.0;
    280.   o.Specular = 0.0;
    281.   o.Alpha = 0.0;
    282.   o.Gloss = 0.0;
    283.   fixed3 normalWorldVertex = fixed3(0,0,1);
    284.   o.Normal = fixed3(0,0,1);
    285.  
    286.   // call surface function
    287.   surf (surfIN, o);
    288. fixed3 originalNormal = o.Normal;
    289.   float3 worldN;
    290.   worldN.x = dot(_unity_tbn_0, o.Normal);
    291.   worldN.y = dot(_unity_tbn_1, o.Normal);
    292.   worldN.z = dot(_unity_tbn_2, o.Normal);
    293.   worldN = normalize(worldN);
    294.   o.Normal = worldN;
    295.   half atten = 1;
    296.  
    297.   // Setup lighting environment
    298.   UnityGI gi;
    299.   UNITY_INITIALIZE_OUTPUT(UnityGI, gi);
    300.   gi.indirect.diffuse = 0;
    301.   gi.indirect.specular = 0;
    302.   gi.light.color = 0;
    303.   gi.light.dir = half3(0,1,0);
    304.   // Call GI (lightmaps/SH/reflections) lighting function
    305.   UnityGIInput giInput;
    306.   UNITY_INITIALIZE_OUTPUT(UnityGIInput, giInput);
    307.   giInput.light = gi.light;
    308.   giInput.worldPos = worldPos;
    309.   giInput.worldViewDir = worldViewDir;
    310.   giInput.atten = atten;
    311.   #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
    312.     giInput.lightmapUV = IN.lmap;
    313.   #else
    314.     giInput.lightmapUV = 0.0;
    315.   #endif
    316.   #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL
    317.     giInput.ambient = IN.sh;
    318.   #else
    319.     giInput.ambient.rgb = 0.0;
    320.   #endif
    321.   giInput.probeHDR[0] = unity_SpecCube0_HDR;
    322.   giInput.probeHDR[1] = unity_SpecCube1_HDR;
    323.   #if defined(UNITY_SPECCUBE_BLENDING) || defined(UNITY_SPECCUBE_BOX_PROJECTION)
    324.     giInput.boxMin[0] = unity_SpecCube0_BoxMin; // .w holds lerp value for blending
    325.   #endif
    326.   #ifdef UNITY_SPECCUBE_BOX_PROJECTION
    327.     giInput.boxMax[0] = unity_SpecCube0_BoxMax;
    328.     giInput.probePosition[0] = unity_SpecCube0_ProbePosition;
    329.     giInput.boxMax[1] = unity_SpecCube1_BoxMax;
    330.     giInput.boxMin[1] = unity_SpecCube1_BoxMin;
    331.     giInput.probePosition[1] = unity_SpecCube1_ProbePosition;
    332.   #endif
    333.   LightingBlinnPhong_GI(o, giInput, gi);
    334.  
    335.   // call lighting function to output g-buffer
    336.   outEmission = LightingBlinnPhong_Deferred (o, worldViewDir, gi, outGBuffer0, outGBuffer1, outGBuffer2);
    337.   #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4)
    338.     outShadowMask = UnityGetRawBakedOcclusions (IN.lmap.xy, worldPos);
    339.   #endif
    340.   #ifndef UNITY_HDR_ON
    341.   outEmission.rgb = exp2(-outEmission.rgb);
    342.   #endif
    343. }
    344.  
    345. ENDCG
    346.  
    347. }
    348.  
    349.    // ---- end of surface shader generated code
    350.  
    351. #LINE 57
    352.  
    353.     }
    354.     FallBack "Diffuse"
    355. }
    356.  
    You could tell if it works in defferred on your hardware in build.

    Tom
     
  13. VoiD_AUT

    VoiD_AUT

    Joined:
    Feb 16, 2017
    Posts:
    1
    Hi ,
    Short time ago i bought uber and I love it, but i dont get the extrusion shader to work. Even when i set up everything like in the example it doesnt show up. Is the mesh a single plane or double sided?
     
  14. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,775
    The mesh need to be named with special suffixes - then it gets processed under import. Refer to my example models.

    Tom
     
  15. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,001
    Why POM Advanced rotates and moves along with camera? I've created some small rocks with POM Advanced and it looks good but when I move camera all rocks start moving and rotating along with camera :(

    POM Extrusion doesn't have that issue but it doesn't looks good visually.
     
    Last edited: Jan 25, 2019
  16. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,001
    Also Uber have an issue with new substance plugin for Unity and the Unity 2018.3.1! It can't get height information from a substance material to use with POM shaders.
     
  17. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,775
    Can you give more info to reproduce the issue? How have you POM Advanced configured? Has mesh been baked/preprocessed to you it? I have POM Advanced meshes rendered in my example scene, can you observe the problem there (for example on torus or "rocky box capped top/bottom")?

    Unfortunately I wasn't even able to reproduce the issue, because Substance has apparently sitll some bugs. Followed instructions on allegorithmic site, but it simply crashed Unity 2018.3.0f2... What I tried to do was to (following instructions) - make project in U2017, import some legacy substance (free brick from AssetStore), reopen project in U2018 and import substance plugin. Then it crashes... W/o stable substance in Unity (not related to UBER because I haven't even imported UBER in the test project) I can't help yet.

    Tom
     
    ksam2 and Deckard_89 like this.
  18. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    253
    I had the exact same experience with the Substance plugin. It just does not work. Hoping Allegorithmic will fix bugs soon.
     
  19. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,001
    Here is pics that shows what I'm talking about :) movement is so obvious when character walks on it.





     
  20. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,001
  21. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,775
    Dealing with example scene I can't see anything suspicious. It's probbaly kind of misunderstanding here how POM Advanced features work and what's this shader variant meat for and capable of. If you refer to edges - it can not simply resolve corner silhouette, it's parallax effect that operates inside mesh triangles being drawn. On the example scene cube after we change the shader to POM advanced it works like expected - object scale is set to correct value (it's 1m cube so UVs of rock texture are mapped 0..1 across 1m - UV scale set to 1 as default makes it working good w/o any intersection bendings (where cylinder crosses the surface of cube). UV ranges for cut are set 0,0,1,1 and clips pixels that go beyond when ray tracing (so it resembles the silhouette being solved up to the triangle edge, but of course looking at this from other angles reveals the trick...). Bottom cut set to value around 0,5 makes bottoms (heightmap values below) being clipped as well.

    Tom
     
    ksam2 likes this.
  22. Teosis

    Teosis

    Joined:
    Jan 24, 2018
    Posts:
    22
    Good day
    Is UBER compatible with Unity 2018.3 built-in render pipeline aka ordinary 3d template (That is, not with HDRP or LWRP, these two are unsupported by UBER as far as I understand) ? Just want to be sure before I buy.
    Also, regarding PBR Smoothness/Metallic workflow -- how does UBER handle those maps? Is it a single map with RGB for Metallic, and Alpha for Smoothness?
    Lastly, as far as I can get from posts on the previous pages, desired fog variant should be enabled manually for UBER. Question is, could UBER be affected by volumetric fog like AURA?
    Regards
     
  23. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,775
    UBER works only with built-in rendering pipelines (forward, deferred), no SRP. It handles spec/metal workflow just like Unity Standard shader does. It's kind of solution feature packed on the top of Unity Standard shader. The time UBER was created I removed Unity's fog selection in favor of manual (so we need to select the fog defining it in one of configuration .cginc file). We can easily remove this limitation now adding a few #pragma directives in a given UBER shader if you really need to have it selectable runtime. As for AURA - I can't say for sure, because I've never checked it. I believe AURA introduces no roadblock here. It just sweeps kind of raytrace over shadowmaps like postprocessing effect. UBER writes all output need here - it has valid shadow casters and writes correctly to depth/normals (esp. in deferred).

    Tom
     
    Teosis likes this.
  24. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,001
    Ok, sorry for misunderstanding :)

    About Uber and Substance I created a small project with a substance material and uber that shows how it doesn't work :D I'll send a PM to you please check why POM can get height texture from a substance material.
     
  25. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,775
    Check if Substance heightmap has Alpha channel filled with contents. This channel is used by default for heightmapin UBER. It's configurable though. look for "#define PARALLAX_CHANNEL a" in UBER_StandardConfig.cginc and change the channel to r. Or configure your substance to output height texture to alpha channel (preferably texture produced should be Alpha8 - we need only a single channel w/o compression).

    Tom
     
    ksam2 likes this.
  26. thussainA3

    thussainA3

    Joined:
    Nov 11, 2015
    Posts:
    1
    I'm having some trouble with getting the global params for snow to work in Unity build.

    Using Unity 2018.3.6f1, latest version of Uber.

    I have ticked dynamic snow for some materials and set the global control. Adjusting the global params in the Unity editor works fine - i linked up Unity slider to the global params too.

    However when I build it out, the slider doesn't update the global params.

    Can you please advise, am I doing something wrong?
     
  27. dirkjacobasch

    dirkjacobasch

    Joined:
    Apr 24, 2018
    Posts:
    233
    Hi,

    I want to disable or enable emission like you can do with the Unity standard shader.
    Code (CSharp):
    1.  
    2. myMaterial.DisableKeyword("_EMISSION");
    3. myMaterial.EnableKeyword("_EMISSION");
    4.  
    Is there a way to do the same thing with the Uber shader? I can't find how to do it. I use the Metallic Setup / POM Advanced.

    Thanks.
     
  28. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,775
    In UBER static/constant emission is always available. If you put texture into slot we use _EMISSION_TEXTURED keyword variant. If you select animation _EMISSION_ANIMATED keyword is used. When no keyword is defined you can cancel animation setting material emission color to 0:

    Code (CSharp):
    1. myMaterial.SetColor("_EmissionColor", Color.black);
     
  29. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,775
    Can you check it making a build out of UBER's example scene? There's a rocky sphere example with sun/snow and slider. It's configured to work globally. It works on my side in build. You need to make sure material has parameters to take global control set (theu're floats 0/1) and values of global wet/snow values are also set. Maybe you have added 2 controllers accidentially (or they are on separate scenes that are bothloaded). That can cause controllers interfere each other.
     
  30. lorddesu

    lorddesu

    Joined:
    Aug 20, 2014
    Posts:
    27
    @tomaszek
    Should we wait for update with SRP support? Or UBER HDRP Shader will be a separate asset? If It will.
     
  31. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,775
    I'll try to rewrite it for HDRP when it's final.

    Tom
     
    hopeful and lorddesu like this.
  32. HenryChinaski

    HenryChinaski

    Joined:
    Jul 9, 2013
    Posts:
    97
    Hey Tom,

    I was able to create really(!) awesome looking puddle behavior in our Top-Down-Game by using the UBER Core Shader playing a little with the wetness settings. However, there are two problems I am facing now:

    1. I use the ripples animation for animating the general flow of the puddle. Problem with that is, that there is a pause after every animation cycle, even if I set the rain intensity to 1. I have no idea of shader development, so could you tell me if there is a way to make the animation kind of loop?

    2. Am I right that I have no control about the spawn position of a ripple? If I could spawn heavier ripples by myself. I could make the puddle even interactive and only play the ripple animation with the normals I use, if the player touches a point on a trigger I attached.

    Thanks for your help and thanks for the awesome shader. I think my question shows also new customers how powerful it really is and how far you are able to expand it with a little experience.

    Regards,
    Daniel
     
  33. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,775
    The ripple technique doesn't give us much control, esp. where and when ripples are spawned. This is more texture animation trick. More control - possible but rather as kind of decal projection on wet areas, but this is not part of what UBER can do by now.

    Tom
     
  34. HenryChinaski

    HenryChinaski

    Joined:
    Jul 9, 2013
    Posts:
    97
    Hey Tom, thanks for the quick answer!
    I did a few tests with the input map for the ripples (since you told me that it would not easily be possible to loop the animation from the shader itself). I understand that the alpha of the painted areas is correlated to the strength of the ripple and that the shape of the painted areas reflects their shape.

    What I just don't understand is how the spawn time/order is determined. If I - for example - take one of the drops on the map in Photoshop and duplicate it to fill the map, the result is that all the ripples are drawn at once. First I thought that the position on the textures axis would explain the different spawn times of the standard ripple texture - but this does not seem to be the case. My idea was to kind of swap your ripple-shaped elements in the map with little noise elements so that at every point of the texture some noise exists at any moment - just like the ripples at full strength almost cover the entirety of my floor texture.

    Could you explain shortly how spawn order is determined and if there are any prerequisites required?
    I already copied the settings of the standard ripple texture to mine.
     
  35. Hazneliel

    Hazneliel

    Joined:
    Nov 14, 2013
    Posts:
    185
    Hello, I have one problem. How can I specify an alpha mask texture to cutout some parts of the mesh using the Uber Specular Core shader?

    Thanks for any help
     
  36. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,775
    Grayscale determines "time shift". It's based on Sebastian Legarde ripples designed for "Remember me". You can find more details googling for it.

    It's alpha channel of albedo/diffuse. Set mode from "Opaque" to "cutoff" in dropdown - it's like you do it in Unity Standard shader.

    Tom
     
  37. Hazneliel

    Hazneliel

    Joined:
    Nov 14, 2013
    Posts:
    185
    Thanks, I tried that but there is no where I can assign an alpha texture that is going to be used to clip the material.
     
  38. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,775
    You can merge alpha texture with albedo (injecting the contents of the seprate cutout texture to the alpha channel of albedo). Use channel mixer (a button is available at the top of UBER material inspector) provided for this task. Please, refer to my pdf documentation.

    Tom
     
  39. Hazneliel

    Hazneliel

    Joined:
    Nov 14, 2013
    Posts:
    185
    Thanks, this is not what I would like to do, I have different masks that can be applied at different times, instead of changing the albedo I just want to assign a texture mask to the alpha channel to hide or show different parts of the character.

    I have seen some shaders support this, can it be done with UBER?
     
  40. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,775
    It can be done of course, but it would mean UBER shader and and its material inspector custom tweaks.

    Tom
     
  41. Hazneliel

    Hazneliel

    Joined:
    Nov 14, 2013
    Posts:
    185
    Thanks, any advise or direction?
    From what I could see in other shaders they declare an alpha texture in the shader, then they do some arithmetic using that texture to produce the following shader pass.
     
  42. HenryChinaski

    HenryChinaski

    Joined:
    Jul 9, 2013
    Posts:
    97
    Worked perfectly and looks awesome! Thanks!
     
  43. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,775
    It's not that much difficult to customize UBER for taking cutout data from separate texture, but it out of the scope for the public forum. It needs modifying shader code, includes code ("input" .cginc where we sample textures) and custom editor for UBER so you can manage the texture in inspector. If this functionality is critical for your project you can contact me via priv message. It's "per user" specific request that's not covered by vanilla UBER release (it's hard to manage all possible scenarios in general package).

    Best Regards, Tom
     
  44. photonic

    photonic

    Joined:
    Dec 29, 2012
    Posts:
    34
    Hi Tomaszek,

    I'm having trouble with the 2 sided shader with rendering mode transparency / fade.
    As you can see below the separate quads render correctly behind each other (2nd quad even showing backface),
    but if I use the shader on a single object the z-buffer seems to have troubles.
    upload_2019-3-25_18-47-2.png

    I works with the cutout option, though:
    upload_2019-3-25_18-52-14.png

    Do you have any tips what I can do?
    Thanks a lot!

    p.s.: Unity 2018.3.9f1
     
  45. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,775
    It is not much UBER specific problem. You could even check the behaviour with Unity's vanilla Standard shader. Transparent objects needs to be always drawn back to front - cube mesh does not guarantee it. Depending on cam angle sometimes triangles will be drawn in righ order, sometimes not. an option could be using set of 6 quads - they might get sorted better by Unity, but I doubt Unity makes it 100% conservatively. It might just turn out to be "loose back to front". Another option is to uncomment depth prepass for this cube object but then beware of another set of troubles with postFXes as transparent objects are basically not supposed to write into depth.

    Yet another option - split your cube into 2 meshes. First draw with cutout (then ordering fine - it writes into depth buffer). 2nd pass would be the same object drawn as transparent with glass like areas exposed).

    Tom
     
  46. photonic

    photonic

    Joined:
    Dec 29, 2012
    Posts:
    34
    Thanks Tom for the fast reply .. will try my best.
    Cheers :)
     
  47. Daft_Hunk

    Daft_Hunk

    Joined:
    Nov 15, 2016
    Posts:
    15
    Hello ! I'm having quite a headache with the transparency render, indeed I don't understand which keyword is the good one for enabling it.

    Editor render :


    Ingame render :


    My keywords :
    Code (CSharp):
    1. private void KeywordsEnabler()
    2. {
    3.         Shader.EnableKeyword("_EMISSION");
    4.         Shader.EnableKeyword("_EMISSION_TEXTURED");
    5.         Shader.EnableKeyword("_EMISSION_ANIMATED");
    6.         Shader.EnableKeyword("_ALPHAPREMULTIPLY_ON");
    7.         Shader.EnableKeyword("_ALPHABLEND_ON");
    8.         Shader.EnableKeyword("ETC1_EXTERNAL_ALPHA");
    9.         Shader.EnableKeyword("_GLOSSYREFLECTIONS_OFF");
    10.         Shader.EnableKeyword("_METALLICGLOSSMAP");      
    11.         Shader.EnableKeyword("_NORMALMAP");
    12.         Shader.EnableKeyword("_SPECULARHIGHLIGHTS_OFF");
    13.         Shader.EnableKeyword("_DETAIL_TEXTURED_WITH_SPEC_GLOSS");
    14.         Shader.EnableKeyword("_WETNESS_NONE");
    15. }
    Thanks in advance :)
     
  48. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,775
    First, your keyword set enables mutualy exclusive variants. Like we can have either _EMISSION (simple color) or _EMISSION_TEXTURED (texture used) or _EMISSION_ANIMATED (texture used and animation is turned on).
    The same for alpha blending. Transparency to remove elements - use_ALPHABLEND_ON (the other - _ALPHAPREMULTIPLY_ON is for glass so you would see spec. highliths on transparent parts).

    _SPECULARHIGHLIGHTS_OFF - this is Unity's keyword and is not implemented in UBER. Use material with smoothness=0 (preferably specular workflow with black specular color set).

    _DETAIL_TEXTURED_WITH_SPEC_GLOSS - do you use secondary detail texturing?

    Some of keywords are Unity specific and won't influence rendering in UBER.

    Second - setup of transparent material is not only about keywords. It's about how shader set the rendering state - rendering order and blending. We use hidden material properties for this (look at the material property section). So - changing material into transparent means - render queue is set to transparent and blending to SrcAlpha OneMinusSrcAlpha. These literals have numeric representation (find Blend [src][dst] in shader code to figure it out).

    Generaly you can figure out the material/shader state for transparent using inspector debug mode. After changing material to transparent you can see which keywords are set and you can also find all material property values (blending floats) + render queue.

    But, in the end - can't you just use separate material already setup for transparent rendering in editor? (UBER's material inspector takes care of setting all keywords, blending and rendering queue for you).
     
  49. Daft_Hunk

    Daft_Hunk

    Joined:
    Nov 15, 2016
    Posts:
    15
    Thanks for the quick and complete explanation ;)

    By just setting up separate materials I'm heading up to messed up result even in the editor :



    My setup is :
    > 2Sided Transparent (For the flame)
    > CoreEmission (For block, it uses Metalic core and can have Detail Map and/or Animated Textured Emissive)
    > Default & Default_2Sided (For props, Metalic core/2sided and can have Emissive)
    > Emission (For area render, it only uses transparent Animated Textured Emissive)

    Here is my materials, just in case :
    https://mega.nz/#!5VwRyQra!B7LpWhJhpU9KQmULDTZyTRnIaPZU4h7gy291lKeb5XU

    I think seeing all of this I'm doing something wrongly since a long time...
     
  50. Daft_Hunk

    Daft_Hunk

    Joined:
    Nov 15, 2016
    Posts:
    15
    Oh and I don't know if it's relevant or not but I'm in deferred lighting
    And thanks for the debug hint, it will save me a lot of pain finding which on is used

    My specific settings for the transparent emissive :
    Code (CSharp):
    1. Material material = tRender.GetComponent<MeshRenderer>().material;
    2.  
    3.         material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
    4.         material.DisableKeyword("ETC1_EXTERNAL_ALPHA");
    5.         material.DisableKeyword("_EMISSION");
    6.         material.DisableKeyword("_EMISSION_TEXTURED");
    7.  
    8.         material.EnableKeyword("_ALPHABLEND_ON");
    9.         material.EnableKeyword("_EMISSION_ANIMATED");
    10.      
    11.         material.renderQueue = 3000;
    12.         material.SetOverrideTag("RenderType", "Transparent");
    13.         material.globalIlluminationFlags = MaterialGlobalIlluminationFlags.RealtimeEmissive;
    I have also noted that my materials are auto set to _ALPHAPREMULTIPLY_ON instead of _ALPHABLEND_ON any idea why ?
     
    Last edited: Apr 18, 2019
unityunity