Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    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. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    579
    So Unity confirmed it's bug and will fix it soon.
     
  2. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,716
    MicroSplat uses the Unity Terrain systems splat map data; so if you want to use a splat map from an external source you will need to apply it to the terrain however you’d do that normally.
     
  3. Harjawalda

    Harjawalda

    Joined:
    Sep 1, 2018
    Posts:
    10
    Thanks for the reply, I do use a script provided by WM for the import of the splatmap. Now the issue I have is, when I convert the Terrain to microsplat, the general distribution of the textures seems to be taken into account but I loose all the details (errosion, waterflow). I hope the screenshot comparison helps, is there a way to preserve the detail? I'd love to use your tools but when I loose all the detail I worked to get from WM, I'm basicly starting from scratch. I'm new to world design so I dont know if that workflow Im proposing is feasible or not. TIA.

    Mount-Test-V2.jpg

    Nevermind, Height Based Blending needs adjustment all works fine!
     
    Last edited: Oct 22, 2018
  4. bodzi0x95

    bodzi0x95

    Joined:
    May 16, 2018
    Posts:
    11
    Hi,
    I have a little problem with microsplat. I added microsplat to one terrain and it works ok but next I added it to second terrain and it looks like some of textures have correct brightness and contrast and some of them have washed out colours. The same textures work well on first terrain.
    I'm using linear color space and on first terrain all textures looks great but on second terrain some of them look like linear color space and other look like gamma color space. All textures are imported in correct way. Unfortunatelly I can't post any screenshots because I can't spread this kind of data.
     
  5. Amenophis-Memnon

    Amenophis-Memnon

    Joined:
    Sep 22, 2016
    Posts:
    3
    Hi! Thanks for your work! I'ts incredible and so easy to use.
    I have a cave entrance model that uses same rock texture as my terrain. How to give him the same look as MicroSplat shader? It's possible with standard shader? If not, can you create a shader for meshes without textures array? I just want the same look, not a paintable mesh (i know you make a new module thats make that but i not need that)
     
  6. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,716
    You likely want to select both terrains and convert them together, otherwise you'll have two sets of textures/shaders/materials for each instead of one. Why one would look different than the other, I'm not sure- I would expect them to work the same, unless you added the additional maps (smoothness, etc) only to one of the texture array configs you generated.
     
  7. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,716
    The easiest way would be to use the terrain blending module and blend them.
     
  8. bodzi0x95

    bodzi0x95

    Joined:
    May 16, 2018
    Posts:
    11
    It's a specific case to have 2 terrains which must have different settings for textures etc.
    I don't have any other additional maps beside height and normal. It isn't look like some textures have additional maps or not, it rather looks like some of them use gamma color space and other uses linear :/
     
  9. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,033
    I'm finally using the mesh tool, and it's working very nicely! But is there a way to save the generated meshes in the scene as meshes or prefabs or assets or something, so I can copy-paste them into another scene?
     
  10. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,716
    It doesn't generate new meshes, so you should be able to prefab them just fine.
     
  11. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,033
    Sorry, that's what I was trying to say -- there is no mesh if I make a prefab -- the Mesh Filter component is empty.
     
  12. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,716
    You mean like it goes away? It should just reference whatever mesh you were using, which I assume is an FBX or something on disk, right?
     
  13. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,033
    sorry, i mean when I use the Terrain to Mesh converter -- those generated meshes.
     
  14. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,716
    Pretty sure they get written to disk. I'll test and see if the reference clears for me, maybe something isn't being dirtied that should.
     
  15. diego_ger

    diego_ger

    Joined:
    Dec 17, 2017
    Posts:
    8
    Hello. Is there a limit in the size of the splatmap for the terrain? Is it posible to make it bigger than 2048x2048?
     
  16. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,716
    The splat maps come from the Unity Terrain system, so it’s limited to whatever they generate (the shader will work for any size)
     
  17. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,033
    I select a folder in the project for the converted files to be saved to, and the splat/control maps are generated there, but no meshes -- at least not in several attempts I've made.
     
  18. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,716
    fixed
     
  19. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,033
    thank you!
     
  20. marcmantraunity

    marcmantraunity

    Joined:
    May 31, 2014
    Posts:
    16
  21. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,716
  22. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    280
    @jbooth I've been getting endless copytexture errors in the latest few 2018.3 betas and Microsplat appears broken. I think you said Unity had broken something? Any guess when that might be fixed? Cheers.

    Code (CSharp):
    1. Image invalid format!
    2. UnityEngine.Graphics:CopyTexture(Texture, Int32, Int32, Texture, Int32, Int32)
    3. JBooth.MicroSplat.TextureArrayConfigEditor:CompileConfig(TextureArrayConfig, List`1, String, Boolean) (at Assets/MicroSplat/Core/Scripts/Editor/TextureArrayConfigEditor.cs:1379)
    4. JBooth.MicroSplat.TextureArrayConfigEditor:CompileConfig(TextureArrayConfig) (at Assets/MicroSplat/Core/Scripts/Editor/TextureArrayConfigEditor.cs:1538)
    5. JBooth.MicroSplat.TextureArrayPreProcessor:OnPostprocessAllAssets(String[], String[], String[], String[]) (at Assets/MicroSplat/Core/Scripts/Editor/TextureArrayPreprocessor.cs:48)
    6. UnityEditor.AssetDatabase:CreateAsset(Object, String)
    7. JBooth.MicroSplat.TextureArrayConfigEditor:CreateConfig(Terrain) (at Assets/MicroSplat/Core/Scripts/Editor/TextureArrayConfigEditor.cs:359)
    8. MicroSplatTerrainEditor:OnInspectorGUI() (at Assets/MicroSplat/Core/Scripts/Editor/MicroSplatTerrainEditor.cs:67)
    9. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    10.  
     
  23. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,716
    I submitted a bug to them about it- so no, I have no idea when they are going to fix it.
     
  24. PeterB

    PeterB

    Joined:
    Nov 3, 2010
    Posts:
    342
    I have a couple of questions. I'm running on Mac, latest 2018.3 beta 7, but the problem has existed for a very long time and in much earlier versions.

    MicroSplat works very well, except for one thing: when I save the project, no matter whether there are changes or not, all terrains go from this:

    Screenshot 2018-10-27 at 12.45.55.png

    to this:

    Screenshot 2018-10-27 at 12.47.59.png

    That is, MicroSplat is disabled and all terrains (there are several) revert to the standard shader. I have no idea why, and there's no special code that I know of in the project which could cause it. I'm also wondering about that warning.

    Running the project fixes this, but there's no way to revert back to MicroSplat in the editor unless you do it manually.

    The second question has to do with the new instanced terrains. Enabling "Draw Instanced" disables drawing of the terrain entirely. It's just not visible.

    Is this particular to Metal on Mac, is it due to the beta status of 2018.3, or is Draw Instanced terrain mode not supported by MicroSplat yet?

    Thanks in advance.
     
  25. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,716
    I think there's code in OnDisable that reverts the terrain, this is so people can switch off MicroSplat and compare vs. regular terrain. Is this causing an issue?

    Instance Terrain Mode is supported, but written for 2017.3. I personally cannot get MicroSplat to work on the latest 2018.3 betas because of a CopyTexture bug Unity introduced in Beta 5, so I'm surprised it's working at all for you in 2018.3.7
     
  26. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    280
    Cool. Is there somewhere we can upvote your bug report?
     
  27. SOIL

    SOIL

    Joined:
    Sep 2, 2011
    Posts:
    143
    (post deleted) ups wrong thread! xD
     
    Last edited: Oct 28, 2018
  28. PeterB

    PeterB

    Joined:
    Nov 3, 2010
    Posts:
    342
    Well, if the OnDisable code is triggered in connection with a save and thereby disables MicroSplat, then yes. Why would I want to see my terrains in regular render mode after a Save? Especially if there's no way of switching them back except by running the app again? But I'm perhaps misunderstanding something.

    It works just as it always has in the latest betas. Perhaps the bug doesn't manifest on Mac?
     
  29. Bzuco

    Bzuco

    Joined:
    Sep 6, 2015
    Posts:
    44
  30. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,716
    Well, then something in your code base is disabling it and not re-enabling it after the save. A save doesn't trigger the disabling of components.

    I dev on a Mac..
     
  31. PeterB

    PeterB

    Joined:
    Nov 3, 2010
    Posts:
    342
    I'll PM you about this, as there are no non-standard components in the code base.
     
  32. Bzuco

    Bzuco

    Joined:
    Sep 6, 2015
    Posts:
    44
    Hi,

    it is somehow possible reduce terrain SplatAlpha0, SplatAlpha1, .. files which are compressed as ARGB 32bit (21.3MB each)?
    My scene consist from 16 terrains, each 2k size and for now I am using 6 textures, so size of the build is around 1GB.
    If it is possible force unity to compress SplatAlphas with DXT5 it will be significant reduction in build size. I dont need super quality in texture blending, so DXT5 should be OK.

    I tried Source Texture Size set to K32, but I am not sure if this option is affecting SplatAlpha terrain files.
     
  33. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,716
    Funny, I just added a feature that might make this possible. Source texture size does not affect the Splat maps; those are generated by Unity and passed to the shader automatically.

    In the latest version, I added a feature so you can use external splat maps instead of Unity's. What you can do is export the splat map data (no tool for that included, but easy to write) and compress it however you like. Then set MicroSplat to use the external splat maps and assign the output splat maps. Finally, you can set the terrain's alpha map size to 16 or something so that Unity's ones are tiny. This would be a destructive operation, but if you do it at build time and don't rely on the alpha map data for anything, it should work fine and allow you to compress those textures.
     
  34. Bzuco

    Bzuco

    Joined:
    Sep 6, 2015
    Posts:
    44
    I was already using custom splatmaps, but this part of workflow I overlooked in terrain options. Now the build size is reduced. Thanks for help.
     
  35. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    280
    I'm on a Mac as well and getting the same issues as @jbooth in 2018.3b7 (since about 2018.3b4 I think).
     
  36. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,716
    Unity broke CopyTexture in 2018.3b4, so until they fix that I wouldn't expect the beta to work.
     
  37. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    280
  38. Bzuco

    Bzuco

    Joined:
    Sep 6, 2015
    Posts:
    44
    Hi,

    if I enable tessellation with Use custom Splatmaps, my terrain turns white from camera position to max tessellation distance and unity throws shader error: "undeclared identifier '_Control1' at line 725 (on d3d11)".

    In MicroSplatConfig I am using 6 textures , packing mode fastest, PBR.
    MicroSplat material: packing mode fastest, max texture count 8.

    Both tessellation and custom splat maps options ON are working only if I set max texture count 4. All other options 8 - 32 throws error and white terrain. Parallax + custom splat maps are working OK.
    tessellationCusomSplatMaps.jpg
     
  39. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,716
    Ah, I’ll check it out and upload a patch; I think I know what I missed.
     
    mmaclaurin likes this.
  40. erenaydin

    erenaydin

    Joined:
    Mar 1, 2011
    Posts:
    366
    Anyone figured out to fix the texture array bug until the official release come?

    This is my only error with Unity BETA 2018.3.0b7
     
  41. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,716
    Nope, waiting on Unity as it's in their code..
     
    erenaydin likes this.
  42. Bzuco

    Bzuco

    Joined:
    Sep 6, 2015
    Posts:
    44
    Hi

    few questions:
    Is is possible to implement mipmaps streaming for texture arrays, or we need to waint first for unity implementation?
    Crunched DXT compression(in texture arrays) - is there some performance drop compared to the default DXT?
    How far is development of Microsplat for mesh module? :)
     
  43. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,716
    Unity would have to implement that- not sure if texture arrays even support that kind of a thing anyway. I haven't experimented with crunch much, but my understanding is that it's entirely a loading optimization and completely uncompressed to DXT by the time it gets to the GPU.

    Mesh module has been done for ages- I just haven't made the marketing images and such..
     
    Bzuco likes this.
  44. eaque

    eaque

    Joined:
    Aug 20, 2014
    Posts:
    596
    Hi, Early this year i used to have some artifacts on textures using Microsplat (on my old 660 ti):oops: i did a test in U2018.2.13 with the last update of your asset !! and now everything seems fine!:):)

    Glad i bought the anti tile module a long time ago! I'm gonna dive into MicroS now! It performs real fast considering my needs!

    I have a general question, considering my low end GPU, do you think using U2018 instead of U5.6 is gonna make me lose Some fps in my project? (wich seems to be the case but not much)or maybe improve? (which i doubt a lot).
    I'm thinking of MicroS to balance this general fps lose.

    Edit: And BTW is there any issue with VS Pro version? The author says it was rewritten so maybe things are different now...??

    thanks
     
    Last edited: Nov 7, 2018
  45. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,716
    I wouldn't know about unity versions and speed- you'd have to test. As far as I know everything is fine with VSPro- if there are issues, Leonart and I would fix them.
     
    eaque likes this.
  46. eaque

    eaque

    Joined:
    Aug 20, 2014
    Posts:
    596
    Many thanks for your prompt answer! Great news!
     
  47. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,716
    It's hard to say without examining each device under a profiler- android devices are really wacky and have a ton of inconsistencies in terms of how they are actually built, though I would expect a pixel and S8 to both have fairly decent hardware. Some things to check:

    - Make sure the texture arrays are being compressed into the correct texture format (ETC2); if for some reason they aren't, then they'd end up being uncompressed, which will destroy memory bandwidth.
    - Try reducing texture res to see if it helps- this will only help if your memory bound, which is usually not the case.
    - Can you post your material settings so I can see which options you have on?
    - Using LOD sampler mode can speed things up a bit, but will cause some blurriness in some cases.
    - Make sure blend mode is set to Quality when using max 4 textures. If it's not set to quality, then it still has to sort the samples, which can be expensive on mobiles.
     
  48. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,716
    Do you have a shader profiler for android? Because that would be the best way to track it down. I normally do mobile optimizations on Instruments, because it can show you how long you are spending on each section of the shader code, which is incredibly useful, but I'm not sure if something like that exists for Android because the architecture is so varied. Likely it would come from the GPU manufacturer for that particular device. However, if your getting other artifacts it might not be MicroSplat at all, because it doesn't really mess with rendering order and such, it's just a surface shader.
     
  49. hungrybelome

    hungrybelome

    Joined:
    Dec 31, 2014
    Posts:
    275
    Actually, after some more testing, I think your suggestions on the material settings helped quite a bit. It turns out that I also had some accidental high aniso settings for the texture arrays that I think were also affecting performance. I think the MicroSplat material still performs better on iOS than Android, but now the performance is much closer, and usable on Android. Also, I was completely mistaken about the aforementioned artifact: It was purely due some bugs in my app code.

    Really sorry about the misleading posts, I have now deleted them.
     
  50. sylon

    sylon

    Joined:
    Mar 5, 2017
    Posts:
    242
    Do you have documentation on how to do this?
    I managed to adjust the base shader to accept my Rendertexture and integrate it into the streams code.
    Looks great btw :)
    But how can i make this a module that integrates into your system?