Search Unity

  1. 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
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    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:
    4,196
    So I submitted a repo of a bug with tessellation and instancing not compiling on metal in 2018.3f1, but Unity says that issue is fixed in the latest patches, but I haven't had a moment to test yet.
     
  2. Bzuco

    Bzuco

    Joined:
    Sep 6, 2015
    Posts:
    53
    On Win 2018.3.3f1 no errors with tess and instancing, but the terrain is not visible from camera to tesselation max distance.
     
  3. Revan3192

    Revan3192

    Joined:
    Mar 28, 2018
    Posts:
    7
    Hi everyone!

    I have some problems. I have 8 textures on my terrain using texture clusters so it means i'm actually using 16, and i set the max texture count to 16. I now tried to add another texture slot on the MicrosplatConfig and as soon as I select my terrain unity stop working.
    Some extra files appeared on the MicroSplatData folder, one for each texture with it's name but with "microsplat_later" as prefix.

    Also i can't use the texture slider on the Microsplat material settings and anything i touch it takes a lot of time thinking. I tried to change the max texture count to 32 but the problem remains.




    I'm doing something wrong??



    Thanks in advance
     
    Last edited: Jan 28, 2019
  4. m506

    m506

    Joined:
    Dec 21, 2015
    Posts:
    66
    Hi, this indeed fix the terrainlayer error. I still have to press sync everytime I change terrain and changing any properties (microsplat per texture array) still takes forever, but I can live with that.

    I reckon all this is being caused by some new editor functionalities pushed by Unity in 2018.3, am I right? I have another 3rd party tool (UMotion) which is also failing after I updated Unity.

    Thank you for this
    Regards
     
  5. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,196
    Yes, they changed the terrain system around to use custom assets for each layer of textures instead of having that structure internally, as well as some other things. Can you open the profiler and turn of profile editor and see what’s taking all the time?
     
  6. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,196
    There’s a fix for this posted above; though note if you have 8 texture choices on your terrain and are using clusters, max texture count only needs to be set to 8. If after applying the fix you are still seeing a slowdown and can provide a repro project I’d love to take a look.
     
  7. m506

    m506

    Joined:
    Dec 21, 2015
    Posts:
    66
    I tried, but the thing is, the profiler hangs when I change any values so I'm not able to determine the culprit... I will have to reinstall Unity at some point to see if things are fixed
     
  8. Revan3192

    Revan3192

    Joined:
    Mar 28, 2018
    Posts:
    7
    Hi Jbooth!

    I noticed that it only works when i use the same number of textures that are defined as max texture count. (8 ,12, 16..) If i use 9 textures it brokes without any error...

    I used 12 texture count with max 16 texture count and at first it worked but after some time I just clicked a terrain and suddenly unity crashed.

    I will try to send you a reproject but it's a huge multiscene with 16 terrain connected. I don't know what is it and I don't get any error. It just crash.
     
  9. Ivoryjw

    Ivoryjw

    Joined:
    May 20, 2018
    Posts:
    31
    Hello there JBooth.
    I noticed these weird looking lines that are formed around the texture:


    I tracked down the cause and it turns out that it was the Triplanar Module that causes this.
    You now anyway of fixing this?

    All the modules and core asset is updated, using Unity 2018.3.3
     

    Attached Files:

  10. Ivoryjw

    Ivoryjw

    Joined:
    May 20, 2018
    Posts:
    31
    Also one more thing, I'm also getting these errors after a certain time and I cant paint textures afterwards:

    NullReferenceException: Object reference not set to an instance of an object
    JBooth.MicroSplat.FeatureDescriptor.DrawPerTexVector2Vector2 (System.Int32 curIdx, System.Int32 pixel, System.String keyword, UnityEngine.Material mat, MicroSplatPropData propData, UnityEngine.GUIContent label, UnityEngine.GUIContent label2) (at Assets/MicroSplat/Core/Scripts/Editor/FeatureDescriptor.cs:289)

    Restarting unity fixed this for a bit but it comes back. Have any idea why?
     
  11. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,196
    Any idea what starts it happening?
     
  12. Ivoryjw

    Ivoryjw

    Joined:
    May 20, 2018
    Posts:
    31
    Don't have a clue. Its seems like entering and reentering scenes (or in and out of playmode) causes this error to happen.
    In the beginning of restarting, its fine, I can paint textures. But after going in and out of scenes, the error starts to happen.

    Also this affects Unity's terrain shader as well. Get errors (different ones) despite it being in another scene as well.
    Though I just tested painting on a non microsplat terrain with the microsplat error still going on and it paints just fine.
     
  13. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,196
    Can you post the error your getting?
     
  14. Ivoryjw

    Ivoryjw

    Joined:
    May 20, 2018
    Posts:
    31
    The microsplat one or the Unity one?
    I'll see if I can replicate the unity error. But I remember it saying m_Target doesn't exist or something.
     
  15. FiveFingerStudios

    FiveFingerStudios

    Joined:
    Apr 22, 2016
    Posts:
    395
    I'm trying to keep my terrain as performant as possible.

    I know that microsplat only samples 2-4 textures per pixel depending on quality setting, but just want to make sure. Is there a cost for each texture added to the texture array, or is it a fixed cost?
     
  16. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,196
    In terms of shader performance it's a fixed cost, but you still have to load and store the entire texture array in memory.
     
  17. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    73
    Hi @jbooth, sorry if this isn't the right place for it, but has there been any update on your Microsplat Mesh Workflow that you teased via Youtube?


    And does this process require that the mesh already be UV unwrapped, or is there a fully triplanar option? Microsplat on meshes sounds like a dream, thanks!
     
  18. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,196
    It’s been done for months; just need someone to produce some nice non-terrain stuff with it for marketing. It requires unique uv’s for the control map, since it uses a texture backing instead of vertex based.
     
  19. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,084
    Awhile ago I deleted the Microsplat Vegetation Studio script because it threw namespace errors with Veg Studio Pro. Now that Lennart has updated VSP to do the MS grass and shadow maps, I want to use that script, but upon importing the latest version of MS from the asset store, I get a bunch of those errors again. I *think* it's because MS references VEGETATION_STUDIO namespace, but not VEGETATION_STUDIO_PRO -- though not totally sure because I barely understand that stuff. At any rate, do you know how to fix these errors?

    (EDIT: Well, I see the script does reference both....but these errors just appeared after importing the latest MS, so I'm hoping you have an idea about how to fix them.)

    Assets\MicroSplat\Core\Scripts\VegetationStudio\Editor\MicroSplatVegetationStudio.cs(17,46): error CS0246: The type or namespace name 'FeatureDescriptor' could not be found (are you missing a using directive or an assembly reference?)

    Assets\MicroSplat\Core\Scripts\VegetationStudio\Editor\MicroSplatVegetationStudio.cs(92,42): error CS0246: The type or namespace name 'MicroSplatShaderGUI' could not be found (are you missing a using directive or an assembly reference?)


    etc,
     
  20. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,196
    Try deleting and reinstalling MicroSplat - it looks as if some files are missing or something?
     
  21. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,084
    I downloaded and imported the latest MS core, but not the others yet. Would that cause a problem like this?

    Since we've moved all the editor scripts into a single Editor folder (so we can use Assembly Defs), it's tricky to delete and reimport. Easier to download from github and copy files over....is that repro good to use ATM?
     
  22. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,196
    Depot is good- but once you get into moving things into assembly defs and changing how things are linked up, it's not my issue if it doesn't link anymore.
     
  23. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,084
    Problem solved by getting all the updated module files. Sorry for the false alarm.

    However, I now suddenly have a problem with the Microsplat-Enviro integration script. No errors, but it uses 13330ms on the CPU. Any ideas? I think Vondox made that script, so I'll ask him, but any idea what might've changed in MS?
     
  24. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,196
    Nothing- that script shouldn't even have to interact with MS, since MS publishes the data it needs to global variables in the shader table.
     
  25. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,084
    Okay.

    And argh, I'm having the same problem after updating MS as I did a month ago (when I just reverted to the previous version) -- Unity hangs with endless stuff like this in the console app. I think you needed a repro, which I can try to do....but you haven't gotten any ideas about what's going on with this since then?

    ----- Compute hash for Assets/09 Terrains/02 Amesthyst Terrain/Amethyst terrain TC2/MicroSplatData/microsplat_layer_TexturesCom_RiverStones2_2.5x2.5_2048_albedo_0.terrainlayer.
    done. [Time: 5.427033 ms]
    Script Compilation Pipeline Post Process Assets time: 0.000008s
    Assembly Updater Post Process Assets time: 0.000047s
    gstr.c:876: assertion 's2 != NULL' failed
    gstr.c:876: assertion 's2 != NULL' failed
    gstr.c:876: assertion 's2 != NULL' failed
    gstr.c:876: assertion 's2 != NULL' failed
    gstr.c:876: assertion 's2 != NULL' failed
    gstr.c:876: assertion 's2 != NULL' failed
    gstr.c:876: assertion 's2 != NULL' failed
    gstr.c:876: assertion 's2 != NULL' failed
    gstr.c:876: assertion 's2 != NULL' failed
    gstr.c:876: assertion 's2 != NULL' failed
    gstr.c:876: assertion 's2 != NULL' failed
    gstr.c:876: assertion 's2 != NULL' failed
    Refreshing native plugins compatible for Editor in 4.92 ms, found 3 plugins.
    Preloading 1 native plugins for Editor in 1.58 ms.
    Updating Assets/09 Terrains/02 Amesthyst Terrain/Amethyst terrain TC2/MicroSplatData/microsplat_layer_Ground_DirtBrownTan_1k_alb_s_1.terrainlayer - GUID: e9edfaf74d08cd14a8ceacd3c5aa37eb...
     
  26. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,196
    I’m not going to look into it because it seems unique to your project, where you’ve moved all the script files around and put them into assemblies.
     
  27. Ivoryjw

    Ivoryjw

    Joined:
    May 20, 2018
    Posts:
    31
    Well Mr.Booth I got some good news and I got some bad news. The update that came around actually fixed the line issue for triplanar. The bad news is this happens with triplanar.

    Interestingly enough this only happens on flat ground and has no effect on slopes. In fact I could just use another texture for slopes and disable triplanar for the flat ground. The shader only has triplanar active and no other module.

    This was probably addressed before and you probably do have a solution on your side. Everything else is fine and I really like triplanar noise for the anti tiling asset.

    Edit about my edit: Yep, the grain is gone for the flat ground texture with triplanar disabled for them and still have no grain for textures on slopes.
     

    Attached Files:

    Last edited: Feb 7, 2019
  28. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,196
    I have a rewrite of some of the triplanar stuff on my machine that I haven't published yet, so I suspect this is already fixed. Is this with the gradient samplers?
     
  29. miklelottesen

    miklelottesen

    Joined:
    Mar 7, 2015
    Posts:
    19
    Hi

    Just a heads up. I discovered some issues after updating to 2.3 (might have been one of the 2.2 updates, I don't remember which version I was on before).

    I have a setup in which I procedurally generate and instantiate terrains. So for each terrain, I basically create a new Unity terrain from scratch programmatically, attach a MicroSplatTerrain to it, add a premade material template and prop data to the MicroSplat component and sync.

    Before the update, it could spawn hundreds of small terrains in a matter of seconds, but after the update each terrain seemed to take at least one full second to spawn.

    I did some analysis of the MicroSplatTerrain script's Sync method, basically logging how many ms have passed since the beginning of the method execution at various points in the method. Everything took a reasonable amount of time, except the RestorePrototypes call which took around 1300 ms and was being called for each terrain.

    I've now manually disabled the method call, and found that I don't seem to need it at all (I'm guessing it has something to do with being able to edit the terrain in the editor, which is something I don't need in this setup). But I thought I'd still make you aware that something is up with that method. I think I was running 2.2 before updating, and I had previously implemented a fix to the RestorePrototypes method that you had posted earlier in this thread to make it work in 2018.3.
     
  30. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,196
    That method is only called in the editor, so should not even happen in an actual game. That said, it shouldn't take any more time that it used to, as it actually does less work now. Do you have a repro project you could share?
     
  31. miklelottesen

    miklelottesen

    Joined:
    Mar 7, 2015
    Posts:
    19
    I should add that I use my terrain spawner extensively in the editor to test my generation algorithms, and that's where I've had the problems. I haven't tested it in play mode or in a build but, as you say, it most likely wouldn't be an issue there.

    I threw together a small, barebone repro project (using only the free core module): https://drive.google.com/open?id=1Dgr8tgDt3cLlS3OtyaUr-rHcvtw3-uOY

    In the included sample scene, there's a GameObject in the hierachy with a small editor tool which vaguely emulates the terrain generation process in my main project. With the RestorePrototypes call disabled, it takes 3 ms per terrain and when it's enabled it takes around 600 ms, at least on my machine.
     
  32. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,196
    Ok, fixed. I just uploaded 2.4 to the asset store, so it will be in that patch..
     
  33. Brian-Brookwell

    Brian-Brookwell

    Joined:
    Sep 14, 2012
    Posts:
    47
    How tied is MicroSplat to the unity Terrain object? It's exactly the system I need for a terrain generation research project I'm working on. I create a mesh (including uvs and normals) but the mesh isn't rectangular like Terrain is, it's based on hexagons. Has anyone tried using MicroSplat on other mesh objects?
     
  34. StevenPicard

    StevenPicard

    Joined:
    Mar 7, 2016
    Posts:
    668
    MegaSplat is probably a better choice for Mesh objects.
     
  35. magic9cube

    magic9cube

    Joined:
    Jan 30, 2014
    Posts:
    58
    Hi Jason,

    I've been using megasplat for a while with voxel / procedural terrain, which works quite well.. I'm trying to do the same on mobile / android with microsplat getting the following error.

    "Graphics.CopyTexture can only copy between same texture format groups (d3d11 base formats: src=0 dst=27)"

    I thought i'd set the compression correctly everywhere for the platform and remade the texture arrays. I guess i've missed something simple here..

    upload_2019-2-8_11-17-47.png
     
  36. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,196
    What version of Unity are you using? Unity broke this function in 2018.3 beta, and I believe the change was also in a few 2017.4 versions as well.
     
  37. Ivoryjw

    Ivoryjw

    Joined:
    May 20, 2018
    Posts:
    31
    So I have a problem again with the line of triplanar.
    Turns out that it still exist.
    But for some reason the line is drawn on a texture that has triplanar disabled. The rock texture that I used had the issue as well until I updated the textures for the grass and now it has none.
     

    Attached Files:

  38. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,196
    Is this after updating to the patch that came out this morning? If so, can you send a repro?
     
  39. Ziplock9000

    Ziplock9000

    Joined:
    Jan 26, 2016
    Posts:
    194
    Hey does MS support what I think is called terrain decals?
    If you look in this screenshot from DDOS2, you can see the small rocks are overlaid on top of the normal terrain blending with a mask. They are definitely not one of the normal terrain textures.
    I'm going to assume this is done within the same shader as the terrain rather than a bunch of separate meshes.
    https://i.imgur.com/l4cyoAZ.jpg

    The best way to look at this in your mind is to assume there's 1000's of permanent blood splatters all over the terrain that overlay the normal map blending. That's essentially what those rocks are.

    Does microsplat support this? If it does, how do you actually tell it what and where they are placed?

    Thanks.
     
    Last edited: Feb 8, 2019
  40. Ivoryjw

    Ivoryjw

    Joined:
    May 20, 2018
    Posts:
    31
    Hello again. I tried upgrading to 2.4 but its throwing me errors about upgrading to 2.4 in the material. Turns out that anti tiling isn't updated yet and removing it from my project fixes that error.
     
  41. Ivoryjw

    Ivoryjw

    Joined:
    May 20, 2018
    Posts:
    31
    Good news, though, triplanar is completely fixed.
     
  42. Ivoryjw

    Ivoryjw

    Joined:
    May 20, 2018
    Posts:
    31
    Also I got the paining error for the terrain for the unity shader:
    Weird thing is that unity references another asset in its error. However it doesn't say anything for any other asset for microsplats error. And when I do get rid of microsplat, everything is fine for paining.
     

    Attached Files:

  43. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,196
    Thst just looks like height blending to me; nothing special. If you were going to do a decal system in the terrain shader, it would be unbelievably slow, as every pixel would need to rest against every decal. It’s far better to do that with a deferred decal system.
     
  44. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,196
    Yeah, looks like 2 modules didn’t get released yet, which is unfortunate. They’ll likely have them out on Monday.
     
  45. M_R_M

    M_R_M

    Joined:
    Jan 31, 2019
    Posts:
    10
    I'm seriously loving the features of this module, if Unity came with half of these features by default it would be a massive improvement. Unfortunately I keep running into issues that prevent me from being able to use it though, not sure if it's user error or a bug. Is it normal for the textures in terrain layers to become blank and unusable every time you click on MicroSplat.mat? I have to re add the textures each time to paint them, but when I click on the MicroSplat material to adjust the settings, all of the textures but one will be blank, and I'll have to delete them all (removing the work that was just done) in order to continue painting.

    I also can't seem to remove the module without it either deleting the paint tools from the inspector, or deleting all of the paint tools and the materials making the terrain all white unable to accept textures at all (I'm assuming the shader has been removed?).
     
  46. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,196
    I'm under the impression that all of these issues with 2018.3 are fixed, what version of MicroSplat are you running?
     
  47. chrisk

    chrisk

    Joined:
    Jan 23, 2009
    Posts:
    681
    Hi, JBooth, I was surprised to discover Microsplat and it was very pleasant.
    Right now, there is a bit of a small problem.
    We are using Source Control and it needs to be checked out before generating a new shader.
    There is doc how you can checkout files before modifying.
    https://docs.unity3d.com/ScriptReference/VersionControl.Provider.Checkout.html
    I would appreciate if you can put the support in.
    Cheers!
     
  48. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,196
    Yeah, I've actually been meaning to do that..
     
  49. chrisk

    chrisk

    Joined:
    Jan 23, 2009
    Posts:
    681
    Awesome! I've looked at other terrain shaders and your support is probably the best. And of course, the stuff that you are working on is also the best in terms of the perf and features. I'm looking forward to working with you. Cheers!
     
  50. pselok

    pselok

    Joined:
    Feb 9, 2019
    Posts:
    3
    Hello! Just bought MicroSplat + Tesselation / parallax and i have weird feelings. I'm the very beginner so it must be funny for you, but is it looks normal? (see screenshots). Without microsplat terrain looks much better as i can see, but when i enable microsplat it comes like with lower resolution? Maybe i'm doing something wrong or is it normal behaviour and i'm using it wrong?
    Also I cannot control anything from terrain panel in inspector (where microsplat shader is), I cannot enable tesselation and parallax: checkmarks are just resets to default and other features seems do not anything when I change values. I tried it with 3 different assets, my favorite one is Surfaces.
    Thank you very much, as i can see you made a great job with that and i'm sure it's my mistake over here. Currently i'm an iOS developer and i only learning unity and game development basics. Please just tell me my mistakes if i missed something and please don't go negative on me:)
     

    Attached Files:

    Last edited: Feb 12, 2019
unityunity