Search Unity

[FREE]MicroSplat, a modular terrain shading system for Unity Terrains

Discussion in 'Assets and Asset Store' started by jbooth, Aug 9, 2017.

Thread Status:
Not open for further replies.
  1. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    I've been using the Mesh Workflow module beta for awhile and it beautifully solves the problem that I've been grappling with for years: My game has a lot of large objects like cliffs and rocky outcrops, and I've never found a way to make them look good both at distance and close-up. With MicroSplat meshes, I can finally do that. With a four-texture splatmap (with MicroSplat Detail Noise and Dynamic Snow effects), the objects look great up close. And MS Global Texturing lets me overlay an albedo and normal map that fade in with increasing distance, which helps obscure the tiling patterns on the rock (though I could also use other MS anti-tiling features), and more importantly, creates large-scale color and form, so the rocks look fantastic at a distance.

    I'm also using it to dirty up an old cabin (using the same texture arrays as the rocks use), and it adds so much realism. This module has a ton of potential, I've hardly begun scraping the surface.

    Here are some pix (cabin has one wall with MS mesh shader, and one wall without it).

    rocks MS 1.PNG
    rocks MS 3.PNG cabin MS.PNG
     
  2. jaj73

    jaj73

    Joined:
    Sep 26, 2017
    Posts:
    1
    Hi Jason, I'm really enjoying using MicroSplat! One difficulty I'm having; some textures are starting to paint as 'black'. I'm using your terrain hole add-on, it looks like that but not transparent (it has a 'rim' of proper texture around it). Looks fine in Unity but not when loaded on the Oculus Quest. Could you advise? Thanks.
     
  3. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Maybe try clearing your library folder? Sometimes that thing gets corrupted and causes weird issues.
     
  4. niallmc

    niallmc

    Joined:
    Sep 3, 2015
    Posts:
    44
    hey @jbooth
    So I'm seeing some very harsh lines on my terrain. This only occurs when the per texture normal is turned up. It appears as though the normals have a distance based level of detail, and it's causing this. Any idea how I could increase the distance of the normals?
     

    Attached Files:

  5. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    That's mip mapping. If you are seeing a line where they are transitioning, turn on trilinear filtering (in the texture array config) as this blends between the mip levels. If it's normal strength you want, I believe unity has a keser filter option on mip maps that's sharper than the default box filter.
     
  6. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461


    Added non-destructive workflow to the procedural texturing module in 3.0..
     
  7. niallmc

    niallmc

    Joined:
    Sep 3, 2015
    Posts:
    44
    @jbooth That did the trick. Thanks for the help.
     
  8. nsxdavid

    nsxdavid

    Joined:
    Apr 6, 2009
    Posts:
    476
    @jbooth Non-destructive procedural is cool. However, is there a way to pain the texture that is used for procedural (jsut as texture, not as procedural)? Or do you have to have it in there twice?
     
  9. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    It can only exist in the procedural texturing- otherwise you'd have to put it in twice..
     
  10. nsxdavid

    nsxdavid

    Joined:
    Apr 6, 2009
    Posts:
    476
    Does it optimize that somehow top be less ... icky?
     
  11. niallmc

    niallmc

    Joined:
    Sep 3, 2015
    Posts:
    44
    @jbooth just to follow up on the normal issue, turning on trilinear filtering stoppeed the lines. However the normal fade still falls of very quickly, its quite noticeable as the camera pans over the terrain that the parts closer to the camera have stronger normals.

    Any idea how I could reduce the falloff for the normal?
     
  12. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    how so? The alternative is to have a whole splat map for it. That’s basically what Unity does for their holes system, so you end up with a large, uncompressed texture mask per terrain, which is way less efficient than using one channel of splat map and still being able to use the texture in the procedural system.
     
  13. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Turning up Aniso level on the normals will also help. Beyond that you’d have to do something custom for your mip maps; by default Unity box filters them to an average color, so you lose a lot of detail as you go down mip levels, changing both the lighting and specular responses. On smooth materials high frequency normals are effectively simulated by the roughness of the surface and the BDRF used, so you can modify them down the mip chain to balance the loss of normal variation to some degree.
     
  14. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    558
    I updated my project and can't remember or find how to rebuild the texture arrays or whatever I need to do to fix them... Can you point me in the right direction?
     
  15. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    You shouldn't have to rebuild the texture arrays, but to do so just press Update on the Texture Array Config. What you may need to do is regenerate the shader by changing an option in the top section, this will cause it to re-write the shader code with the latest changes.
     
  16. Goldenvale

    Goldenvale

    Joined:
    Feb 26, 2015
    Posts:
    86
    I'm using unity's paint holes with your terrain shader but the lightmapper is treating it as if it's still solid and is not allowing light through. Here's an example where I've set up a room behind a hole:


    Unity's default shader does allow light through. Is this something that can be easily fixed?
     
  17. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    The code is copied directly from Unity's shader for holes- not sure why it would be any different. If you have a small test case I can play around with it and see if I can find a reason why..
     
  18. Goldenvale

    Goldenvale

    Joined:
    Feb 26, 2015
    Posts:
    86
  19. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    So, opinions wanted.

    Tonight I implemented a new optimization idea, and in some cases it makes the shader much, much faster. Basically, using a demo scene with triplanar texturing (3x samples), stochastic sampling (3x samples) and distance resampling on full (1.5x samples), as well as tessellation and terrain blending on, it took my frame rate from 26fps to 56fps.

    What this optimization does is use dynamic branching on the GPU to cull samples in areas where their weight is definitely 0. Using fastest packing, this combination of features would normally do 108 texture array samples per pixel, which is a lot of memory access. With the new feature enabled, the average pixel is likely doing closer to 35 samples per pixel. This will depend on how your terrain is painted, essentially, but in many cases a terrain is only showing 1 or 2 textures on a given pixel and can effectively avoid the work of sampling the additional pixels. This is further helped by height blending, which tends to favor one texture over another when the interpolation contrast is set high.

    The main optimization in MicroSplat prevents sampler counts from exploding by culling the maximum number of texture sets sampled to 4 per pixel (this is why the speed difference between a 16 texture and 4 texture terrain is relatively minor), but this new optimization allows it to go lower on a pixel by pixel basis (really shading block, but close enough). The cost is some extra work on the ALU side, but this is dwarfed by the savings in memory access times.

    So if your using features like triplanar, stochastic sampling, etc, this is pretty much a no brainer. However, if you are running on mobile and not using expensive features, it can actually be slower. It's also both GPU and paint job dependent. So I'm wondering what the default should be- on or off by default?

    My current thinking is to leave it off by default, but if expensive features are enabled put a warning about the option to let people know they should try it?
     
  20. CommunityUS

    CommunityUS

    Joined:
    Sep 2, 2011
    Posts:
    240
    Hi Jason, I will answer above when next I have a sec. I did pop in for a quick question...The microsplat mesh workflow has been tested in HDRP yes? What version we up to these days I noticed an update to all your stuff on the asset store. I am playing in HD unityRelease:2019.2.12 and a in between SRP. I noticed it looks like maybe somewhere between 7.0.0 and the 8.0.0 branch is headed to properly rename current "tangentToWorld" to proper "worldToTangent" same with the BuildWordToTangent and then the MicroSplat other fix was "AttributesMesh ApplyMeshModification(AttributesMesh input)" instead of two parameter function "AttributesMesh ApplyMeshModification(AttributesMesh input, float3 timeParameters)"

    ref: https://github.com/Unity-Technologi...mmit/cede654785c9497b71a9c229d4f0e1d21440402f

    Anyways the question I actually have is how long should we expect "microsplat mesh workflow" to be on beta sale. Still a tad broke from Holidays - but want to pickup before price bump and hopefully help test too.
     
  21. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Unity 2019.3 and its version of the HDRP are the current minimum versions for HDRP. I'll remove the beta label when I'm confident any edge cases I might have missed are found, and yes, it's been tested with HDRP as well.
     
  22. m506

    m506

    Joined:
    Dec 21, 2015
    Posts:
    93
    Hi, perhaps its just me but after upgrading to the latest version today I am getting these errors:

    Assets\MicroSplat\Core\Scripts\Editor\UnityLDRenderLoopAdapter.cs(11,44): error CS0535: 'UnityLDRenderLoopAdapter' does not implement interface member 'IRenderLoopAdapter.UseReplaceMethods()'
    Assets\MicroSplat\Core\Scripts\Editor\UnityLDRenderLoopAdapter.cs(11,44): error CS0535: 'UnityLDRenderLoopAdapter' does not implement interface member 'IRenderLoopAdapter.WriteProperties(string[], StringBuilder, bool)'
    Assets\MicroSplat\Core\Scripts\Editor\UnityLDRenderLoopAdapter.cs(11,44): error CS0535: 'UnityLDRenderLoopAdapter' does not implement interface member 'IRenderLoopAdapter.WritePerMaterialCBuffer(string[], StringBuilder, bool)'

    If I add an empty implementation for the functions it works fine, but I suppose this needs to be corrected somehow?

    Thanks
     
  23. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Did you upgrade to the latest LWRP module as well? Looks like you didn't.
     
  24. m506

    m506

    Joined:
    Dec 21, 2015
    Posts:
    93
    hi, I didn't buy this module as i don't really need it. is there any workarounds?
     
  25. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Then why do you have its code in the core module? That doesn't ship with core - you can delete the file, but how did it get there?
     
  26. m506

    m506

    Joined:
    Dec 21, 2015
    Posts:
    93
    i really dont know. All i did was to update all my modules today. I never used the universal pipeline.
    The modules I have:
    - core
    - terrain blending
    - snow
    - lava
    - anti-tile
    - triplanar
    - tesselation
    - wind
    - advanced details

    If its a big problem debugging it dont worry as I added empty function implementations. just wanted to report the error.
     
  27. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    You can just delete the cs file all together. Were you upgrading from a very old version? Like from a year ago or so?
     
  28. m506

    m506

    Joined:
    Dec 21, 2015
    Posts:
    93
    no problem will delete it. yes I usually only update modules when I have to upgrade unity. so last time i updated microsplat was when 2019.2 was released
     
  29. CommunityUS

    CommunityUS

    Joined:
    Sep 2, 2011
    Posts:
    240
    Thank you for the reply. I just went and looked at it again. Is it discounted while in beta or did I just think that for some reason lol. :) If it is discounted do you have an idea what the price will raise to once out of beta?
     
  30. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    It's not necessarily discounted during beta- but I do reserve the right to change pricing at any time.
     
    CommunityUS likes this.
  31. CommunityUS

    CommunityUS

    Joined:
    Sep 2, 2011
    Posts:
    240
    Leaving off by default fine are you able to put in a scene / sample showing the speed diff so we can sample the power with limited messing about.
     
    boysenberry likes this.
  32. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I mean it's pretty much one drop down control, so not hard to see what it does for your scene. I can't really include demo's if they involve more than the module they ship in, because otherwise the code isn't there to compile.
     
    boysenberry likes this.
  33. boysenberry

    boysenberry

    Joined:
    Jul 28, 2014
    Posts:
    365
    Off by default with a warning sounds solid to me.
     
  34. khushildep

    khushildep

    Joined:
    Oct 10, 2013
    Posts:
    13
    Hi there

    Trying to use this in latest 2018 LTS but I'm getting a load of errors in import:

    "Binary to YAML conversion: type UInt16 is unsupported"

    What am I doing wrong do you think? Nothing else imported - standard project.
     
  35. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Nothing, Unity's been throwing these for a while, and it appears to be related to using forced ascii serialization. Doesn't seem to cause any issues, and there's no uint16's used in MicroSplat, so not much I can find to do about it.
     
  36. khushildep

    khushildep

    Joined:
    Oct 10, 2013
    Posts:
    13
    Thanks Jason!
     
  37. CommunityUS

    CommunityUS

    Joined:
    Sep 2, 2011
    Posts:
    240
    A video of it may also be a good idea. I am now wondering if there are other neat features and performance tips I've missed. Perhaps instead of a video per feature. Once or twice per year 2x vids are made - one using everything in your packs to create the best looking scene. (maybe hold a contest if don't want to source the art) and a other video about performance and framerate with still looking good a care but not the focus.
     
  38. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
  39. boysenberry

    boysenberry

    Joined:
    Jul 28, 2014
    Posts:
    365
    Great video! Thanks for the insight. Your video and insights are inspiring. I need to hurry up and finish my menus system so I can get to terrain creation again and try this out. Do you know when the new feature will be released yet? It seemed in the video you had a bit of testing left before this is released, right?
     
  40. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Likely next week sometime. It's pretty well tested at this point, but I want to do some testing on windows since the compiler can be picky about different things there.
     
    boysenberry likes this.
  41. RetroFlight

    RetroFlight

    Joined:
    Nov 16, 2019
    Posts:
    41
    Hey I love the shader but am having performance issues on an Oculus Quest flight sim. I am trying to run Microsplat with the anti tiling module. It looks great in editor but on the Quest it srops from the desired 72fps to 25fps. If I fly high it speeds up to 60fps.

    I tried dropping the textures from 2048 to 128 (super tiny) and not much change.

    I can run 8 vanilla unity textures no problem.

    Do you have an "optimization list" that can be done for max performance?

    All I want at minimum is 4 textures plus a secondary (antitiling) normal. In the editor this really is impressive. Id love more but obviously Im making due with the limited android hardware.

    Thanks!
     
  42. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    There's an optimization guide in the documents folder which will key you in on things to try. Also, on quest, I've heard texture format is better as ATSC instead of the default for android which is ETC.
     
    jaydnwlsn likes this.
  43. RetroFlight

    RetroFlight

    Joined:
    Nov 16, 2019
    Posts:
    41
    Thanks very much for the quick reply. I went through the optimizations (except compressing splats) and still can't get much above 50fps. I turned off anti tiling all together and it didnt change. I checked debug and there are 8/1 samples. Even going down to 128 res textures didnt help.

    I suspect some settings are wrong. Or maybe Unity is not updating settings properly. I can run vanilla unity terrain with specular, normals, at 2048 with no issue.

    I'll try the new optimized version of MicroSplat when you release it and see if I can do any better on frames.
     
  44. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Unlikely that's going to help because branching is unlikely to be a good option on low end mobile, and you don't seem like you are memory bound right now as changing texture res makes no difference. Did you try ATSC compression instead of ETC2? That's recommended in the quest docs. You could also open up the snapdragon GPU profiler and see what it says is holding it up, that would give you clear answers.
     
  45. RetroFlight

    RetroFlight

    Joined:
    Nov 16, 2019
    Posts:
    41
    Thanks again for the reply. I did try ATSC and it seemed to help a bit. Once I get to the snapdragon profiler i will try again and post here if I have any luck.
     
  46. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    MicroSplat 3.1 submitted
    • Branch Samples optimization, which can double the speed of the shader in cases where its memory bound, is now available. New debug output modes to visualize savings are available.
    • Distance Resampling in Full mode now has normal strength slider
    • Option to disable alpha hole on terrain blended objects
    • Option to HSL shift based on terrain slope added to Procedural Module
    • Fixed sample counter in distance resampling mode to more accurately compute cost
    • Splat importer handles cases where number of splat maps is greater than what’s on the terrain
    • Fix to edges on Procedural Texturing combined mode
    • Per Texture Property GUI for Triplanar Rotation, HSL curves now only show first line when disabled to save GUI space
    • Fix to compile error in Vegetation Studio shadow map feature
     
    boysenberry likes this.
  47. Ruufer

    Ruufer

    Joined:
    Jul 28, 2016
    Posts:
    17
    ^^^ excited

    thanks for all your hard work, seriously
     
  48. razzraziel

    razzraziel

    Joined:
    Sep 13, 2018
    Posts:
    396
    good vid!
     
  49. Vad3rInHale

    Vad3rInHale

    Joined:
    Apr 19, 2015
    Posts:
    96
    Hello,

    I'm looking into the same thing as @RetroFlight Running Microsplat 3.1 w/ Unity 2019.3 on Oculus Quest, with ASTC compression and 7 2K textures. I went ahead and downloaded the Snapdragon Profiler to see what was up, and I got some data from my scene, I just don't know how to interpret it...

    Works fine in editor, but when I build, I am getting ~50 fps (and my textures are black/dark?)

    upload_2020-2-6_15-17-43.png
     
  50. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Black or dark? Black sounds like some kind of texture compatibility issue. I recently put code in that checks supported texture types and falls back through all possible types because some android users were reporting ETC2 not being compatible - which is odd because I'm pretty sure it's required in the GL3.0+ spec, but who knows, maybe they were on Vulkan where the requirements might be different.

    I'll see if I can get my quest up and running again and repro any of this..
     
Thread Status:
Not open for further replies.