Search Unity

UBER - Standard Shader Ultra

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

  1. VP_no1

    VP_no1

    Joined:
    May 12, 2018
    Posts:
    132
    @tomaszek Thank you for answering so fast! I will apply what you told me these days when I have a small window from work :) It doesnt seem complicated :)
     
  2. VP_no1

    VP_no1

    Joined:
    May 12, 2018
    Posts:
    132

    Attached Files:

  3. VP_no1

    VP_no1

    Joined:
    May 12, 2018
    Posts:
    132
    mention: I am beginner in shaders but I can understand code :)
    looking at the code for UBER and for the one I have, I see that are some sections that contains the properties of the shaders like: Properties, CGPROGRAM
    my question is this:
    Should I get what I need from my shader (code I mean) and insert it into the UBER SHADER (Shader "UBER - Metallic Setup/ Core" this one maybe ?) ?
    the shader that mat is using is the att one
     

    Attached Files:

  4. VP_no1

    VP_no1

    Joined:
    May 12, 2018
    Posts:
    132
    unfortunately I do not see a simple way comparing the uber shader and this custom shader from unity to make them work
    I think the only way would be to match the Secondary Map from Uber with the Top Textures from the Stonework Shader.
    What do I have to modify to make it work ?
    I was very happy initally seeing that changing some materials to your shaders there is nothing else to do becasue the MAP was mapped :) But with this custom shader, things are a bit above my ears :)
    (the custom shader is from 3d kit and i need all the kit shaders becasue else the Enviroment will be totally different :))
     
  5. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Sorry for bringing not-that-optimistic news...

    What you're trying to achieve is not that simple. Most probably you try to use kind of shader that adds top planar mapped moss on rocks. 2ndary map uses maps from uvs not from xz top-planar position (unless we use triplanar, but that's different story). You would need to find where 2ndary map is fatched in UBER and use top planar uvs (position on vertex on xz plane). Then you need to take care about decoding normal correct way (tangent frame is different), then you need to blend 2ndary texture using world normals (placing it only on rock tops)

    The opposite way - adding UBER functionalities to ready made shader (which might be obfuscated code from visual shader creator) might be the way to go as far as yoou can extract it from UBER. Weather effects, diffuse scattering, translucency, etc. This is also not simple task for non-shader coder.

    EDIT: I saw some creative usage of snow (with tweaked color and textures) over rocks to resemble very nice "top-placed" moss. It was posted in this thread some pages back by an user.

    Tom
     
    Last edited: Sep 21, 2018
  6. VP_no1

    VP_no1

    Joined:
    May 12, 2018
    Posts:
    132
    Thank you a lot @tomaszek for your answers and its ok, it is not discouraging - i was expecting sooner or later to have to dive into this part of game dev I didn't explore yet :)

    I noticed there are some detailed explanations in some chapters from here: https://unity3d.com/learn/tutorials/s/graphics
    >> you think its enough to help me with extending the shaders from the KIT with UBER functionalities ? (I know some programming)
    the Global script should work as it will find its functionalities in those modified shaders, right ?
    --
    Also, I have some questions please as I dont know wich path to choose - visual vs coding :
    1. rebuilding the shaders I have in KIT as visual nodes and adding UBER functionalities visual nodes to those shaders can work similar to coding them ? are there any features I cannot have as fast as writing a code shader line ?
    or there would be issues in this visual rebuilding that you think might come ?
    for example: the global UBER script will work with the code of a visual shader editor or you never tried it ?
    2. should I better go to just learning to code as in tutorials above ? (I am not afraid of a learning curve but more of lack of good resources / tutorials)

    thank you!
     
  7. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Hi, both ways can be beneficial. Introducing UBER functionalities in visual shader editor - they are possible in most cases depending on functionality and visual editor you use. Simple texture fetching and combining results with shader outputs is not hard and can be done purely with nodes. Sometimes, because code consits of many equations, it's better to copy part of shader code (i.e. glitter function) and use as custom node with inputs (function inputs) and output (in our case glitter affects spec color and emission in pipeline). Otherwise you'll be quickly lost in jungle of wired nodes which get out of control.
    Global parameters will just work in any shader (made in visual editor) as far as they follow the same variable naming (don't confuse it with property description you see in editor or in Properties{} section of shader code). UBER global weather controller sets variables via Shader.SetGlobal...() calls - it doesn't matter how shader is created. In case of UBER shaders they can work within 2 modes - local and global and there are conditional operators (?:) used in my code to select - an object can have snow controled per material or global - it's reflected in UBER inspector buttons at the bottom of snow/weather sections.

    Introducing external functionalities in UBER isn't hard, but only when you're quite familiar with UBER code and with shader programming generally. Adding yet another tex fetch that modifies for example albedo isn't hard, but operating on set of factors (texture albedo, PBR values, decoding normals in right tangent frame, using custom uvs, blending all together) needs some patience finding right parts in code to change. In the end you need to add properties to material/shader and modify UBER inspector to be able to control new properties from UBER material inspector window.

    In the end - ability to code shaders you'll find that in case of more complex ones writing code is much quicker than draging hundreds of nodes in visual editor. That's how I feel it. Particularily, analysing complex shader in visual editor makes me dizzy:).

    Tom
     
  8. VP_no1

    VP_no1

    Joined:
    May 12, 2018
    Posts:
    132
    I was thinking that I would come in the end to your last phrase too, @tomaszek :)
    Thank you for all the detailed explanations.
    I will begin study shader programming firstly to have a base then study what UBER has extra.
    Can you tell me if I need other resources to go study besides this ? https://unity3d.com/learn/tutorials/s/graphics

    Thank you!
     
  9. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    https://docs.unity3d.com/Manual/ShadersOverview.html is the more precise point to start. Generally you can stick to hlsl tutorials available anywhere in the web.

    Tom
     
  10. VP_no1

    VP_no1

    Joined:
    May 12, 2018
    Posts:
    132
  11. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Shader graph is meant to create your own shaders while UBER is about using ready made ones (UBER ones). I don't really get the idea behind using shader graphs over UBER shaders. They are created in cg/hlsl shader code while shader graph offers "visual way of creating shader code". The opposite way it doesn't work, esp. for complex shaders. I.e. having a complex shader doesn't give you chance to edit it visual way (thru nodes) unless you'd like to see graph 1kmx1km large :). Anyway - it's not possible to edit/tweak UBER features visually. The only way is to tweak its code (which is available along with the package).

    Tom
     
    VP_no1 likes this.
  12. Fine3D

    Fine3D

    Joined:
    Dec 13, 2014
    Posts:
    11
    Hi guys!

    It seems that fog doesn't affect the uber materials (at least in my project). Any idea why?
    I googled for a while without any luck...

    Thanks! fog issue.jpg
     
  13. Fine3D

    Fine3D

    Joined:
    Dec 13, 2014
    Posts:
    11
    Ok, I found this:
    "In deferred you're supposed to used postFX fog. Forward rendered shaders in UBER (transparent) can handle fog, but you need to configure which fog model is used and recompile shaders. The reason I made it like this - it save a ton of shader variants produced (thus RAM, resources, compilation time, etc.). Just select fog model used in your project for forward shaders.

    I realise that transparent shaders doesn't write into depth so post FX fog won't affect them. That's why it might be desirable to use fog baked at shader level in such case."

    I don't really know what to do... sorry... how do you configure a fog model? or select a fog model? what does this refer to exactly? Thanks!
     
  14. lo-94

    lo-94

    Joined:
    Nov 1, 2013
    Posts:
    282
    Hey just curious, I'm using this shader in one of my bigger projects and wanted to know if it supports some sort of highlight/outline functionality? Want to use it for showing what object is currently highlighted and would prefer not having to use one of the more expensive camera effect highlight options available on the asset store
     
  15. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Take a look at UBER/Shaders/UBER_ForwardFogType.cginc and change it to a fog model you need (save the file). Then recompile shaders (use reimport after right clickin shader folder).

    UBER shader itself doesn't provide highlit (outline). You could stick to emission if it's possible (animating/blinking object selected colored the way you need). Depending on target platform it should be possible to use per object outline shader. If you add a material on the renderer list you force Unity to add a pass on the last submesh - so it's unusable for meshes that uses submeshes. Otherwise using outline shader as a last material on the list woulkd do a job w/o necessity of fullscreen solutions.

    Tom
     
  16. JonDadley

    JonDadley

    Joined:
    Sep 2, 2013
    Posts:
    139
    I'm having an issue combining the wetness effect with geometry created by EasyRoads3D. Ripples etc all appear correctly, however the droplets animation is not visible. If apply the same material to another object, the droplets are visible. I've tried changing the scale of the droplets but it makes no difference. Do you have any thoughts what may cause this issue?
     
  17. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Might be that droplets and wetness effects are masked by different channels of mesh vertex colors. You can look at CGINCLUDE section at the beginning of given UBER shader and configure it to you needs.So - take care that vertex colors for mesh created in easy roads has values that don't mask.

    ATB, Tom
     
  18. FairGamesProductions

    FairGamesProductions

    Joined:
    Mar 8, 2014
    Posts:
    81
    Hello everyone.

    I find myself in a pickle. I know almost nothing about shader coding, but I find myself in need of adding a special parameter to the UBER shader. I need the ability to offset the Detail Mask texture without moving the main or secondary Albedo offsets. How would I go about doing this?
    I am using the UBER - Specular Setup/Core variant.
     
  19. FairGamesProductions

    FairGamesProductions

    Joined:
    Mar 8, 2014
    Posts:
    81
    NVM. I figured it out :p
     
  20. Pourya-MDP

    Pourya-MDP

    Joined:
    May 18, 2017
    Posts:
    145
    Hi every one
    I recently installed uber but for some reasones i have weird looking scene
    Can any one please help me?
    Using unity 2017.1.f1
    And uber 1.2g
    Ashampoo_Snap_Sunday, September 30, 2018_12h34m03s_002_.png Ashampoo_Snap_Sunday, September 30, 2018_12h33m37s_001_.png
     
    Last edited: Oct 16, 2018
  21. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Oh, looking crazy odd. First screenshot suggests problem with postFX (full screen weirdness). I include a few cinematic effects from Unity for showcasing purpose, but they are not what UBER shading is about. You can use newest Unity postFXes for this. More interesting is bottom screenshot showing oddly shaded object. Can you ccheck on the freh project in higher Unity version? Simply make a new scene, add an object and put given UBER material (might be from my examples), then tell? What's your platform? Win, DX11, OpenGL?

    Tom
     
  22. Pourya-MDP

    Pourya-MDP

    Joined:
    May 18, 2017
    Posts:
    145
    Hi again tom
    I just tried newer version of unity (2018)and that ugly thing just disappeared
    Just want to say thank you for such a greate asset
    Is there a chance to run it on 2017.4?
    Cause still the same in 2017.4
    Also using dx11 on windows 10
     
    Last edited: Oct 16, 2018
  23. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Installing UBER 1.2g on Unity 2017.4.2f2 gives no problem on my side. What's the Unity version it breaks on your side? Might be related to GPU vendor as well (AMD or nVidia?) as I can effectively check it on my nVidia only. I'm about to buy RX580 (AMD) in next few days just for sake of testing things on AMD GPUs, then I can recheck it.

    Tom
     
  24. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    938
    Hi tomaszek, I'm using uber for rocks that are placed and controlled by vegetation studio. Do you have any plans to add instanced indirect rendering? If I add it to uber will it cause any issues?

    It was a simple addition when i added it to my vegetation shader but just thought I would ask if there are any specific reason it wont work or would not be a good idea for uber. I use the core specular shader in deferred camera mode.

    Thanks,

    Andy
     
  25. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    This is only about passing per instance parameters to shader. Depending on what you need per instance. If you need only to pass object objectToWorld matrix it can be potentially vey easy. Would be only like reading MVP materix basing on instance ID passed. I don't know how vegetation studio defines the steps needed, but I'd encoruage you to just do it ;).

    Tom
     
    AndyNeoman likes this.
  26. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    938
    Great. My shader experience is limited to adding wetness from one shader to another and adding instance indirect to a couple so I just thought I would check. Thanks.
     
  27. toto2003

    toto2003

    Joined:
    Sep 22, 2010
    Posts:
    528
    Hi Tom, i was looking at the glass shader, it already look very nice already for my need, but i stumble upon a maya glass shader tutorial, and it has a very neat effect call transmittance that i can use a color ramp, was wondering if it s technically doable with your shader.
    it start at 06:48

     
  28. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    938
    For some reason following Vegetation Studios instructions doesn't work. It's only adding two Pragmas and an include but it screws up the shader.
     
  29. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    So - making a shader VegetationStudio compliant is just adding 2 pragmas in shader code? Is that all VS documenation says? Show me these pragmas then and I'll think what's missing.

    Tom
    Introducing physically realistic light propagation effect in UBER is not possible. Maya is offline renderer. We can only think about some kind of cheat that looks similarily plausible. It won't work the same way though. I guess introducing color array (Maya's "ramp") and making it inflouencing object color depending on view anglae or view angle against the light (like with translucency) could make a job. Although it's not a part of UBER functionality, it could be done with some effort requiring shader code tweaks (and UBER inspector to manage the color ramp using colors or texture) if you know how to do it.

    Tom
     
    AndyNeoman likes this.
  30. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    938
    HI @tomaszek, yeah, the instructions are really simple although I think depending on the shader you sometimes need them listed multiple times (I.E in the shadows section too). I noticed uber has a few sections, forward/deferred etc and I wonder if i'm putting it in the wrong place. I'm using deferred btw.

    1. #pragma instancing_options procedural:setup
    2. #pragma multi_compile GPU_FRUSTUM_ON __
    3. #include "VS_indirect.cginc"
    These are the settings that need adding to make the shader VS instanced indirect compatible. Thanks for taking the time to help - I really appreciate it and I think a lot of users will as VS is becoming the defacto vegetation renderer. :)

    In case you want the reference page the link is

    https://www.awesometech.no/index.php/guide-adding-instanced-indirect-support-to-shaders/
     
  31. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    I saw the VS documentation. It works with setup function which is used to reassing unity_localToWorld and unity_worldToLocal matrices. For surface shaders it works out of the box, but for other shaders we need to call setup in vertex program ourselves. It relies on computebuffers defined in VS_indirect.cginc and instance id data passed to vertex program. Basically including VS_indirect.cginc in UBER core.cginc and calling setup() in vertex program should redefine matrices to work with instancing, but to check this I need to get VS to test it myself. I'll try to get into contact with VS developer and ask for voucher to check it. Or the way around (VS developer taking UBER license and giving his customers tutorial how to setup it). I'll keep you updated.

    Tom
     
    AndyNeoman likes this.
  32. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    316
    Is UBER compatible with 2018? I saw a review saying it does not work in builds made from 2018, and it's putting me off updating Unity because I love UBER shader.
     
  33. Guideborn

    Guideborn

    Joined:
    Jun 15, 2013
    Posts:
    231
    Incoming silly question: are there any toon outlines in this shader? Wanted to try some things out!
     

    Attached Files:

  34. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Not sure about specific setup, but what I have just done installing UBER1.2g on U2018.2.11f1 and making a build out of included example scene. Works flawlessly for me.

    Short question (there's nothing noobish asking) gives short answer - nope. UBER doesn't have any outline shader variant.

    ATB, Tom
     
    Deckard_89 likes this.
  35. Guideborn

    Guideborn

    Joined:
    Jun 15, 2013
    Posts:
    231
    Ah, shame. Thanks for the speedy answer! I suppose I'll have to live without.
     
  36. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    I had opportunity to check it directly with Vegetation Studio. It's very easy to setup, only single include command missing to get rid of some dependencies with shader compilation.

    Open UBER shader you use, find deferred pass and there's
    Code (csharp):
    1. #include "../Includes/UBER_StandardCore.cginc"
    line. Add these 4 lines, so it looks like this:

    Code (csharp):
    1.  
    2. #pragma instancing_options procedural:setup
    3. #pragma multi_compile GPU_FRUSTUM_ON __
    4. #include "UnityInstancing.cginc"
    5. #include "Assets/AwesomeTechnologies/VegetationStudio/Shaders/VS_indirect.cginc"
    6.              
    7. #include "../Includes/UBER_StandardCore.cginc"
    8.  
    Save and recompile. Works fine for me. For some reason I haven't yet figured out why indirect instanced stuff can't cast shadows. That's also the case for boulders included in VS example scene which use Unity standard shader with instancing. Maybe it depends on VS implementations or Unity limitations here. Haven't analysed that deep.

    Generaly it's also just the way to make Unity standard shader working with indirect instancing (download standard shader from Unity server and modify the same way it's done for UBER shader). We need to add UnityInstancing.cginc first because VS_indirect.cginc refers to some Unity variables and macros that needs to be declared first.

    ATB, Tom
     
    AndyNeoman likes this.
  37. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    938
    That's great, thanks Tom I'll give it a go. I had a problem with shadows when I change my vegetation shader and it turned out i had to add the traumas and includes again in the shadowcaster section of the shader. My vegetation and trees do cast shadows now.
     
  38. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    "traumas", I like this bit. Shader programming is sometimes quite traumatic experience... ;).
     
    Rewaken and AndyNeoman like this.
  39. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    938
    Auto corrects hehe, although you're right, shaders = trauma :)
     
  40. HenryChinaski

    HenryChinaski

    Joined:
    Jul 9, 2013
    Posts:
    108
    My materials with UBER - Specular Shader in Deferred Rendering don't receive any ambient light.
    In Forward, everything works fine.

    Newest UBER Version. Unity 2018.1.1.
    Any idea what's happening?
     
  41. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    What's your lighting setup? Can you provide me with more information? Lightmapping of any kind? Asking because I can't reproduce the problem.
    Installed newest UBER under U2018.2.11f1 and example scene looks just fine when we change camera to deferred. Have you changed deferred lighting shader in graphics settings to UBER variant? It enables UBER specific features like translucency. However - it's unrelated to ambient light issue. It works anyway.

    Tom
     
  42. HenryChinaski

    HenryChinaski

    Joined:
    Jul 9, 2013
    Posts:
    108
    Hi Tom,

    thanks for the quick answer.
    My lighting setup is just a directional light with shadows on at 50%. The problem actually also exists in a newly created scene. No lightmapping.

    I remeber that I had the issue in a project a few weeks ago aswell. I opened that project and seemingly I found a way to fix the problem but I just cannot remeber. I am sure that it is an issue with the uber shader because the textures become bright whenever I switch to the standard shader back.

    I know that this is not very much to work with. Give me a few days and I will try to understand what is happening.
     
  43. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,079
    Can you please add Alpha Cutout for secondary maps too? It can be useful.
    I have a lot of textures of roads that need to place as secondary map but first I need to use Alpha Cutout on them.
     
    Last edited: Nov 24, 2018
  44. HenryChinaski

    HenryChinaski

    Joined:
    Jul 9, 2013
    Posts:
    108
    Okay, so if I create a new scene the problem doesn't occur. If I copy the problematic model + materials in this scene the problem still doesn't occur. If I create a Relief Terrain object in the scene the problem doesn't occur either. But every scene with the problem has a Relief Terrain object in it. When the problem occurred in the other project, there was also a RTP Terrain in the scene. Maybe it has something to do with it? I really don't know what to try anymore.
     
  45. HenryChinaski

    HenryChinaski

    Joined:
    Jul 9, 2013
    Posts:
    108
    Hi Tom,

    I am so sorry for spamming your thread.
    I struggled for so many hours with this and the solution was so incredibly simple: I was really stupid.
    I could have sworn that I was at 1.2g but in reality, I was at 1.2.
    Downloaded the newest package and it fixed the problem instantly.
    Sorry again, this really was a newbie mistake!
     
  46. razzraziel

    razzraziel

    Joined:
    Sep 13, 2018
    Posts:
    396
    Hi, any plans for Black Friday sale?

    Waiting for it to buy. Thanks.
     
  47. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,079
    :rolleyes:
     
  48. Hazneliel

    Hazneliel

    Joined:
    Nov 14, 2013
    Posts:
    305
    Hello
    Did you made this? Do UBER shaders have setup LODs ??
     
  49. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    938
    Hi @tomaszek, I'm getting this error suddenly in my project. Unfortunately I cannot locate what is causing it. Is there a way to rebuild this list? I don't even use Uber for any of my trees so it seems an odd one.

    A tree couldn't be loaded because the prefab is missing.
    UnityEditor.AssetDatabase:LoadAssetAtPath()
    UBER_PostProcessModelForPOM:OnPostprocessAllAssets(String[], String[], String[], String[]) (at Assets/UBER/Editor/UBER_PostProcessModelForPOM.cs:48)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)

    A tree couldn't be loaded because the prefab is missing.
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
     
  50. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    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