Search Unity

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

    Dismiss Notice

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

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

  1. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,997
    Hi, so there's an error with the new Mesh Workflow that prevents it from working without various modules installed. So if you hit this error, just replace these two file's in the MeshWorkflow directory with these versions. A patch has been uploaded but unity will most likely not approve it until monday.

    File 1

    File 2
     
  2. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,055
    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
     
  3. 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.
     
  4. jbooth

    jbooth

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

    niallmc

    Joined:
    Sep 3, 2015
    Posts:
    22
    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:

  6. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,997
    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.
     
  7. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,997


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

    niallmc

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

    nsxdavid

    Joined:
    Apr 6, 2009
    Posts:
    375
    @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?
     
  10. jbooth

    jbooth

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

    nsxdavid

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

    niallmc

    Joined:
    Sep 3, 2015
    Posts:
    22
    @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?
     
  13. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,997
    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.
     
  14. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,997
    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.
     
  15. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    484
    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?
     
  16. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,997
    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.
     
  17. Goldenvale

    Goldenvale

    Joined:
    Feb 26, 2015
    Posts:
    49
    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?
     
  18. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,997
    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..
     
  19. Goldenvale

    Goldenvale

    Joined:
    Feb 26, 2015
    Posts:
    49
  20. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,997
    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?
     
  21. CommunityUS

    CommunityUS

    Joined:
    Sep 2, 2011
    Posts:
    212
    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.
     
  22. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,997
    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.
     
  23. m506

    m506

    Joined:
    Dec 21, 2015
    Posts:
    55
    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
     
  24. jbooth

    jbooth

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

    m506

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

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,997
    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?
     
  27. m506

    m506

    Joined:
    Dec 21, 2015
    Posts:
    55
    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.
     
  28. jbooth

    jbooth

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

    m506

    Joined:
    Dec 21, 2015
    Posts:
    55
    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
     
  30. CommunityUS

    CommunityUS

    Joined:
    Sep 2, 2011
    Posts:
    212
    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?
     
  31. jbooth

    jbooth

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

    CommunityUS

    Joined:
    Sep 2, 2011
    Posts:
    212
    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.
  33. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,997
    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.
  34. boysenberry

    boysenberry

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

    khushildep

    Joined:
    Oct 10, 2013
    Posts:
    7
    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.
     
  36. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,997
    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.
     
  37. khushildep

    khushildep

    Joined:
    Oct 10, 2013
    Posts:
    7
    Thanks Jason!
     
  38. CommunityUS

    CommunityUS

    Joined:
    Sep 2, 2011
    Posts:
    212
    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.
     
  39. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,997
  40. boysenberry

    boysenberry

    Joined:
    Jul 28, 2014
    Posts:
    347
    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?
     
  41. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,997
    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.
  42. RetroFlight

    RetroFlight

    Joined:
    Nov 16, 2019
    Posts:
    25
    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!
     
  43. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,997
    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.
     
  44. RetroFlight

    RetroFlight

    Joined:
    Nov 16, 2019
    Posts:
    25
    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.
     
  45. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,997
    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.
     
  46. RetroFlight

    RetroFlight

    Joined:
    Nov 16, 2019
    Posts:
    25
    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.
     
  47. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,997
    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.
  48. Ruufer

    Ruufer

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

    thanks for all your hard work, seriously
     
  49. razzraziel

    razzraziel

    Joined:
    Sep 13, 2018
    Posts:
    145
    good vid!
     
  50. vanhalen17

    vanhalen17

    Joined:
    Apr 19, 2015
    Posts:
    72
    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
     
unityunity