Search Unity

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

UBER - Standard Shader Ultra

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

  1. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,805
    Located the issue. For some reason Dx9 HLSL compiler can't handle uniform variable branching (possibly with "else" clause only). So, open UBER_StandardCore.cginc and find such lines:

    Code (csharp):
    1. if (_DiffuseScatter) {
    and replace with this:

    Code (csharp):
    1. if (_DiffuseScatter>0) {
    I'll use this fix for upcoming UBER 1.03 too

    ATB, Tom
     
  2. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,805
    I'm not sure if we refer to the same bug. On my side water is indeed broken in forward lighting for additional light when not using additional features (like POM). It doesn't disappear though. Rather behaves very strange when flowing. Anyway I found the bug and fixed this for next update 1.03. Hopefully it will solve your problem.

    Tom
     
    Last edited: Aug 17, 2015
  3. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,030
    Bought this, seems pretty good so far! But I am seeing different results in editor and play mode, looks fine in editor when I hit play it looks all distorted and crazy like a mountain range, im trying to use with UFPS, whose main camera i have set to HDR.
     
  4. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,805
    You need to specify exact setup you're using. Unity version, platform, UBER version (current 1.02 I assume). Then - forward or deferred lighting ? Gamme or linear. Which shader exactly makes trobles. Does example scene works with UBER installed on fresh project?

    Screenshots please - "mountain range" is too wide for guessing the problem :).

    Tom
     
  5. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    921
    Can I use UBER and SSAO PRO?
     
  6. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,805
    Tested UBER with SSAO Pro a while ago in deferred. Worked fine, but you need to consider that POM extruded (and probably tessellation) features on surface can be only managed properly in deferred. Simply in forward Unity uses replacement shader to get depth buffer, but I could be wrong here and if only Unity uses shadow caster pass from UBER shader then POM might work fine also in forward.

    Tom
     
  7. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    921
    Great, I'll check it.
    Thanks!
     
  8. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,805
    I've just submitted UBER 1.03 to AssetStore. Should appear life in a few days. Meanwhile you can use updater:

    http://www.stobierski.pl/unity/UBERUpdate.php

    There is also updated documentation that reflects main changes:

    http://www.stobierski.pl/unity/UBER.html

    Brief changelog is as follows (EDITED):

    1. 2 sided variants added
    2. improved translucency with optional NdotL factor
    3. reduced wobbling of tessellation disaplcement shaders (cancelling amount of displacement with distance, not only tessellation amount)
    4. tessellation displacement amount can be now controlled via vetrex color (look at selected tessellation shader header between CGINCLUDE and ENDCG block for more info)
    5. info in pdf docs about enabling GGX specularity model instead of default Blinn-Phong (GGX is more expensive but hi-end engines uses this, example for Unity is Alloy)
    6. fixed issue with DX9 with dynamic snow
    7. fixed issue with additive lights and water

    With 2 sided variants and improved translucency it's possible now to get nice 2 sided vegetation or easy fabrics.

    Enjoy, Tom
     
    Last edited: Aug 18, 2015
    kenshin likes this.
  9. ForceX

    ForceX

    Joined:
    Jun 22, 2010
    Posts:
    1,102
    Does the two sided respect light direction / shadows for each side? Because one side is missing normals does it use a inverse normal value from the side that does have normals?
     
  10. DrewMedina

    DrewMedina

    Joined:
    Apr 1, 2013
    Posts:
    418
    Excellent, thanks Tom! How much of performance difference is there bewtween single and double sided?

    Thank you for using an updater, its maddening waiting for updates to appear on the store. VERY cool of you, thanks.
     
  11. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,805
    Normals are supposed to be correct (as far as I tested they are). Would make no sense to have 2 sided variant with screwed normals...

    EDIT: For shadows - they work nice with translucency so that we can see shadows that are casted on the other side of an 2 sided object (like we're inside a 2 sided tent model and we can see shadows of trees that are casted outside the tent).

    2 sided has no impact for objects that are supposed to be 2 sided (like fabrics, vegetation leaves). It takes advantage of VFACE semantics which makes it possible to render objects without neccessity of firing additional passes (doubling draw calls) like some other solutions do. 2sided can decrease mesh side (only half of vertices their inverted normals and polys needed).

    Of course - dont use 2 sided for objects like spheres - you're not supposed to see interior in most cases and the unculled interior would increase shading cost (occluded internal surface rendered unnecesarilly).

    Tom

    P.S. I've updated 1.03 changelog above
     
    Last edited: Aug 18, 2015
    kenshin likes this.
  12. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    921
    Any test with "Super Sampling SSAA" asset?
     
  13. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,805
    No. The package is rendering in higher resolution and then grabs the render texture for downsizing as far as I know. So it doesn't matter which shader is used. The only question is how it handles the camera in deferred (UBER uses command buffers for translucency).

    Tom
     
    kenshin likes this.
  14. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,315
    Hi Tom, I'm using Uber and RTP together in this scene, and I'm not sure which is the culprit. I dragged the "IceBlock" prefab from the Uber samples into my scene, the one with a point light inside a translucent ice block. I'm in Deferred mode. It seems when the IceBlock is within the camera frustrum, I get large translucent shadows all over the terrain, but as soon as it leaves the frustrum, the shadows disappear. This doesn't seem to happen in Forward rendering. Is there anything I can do to fix this? Example screens below; first is IceBlock just off screen, second is turning a bit to the left with the IceBlock on screen; note the change in shadows on the ground.

    Capture.JPG Capture2.JPG

    I should add that these shadows don't seem to be coming from any particular light source. The point light inside the ice block is set to No Shadows, and the shadows are all coming from a weird direction that doesn't match up with where the directional light and actual shadows are. In Forward rendering, these shadows don't appear at all.
     
    Last edited: Aug 19, 2015
  15. weasel47

    weasel47

    Joined:
    Mar 9, 2014
    Posts:
    26
    I haven't been able to update successfully. I downloaded the four parts (.zip, .z01, .z02, .z03) and Windows recognized the .zip as a valid zip file but couldn't extract the contents. I was able to open the unity package without extracting, but it appeared to only contain the readme files when I did that.
    I tried to extract the zip using 7zip and it said it's not valid. I tried combining the files using 7zip and then 7zip and Windows both told me the resulting file was not valid. I tried combining the files from the command prompt, and got the same result.

    Has anyone been able to update?
     
  16. Plutoman

    Plutoman

    Joined:
    May 24, 2013
    Posts:
    257
    I did, maybe you should try re-downloading? It's just a split zip - I used 7-zip to extract from the first object once all were downloaded to the same folder.

    I did have issues importing, but that's because Unity was being dumb with meta files and I had to reset and restart Unity for it to actually clear out the GUID's from the prior deleted files, the import kept choosing new GUID's and thus breaking all the examples, materials, connections, etc.
     
  17. weasel47

    weasel47

    Joined:
    Mar 9, 2014
    Posts:
    26
    I just re-downloaded all four parts, told 7zip to unzip UBER_1_03.ZIP and it said:
    Can not open file '[blah blah]' as archive

    (It didn't actually say [blah blah], that was the full path of the file)

    EDIT: Update: I used winrar and extracted and it extracted the full unitypackage. It turns out Windows had done that the first time, probably! The problem was, I hadn't deleted the existing asset from my project.
     
    Last edited: Aug 20, 2015
  18. ChezDoodles

    ChezDoodles

    Joined:
    Sep 13, 2007
    Posts:
    94
    About Global Controllers...

    Would it be possible to add a global controller for Emission...?
    Possibly a checkbox if you want a specific material to be controlled by the global controller.

    USECASE:
    In a simulation game, all buildings and objects have emissive textures that I turn on during the night cycle and off during the day. These represent window lights, headlights, rear lights, street lights, etc. Having single point to turn these on/off would be a GREAT optimization.
     
  19. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,805
    I might consider it for future update. Thanks for sharing.

    Tom
     
  20. ChezDoodles

    ChezDoodles

    Joined:
    Sep 13, 2007
    Posts:
    94
    Thanks!
    Another useful extension for the dynamic snow:

    For a full year cycle, the "SLOPE DAMP" and the "DAMP BY HEIGHT" should also be updated as global parameters. During the winter, even low lands can have snow - but during summer, only the highest mountains would have snow.

    ...and to go even further...during summer, I would really like to be able to change the texture to handle sand in the dessert during summer - which would need access to COLOR, FROST and BUMP MAP. Actually - the entire "DYNAMIC SNOW" block should be controlled by the global controller instead of PER material.

    (I have previously modified the Standard Shader for all these options (I also packaged the textures differently) - but got tired of repeatedly updating the shaders for every new version of Unity.)
     
    Last edited: Aug 20, 2015
  21. ChezDoodles

    ChezDoodles

    Joined:
    Sep 13, 2007
    Posts:
    94
    ...and one final thought...

    Would love to have a map for how snow builds up on a model. It would resemble something of an inverse AO map - or what you get from SSAA effects, since snow would often build up more in corners etc (but there are also differences - like areas underneath other objects which would often be dark in the AO map, but would also have low "snow" values, since less snow would reach those areas - so a separate map would be preferable to just using inverted AO map - but even just using the AO map would be a great start.
     
  22. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,805
    The quickfix for you (as I see you're coding wise developer). If you really like to controll all snow globally you might tweak UBER to your needs then. In material inspector script find places where specific parameter is taken from material (FindProperty() function) then comment out it's controller in inspector in snow section (to not get null references for sliders etc.). Then in shader comment out parameters that you'd like to controll globally. Unity works like this - if parameter is not present in material property block it still can be used in shader but should be set via Shader.SetGlobalFloat() or similar function like my global controller does. It wond't be that difficult then to tailor UBER system to your needs. The reason I've introduced both local/global parameters was that sometimes people would like to have snow independently (like in frost caverns, on high mountains, etc.) from global weather controller.

    For snow coverage - could you bake AO in vertex channel via any tool (available on assetstore). Then use it as snow mask (it's configurable in shader header).

    Tom
     
  23. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,805
    It might have something to do with RTP vs UBER deferred lighting. Do you use UBER's deferred lighting shader provided, RTP's one, or ? Anyway - I can't reproduce it with test scene with UBER installed alone. Shadows stay intact here. Could you make a bit more tests in which conditions it happens ? Maybe some postFX is culprit ?

    Tom
     
  24. ChezDoodles

    ChezDoodles

    Joined:
    Sep 13, 2007
    Posts:
    94
    Excellent suggestion. That's how I controlled such parameters in my old shaders.


    Not really a good idea, since it would require remodelling of hundreds of models. I try to save on the polycount and bake as much details into maps as possible - which means that for instance a roof can be just a few polys (with structure baked in normal, AO and height maps). Which again means there are not enough vertices to bake something that resembles an AO map into the vertices.

    However, a quick fix would be to just invert the AO and apply that. I can of course do all of these myself, but I thought I should check with you first and maybe save me the trouble :) But if you don't think this has universal interest, I will get my hands dirty - no problem - just wanted to check first...
     
  25. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,805
    You could look into UBER_StandardCore.cginc and look for occ.x usage which stores occlusion data then using it for snow coverage dampler in code (tip: _snow_val if variable that controls coverage level)

    Tom
     
  26. Yasei_no_otoko

    Yasei_no_otoko

    Joined:
    Nov 25, 2013
    Posts:
    13
    I was amazing for this asset.
    It can be use for OpenGLES 2.0 or 3.0?
    I want to use this for Oculus Rift and Gear VR apps.
     
  27. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,805
    GLES3.0 gives chance to work with this reasonably well (w/o fancy POM because they are rather desktop/console oriented - too expensive for mobile). GLES2 - we'll miss resources (too many textures needed and texture interpolator in shader).

    UBER should work fine with integrated VR since 5.1.2p3 ASAIK (don't have stereoscopic hardware myself though).

    Tom
     
  28. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,315
    I'm using UBER's deferred shader replacement, and I tried turning off all post effects (I suspected SSAO) but it made no difference. I'll see if I can narrow it down. I'm pretty sure it's some conflict between RTP and UBER because I only get those weird shadows on the terrain, not on regular meshes. It looks almost like it's rendering a shadow pass for the translucent object but then pasting copies of the shadow all over the place on the terrain where it doesn't belong.
     
  29. MS80

    MS80

    Joined:
    Mar 7, 2014
    Posts:
    335
    Just wanted to confirm that UBER works great with integrated VR in Unity 5.1.2p3 (tested with DK2)! With older unity 5.1 versions pom shaders looked flat. Now the UBER POM shaders just look super real, you can't imagine how perfectly these shaders work in VR!

    I feel sorry for you Tom, you really should see your UBER POMs in VR! :)
     
    tomaszek likes this.
  30. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,315
    I've narrowed it down. It happens when there is an RTP terrain, a point light, and a mesh using any of the core UBER shaders with Transparent rendering mode selected. I think it's related to POM. I have POM and 8 layers in one pass selected in RTP.

    The POM shadows vary greatly depending on whether or not the transparent object is in the viewing frustrum and where the point light is relative to it. The point light is set to "No Shadows" and the shadows that POM is drawing are not what the shadows would look like if it was from the point light. POM looks correct if the object is switched to Opaque or disabled, but when it's transparent, the POM shadows are messed up, kind of random looking. Is there a chance that the Transparent UBER rendering from a point light and the RTP POM shading from directional light are writing to the same frame buffer or something?
     
    Last edited: Aug 21, 2015
  31. eco_bach

    eco_bach

    Joined:
    Jul 8, 2013
    Posts:
    1,415
    Great set of shaders. Just wanted to mention the demo scene seems to break using Deferred Linear.

    Can't get the candle demo to look as good as in your preview.

    Also, does translucency only work under DX11? have trouble seeing the effect, at least in the statue.
    Screen Shot 2015-08-20 at 8.37.59 PM.png
     
  32. QuantumTheory

    QuantumTheory

    Joined:
    Jan 19, 2012
    Posts:
    1,072
    Dropped by to say excellent work as always! Best of luck to you and I hope to see you at Unite!
     
  33. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,805
    Exactly. I've realised that RTP uses surface shader with limited control over what's written into actual gbuffer channel (will be introduced in U5.2 though). So as far as I realise I write POM self-shadow info into color alpha which is then transferred into gbuffer diffuse alpha. This channel is supposed to be used by Unity for occlusion, but currently (5.1) is not as far as tested. So there should be no interference.

    Does it help to turn off POM self-shadow in LOD manager ? I got it working very weird way in one case (tested with Mac user though). If this is related to POM self-shadows and you can fix it disabling it I think we'll just wait till U5.2 and I will submit RTP for U5.2 that will be using the same gbuffer channel as UBER thus making this consistent.

    Tom
     
  34. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,805
    Thank you. If you refering to Unite Boston - sorry, I'm European based publisher and going to Boston is a bit too pricy and messy for me :). Of course - talking to one of the most dedicated and professional artwork creators in AssetStore like you would be a honor, but I can't go there. I was in Amsterdam though because Unity invited me to present my product at one of AssetStore publisher kiosk.

    Tom
     
  35. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,805
    Checked on DX9/DX11 and example scene works. Do you remember about using dedicated deferred light shader ?

    Internal-DeferredShading_UBER.shader

    Refer to my pdf docs. Also - in deferred translucency works only when camera renders in HDR (check MSAA and turn it off in quality settings).

    I'm on U5.1.1f1, but on U5.1.2f1 it also works for me.

    Tom
     
  36. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,315
    I'm actually using the 5.2 RC currently and it still happens there. Do you need to change something in the shader to make it work with 5.2? If you have a change you need tested in 5.2 I would be happy to try it out.
     
  37. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,030
    OK :) Im using unity 5.1.2, Windows7, Uber 1.02, forward rendering, gamma colorspace, all of the materials you get cause troubles for me, screenshots:

    Simple curvature POM
    POM with depth writing
     
  38. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,805
    You should adjust UV ratios or bake your mesh as described in my docs. I see distortions that come from it (at least on the 2nd screenshot I'm sure they are). For example if you get a Unity plane and set ratios to something other than 10,10 you will get wrong z-writing. If ratios would be skewed (like 5,10) distortions like on the 2nd screenshot will appear, esp. when viewing close to the surface parallel. Simple curvature POM also needs mesh preparation. For obvious meshes like Unity's cylinder it's not necessary becuse we could set ratios and curvature manually (like on my example scene column).

    Tom

    P.S. UBER1.03 with a few fixes and improvements is available.
     
  39. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,805
    UBER is not yet supported for U5.2. I'll submit update for new Unity version when it's out. Then I can check it against RTP, too. You can remind me then, please (UBER vs. RTP).

    Tom
     
  40. Neo-Gamefactory

    Neo-Gamefactory

    Joined:
    Oct 18, 2012
    Posts:
    145
    With substance support?
     
  41. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,805
    Yes, it has.
     
    Neo-Gamefactory likes this.
  42. adamlukegoodwin

    adamlukegoodwin

    Joined:
    May 10, 2015
    Posts:
    15
    Having a bit of trouble here. The same thing has happened twice on two test scenes.

    I am trying to use your tessellation shader in ~ UBER specular setup / Tessellation / core.

    It happens when I have been using it for a while, it suddenly decides that it is a Parallax shader and I can't get the Tessellation options back ~ See the screenshot attached. Note that is has no option to switch to Tesselation in the parallax options.

    EDIT #1
    Just deleted UBER from my project and reinstalled it and it still doesn't offer Tessellation.
    I think it happened after saving, closing unity and opening the project ~ But am not 100% sure when it happened. I will start a new project with UBER and let you know.

    EDIT #2
    Found the problem. Adventure Creator. After recreating the same project conditions, it was fine. I added Adventure creator, but didn't touch any controls etc.. Tessellation was available. As soon as I closed and reopened the project, No more Tessellation. I guess this isn't your problem as your Asset runs great on its own. But do you have any suggestions that might help fix this? Please note, I am no programmer - hence I am using adventure creator :p I really want to use UBER on my game >__<

    EDIT #3
    Just tried Adventure Creator with the free DX11 shader on the asset store, and it disables the shader. Sorry ~ looks like this is Adventure creator's problem. I will go bug them and ask over there too ;)

    I am using Unity 5.1.2 and your latest UBER that I updated today.
    uber.jpg
     
    Last edited: Aug 22, 2015
  43. Neo-Gamefactory

    Neo-Gamefactory

    Joined:
    Oct 18, 2012
    Posts:
    145
    Great :) I love your Assets :)
     
  44. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,015
    there will be any skin shader?
     
    Neo-Gamefactory likes this.
  45. Neo-Gamefactory

    Neo-Gamefactory

    Joined:
    Oct 18, 2012
    Posts:
    145
    Your Shader's are great, i hope i can find some Shader from you for Clothes, fabric or wool or something like this ;)

    With shaders, i'm a noob :(
     
    kenshin likes this.
  46. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    921
    +1!!! :)
     
    Neo-Gamefactory likes this.
  47. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,805
    New to UBER 1.03 you can try 2sided version. Although it doesn't have separate lighting model for fabric, with well tweaked diffuse scattering for material you can achieve quite convincing look I believe. Of course you need good maps for this. You could try substances available maybe like - https://www.assetstore.unity3d.com/en/#!/content/1604 If it doesn't have separate smoothness channel you can simply use specular data from pre-PBR era as smoothness with low specularity (use darker specular color tint) which often works fine. Tweaking smoothness with gloss min/max helps as well.

    Additionally large wool groove patterns should work nice with POM I believe.

    Tom
     
    Neo-Gamefactory and kenshin like this.
  48. super-cypher

    super-cypher

    Joined:
    May 10, 2014
    Posts:
    113
    Hi

    Any news on when/if you will be adding a mobile version? And if i buy this package now will the mobile be included in it (not a separate package)?

    thanks
     
  49. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,805
    It will be separate package I believe, because mobile treatment means a lot different approach on resources (we need to save then as possible). GLES2 will be the minimum and with a lot of simplifications. GLES3 preferred. Anyway - I believe that if you'd try to remove #pragma exclude_renderers gles from shader code it will actually wok on high-end mobile hardware without problems (core functionality with no expensive features like POM with z-write).

    Sorry, no schedule on when could you expect mobile. I've got queued work for my packages that ned to be doen and I can't predict the time it will take now.

    Tom
     
    Tiny-Tree and zyzyx like this.
  50. Sir-Spunky

    Sir-Spunky

    Joined:
    Apr 7, 2013
    Posts:
    132
    This looks amazing. Exactly what I was missing. Unity should hire you.

    A quick question: Is there LOD support for POM shaders? POM looks amazing and seems very flexible, but I'd like to only use it when close to objects to save performance.

    Also, if this is the case, can I tweak the LOD distance myself?

    Thanks.
     
unityunity