Search Unity

UBER - Standard Shader Ultra

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

  1. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Is SpeedTreeHD still a possibility? Would it add the ability to make SpeedTrees have wetness and snow? I have a large library of SpeedTrees, but really need a wetness/snow capability for them in my game.
     
  2. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Yes, it is. But not sooner than in a few next months (due to reasons I already gave).

    Tom
     
  3. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    When you say yes, do you mean yes to all the questions, including wetness and snow? If so, that's great and I will gladly wait for it. I need it for our game to be released end of year, but it sounds like your timeline would line up with that.
     
  4. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    In time I'd like to provide community with real "global" weather where everything can handle it. For 3rd party shaders I don't know - will give you framework as simple as possible to add weather to it or maybe via additional pass (using my weahter) added on the top of 3rd party shaded objects.

    Tom
     
  5. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Forgive me for asking again, but I am not quite sure the answer to my question was in there. Will your SpeedTreeHD have wetness and snow feature in it?
     
  6. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    If I decide to globalize weather treatment - then no - weather might be part of separate product which will work with my SpeedTree shaders. If not - my SpeedTree shaders will handle weather themselves. This way or another - you'll be able to use weather on trees which is your concern here.

    Tom
     
  7. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I see. So either way when you are ready to release this there will be a path to SpeedTree and wetness/snow. I am fine with that. I don't want to lose my investment in SpeedTree so this is a huge positive.
     
  8. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    SpeedTree produce great models with nice wind. Would be wrong not using this potential. Separate issue is performance, but that's more ST rendering implementation (separately from shading), which I consider looking into and doing some research later on as well.
     
    buttmatrix likes this.
  9. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I'm currently using the Awesome vegetation Studio beta with SpeedTrees and performance is much better in that system.
     
  10. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    Hi Tom, I'm wondering if Uber can have Enable Instancing for GPU.

    Thanx Jim :D
     
    BonsaTech likes this.
  11. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    It has. Uncomment #pragma multi_compile_instancing in all passes for given UBER shader.
     
    llJIMBOBll likes this.
  12. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    Nice! Thank You :D
     
  13. xexuxjy

    xexuxjy

    Joined:
    Feb 10, 2014
    Posts:
    18
    Apologies if I've missed it, but is there any information available about setting up the shaders and their parameters via scripting? I've got an asset importer class that I use to create models and their materials and i'd like to set the materials to use the Uber shader and default some basic parameters in such as albedo and metallic textures, smoothness, metallic, transparency etc)

    I've got it partly working (as in section below) - but this was coming from the standard unity shaders (where it also only partly worked) and it would be useful to see these parameters documented.

    Many thanks,

    Code (CSharp):
    1. Shader shader = Shader.Find("UBER - Metallic Setup/ Core");
    2. m = new Material(shader);
    3.  
    4. bool isAlpha = false;
    5. // update for transparent
    6. if (textureData1.textureName.Contains(".cc"))
    7. {
    8. isAlpha = true;
    9. }
    10. else
    11. {
    12. isAlpha = DoesTextureHaveAlpha(texture);
    13. }
    14.  
    15. if (isAlpha)
    16. {
    17. m.SetFloat("_Mode", 3.0f);
    18. m.color = new Color(1.0f, 1.0f, 1.0f, 0.5f);
    19. }
     
  14. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862

    This is not enough. When the mode is changed in material inspector a few other actions take place. For example proper keywords are being set (for transparency shader variant to be used, depending on presence of some textures we use features that are also treat via keywords, you need to take care of right queue material need to be rendered as transparency materials are rendered last). Both - custom render queue and shader keywords for material can be set via script using public material methods). You would need to analyse UBER_StandardShaderGUI.cs inspector script to see "what happens between lines" in regards to what I mentioned.

    Tom

    Tom
     
    xexuxjy likes this.
  15. BonsaTech

    BonsaTech

    Joined:
    Dec 22, 2015
    Posts:
    73
    Isn´t instancing enabled by default?
     
  16. LightMagicStudio

    LightMagicStudio

    Joined:
    Jul 26, 2015
    Posts:
    15
    Hello,
    I have a problem with the glitter feature, when I turn it on - it literally washes out the whole object, even when the glitter has rgba set to 0000, I was trying to use it as an addition and enhancement for the dynamic snow, but I can't use it while it makes the whole object washed out...
    It just looks like the snow's frost is enabled for the whole object when I enable the glitter checkbox... But it has even a stronger effect than just a snow's frost. Could you please help me to fix it?
     

    Attached Files:

    Last edited: Jul 9, 2017
  17. kdkgames

    kdkgames

    Joined:
    Nov 12, 2015
    Posts:
    1
    Hello,
    I have a problem with Dynamic Snow and cutout. I want to ask if there is a solution for the situation I'm facing right now? 4.png
     
  18. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Trying hard to reproduce your issue, but I'm not able... Using UBER1.2c with Unity 5.6.1f1. Glitter component is independent from snow when it comes to glitter color - setting this value to black (RGBA) keeps glitter output null. What's your setup? Forward/deferred?

    Oh yeah - that's definitely a bug. Open UBER_StandardCore.cginc and find this part of code:

    Code (csharp):
    1.  
    2. #if defined(_ALPHATEST_ON)
    3.        clip(alpha - _Cutoff);
    4. #endif
    5.  
    You need to move it a few lines up so that the whole part looks like this:

    Code (csharp):
    1.  
    2. #else
    3.    // alpha computed regular way (in opposite to geom blend)
    4.    half alpha = Alpha(i_tex, _ddx, _ddy, _ddxDet, _ddyDet, vertex_color); // UBER - ddx, ddy, vertex_color (2 layers)
    5.  
    6.    #if defined(_ALPHATEST_ON)
    7.            clip(alpha - _Cutoff);
    8.    #endif
    9.  
    10.    #if defined(_SNOW)
    11.        alpha=lerp(alpha, 1, _snow_val);
    12.    #endif  
    13.    #if defined(_WETNESS)
    14.        alpha=lerp(alpha, 1, Wetness*_WetnessColor.a);
    15.    #endif  
    16. #endif
    17.  
    instead of this (current wrong part of code):
    Code (csharp):
    1.  
    2. #else
    3.    // alpha computed regular way (in opposite to geom blend)
    4.    half alpha = Alpha(i_tex, _ddx, _ddy, _ddxDet, _ddyDet, vertex_color); // UBER - ddx, ddy, vertex_color (2 layers)
    5.    #if defined(_SNOW)
    6.        alpha=lerp(alpha, 1, _snow_val);
    7.    #endif  
    8.    #if defined(_WETNESS)
    9.        alpha=lerp(alpha, 1, Wetness*_WetnessColor.a);
    10.    #endif  
    11. #endif
    12.  
    13.  
    14. #if defined(_ALPHATEST_ON)
    15.    clip (alpha - _Cutoff);
    16. #endif
    17.  
    After saving cginc file recompile (simply right click and reimport) UBER shaders.

    I will include this fix in next update.

    ATB, Tom
     
    hopeful and buttmatrix like this.
  19. LightMagicStudio

    LightMagicStudio

    Joined:
    Jul 26, 2015
    Posts:
    15
    It's Deferred.
    Ok, I just noticed that I'm using Unity 5.5.0f3 and UBER 1.2c (U5.5.0p3 release), I'll ask my client for the proper shader version or we'll upgrade the project to the latest patch:)
     
  20. waverz

    waverz

    Joined:
    May 23, 2017
    Posts:
    17
    So any test on Android devices or it's not gonna work?
     
  21. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    gles (GL2) won't work and these variants are excluded. GLES3 should be fine as far as you don't require too much (POM selfshadowing with wetness/snow) - performance might be not-that-impressive.

    Tom
     
  22. EpsilonBetaGamma

    EpsilonBetaGamma

    Joined:
    Nov 18, 2013
    Posts:
    33
    Hi!
    Just wanted to ask if UBER works on PS4 and Xbox One?

    Thanks a lot!
     
  23. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    As far as I'm aware - yes.

    Tom
     
  24. EpsilonBetaGamma

    EpsilonBetaGamma

    Joined:
    Nov 18, 2013
    Posts:
    33
    Hi again Tom!
    I purchased your shader yesterday (I totally love it!), and now I'm ready to texture my scene. I just have one question - do you suggest to use "classic" textures or Substances with your shader? Or it doesn't matter?

    Thanks a lot, and keep up the good work!
     
  25. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    For the sahder it doesn't matter. Substances have their pros (compact storage, adjustable procedural conent) and cons (increased generation time, they tend to crash Unity - at least in the past). So you need to weight yourself what to use.

    Tom
     
  26. toto2003

    toto2003

    Joined:
    Sep 22, 2010
    Posts:
    528
    Hello Tom, i own Uber, and it really fit my need in term of visual, really happy with it, i m targeting mid end mobile gles 3.0 plateform, and i need to change the deph distance from a POM Distance map shader to fit my need with something like 1000 instead of 100, will this have a huge impact in term of performance?
    also would it be possible to extrude with gradient the distance map instead than just black and white? so i can have more level of bevel.

    thanks
     
    Last edited: Jul 19, 2017
  27. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    You can change the distance and check. It's introduced to not perform expensive POM farther from camera. Gradient maps (displacement mapping) is not available by now.

    Tom
     
  28. TechnicalArtist

    TechnicalArtist

    Joined:
    Jul 9, 2012
    Posts:
    736
  29. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
  30. TechnicalArtist

    TechnicalArtist

    Joined:
    Jul 9, 2012
    Posts:
    736
    Thanks for reply
     
  31. SNicolas

    SNicolas

    Joined:
    Apr 6, 2013
    Posts:
    32
    Hi,

    I am surely I am doing something wrong, but I just encountered a problem using the POM Extrude variant that cannot find a possible fix atm.

    When I zoom in with my camera, I usually see these (artifacts?) that start flickering all the time, and obviously break the effect a little bit. The only "fix"I found was using the wetness effect, mostly because it adds some contrast to the extruded areas (but the "white points" are still there).

    Any workaround for this? I am using all the correct setup (I suppose), but maybe I missed something else.

    Thank you,

    Sergi
     

    Attached Files:

  32. zge

    zge

    Joined:
    Sep 18, 2014
    Posts:
    35
    I'm having some difficulty with parallax extrusion that I'm hoping you can help me with. The image shows each of these problems.

    Can you elaborate on the Extrusion map tooltip "It's like height map but displacement is realized orthogonal at 0.5 height threshold"?
    Not all of the values in my height maps are being used as you can see in the image. I don't know how to work out my values with the current threshold, and I don't know how I can change the current threshold.

    Is there are way that I can decouple the steps and the image resolution? I'd like to use very low resolution maps for the extrusion, but the steps are too obvious. The only way I can figure out to raise the step count is to raise the image resolution.

    In some areas with shallow corners, the back of the extruded area disappears. Not all of the shallow corners disappear, but I haven't figured out what makes some work and others not work. Can you help?


     
  33. tachyon-particle

    tachyon-particle

    Joined:
    Jan 5, 2016
    Posts:
    79
    Hi,

    Unity 2017.1.0p2
    UBER 1.2c

    Warning message shows in console when Unity editor loads:
    Invalid AssetDatabase path: C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/VR/OSXUniversal/AudioPluginOculusSpatializer.bundle. Use path relative to the project folder.
    UnityEditor.AssetDatabase:LoadAssetAtPath(String, Type)
    UBER_PostProcessModelForPOM:OnPostprocessAllAssets(String[], String[], String[], String[]) (at Assets/UBER/Editor/UBER_PostProcessModelForPOM.cs:48)
    UnityEditor.AssetPostprocessingInternal:postprocessAllAssets(String[], String[], String[], String[], String[])


    When clicking on the warning message, it leads to the UBER_PostProcessModelForPOM.cs file.

    Thanks
     
    Last edited: Jul 28, 2017
  34. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Sorry for delay. I'm wondering if dots are issued by some kind of numerical error in shader or simply they pass from too "tight" normalmap. UBER solves some raytracing in heightmap texture space to get parallaxed UV. Then this uv is used to sample rest of maps - normals are still taken from normalmap though. In deferred you can check what's the output of gbuffer normals - if they are polluted with these streaks mi8ght mean that you need "softer" version of normalmap at places where we've got extruded edges.

    Otherwise I'd need to check if I can reproduce the same issue on my side (your heightmap textures and test model would be welcome if you can expose it to me via private message + Unity and UBER version used).

    To not mislead extrusion maps with distance maps (where we can't have "round extruded corners") - couldn't you simply blur your heightmap - it should result in rounded corners of your walls?

    For the cutout issue try to play with UV border cut and bottom cut values to check if this helps - check bottom cut. Refer to my docs where I explained some models need to be preprocessed on import - you need to follow correct model naming so that UBER can detect it - that gives best results on shading.

    P.S. Your usecase is perfect example of how such surfaces like your "scifi like" walls can me solved using UBER parallax features w/o having to use hi-poly models (and extrusion maps work reasonably fast - especially on relatively big triangles).

    The error looks odd to me - could you debug via Debug.Log call in my script what kind of asset it attepmts to preprocess? UBER should only take of specifically named textures (specular/gloss textures to estimate variance from accompanying normalmaps) and specifically named models (to preprocess their data to work well with UBER's parallax routines).

    Tom
     
  35. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    For all users that follow this thread - finally I can post it here... (so you know what I've been doing last months) as we reveal D.R.O.N.E. together with Unity.

    Enjoy and be insprired what actually Unity is capable of :)



    All drones, buildings and some other stuff are rendered using UBER.

    ATB, Tom
     
    kerrmedia, hippocoder, MS80 and 8 others like this.
  36. zge

    zge

    Joined:
    Sep 18, 2014
    Posts:
    35
    Thanks for your reply.

    Extrusion height:
    My understanding is that distance maps can only have a single distance value, but extrusion maps can have multiple distances based on the value of the height map. Is that correct?

    I need sharp corners, but with 3 different height values. The problem is that the mid grey value isn't being used in the extrusion. I want the extrusion to be more sensitive to value variation in the texture.

    And please let me know what does "0.5 height threshold" mean?

    Disappearing backfaces:
    The back of the extrusion disappears when viewed on a shallow angle. I have adjusted every variable including UV cut and bottom cut, but nothing fixes it. As you can see from the image I have named my object correctly, and have also named my height map according to the instructions.

    Unfortunately while this problem exists it's not possible to use UBER parallax for walls, because they become invisible.

    Extrusion steps:
    Please let me know if there is a way to specify how close the extrusion steps are, other than increasing the resolution of the map?
     
  37. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    0.5 threshold means - every value darker than mid grey on heightmap will be pushed down. The other pixels will stay not extruded. So - there are 2 states (extruded/not extruded) and no in-between values. For such application use regular POM mapping (like in UBER Core variant) although it will round corners due to heightmap interpolation when sampling. You might theoretically turn off interpolation (set Point filtering on heightmap texture) but I've never tried it out, so I can't tell how would it behave.

    To solve this problem I'd need to be able to reproduce the issue on my side, so please provide me with some basic test rig (model, texture) on private forum message.

    Extrusion steps are related to texture resolution.

    Tom

    P.S. Distance maps are special kind of textures computed out of grayscale heightmaps - they provide straight corners. The name "distance" comes from the method I use to solve parallax texturespace raytracing - distancemaps encode distances which gives excelent performance in return.
     
  38. tachyon-particle

    tachyon-particle

    Joined:
    Jan 5, 2016
    Posts:
    79
    Thank you for the reply.

    It looks like that warning message only showed up once when I first updated to Unity 2017.1.0p2

    Very weird, it showed up once. After seeing that message, I restarted Unity, and I haven't seen that warning again.

    Again, thank your response.

    Cheers
     
  39. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Weather Maker now has UBER: Standard Shader Ultra integration! Hoping Unity will acquire this amazing shader asset and replace the current standard shader :)
     
    buttmatrix and tomaszek like this.
  40. zge

    zge

    Joined:
    Sep 18, 2014
    Posts:
    35
    Thanks Tom,

    I've sent my test scene to you.

    I tried UBER Core and the height has the 3 values, but still has problems in the same places as the extrusion shader.
     
  41. zge

    zge

    Joined:
    Sep 18, 2014
    Posts:
    35
    I have another question.

    Looking at the edges of the extrusion, it appears to be blending between the color on one side and the color on the other. This causes a problem in many of my use cases.

    In most cases I would like the extrusion to use the values from the higher region. Most of my uses are for recessed areas in which case the sides would inherit the material from the high region and not the low region. Here is an example where I want a layer of green blocks, then a layer of orange blocks with a yellow recessed light or screen:


    Is there a way that you can think of to change this? Or can you point me to where in the code I could experiment with different values?
     
  42. zge

    zge

    Joined:
    Sep 18, 2014
    Posts:
    35
    I figured out why the backfaces are disappearing. It's caused by the smoothing angle. I recalculated the normals without smoothing and it's behaving as expected.
     
  43. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    The way you handle UBER's extrusion features will not work great in your usecase. Closest to what you might need is regular POM with haightmaps not filtered (point). This allows you to have different level of extrusion per surface. Extrusion map usage from your scene is not perfect either because of parallax raytrace resolusion which is limited and results in these ugly stripes as you'd like to have 1 big atlas for all wall panels extruded "pixel perfect". Another problem is to match normals right precisely - both regular POM and extrusion maps uses normalmap for this purpose. In your exmaple scene pannels don't receive right lighting due to incorrect normalmapping.

    For straight pixel extrusion corners for me is best to use distance mapping - that's the underlying "feature" of this technique. It has 0/1 logic (fully extruded "floor" against not extruded "ceiling"), but it solves normals on the corners effectively. As your walls are repetitive (not sure if that's the general case) you could use simple panel pattern and tile it at material level. Take a look at my tests below on your example scene (I used a scaled plane next to one of your walls):

    map_source.JPG

    This is source B&W distance map source. When you name it with UBER_DistanceMap suffix it will be processed from B&W to RGBA distance map:

    map_processed.JPG
    Notice that distance map are limited to 256x256 size (that's the highest value that can be stored in a byte of RGBA texture).

    Distance mapped surfaces can be further textured:

    map_textured.JPG
    Corners of distance map extrusion have correctly solved normals.

    General issue around using any POM technique is that is searches along ray in texturespace (starting at some point on heightmap ray is traced along tangent view direction). So - it's not pretty usable for atlased heightmaps (distance maps and so on) as we can start at some "panel" area and finish tracing at quite different part of atlas that doesn't belong to the surface being resolved - at grazing angles we could "see" what's present at part of atlas that belongs to the object that could be placed spatially at quite different in world space. Solution might be to "enclose" separate POM surface in heightmap so the ray will always get solved and never hit the empty space where it could "escape" to the adjanced atlas element that does not belong.

    You can take a look how it's implemented - parallax routines are placed in UBER_StandardUtility2.cginc
    if you think you can tailor it to your needs better.

    ATB, Tom
     
    Last edited: Aug 3, 2017
    buttmatrix likes this.
  44. zge

    zge

    Joined:
    Sep 18, 2014
    Posts:
    35
    Thank you Tom.

    Your crisp edge results with distance mapping are what I'm after, but I am hoping to have multiple levels. I'll experiment a bit more with distance mapping.

    I'm also eager to look at your parallax routines to try to understand more about what's happening in the background, so thanks for your pointer.
     
  45. kerrmedia

    kerrmedia

    Joined:
    Nov 4, 2015
    Posts:
    250
    Hi Tom,
    Your Uber shader looks great, but with Unity 2017, is it still necessary? If so I would be interested in purchasing.
     
  46. kerrmedia

    kerrmedia

    Joined:
    Nov 4, 2015
    Posts:
    250
    I also have RTP
     
  47. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    out of curiosity, why would it not be?
     
  48. kerrmedia

    kerrmedia

    Joined:
    Nov 4, 2015
    Posts:
    250
    I've just started with Unity, every time they update a version it seems things drastically change, so it just seemed from 2015 to 2017, maybe they improved the standard shader? I've got the Uber shader in my cart now, if its a great asset I'll buy it.
     
  49. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    I understand. It is a great asset, and it offers far more than what the standard shader does by default.
     
    punk and tomaszek like this.
  50. kerrmedia

    kerrmedia

    Joined:
    Nov 4, 2015
    Posts:
    250
    OK, thank you, it looks great in the demo.
     
    tomaszek likes this.