Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[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. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    No, it just discards those pixels in the shader so they aren't drawn. Everything else should be rendered normally.
     
  2. Redrag

    Redrag

    Joined:
    Apr 27, 2014
    Posts:
    179
    Thanks Jason - if this works you will have made me a very happy man! This system is head and shoulders above all other assets I have purchased.

    UPDATE: It worked! Although FYI the hole mask did have an effect on the sea behind it. But I have been able to overcome that.
     
    Last edited: May 1, 2019
  3. FiveFingerStudios

    FiveFingerStudios

    Joined:
    Apr 22, 2016
    Posts:
    510
    How can I change the tint of one texture and not the others? I've tried moving the index slider to have the correct texture show up and checked tint, but nothing changes. I've even tried repacking the textures (with MicroSplatConfig), but that doesn't seem to do the trick.
     
  4. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Look in the debug section and make sure the propdata object is hooked up.
     
  5. FiveFingerStudios

    FiveFingerStudios

    Joined:
    Apr 22, 2016
    Posts:
    510
    Yes, its hooked up. (I double clicked it to make sure it pointing to the correct folder)
     

    Attached Files:

  6. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Strange- no errors in the console or anything? Worst case if you can't figure it out, send me the project. But I take it this all works fine on new terrains or the example scenes?
     
  7. FiveFingerStudios

    FiveFingerStudios

    Joined:
    Apr 22, 2016
    Posts:
    510
    Unfortunately, my project is pretty large. I'm going to try it in a smaller project.

    Btw I'm using Unity 2017.4.24f1

    EDIT: I just tested it on a clean project and it does indeed work. Not sure why its not working in my project.

    Is there any dependency on Unity terrain settings for the per texture options to work?

    I noticed I had 4 issues with my textures in Microsplat, I corrected them, but not sure if they could permamently mess up that particular terrain.

    1. I had one texture that was 512x1024, when all the others were 1024x1024.
    2. I had 1 normal map, not configured in Unity as a normal map (it was set as default).
    3. I had 1 AO texture, when the others had them empty.
    4. I noticed that the shader had the "MicroSplatConfig_normSAO_tarray" assigned to the Normal array (with only 1 of 7 textures assigned) and nothing in the smoothness AO.

    I've since corrected those, but still have the issue. I've also updated to the latest version of Microsplat. Is there anything else I should be looking at?
     
    Last edited: May 1, 2019
  8. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    No, it's not connected to anything with the terrain or textures. In fact, the texture config will handle most of those cases, as it resizes all textures to be the same size and generates any missing images from whatever data it has (ie: Generate a missing normal map from a height map, etc).

    My guess is that you have some mismatched references or something, caused by renaming or moving some files in the MicroSplatData directory around. You can try to figure out whats going on, or it might be faster to resetup the MicroSplat part of the terrain so that everything connects correctly again.
     
  9. FiveFingerStudios

    FiveFingerStudios

    Joined:
    Apr 22, 2016
    Posts:
    510
    Ok, that was it. I renamed the material in that folder from "Microsplat" to "Scene3-Microsplat". I've renamed it back and it now works...thanks.
     
  10. FiveFingerStudios

    FiveFingerStudios

    Joined:
    Apr 22, 2016
    Posts:
    510
    Thanks for the help.

    One more question:
    I plan on purchasing the Anti-Tiling module and the Terrain holes. How many additional passes do each cost performance wise?

    I'm currently at 6 Texture Array Samples and 4 Regular Samples.
     
    Willbkool_FPCS likes this.
  11. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    No extra passes; terrain holes only costs a single sample if your using a texture as a mask, in the other mode no samples are needed. Anti-tile depends on which effects you are using, but is generally on the cheaper end of anti tiling techniques compared to techniques used in the texture cluster module.
     
  12. nosebleed_dre

    nosebleed_dre

    Joined:
    Jul 25, 2013
    Posts:
    23
    Hey Jason,

    We've been using Microsplat and a bunch of the plugins (anti tile, wind and glitter etc) for our project for a while. However we've had to update from unity 2017 to 2019. I'm wondering if unity's new(ish) terrain instancing is now supported by Microsplat and if so, how we go about updating existing terrains?

    Cheers
    Dre
     
  13. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Change an option on the shader to re-generate it with the 2018.3+ code and turn on Draw Instancing. Note that terrain instancing is not compatible with surface shader tessellation due to a Unity bug, so in the next release it will be turned off if tessellation is enabled.
     
    nosebleed_dre likes this.
  14. nosebleed_dre

    nosebleed_dre

    Joined:
    Jul 25, 2013
    Posts:
    23
    Works a treat. Thanks
     
  15. Calum

    Calum

    Joined:
    Mar 14, 2015
    Posts:
    45
    Have downloaded this and a few of the add-ons but I'm really struggling with it. The tutorials are quite hard to follow too because they mostly don't start from scratch and are following work that's already been done.

    Tried to procedurally texture my terrain but all I get is a dark/shiny map with one texture and no normal, height, roughness or ao. :(

    Any help would be greatly appreciated.

    Thanks

    Calum
     

    Attached Files:

  16. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    374
    MicroSplat - Terrain Collection.

    It took me a long time to decide to change. Only for my laziness. Now I regret not having done it much before.

    The quality of the resulting textures is spectacular.

    I do not notice improvement in rendering performance with my previous option, but the quality and simplicity are an incentive more than justified.

    Congratulations!!!!
     
  17. FiveFingerStudios

    FiveFingerStudios

    Joined:
    Apr 22, 2016
    Posts:
    510
    Is there special coding I need to do for detecting which texture is most dominant at a particular position on terrain? I've noticing that my footstep code is no longer working correctly and only detects the correct texture when it is 100% that texture.
     
  18. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Should be exactly the same- The only difference is how MicroSplat is visually rendering them, using height based blending. This will tend to make one texture 'win' over another more often unless the contrast is low- but I wouldn't expect that to be very noticeable.
     
  19. docsavage

    docsavage

    Joined:
    Jun 20, 2014
    Posts:
    1,020
    Hi Jason,

    Just wondering if you implemented this?

    Thanks
     
  20. FiveFingerStudios

    FiveFingerStudios

    Joined:
    Apr 22, 2016
    Posts:
    510
    I just purchased the Terrain Blending for GameObjects.

    I've noticed that some of my GameObjects won't blend with the terrain (I see no visual difference not matter what values are chosen in the MicroSplatBlendableObject component). Besides the 1 material restriction, are there any others that I should be aware of?

    BTW, I use ProBuilder in my project to create meshes extensively. Those are the only meshes I see affected so far (although not all of them are).

    Edit: I just noticed that Vertex color for the meshes affects whether or not blending can work.
     
    Last edited: May 18, 2019
  21. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Vertex colors can be used to control where the blend happens (alpha), so perhaps the meshes are being created with 0 for alpha instead of 1. You can turn this feature off in the shader generator though.
     
  22. SgtLame

    SgtLame

    Joined:
    Nov 26, 2015
    Posts:
    129
    Hi,
    I am new to Microsplat and there is something I don't understand with how splat export works: For example, I'm working on a terrain which uses 4 textures, and when I use the splat export function, only one image is created, with the mapping for the 4th used texture only. What is it that I don't get? I'm using Unity 2018.3.11f1.
     
    Last edited: May 20, 2019
  23. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Splay maps hold the weights for 4 textures each, so if you have 4 textures on your terrain, the R channel is the weight of the first one, G for the second, etc.
     
  24. SgtLame

    SgtLame

    Joined:
    Nov 26, 2015
    Posts:
    129
    Hi, and thanks for your answer. I have an 8 textures terrain:

    Clipboard02.jpg

    When using the export splat function, I get two png files. One seems to contain only one texture mapping, with all channels being the same. The second image file just look empty.

    Clipboard06.jpg Clipboard08.jpg

    Obviously, there is something I don't understand.

    On the same page, I'd like to know how to use custom splatmaps. I cound only find one paragrah about it in the documentation.
     

    Attached Files:

    Last edited: May 20, 2019
  25. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Unity writes PNG files as premultiplied alpha, so what your seeing is only where the alpha channel has weight. If you look at them in Unity you'll notice they have data in them, but photoshop loads them like they are blank because the alpha is 0 and they multiply that into the color channels. I believe there is a third party PNG importer for photoshop that will load them correctly though.

    For external splat maps there are two options- use the importer to suck them into the terrain object, or use them externally by enabling it on the shader and hooking them up on the terrain component. The second option allows you to compress them, which can be a win on low end platforms.
     
  26. SgtLame

    SgtLame

    Joined:
    Nov 26, 2015
    Posts:
    129
    Ok, thank you, I get it.

    This is where I am completely lost. So far, I create splatmaps with external tools for texturing my terrains. I would like to use Microsplat because it looks brilliant in all its features, but I am not sure it supports the "basic" use I make of splatmap texturing (meaning Microsplat is made for more complex operations). I am going to sound like a complete newbie, but dDoes "use the importer to suck them into the terrain" mean the Import button in the MicroSplat terrain script editor? And does "use them externally by enabling it on the shader and hooking them up on the terrain component" mean ticking the "Use custom splatmaps" checkbox in the Microsplat material?
     
  27. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yes and yes. You only need one or the other though- if you import them, you can use unity's paint tools to paint, etc. Using the second way is mostly for optimizations or if you have some system procedurally creating them and don't want to go through Unity's terrain system.
     
  28. SgtLame

    SgtLame

    Joined:
    Nov 26, 2015
    Posts:
    129
    Ok, got it. But then, in the Microsplat terrain editor script, how does one use those eight "custom splat" slots?
     
  29. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    You put your splat maps in there if you have the custom map feature turned on. Each terrain has its own splat maps, but usually want to use the same shader.
     
  30. razzraziel

    razzraziel

    Joined:
    Sep 13, 2018
    Posts:
    395
    Hi @jbooth, i recently bought Microsplat pack. It works like a charm but i have an issue about my cloud shadows. I'm using Weather Maker and it has a little edit for Unity Shadow distance on UnityShadowLibrary.cginc like this:

    Code (CSharp):
    1. half UnityComputeShadowFade(float fadeDist)
    2. {
    3.     //return saturate(fadeDist * _LightShadowData.z + _LightShadowData.w);
    4.     return 0.0;
    5. }
    So this way we can get cloud shadows all across the map. But since i imported Microsplat, my multi terrains doesnt get shadows until i get closer to them or increase the shadow distance (which is silly because of cginc edit).
     
    Last edited: May 21, 2019
  31. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    You'd have to ask the weather maker author- MicroSplat is a surface shader, not a vert/fragment shader, so I don't think it uses that library.
     
  32. razzraziel

    razzraziel

    Joined:
    Sep 13, 2018
    Posts:
    395
    it just works well when removing microsplats and going back to built in unity shaders, so it has something to do with that.
     
  33. docsavage

    docsavage

    Joined:
    Jun 20, 2014
    Posts:
    1,020
    @jbooth ,

    Thanks for implementing the stochastic method to the snow add on. Works great.
     
    jbooth likes this.
  34. razzraziel

    razzraziel

    Joined:
    Sep 13, 2018
    Posts:
    395
    Found it. It was because lighting model of microsplat. Standart doesnt work, automatic solved the problem.
     
    jbooth likes this.
  35. Alic

    Alic

    Joined:
    Aug 6, 2013
    Posts:
    137
    Hey Jason, hope you're well!

    Is there a way to get MicroSplat working with assembly definition files? They've become a pretty huge feature for large game projects in recent versions of Unity, and while Microsplat can be rearranged to work with a project using them, it would be great to be able to update without having to rearrange folders. Thanks for your time.
     
  36. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I haven’t considered doing that because it would require me to force a more recent version of Unity. If I eventually raise the minimum version I’d consider it. That said, there’s very little C# in MicroSplat, especially in the runtime, so I’m not sure how much it would actually help.
     
  37. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,641
    Hello, I am the following spamming warning and would love to fix it:

    Duplicate basemap name: '_MainTex'. Ignoring.
    UnityEngine.Terrain:set_materialTemplate(Material)
    MicroSplatTerrain:Sync() (at Assets/Plugins/MicroSplat/Core/Scripts/MicroSplatTerrain.cs:141)
    MicroSplatTerrain:OnEnable() (at Assets/Plugins/MicroSplat/Core/Scripts/MicroSplatTerrain.cs:47)


    what do you think is wrong?
     
  38. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Can you send me a screenshot of you material generation settings? And what Unity version your on?
     
  39. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,641
    Unity is 2019.1.3f1, I am not who is using it (one artist is using it directly), can you tell me what the material generation settings is?
     
  40. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    When you click on a MicroSplat material there's a section on the top which has all the settings for how to compile the shader.
     
    sebas77 likes this.
  41. txarly

    txarly

    Joined:
    Apr 27, 2016
    Posts:
    197
    Hi, i am interested in your runtime procedural texturing, but i have a question.
    Is possible to paint manually some areas and keep the changes even the procedural painting is used too? i mean, i would like to paint the main terrain procedurally, but for example, the bed of a river manually(using the slope,height controls too),around buildings,... , and keep the changes.If not, is planned in a near future?

    Thanks
     
  42. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    You can bake the result back to the terrain and then paint on it, but I don't have plans for any kind of layering system where you have both at once and can update one without affecting the other. Unity has this in the works for a future version of Terrain, so if that happens I can likely piggyback into that system.
     
  43. Perillio

    Perillio

    Joined:
    Feb 4, 2019
    Posts:
    18
    Microsplat is a great asset, i tried it on several small projects (which was just for testing) and it worked like a charm.

    Now i tried in my main project (actually just an Island made with Gaia in the scene i tried microsplat) and it crashes the Unity Editor with an errormessage when i select terrain, add the microsplat terrain script and click the "convert" button. It seems to crash while packing textures (or at least this is the last thing i see on that status bar ...
    Error: http://prntscr.com/nsj4ny

    I tried with reimport all, same :(

    Edit: Using Unity 2019.3.0a2 btw
     
    Last edited: May 23, 2019
  44. razzraziel

    razzraziel

    Joined:
    Sep 13, 2018
    Posts:
    395
    Same here, i got 24 of these errors on my 4 terrains with total 40+ textures (some of them same on terrains) @2019.1.3f1
    i get 6 errors per terrain when they activated.





    And a tutorial focused purely on optimization would be good, which features (old and new) cost what, best practices etc.
     
    Last edited: May 23, 2019
  45. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Thanks, I’ll see if I can repro it. As for performance, one of the best things to look at is the sample counts listed in the debug section; this will give you a reasonable cost because most things are going to end up bound on memory when sampling textures.
     
  46. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,641
    thank you, I guess you mean this:

    upload_2019-5-24_12-33-25.png
     
  47. levelappstudios

    levelappstudios

    Joined:
    Nov 7, 2017
    Posts:
    104
    Hi @jbooth , we are using MicroSplat with the modules Triplanar and Procedural, they work great!

    Is there any way to use a MicroSplat material in a Mesh Renderer? We are converting the Unity terrain to a mesh using TerrainToMesh plugin (it works great also) for performance reasons.

    Is there any paid module to do this?

    Thanks in advance.
     
  48. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I have one finished but have not released it yet. However, if all your looking to do is implement mesh based terrains then you can look in the MicroSplatTerrain component and write the equivalent code for a mesh. Essentially as long as that mesh conforms to the same rules as a terrain and you provide the required data to the shader, it will work fine.
     
  49. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Ah, I'm betting this is a LWRP specific issue- thanks, I'll take a look.
     
    sebas77 likes this.
  50. levelappstudios

    levelappstudios

    Joined:
    Nov 7, 2017
    Posts:
    104
    Thanks!

    Do you know when is the module going to be released?
     
Thread Status:
Not open for further replies.