Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Let us know a bit about your interests, and if you'd like to become more directly involved. Take our survey!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    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:
    2,989
    So, when up bias is set to 0, tessellated vertices are displace along the normal of the polygon. So if you have a V in your terrain, with the seam at the bottom of the V, the vertices would be pushed through each other. With an UpBias of 0, displaced vertices are pushed straight up, which means both vertices along the seem are pushed in the same direction regardless of normal angle.
     
  2. FastKillteam1

    FastKillteam1

    Joined:
    Sep 20, 2017
    Posts:
    21
    Loving what can be done with the tool... but when I build my terrain has no textures... it turns white. Looks beautiful in the editor, any ideas what I have done wrong?
     
  3. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,989
    What platform are you running it on? You need a platform that supports texture arrays, so old mobile phones and such might not work.
     
  4. FastKillteam1

    FastKillteam1

    Joined:
    Sep 20, 2017
    Posts:
    21
    thanks for the prompt response :) that may just be the issue. I am developing with the latest unity version, but i do testing with Koplayer for android builds... maybe koplayer is outdated, think ill have to bite the bullet and buy a new android device to test with. Will late model mobile devices work with microsplat?
     
  5. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,989
    Anything which supports opengles 3.0 or greater..
     
  6. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    370
    I'm having an issue where when I add microsplat to the terrain it makes the grass transparent and I can then see objects through the grass that should be blocked from sight. What can I do to correct this issue?
     
  7. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,989
    Screenshot of the issue and your settings?
     
  8. Goon-Studios

    Goon-Studios

    Joined:
    Mar 16, 2015
    Posts:
    8
    this top image has no billboarding on the grass
    transparent grass.jpg this bottom image has billboarding on the grass, the billboards don't look so bad here, but in game view they don't look so good.
    billboard grass.jpg
     
  9. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,989
    I guess I don't see what your issue is - the terrain looks like it's drawing fine, I don't see anything drawing out of order. And I don't see why MicroSplat would have any effect on how the grass draws- it doesn't have anything to do with grass.
     
  10. TakeRefugeGames

    TakeRefugeGames

    Joined:
    Dec 9, 2017
    Posts:
    9
    Hi there How can I use substances in Microsplat? I cant seem to find the module but I am sure I saw it in a video once.
     
  11. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,989
    Unity removed support in 2017.3, so use an earlier version or bake out the textures.
     
    TakeRefugeGames likes this.
  12. TakeRefugeGames

    TakeRefugeGames

    Joined:
    Dec 9, 2017
    Posts:
    9
    Thanks Jason...
    I'm on Unity 2017.4 if I back pedal a version and use 2017.3 will I get a slot for substances?
    As I am relying on the sliders I have made I can work around this I'd imagine. it'd just be nice to know.
     
  13. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,989
    You can comment out the #if UNITY_2017_3_OR_NEWER in the code; it will spit warnings, but still work until 2018.1.
     
    TakeRefugeGames likes this.
  14. NtkO01

    NtkO01

    Joined:
    Jan 5, 2015
    Posts:
    4
    Hello jbooth, thanks for this awesome asset! :D
    I have a problem with the Lightweight Render Pipeline, I can't see the option to change the "Render Loop" below "Name" option of the Shader Generator. Please I need your help. Thanks!

    Edit: I started my project with the Lightweight Pipeline for VR from Unity Hub
     
  15. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,989
    You need the lightweight render pipeline module installed, which Unity has not approved for sale yet. Hopefully next week..
     
  16. NtkO01

    NtkO01

    Joined:
    Jan 5, 2015
    Posts:
    4
    I see, ok, glad to know it wasn't a bug, thank you! :D
     
  17. TakeRefugeGames

    TakeRefugeGames

    Joined:
    Dec 9, 2017
    Posts:
    9
    Haha Cheers I did have a peek at that but couldn't get substance active its all a bit over and above my needs its probably easier just to bake em out, but thanks.
     
  18. Meceka

    Meceka

    Joined:
    Dec 23, 2013
    Posts:
    301
    Hello, I am interested in trying Microsplat but I have some questions.

    Comparing performance with unity terrain that has 4 splatmaps and uses diffuse lightning, as I understand Microsplat is slower on performance, can you confirm that?

    We are going to publish our game on multiple platforms, including low-end mobile devices.
    So I am thinking of enabling microsplat for higher-end platforms (PC and consoles), and reverting to unity terrain for mobile platforms (and maybe Nintendo Switch) to save performance. Would it be simple to enable/disable MicroSplat when needed or would I need to have seperate terrains for each platform?
    We're also considering to have a low graphics setting that disables microsplat at runtime for low-end PC.

    Also is there an optimization guide available that shows how we can obtain the best performance?
    For example, I read that with "Terrain Holes" module terrain doesn't become rendered under some height (underwater), but does it actually save performance or does it cause a performance impact to visible areas by causing more complexity to the shader?
    Can I paint alpha under invisible areas to save performance (for example below cities, pavements, roads or buildings where terrain is below other meshes and isn't visible).
    Considering I do paint alpha to every place where terrain is behind another mesh. Would the performance still be worse compared to unity terrain, Or would it be a good gain?
     
  19. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,989
    It depends on settings and platform, but generally speaking stock MicroSplat will be slightly slower than a Unity terrain with 4 textures. You can, however, disable things like height blending and lower blend quality and likely get it very similar. However, as you get into higher texture counts, you get very little performance penalty from MicroSplat compared to Unity terrain, and even stock MicroSplat has lots of features that Unity's terrain does not support. But the best way to find out is to profile on your target platform - core is free, so there's no cost to test for yourself. (And you will obviously have to be GPU bound for it to matter). For most projects, this is a pretty academic difference though..

    It kind of depends on what you consider low-end. For instance, I wouldn't bother trying to disable it for a low-end PC, as anything that still runs Unity will likely be fast enough for it not to make a difference. I dev on a 4 year old MacBook, and easily run with tessellation and a ton of features on. If you are trying to run on OpenGLES2.0 mobile devices, then MicroSplat wouldn't be an option since they wouldn't support texture arrays.

    In terms of setting up different profiles for different devices, it's pretty easy. Basically, just output a unique shader for each LOD and set it on the template material and call MicroSplatTerrain.SyncAll() to update the internal materials. If you want to disable MicroSplat, disable the terrain component and reset the basemap distance and it will render with Unity's shader (note this would still load the microsplat data, so a better delivery mechanism would be to build different asset bundle's for each version at build time and download them that way).

    It can save performance in some cases. For instance, if underwater fog is effectively going to fog out the area anyway, then it's a win. I don't think it would help by painting it in places where objects are, though, as the zbuffer will prevent shading from being done on those cases anyway (in the fog case, fog doesn't fill the zbuffer, so it's not able to early out).
     
  20. Zante

    Zante

    Joined:
    Mar 29, 2008
    Posts:
    333
    I'm having an issue with the wetness and stream painting. I can confirm, via your demos that it works in my project but in my particular scene, the only options I have are to fill/clear the terrain, painting has no effect (brush is active, disk visible etc)...

    Any thoughts?
     
  21. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,989
    Do you have the terrain selected when you try to paint? Do the controls for the brush show up? Is Flow turned up enough?
     
  22. Zante

    Zante

    Joined:
    Mar 29, 2008
    Posts:
    333
    Yup, the video below shows the effect:
     
  23. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,989
    Strange- what version of Unity and platform are you on? Can you paint in the example scenes?
     
  24. Zante

    Zante

    Joined:
    Mar 29, 2008
    Posts:
    333
    Just want to say thanks for being so speedy with your responses, it's amazing. Not sure if you know how much people appreciate you for it.

    • Windows platform
    • Unity 2017.4.2f2
    Edit: Yes, in the examples it works as expected.
     
    Akshara likes this.
  25. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,989
    Ok, so if it works in the example, then it's most likely something not related to platform or Unity version, but maybe something going wrong in the setup. If you look in the MicroSplatData directory for your terrain, is there a stream_data texture? Is read/write enabled on it? Also, no errors are being thrown in the console I assume?

    Finally, if you can pack up your scene for me, I can see if I can repro it tonight.
     
  26. Zante

    Zante

    Joined:
    Mar 29, 2008
    Posts:
    333
    No errors, there seems to be a stream_data texture. I've messaged you with a link to a compressed project reproducing the issue.
     
  27. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,989
    BTW- reviews are always a great way to say thanks to any asset store author!
     
  28. Zante

    Zante

    Joined:
    Mar 29, 2008
    Posts:
    333
    Everyone needs to know this man (jbooth) has saved my life. We are very lucky to have this kind of talent in our community. Great support, will write up a big happy review this eve.

    Edit: Issue was to do with terrain scale. Setting it to 1 fixed it.
     
  29. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,989
    I'll see if I can do something about this in the next patch, or at least warn about it. Unity terrains have a scale, but it's completely ignored, so it screws up the painter because it uses the terrain matrix to transform your brush into terrain space.
     
  30. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    557
    Quick question about the Global Texturing module, can the maps be tiled in world-space across multiple terrains? I'd like to use a single set of global maps for all my individual terrain tiles.
     
  31. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,989
    Not currently..
     
  32. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,989
    Ok, added a uv scale/offset to the tint/normal maps. They will use the space that the terrain is textured in, so if you set your terrain to world space, then they will be in world space as well..
     
  33. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    557
    Great! Much appreciated! I use the same maps to texture my distance mesh terrains, so these should blend in perfectly with this :)
     
  34. kielinen

    kielinen

    Joined:
    Jul 18, 2016
    Posts:
    21
    Wondering if anyone else is having this issue. Used 2017 Unity for a while and MicroSplat. I updated Unity to 2018 version today, then, deleted and reinstalled MicroSplat. When I check Tessellation, the preview window shows White Terrain blocks when zoomed in close. Zoom out, and it looks normal. How to fix this?
     
    EvilGremlin likes this.
  35. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,989
    You need to update microsplat to the latest version; simply upgrading the project and reinstalling it doesn't do this, as that doesn't update it from the asset store..
     
  36. kielinen

    kielinen

    Joined:
    Jul 18, 2016
    Posts:
    21
    jbooth

    I removed from the file structure the Asset folders, opened Unity 2018, visited the asset store, downloaded the latest versions twice in a row after removing and installing. Same issue. I noticed when reduce the map draw distance to 0, the terrain textures comes back. But, when i paint on any texture the map turns white, then back to texture, then white with clicks. I followed other advice above by remove, asset store etc.. Reinstall same results.

    I just now created a new project, new terrain. Visted the Asset Store, Downloaded Microsplat and Tesselation. Added 1 image and sub Norms, Disp, OCC and Spec images. Added Microsplat to terrain, updated. Opened MicroSplat config, clicked on Tessellation and WHITE. All White terrain. I reduce Map Draw Distance to 0, terrain shows.

    I checked the Console, should have done this first. Here is the message. I have not changed anything on this system other than logon, update Unity and this asset.

    Shader error in 'MicroSplat/Example_Tessellation': 'tex2D': no matching 4 parameter intrinsic function; Possible intrinsic functions are: tex2D(sampler2D, float2|half2|min10float2|min16float2) tex2D(sampler2D, float2|half2|min10float2|min16float2, float2|half2|min10float2|min16float2, float2|half2|min10float2|min16float2) at line 504 (on d3d11)
     
    EvilGremlin likes this.
  37. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,989
    Open up one of the modules c# files and tell me what version it says it is in the GetVersion function- this error was fixed with the 1.8 version, and I'm betting that for whatever reason, you are still on 1.7 or earlier instead of 1.9.
     
  38. kielinen

    kielinen

    Joined:
    Jul 18, 2016
    Posts:
    21
    I found the GetVersion and it says 1.7. How in the world can this cache the Asset? So how do we remove this and get the correct version? I literally removed, and installed it from the asset store again, after i deleted the old from ALL my projects in the Asset Folders. I scrubbed the PC for any HINT of MicroSplat, and it is still there when i get install from asset store. Like GroundHogs day..
     
  39. kielinen

    kielinen

    Joined:
    Jul 18, 2016
    Posts:
    21

    Same result again.. I scrubbed this F*** PC for this asset, any words, files-names are now atomic gooo... But, I go to the asset store and I click Import.. It installed 1.7... Where is this coming from?
     
  40. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,989
    You need to upgrade it, not just install it. It keeps a cache on your local machine of the last version you downloaded, which is clearly 1.7.
     
  41. kielinen

    kielinen

    Joined:
    Jul 18, 2016
    Posts:
    21
    It is installed and the issue is gone. I think, Im still getting the console message from above. I checked the GetVersion and they say 1.9.
     
  42. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,989
    You might need to change a feature setting on your old terrains to make it recompile them with the new code..
     
  43. FastKillteam1

    FastKillteam1

    Joined:
    Sep 20, 2017
    Posts:
    21
    Terrain blending is awesome I must say, I have a question regarding the way the gameobjects should be flagged. Since the mesh has only itself and no sub mesh for the second mat, unity throws a warning about it declaring that it costs performance and recommends multiple shader passes. This only happens when a GameObject is flagged as static. If it is not flagged as static the warning does not appear. I haven’t noticed any speed issue as of yet but I haven’t been excessive with the gameobjects that are blended. So my question is how much will it affect performance (if at all) if used liberally and the gameobjects are static?
     
  44. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,989
    Mesh blending requires a second drawing of the object. Basically the way it works is that the object is drawn once with the first shader, and again with a special shader that does the blending. The main advantage of this approach is that it will work with the existing shaders you have on the object, instead of requiring you use custom shaders that I provide. This is pretty huge, because it means you aren't forced into a very specific set of shaders, and can use just about anything you want and have it blend. The downside is that it's a second draw call for the object. The approach taken is likely the best balance between ease of use and performance, and the performance differences can be handled in other ways.

    If you are using something like vegetation studio, for instance, it has custom code which will draw all your rocks (lets say) in one call, then draw all of the mesh blending in a second call, essentially batching everything into 2 calls instead of many. This is a much more efficient drawing system than unity's in most cases, which is why you can have such dense vegetation in a package like that.

    However, the exact answer to your question is going to depend on a lot of factors; like forward or deferred rendering, how many lights are hitting the object, what pass types the shader you are using on those objects uses (ie: does it force forward rendering), static vs dynamic batching, where your actual bottlenecks are, etc. I would suggest opening the frame debugger and stepping through the draw list to see it actually draw your scene, so you can get a better idea of how it is being drawn.
     
  45. Nazowa

    Nazowa

    Joined:
    Oct 30, 2017
    Posts:
    12
    Updated to latest version from asset store with the following results:

    Assets/MicroSplat/Core/Scripts/Editor/UnityLDRenderLoopAdapter.cs(11,17): error CS0535: `JBooth.MicroSplat.UnityLDRenderLoopAdapter' does not implement interface member `JBooth.MicroSplat.IRenderLoopAdapter.WriteSharedCode(string[], System.Text.StringBuilder, MicroSplatShaderGUI.MicroSplatCompiler, int, bool)'

    Assets/MicroSplat/Core/Scripts/Editor/UnityLDRenderLoopAdapter.cs(11,17): error CS0535: `JBooth.MicroSplat.UnityLDRenderLoopAdapter' does not implement interface member `JBooth.MicroSplat.IRenderLoopAdapter.WriteTerrainBody(string[], System.Text.StringBuilder, MicroSplatShaderGUI.MicroSplatCompiler, int, bool)'

    Assets/MicroSplat/Core/Scripts/Editor/UnityLDRenderLoopAdapter.cs(11,17): error CS0535: `JBooth.MicroSplat.UnityLDRenderLoopAdapter' does not implement interface member `JBooth.MicroSplat.IRenderLoopAdapter.GetPassType(int)'

    Assets/MicroSplat/Core/Scripts/Editor/UnityLDRenderLoopAdapter.cs(11,17): error CS0535: `JBooth.MicroSplat.UnityLDRenderLoopAdapter' does not implement interface member `JBooth.MicroSplat.IRenderLoopAdapter.GetVersion()'

    After removing all script ties to my terrains, deleting the folder and reimporting working now. Have to do all settings on my terrains.
     
    Last edited: May 17, 2018
  46. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,989

    In the future, just delete MicroSplat and reinstall without touching the terrains. In this case, you could have just deleted that file (The UAS won't delete it with the upgrade, which is annoying)
     
  47. Nazowa

    Nazowa

    Joined:
    Oct 30, 2017
    Posts:
    12
    Aha doing that would keep the settings on the terrains ?
     
  48. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,989
    Yes..
     
  49. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,989
  50. christoph_r

    christoph_r

    Joined:
    May 20, 2013
    Posts:
    389
    Great to see you support SRP that early! I hope you're also planning a port to HDRP?