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. AlienFreak

    AlienFreak

    Joined:
    Jul 2, 2012
    Posts:
    40
    I've got a bunch of your assets and I'd like to use them for an action based puzzle game. The terrain is a composition of unit cube meshes on a 3D unit grid space instanced at load time.

    For a cube mesh based terrain (see game here) where I want the player, a sphere, to do realtime tracks in snow, sand, grass using your tools is this even feasible with any combo of your tools for this type of terrain on mobile? (Trax with Mesh Terrain? Trax with Mesh Workflow? MegaSplat? Other setup?)

    I'm a 30 year game dev like you so just give it to me straight if this is even appropriate and be as technical as you like. You've got killer tools and I'm dying to use them.
     
  2. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yeah, you could use the mesh workflow and when generating your meshes write the data for texturing into the vertex data of each cube. The data is packed, such that color.r has the 8 bit weights for the first 4 textures in it, next in color.g, etc. The painting code will show you how this is done. Trax (and most other things) will just work over it.

    The mesh workflow expects a component on every mesh- but in your case you likely want to skip that and do what that component does to setup the material, then just apply it to every mesh you generate. Essentially what the component does is make sure some data is generated and set on a material, then manage unique instancing for overrides (ie: This one has a different global map than that one does, etc). Your case is simpler, and likely only needs a single material, so managing that yourself would be more efficient.
     
  3. m506

    m506

    Joined:
    Dec 21, 2015
    Posts:
    93
    Hi jbooth,

    I just wanted to let you know your library is being extensively used in our upcoming game "Ilum".

    We just released our gameplay trailer so you can watch if you want. The game takes place in ancient Babylon and uses several Microsplat modules such as anti-tiling, tessellation and streams.

    Please check the video below and the official Unity thread for more information:
    https://forum.unity.com/threads/ilum-gameplay-reveal-trailer.1167101/



    All the best and thank you for this amazing library!
    Marco Marques
     
  4. kypronite

    kypronite

    Joined:
    Apr 15, 2013
    Posts:
    21
    For Microsplat Terrain blending, what happened if I have rocks with mutiple LOD ...etc 3 LOD(LOD0, LOD1 ,LOD2).

    Would the performance cost increase with each microsplat terrain blending script apply with each added LOD.

    I'm planning to use hundreds of rock meshes in my terrain.

    thanks.
     
  5. CrazyCdr

    CrazyCdr

    Joined:
    Nov 20, 2014
    Posts:
    4
    Hi Jason, i am seriously considering using microsplats HDRP for my current project. I am getting only half-satisfactory FPS results on terrians generated in Gaia pro. How much speed will I be gaining with microsplats over the HDRP standard unity terrain shader on a bare terrain with 1024m side and 8 textures?
     
  6. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    GPU performance would be the same, though I'm betting you're overdoing it on LODs, people usually create too many and hurt performance with them. There would be some script overhead on startup though, but not per frame.

    Impossible to say without trying - completely depends on where you are bottlenecked.
     
    kypronite likes this.
  7. CrazyCdr

    CrazyCdr

    Joined:
    Nov 20, 2014
    Posts:
    4
    Hi Jason, I installed the free Microsplat into my Gaia Pro project, bought and installed the Microsplat HDRP 2020 and converted my terrain. No errors, everything is green. However, now I´m getting much less FPS then prior to installation of MST. What did I do wrong in the process? Thanks! Marek
     
  8. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Read the optimization guide - no idea what you had set on your previous terrain vs. this one..
     
  9. gtzpower

    gtzpower

    Joined:
    Jan 23, 2011
    Posts:
    318
    Hey Jason, we are noticing seams in between neighboring terrains when using tessellation. The seams go away when displacement is set to 0, and they grow larger as displacement increases. Do you have any suggestions for eliminating these?
     
  10. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Is it possible Unity is generating slightly different normals for the vertices on each side? That would push them apart.
     
  11. gtzpower

    gtzpower

    Joined:
    Jan 23, 2011
    Posts:
    318
    I am not sure how to verify that on a Unity terrain. Only thing I could find when googling how to work with terrain normals was that calling "Flush" on the terrain will recalculate normals. So I tried that, even in an Update() script on all terrains just to be sure that it was running, but it did nothing.

    Something I did notice was that the issue appears to occur only where textures are blending. If I paint the area fully with the large rock texture, the seam will go away in that area but appear on the edge where the texture blends into the gravel.
     
  12. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    That implies that Unity isn't seaming the splat maps when painting across the border. In other words, one terrain is like 0.7, 0.3 and the next is 0.69, 0.31 - visually unnoticeable, but different enough to affect the tessellation. Not sure if any of the "texture stitching" scripts on the asset store would fix that, but quite possibly.
     
    gtzpower likes this.
  13. gtzpower

    gtzpower

    Joined:
    Jan 23, 2011
    Posts:
    318
    Thanks again for you help Jason. This makes sense. I'll make the alpha map samples match on either side of the seam and see what happens.
     
  14. gtzpower

    gtzpower

    Joined:
    Jan 23, 2011
    Posts:
    318
    This did not resolve the issue. It seems that Unity is matching the alpha channels well on either side of the seam. However, your suggestion led me to suspect the "Control UV noise" option. Disabling this seems to resolve the issue. Tessellation is more important than this feature, so I'll roll with it!
     
  15. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Ah, yeah, that would purturb the UVs on both sides. However, if you switch your terrain to use world space UVs that should map across it.
     
  16. gtzpower

    gtzpower

    Joined:
    Jan 23, 2011
    Posts:
    318
    We were already using "world space" UV mode when we encountered this issue.
     
  17. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    976
    I'm having trouble with importing MicroSplat and Terrain Blending specifically. Not all assets get imported when importing the package.
     
  18. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    The package manager is broken in about 50% of the unity versions out there, and Unity decided it would be better to frustrate everyone and not let you know that. You have to manually delete the cache folders to get it to update things right.
     
  19. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    976
    What folders are those specifically? I'm on Windows.

    The %LOCALAPPDATA%\Unity\cache doesn't seem to contain anything regarding microsplat as far as I can tell.

    I have the unitypackage file, it just doesn't import all the assets. I can see them in the import window but they don't import. This happens in a fresh project in both 2019.4 and 2020.3. (It's the example assets that don't get imported from microsplat terrain blending package.)
     
  20. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    You have to install examples from the package manager - they aren't installed by default to save import time.
     
  21. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    976
    Here's what it looks like for me after importing:


    There is no package to import. In the package manger import window, you can see there's a "Samples~" folder but it won't be included once the import finishes.
     
  22. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Packages are allowed to have samples- they are listed under the package description on the right hand side in the package manager, where you can install them - not on the import assets dialog.
     
    SunnySunshine likes this.
  23. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    976
    Ah, I see now the view in "In project" is different than in "My assets".



    Thanks!
     
  24. dwatt-hollowworldgames

    dwatt-hollowworldgames

    Joined:
    Apr 26, 2019
    Posts:
    104
    Question, will microsplat work with spherical terrain(ie a planet mesh)?
     
  25. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    sure, with the mesh workflow..
     
  26. dwatt-hollowworldgames

    dwatt-hollowworldgames

    Joined:
    Apr 26, 2019
    Posts:
    104
    excellent!
     
  27. Black_Raptor

    Black_Raptor

    Joined:
    Nov 3, 2014
    Posts:
    181
    Hi !

    It seem the Terrain Blending doesn't Work. I used MicroSplat Collection 3.8 with MicroSplat URP 3.8, and terrain blending module activated on the shader, and strictly follow the documentation but when i add the blending script to my rock ( on the rock parent or directly on the mesh ) nothing happen ... All the rest of the feature work correctly except this one.
     
  28. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Most likely you have the script not on the actually mesh renderer. Try on a unity sphere first.
     
  29. Black_Raptor

    Black_Raptor

    Joined:
    Nov 3, 2014
    Posts:
    181
    I guess my problem is because i use a custom shader graph to have top projection on my object, do you have a way to use custom shader made with shader graph to work with your blending terrain shader ?

    Edit : I fix my problem, that come from Alpha Clip
     
    Last edited: Sep 26, 2021
    TI0M likes this.
  30. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    515
    @jbooth It would be nice with a min/max height for wetness; Using transparent water and using only max height results in a shiny ocean floor seen through the water (which is not realistic).

    Appreciate it if you can consider implementing this!
     
  31. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    it’s already an option, wetness height..
     
  32. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    515
    Yes, this defines the height wetness goes up to, but not height it starts at (we do not want wetness under sea level, makes ocean bed shiny when seen through the ocean surface)
     
    Last edited: Sep 29, 2021
  33. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Ah, I see, so a way to invert it, essentially..
     
    MadeFromPolygons likes this.
  34. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    515
    I think a "from height" and a "to height" (min/max) for the wetness range would be excellent!
     
    MadeFromPolygons likes this.
  35. matiasges

    matiasges

    Joined:
    Jan 24, 2021
    Posts:
    142
    Hi. In my project one of the textures look like this with microsplat:



    But with the default unity shader look likes this:



    There are some water marks which I want to get. I have been trying to figure out what to tweak but nothing gave those results. Any idea?
     
  36. slakdevelopacc

    slakdevelopacc

    Joined:
    Jan 5, 2016
    Posts:
    14
    Hello, i found bug in asset. When you press the button to "Weight Limit", an error occurs and the function does not work. Unity 2021.1.19f1

    Code (CSharp):
    1. IndexOutOfRangeException: Index was outside the bounds of the array.
    2. MicroSplatTerrainEditor.WeightLimitTerrain (JBooth.MicroSplat.MicroSplatTerrain bt, System.Int32 maxWeights, System.Boolean secondPass) (at Packages/com.jbooth.microsplat.core/Scripts/Editor/MicroSplatTerrainEditor_WeightLimiting.cs:95)
    3. MicroSplatTerrainEditor.WeightLimitingGUI (JBooth.MicroSplat.MicroSplatTerrain t) (at Packages/com.jbooth.microsplat.core/Scripts/Editor/MicroSplatTerrainEditor_WeightLimiting.cs:36)
    4. MicroSplatTerrainEditor.OnInspectorGUI () (at Packages/com.jbooth.microsplat.core/Scripts/Editor/MicroSplatTerrainEditor.cs:239)
    5. UnityEditor.UIElements.InspectorElement+<>c__DisplayClass59_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <60f4a7b331a5480aaa94dbc2506830d5>:0)
    6. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
    And I also found that with 4 textures, at the lowest settings according to the optimization guide, this asset works about twice as slow then the diffuse unity shader on mobile devices. Perhaps adjusting the weights limit can help, but I doubt it can overtake the simplest unity shader.
     
  37. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Most likely your smoothness channel is not imported correctly.

    Weight limiting does not affect performance much. Unity's shader doesn't do a whole lot, and is much simpler than MicroSplat, so it doesn't surprise me that it would be faster in some configurations. Once you start pushing more textures or features, MicroSplat really starts pulling ahead in the speed department. There's also some non-obvious things with MicroSplat on low end hardware - for instance, making sure the sampler can be set to default (no per-texture UV scales, no branch sampling, or it will switch to the gradient sampler), and using the full blend mode (instead of fastest) can actually be faster than having those optimizations on for low end devices. For instance, low end mobile devices don't handle branches well (branch sampling), are slower using gradient samplers, and when there are only 4 textures in use and blend mode is set to full, MicroSplat can skip sorting the weights, which is expensive on low end hardware. Many of these are huge optimizations when you are dealing with more modern hardware or higher texture counts though, so it's impossible to write one shader that makes the right choices for all hardware (though I try to provide options for all this stuff).
     
    slakdevelopacc likes this.
  38. matiasges

    matiasges

    Joined:
    Jan 24, 2021
    Posts:
    142
    hmm it doesn't have a smoothness to add to the channel
     
    Last edited: Sep 30, 2021
  39. transporter_gate_studios

    transporter_gate_studios

    Joined:
    Oct 17, 2016
    Posts:
    219
    Thanks for the update, my anti-tiling module is working on all array textures again!
     
  40. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    839
    This is a Teaser for an upcoming project continuing the Apollo's Dream series.

    The video was made with Unity 2019 using this asset.
     
  41. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Samples are found in the package manager now rather than installed with the modules.
     
  42. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Whats the actual error?
     
  43. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    That's from something in Unity, not MicroSplat. I would try in a fresh project and not in the latest patch release of Unity. The 2020.3.f0 release was incredibly buggy..
     
  44. GoedWare

    GoedWare

    Joined:
    Aug 28, 2017
    Posts:
    2
    Just a question:
    Is it possible to make the URP shader to draw transparency (to make the terrain transparent).
    And if it is not out of the box, can I adjust the shader manually to do so?
     
  45. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    You'd have to add the feature yourself..
     
  46. GoedWare

    GoedWare

    Joined:
    Aug 28, 2017
    Posts:
    2
    Thanks for the quick reply!
    I managed to manually adjust the Blend value and surface.alpha value in the URP Password text file and and that resulted in my terrain now being semi-transparent (which was my goal at this time).
     
    Last edited: Oct 5, 2021
  47. bngames

    bngames

    Joined:
    Jul 3, 2012
    Posts:
    67
    Not working in 2019.4.30f1

    Assets\MegaSplat\TerrainPainter\Editor\TerrainPainterWindow.cs(47,90): error CS0619: 'SelectionMode.OnlyUserModifiable' is obsolete: ''OnlyUserModifiable' is obsolete. Use 'Editable' instead. (UnityUpgradeable) -> Editable'

    Assets\MegaSplat\Scripts\Editor\TextureGraph\Node_Editor\MegaSplatTextureGraphWindow.cs(285,105): error CS0619: 'SelectionMode.OnlyUserModifiable' is obsolete: ''OnlyUserModifiable' is obsolete. Use 'Editable' instead. (UnityUpgradeable) -> Editable'
     
  48. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Wrong thread, but remove the || SelectionMode.OnlyUserModifiable from those two lines..
     
  49. LibooSoft

    LibooSoft

    Joined:
    Jun 19, 2019
    Posts:
    20
    Hi. I have bought and installed my first two parts of MicroSplat. "Core" and "Anti-Tilling" to try out for my project. I created the shader, but some how I see no traces of the options for the anti-tile module in the shader. Have looked ad the documentation and video(s) I could find regarding Anti-Tiling with out finding any clues for this. Bett its a stupid simpel answer for this, but right now it just takes time and cant find out why. What am I missing?

    I run Unity 2020.3.14f right now.

    upload_2021-10-9_11-52-36.png

    upload_2021-10-9_11-51-45.png
     
  50. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Any console errors? Try in a new project?
     
Thread Status:
Not open for further replies.