Search Unity

  1. Unity 2020.2 has been released.
    Dismiss Notice
  2. 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

[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,576
    Sounds like your using a planar reflection system that re-renders the scene- so you'd need to modify that code to use a half-resolution (or lower) render buffer instead of full resolution. You could also consider using a SSR approach instead, which while not as nice doesn't require re-rendering the entire scene.
     
    mmaclaurin likes this.
  2. PeterB

    PeterB

    Joined:
    Nov 3, 2010
    Posts:
    365
    Maybe I should clarify myself a little: the issue seems to be that MicroSplat under certain circumstances loses track of its textures. The MicroSplat component doesn't actually get disabled in Unity terms, so tracing execution that way isn't possible. It's of course most likely interference from some other package. Are you aware of any kind of circumstances where MicroSplat could lose track of the textures?

    The second issue, upon closer examination, seems to have something to do with Suimono. I'm working with the author to try to find out what's going on.

    But the first issue remains.
     
  3. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,576
    None that I’d know of, but I’d beware of anything which interacts with terrain texturing..
     
    PeterB likes this.
  4. robbob44

    robbob44

    Joined:
    Apr 16, 2018
    Posts:
    22
    Hello,

    Could you give us a little insight into how the blend object shader is implemented so that I can investigate further how to get transparent decals to not cut away the blended material?

    We are trying to place footprints on terrain/meshes, but the current shader we are trying seems to cull away only the microsplat blended effect. The specific shader we are using is here: https://bitbucket.org/bac9/shading/...shader?at=master&fileviewer=file-view-default



    I have fiddled with all the parameters on the shader, including the rendering queue (which is what I would have suspected I needed to change) but altered much higher than it currently is just turns it black.

    I apologize if theres something obvious I'm missing, I'm not particularly familiar with shaders still and how Unity handles rendering.
     
  5. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,576
    It’s handled via a second material, which draws after the first. Ideally, you could use a deferred decal system and deferred rendering.
     
  6. digzelot

    digzelot

    Joined:
    May 12, 2014
    Posts:
    31
    @jbooth A) you rock dude, drinks on me if you're ever in Atlanta B) Issue: I'm converting a basic flat unity terrain using MicroSplat - the terrain has 4 (64x64) .png textures with no normals and when I build to Android (I'm running on a new Google Pixel) my frame rate tanks. SUPER choppy - I also get this error (see image) - when I remove the MicroSplat Terrain component from the terrain and re-build, my framerate jumps right back... Any ideas what I'm doing wrong? (unity version 2018.2.0f2)
     

    Attached Files:

    Last edited: Aug 13, 2018
  7. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,576
    Try setting blend quality to best and max textures to 4 if you have 4 or less textures in use, as there's a special low-end optimization for that case. Also, texture size is controlled on the TextureArrayConfig, not the original textures, so if that is set to 1024 (default) or something then you'd be getting very large textures.

    A graphics.CopyTexture was fixed with the release about a week ago, so you might want to make sure your updated. If that happens, it usually means the texture arrays don't get packed correctly and show up white, which does not seem to be the case here.

    Another thing you can use is the LOD sampler mode, which is faster than the gradient sampler (but no trilinear or anisotropic is available, which likely doesn't matter for your use case).
     
  8. digzelot

    digzelot

    Joined:
    May 12, 2014
    Posts:
    31
    Thanks for such a fast reply - seriously, it means a lot - I am trying to update versions but it seems maybe unity is bugged for me right now or something - I click on the update button for microsplat and it says "decrypting packages" etc etc, then the update button just stays with "update" text... and when I click update again the button icon just infinitely loops and never seems to finish/never gives me a chance to "import" ... idk whats going on with it

    Also, after I click the Update button in the "My Local Downloads" section - same thing... update never actually seems to update, and when I "import" I get obsolete scene/script error - going to keep trying

    *** Edit - ended up removing the microsplat folder from appdata and after doing so unity would let me download it again, unfortunately the "Update" button never stops saying "Update" ... so I'm not sure if I have latest or not. doing all of this has not fixed the FPS drop on my Pixel. - I also tried changing the settings like you have suggested.
     
    Last edited: Aug 14, 2018
  9. franky_li

    franky_li

    Joined:
    Aug 8, 2016
    Posts:
    158
    Hi Jason,

    the asset store shows me an update for MicroSplat 2.15, but when I update it's still 2.14. Updates for the stream and the blend module are shown as well, but same behaviour.

    Edit: The new asset store is showing the correct version, but still downloads the old one. What a mess:(
     
    Last edited: Aug 14, 2018
  10. digzelot

    digzelot

    Joined:
    May 12, 2014
    Posts:
    31
    I'm having a similar issue. I noticed that other assets in my asset store window are behaving the same way, so i think it may have something to do with unity. It is unfortunate but I imagine will be sorted sooner than later. @jbooth My "Shader Generator" is v:2.1 - does this mean that update is indeed not working? should my shader generator be v:2.15?
     
  11. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,576

    No, the version number is part of the locking mechanism to prevent modules being out of sync. So 2,1 is the series, while 2.15 is the fifth update to thst version.
     
  12. mmaclaurin

    mmaclaurin

    Joined:
    Dec 18, 2016
    Posts:
    244
    The new (beta) asset store is very buggy with regarding to version updates. I recommend going back to the "old" asset store to get update / import tracking that works.
     
  13. franky_li

    franky_li

    Joined:
    Aug 8, 2016
    Posts:
    158
    Same problem with old store!
     
  14. HiWill

    HiWill

    Joined:
    Jun 2, 2013
    Posts:
    14
    microsplat with lightweight shader can't receive shadow. @jbooth
     
  15. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,576
    Last I checked shades produced by Unity’s shader graph did not receive shadows, which is really the only reference available as nothing is documented yet. I’ll check the latest next week to see if they fixed it yet.
     
  16. Xeverian

    Xeverian

    Joined:
    Sep 23, 2016
    Posts:
    12
    Is there any way to 'bake' the shader settings in editor so there won't be any need in runtime scripts? Unfortunately I'm under special circumstances so I can't run any custom scripts. I've tried CTS but it's really slow for my VR project so I'd really like to use Micro Splat instead. (Already purchased the anti-tiling component). I mostly only need per-texture normals strength settings and anti-tiling features
     
  17. m506

    m506

    Joined:
    Dec 21, 2015
    Posts:
    80
    Hi JBooth, I've got at the moment two paid modules (anti-Tiling and Lava) and they work great, and now I am thinking about going for a third (mesh blending). So I have some basic questions before I commit to this.

    I've got hundreds of walls, towers and houses, which I intend to blend with the terrain and I just don't know what would be the overhead of having these blended, so can you please clarify the following:
    - are there any runtime penalties for each object blended or an one off penalty for everything?
    - are the blendable parts, an actual mesh created dynamically, or they are part the terrain itself via a shader?

    So basically I wanted to know if the blending is cpu or gpu based and what is the runtime impact.

    Apologies if the answers were mentioned somewhere here already and thank you for the input.
     
  18. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,576
    By default the object is drawn twice; once with your shader, and a second time with the blend shader. If your using Vegetation studio, it will optimize this by drawing all meshes of a given type in a single instanced draw call. There is a small startup cost to sync the object with the terrain as well.

    The shader cost for the blend shader is based on the terrain shader you generate, as it has to do the same work to match up the pixels.
     
  19. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,120
    So I figured out what's behind the problem (or at least one problem) that I've been having with terrain blending -- the problem being that models with the blending component are black, except at the edges where the blending occurs. Bu t this problem goes away if I disable Triplanar mode. (Both Triplanar and Height blended options.) And then it returns when I re-enable that module. Any idea why that could be happening, or how to fix it?

    Mac High Sierra, Unity 2018.1.7, latest version of MS.

    thanks
    Dave
     
  20. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,576
    No, and as you know it doesn’t repro when I simply set up my shaders the same way and does’t seem to repro for you in a new project, so I figure it must be some combination of settings unique to your project. So without that, it’s not really possible for me to help much. If you can break out a project that reproduces the issue, then I can likely figure out what is happening.
     
  21. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,120
    Well, looks like I was finally able to solve it by simply duplicating and copying the "MicroSplat_TerrainObjectBlend" material from your TerrainBlending/Example folder into my terrain's MS folder and assigning it to the terrain. Hopefully that'll fix it for good. Whew!
     
  22. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,576
    That will most likely make it sync with the example terrains settings and textures..
     
  23. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,120
    Yeah, I thought that might happen, but it's using my terrain textures for sure. It is using the shader from the Example terrain, though, so.....yeah, this is weird. And the UV scale doesn't match between my terrain and my mesh object. I've tried changing the UV scale on the Triplanar on both my and the example MicroSplat materials, no help. Obviously this is a screwy type of solution, but any suggestions on how to force it to respect my terrain UV scale?
     
  24. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,576
    Use the material it created in the MicroSplatData directory instead of the one in the example folder. That’s the one that’s being synced to your settings.
     
  25. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,120
    That's the problem -- there isn't one in my MicroSplatData directory. The BlendWIthObject shader is there, but it refuses to generate a material. (But that's not the only problem: In another scene/terrain, MS does generate a BlendWIthObject material, but I have the same black mesh issue when I enable Triplanar on that MicroSplat material. So I have two problems, no idea if they are related, but the black-mesh issue is project-wide, not specific to a terrain as I'd been thinking.)
     
  26. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,576
    There’s nothing special with the material; you could create it and assign the shader manually. As for the black issue, if you can get it to repro in a project you can send I’m happy to look tat it, but without a repro there’s not much I can do.
     
  27. JJango

    JJango

    Joined:
    Jun 3, 2018
    Posts:
    7
    Hi jbooth,

    Do you know if it is possible for terrain blending to work with the roads made with Easy Roads 3D? I currently get "terrain not detected below object, nothing to blend with". Although it is working with other objects. The road I am testing with is a single mesh but maybe somewhere on the mesh it doesn't collide? I have tried adding a box collider on a whim but no luck. Can you think of any other restrictions which may be linked to this issue that I could look for and try and resolve?

    ..or could it be that the mesh is basically a plane and microsplats terrain blending wants some vertical? We basically want the terrain to creep over the edges of the road.

    Thanks!

    Edit:spelling
     
    Last edited: Aug 21, 2018
  28. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,576
    It uses the pivot point to rayxast down and find the terrain to blend with, so if that was not above the terrain that could be the issue.
     
  29. JJango

    JJango

    Joined:
    Jun 3, 2018
    Posts:
    7
    Looks like this is most likely the case. All the objects seem to have the same pivot, at the origin, rather than being centred to the each seperate object. So the pivot is miles away which is unfortunate as it means easy roads probably wont work for us with other parts of our project either.

    Thanks for the help.
     
  30. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,576
    It wouldn’t be hard to add a direct pointer for the terrain to source from instead of it being detected.
     
  31. JJango

    JJango

    Joined:
    Jun 3, 2018
    Posts:
    7
    Did you manage to fix this issue? I've tried to follow your posts but it's not clear to me whether you did or not. Here's a couple of screenshots which I believe I have reproduced if you are still in need of a repro project.

    These are with triplanar on and shows the stretching, the offset and where the stretching stops and the triplanar is working.

    https://gyazo.com/5944406ee254c9b79dd3b36dee2ef23a
    https://gyazo.com/0fd405da53bcfac5950f576b55674a81
    0fd405da53bcfac5950f576b55674a81.jpg
    5944406ee254c9b79dd3b36dee2ef23a.jpg
     
    Last edited: Aug 21, 2018
  32. JJango

    JJango

    Joined:
    Jun 3, 2018
    Posts:
    7
    Thanks, I think this is what we will do. We're just going to have to edit easyroads a little more than anticipated.
     
  33. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,576
    I fixed some of these issues a while back; by chance has the terrain data texture in the MicroSplatData directory gotten set to gamma instead of linear?
     
  34. JJango

    JJango

    Joined:
    Jun 3, 2018
    Posts:
    7
    The sRGB (color texture) option right? No, that is unchecked. I saw your earlier post about that one so looked for that first.
     
  35. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,576
    If you want to package up a repro I can look at it next week.
     
  36. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    984
    Does MicroSplat have a module for procedurally applying textures based on high, slope and mask? Thanks.
     
  37. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,576
    Nope, but there are several tools to do that already in the store.
     
  38. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    984
    Thank you for your reply. I've run into limitations with one of the more popular ones. Looking at your Mega vs Micro page, can MegaSplat be converted back into a mash or terrain. Can it export splay, color and/or normal maps?
     
  39. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,576
    MegaSplat runs on terrains or meshes, but uses its own format and tools for splat mapping which is quite different than Unity’s. It can bake out a resulting diffuse/normal/etc, but only if the UVs are non overlapping and in the 0 to 1 space.

    For Unity terrain work I consider MicroSplat the supperior product..
     
  40. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    984
    My preference is to use a mesh, but I need to use procedural texture generation / painting. I start with real world contours and create a mesh. Bring it into Unity and create a terrain out of it. Then back to a mesh with exported splats. The tool I've been using does a great job of terrains it creates. But not with existing terrains.
     
  41. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,576
    MegaSplat has a texture graph for procedural texturing, along with a runtime procedural system. That said, it uses a custom splat map format and does not export to standard formats.
     
  42. mmaclaurin

    mmaclaurin

    Joined:
    Dec 18, 2016
    Posts:
    244
    1. Thank you for the wetness height filtering.
    2. I can't figure out how to use it. :'^\
    3. A little bit of confuzzlement in the UI:
    - Stream Height Filter is indented under Lava
    - Should there be a setting for overall Wetness Height Filter?
    4. Don't know how to use the 4-vector for Height Filtering - nothing I change there changes the overall specular response for wet ground.
    5. There are now two PDFs documenting wetness, but neither describe the height filtering (that I could find - looking in Microsplat>Streams>Documentation

    Thank you for implementing this - it's going to be a great improvement.

    upload_2018-8-23_22-5-29.png
     
  43. mmaclaurin

    mmaclaurin

    Joined:
    Dec 18, 2016
    Posts:
    244
    Update: found "Specular Fade" but can't make it work - I see there is a two-vector there but:
    - I'm trying to make the specular fade out below 55 height (y)
    - Is it (height_above_which_full_specular, height_below_which_no_specular) or the inverse? Plugging in numbers with either of these interpretations (55,50) or (50, 55) still leaves areas will below 50 very shiny.

    Fun note: the reason I couldn't find "height filter" in the docs is that it doesn't appear in the text, just the image. But it is in there.

    Thanks, almost home...
     
  44. HiWill

    HiWill

    Joined:
    Jun 2, 2013
    Posts:
    14
    any progress about this issue?
     
  45. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,576
    Not yet, won’t be back at home until Monday..
     
  46. mmaclaurin

    mmaclaurin

    Joined:
    Dec 18, 2016
    Posts:
    244
    Wondering if it's conceptually possible to have Microsplat use the base texture when rendering in reflections? Possibly by setting some state on the shader before rendering the reflection?
     
  47. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,576
    You mean the base map unity uses? Not really - it wouldn’t match MicroSplat’s shader since Unity doesn’t give you any access or way to customize this data. You can, however, render out your terrains albedo/normal/etc to textures, and use this with a traditional shader for things where it makes sense to do this.
     
  48. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,120
    Regarding Sampler Mode: It should be set to Default by, uh, default, right? It's always set to Gradient for me, and when I try changing it to Default, nothing happens (no reimport of shader, nothing, just remains on Gradient). And what IS gradient sampler, anyways? It's not mentioned in the Per-Tex section of the core documentation.

    The issue is lack of aniso on terrain textures; would Default do better than Gradient?
     
  49. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,576
    If you are using per texture UV scale then it has to be either LOD or Gradient, and forces you not to use default. In Gradient mode, aniso should work (make sure to set it on the texture array, not the source textures).
     
  50. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,120
unityunity