Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We are updating our Terms of Service for all Unity subscription plans, effective October 13, 2022, to create a more streamlined, user-friendly set of terms. Please review them here: unity.com/legal/terms-of-service.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice
  4. Join us on Thursday, September 29, for a day with Unity's SRP teams here on the forum or on Reddit, and discuss topics around URP, HDRP, and the Scriptable Render Pipeline in general.
    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. Lesnikus5

    Lesnikus5

    Joined:
    May 20, 2016
    Posts:
    131
    Good day!

    Are there any reasons why, when using custom splatmaps, MicroSplat adds Terrain Layers to the terrain? I tried to delete them manually, but when I start the play mode, they are restored automatically from MicroSplatConfig:

    Безымянный2.jpg

    I use custom splatmaps, I don't need standard TerrainLayers on terrain. Due to their presence, 1.5-2 ms is added in each frame somewhere in the internal structures of the Unity engine, in the function Terrain.UpdateSplatProperties. There are 256 terrain tiles on the scene. When using custom splatmaps, are this required for something? I would like to do without them, since 2ms is a good win. Is it possible to make MicroSplat not add them to the terrain?
     
  2. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,278
    Yeah, I could add some kind of check to make them stop creating them. Right now it assumes if you have textures you need layers for them, which isn't the case for you. However, I wouldn't expect them to have any cost other than some cruft on disk..
     
  3. Lesnikus5

    Lesnikus5

    Joined:
    May 20, 2016
    Posts:
    131
    There are some problems when there are many terrain tiles. It was worse Unity 2020.1, then they fixed the terrain systems, but not completely. In my case, I have 256 terrain tiles on the scene and having Terrain Layers adds 1.5-2 ms without any benefit. Removing of Terrain Layers removes this cost.

    MicroSplat 3 3.jpg

    Without MicroSplat 3.jpg
     
  4. TopherGopherman

    TopherGopherman

    Joined:
    Sep 15, 2020
    Posts:
    2
    After upgrading from Unity 2019.4.4 to 2020.2.6 my terrain has turned white. I updated to the latest version of MicroSplat hoping this would solve the problem. It didn't seem to help so I brought in terrain I had saved before converting and tried converting the material again. Unfortunately, I'm getting an error on the MicroSplat material connected to the terrain which states "Can't use materials with shaders which need tangent geometry on terrain, use shaders in Nature/Terrain instead." Any ideas as to what would cause this issue?
     
  5. Nyphur

    Nyphur

    Joined:
    Jan 29, 2016
    Posts:
    45
    MicroSplatTerrainBlending.cs line 116 is trying to set a variable MicroSplatShaderGUI.MicroSplatCompiler.AuxShader.options that doesn't seem to exist. Everything is updated to the latest versions. Commenting out that line didn't seem to make a difference, it still appeared to work fine
     
    SideSwipe9th likes this.
  6. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,278
    The variable does exist because you have an older version of one of your modules. The package manager lies, and gives you and old version, telling you that you have latest. You have to clear the package manager cache before updating anything, because Unity can't even get downloads to work right..
     
  7. Nyphur

    Nyphur

    Joined:
    Jan 29, 2016
    Posts:
    45
    Cheers, christ this must be a support nightmare for creators.

    While I'm here, I'd like to throw another vote in for implementing assembly definitions in the future if possible. I know your stance on them (saw on the Discord), but the way microsplat's folders are organised and the fact that some of the modules communicate means it can never be used with assembly definitions even if we set them up ourselves. Anyone on a large enough project will be using them, so we have to break your folder structure and that leads to more support issues on updates.
     
    SideSwipe9th and gecko like this.
  8. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,278
    There's no way I'm radically changing the structure of MicroSplat any time soon, as the package manager bug alone makes doing any large changes a support nightmare. Any time I fix a bug, I still get a support request for it indefinitely because the package manager keeps telling everyone they have the latest version when they don't, and I get people swearing up and down that I haven't fixed certain bugs when I have, etc, etc. And if a bug is subtle and can be described several different ways, I have to triangulate which bug it might be just to figure out if it might have already been fixed but they are running into the PM bug again.

    The idea of completely restructuring the project and introducing all kinds of interfaces to get around the one way assembly definition rules and then getting 1 star reviews because the package manager won't update thing correctly does not sound like a good use of my time right now.
     
  9. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    2,937
    I was given the pleasure to check out the upcoming realistic Wolf by Malbers. Of course I had to add Trax to it to see the footprints :D Again, Trax adds so much to the overall atmosphere while keeping excellent performance :) Here are a few shots in case anyone is interested, I didn't have time to make a vid yet which shows the effect better, but it'll come:

    trax 01.jpg
    trax 02.jpg
    I changed the blend mode in this one in order to show the effect better:

    trax 00.jpg
     
    Vondox, protopop and ledshok like this.
  10. Kojote

    Kojote

    Joined:
    May 6, 2017
    Posts:
    141
    Hi! Once again a question about the shader. When I load in graphics in MicroSplatConfig and do not make any settings, the textures are displayed way too bright. It is a startup scene with no content. I could also exclude other influences. It's just that all textures are too bright. Example: orange becomes almost neon yellow.

    Does anyone have any ideas?
     
  11. m506

    m506

    Joined:
    Dec 21, 2015
    Posts:
    93
    Hi, in regards to the streams/puddle module, I can see that if I have the tesselation module active, the terrain will get automatically tesselated up in the places I paint these effects. Is this intended behaviour or a bug?
     
  12. Lesnikus5

    Lesnikus5

    Joined:
    May 20, 2016
    Posts:
    131
    Hello!

    I'm using custom splatmaps and can't figure out why layers from the second splatmap don't work. There are 8 layers on the terrain. In the inspector, I adjust color0 for texture0 and the first 4 layers are shown. But when I adjust the color1 applied to texture1 the last 4 textures don't work. None of the values are taken into account.

    What am I doing wrong?

    Code (CSharp):
    1.  
    2.         public Color color0;
    3.         public Color color1;
    4.  
    5.         Texture2D texture0;
    6.         Texture2D texture1;
    7.         public MicroSplatTerrain mst;
    8.  
    9.         private void Awake()
    10.         {
    11.             texture0 = new Texture2D(513, 513);
    12.             texture1 = new Texture2D(513, 513);
    13.             mst.customControl0 = texture0;
    14.             mst.customControl1 = texture1;
    15.         }
    16.  
    17.         private void Update()
    18.         {
    19.             texture0.SetPixel(256, 256, color0);
    20.             texture1.SetPixel(256, 256, color1);
    21.             texture0.Apply();
    22.             texture1.Apply();
    23.             mst.Sync();
    24.         }
    25.  
     
  13. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,278
    Yes, you are increasing the water height. Likely what you want to do is adjust the original textures displacement offset that the center point is lower..

    Your splat map should total 1, so if you have several textures you need to normalize the values to total 1 across all the splat map channels.
     
  14. m506

    m506

    Joined:
    Dec 21, 2015
    Posts:
    93
    Hi, thanks for replying. I think it would make sense to tesselate up earth/grass etc on streams, but in my case a ground stone tile is being tesselated and all the tessalation texture properties is set to 0. This is causing the character to "enter" the stones. Can I please ask you to consider adding a flag to disable that in future releases? If you think that is not a good idea no worries I can try hacking the code, so please let me know.
     
  15. TopherGopherman

    TopherGopherman

    Joined:
    Sep 15, 2020
    Posts:
    2
    After I add the Micro Splat Terrain component to my terrain and then press convert I get the following error message.

    Code (CSharp):
    1. Trying to access current progress scope, but the scope stack is empty
    2. UnityEngine.StackTraceUtility:ExtractStackTrace ()
    3. JBooth.MicroSplat.TextureArrayConfigEditor:CompileConfig (JBooth.MicroSplat.TextureArrayConfig,System.Collections.Generic.List`1<JBooth.MicroSplat.TextureArrayConfig/TextureEntry>,string,bool) (at Assets/MicroSplat/Core/Scripts/Editor/TextureArrayConfigEditor.cs:1732)
    4. JBooth.MicroSplat.TextureArrayConfigEditor:CompileConfig (JBooth.MicroSplat.TextureArrayConfig) (at Assets/MicroSplat/Core/Scripts/Editor/TextureArrayConfigEditor.cs:1870)
    5. JBooth.MicroSplat.TextureArrayConfigEditor:CreateConfig (UnityEngine.Terrain) (at Assets/MicroSplat/Core/Scripts/Editor/TextureArrayConfigEditor.cs:572)
    6. MicroSplatTerrainEditor:DoConvertGUI (MicroSplatTerrain) (at Assets/MicroSplat/Core/Scripts/Editor/MicroSplatTerrainEditor_Convert.cs:295)
    7. MicroSplatTerrainEditor:OnInspectorGUI () (at Assets/MicroSplat/Core/Scripts/Editor/MicroSplatTerrainEditor.cs:93)
    8. UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
    9.  
    I can see that the textures have been converted and are part of the config data, they just aren't showing up on the terrain. I'm running Unity 2020.2.6 and MicroSplat 3.733
     
  16. McNellis

    McNellis

    Joined:
    Jan 8, 2015
    Posts:
    5
    Hi again. I'm back with my normal map issue.
    - Tried to put microsplat files in individual folder. No luck.
    - Tried to manually assign normal map array file to shader. Still nothing. It displays correctly in array though.

    So I noticed there is this 2 files
    MicroSplatConfig 2_normSAO_tarray and MicroSplatConfig 2_normal_tarray
    I expect MicroSplatConfig 2_normal_tarray contains all normal map data, and it looks like it does. At least it looks the same as assigned normal maps in config.
    But as a matter of fact, MicroSplatConfig 2_normSAO_tarray contain this "stuck" normal map I was fighting with.
    And it seems microsplat read exactly this file. Because deleting it led to complete loss of normal map in shader.
    So changing normal maps in config don't affect this array, but erasing it kills all of normals. And it's not clear how I can generate this file back.

    Maybe I have to assign array files somewhere else other than MicroSplat 2 shader? Because assigning different array files from other configs didn't give any visible results.
     
  17. McNellis

    McNellis

    Joined:
    Jan 8, 2015
    Posts:
    5
    Looks like deleting "tarray" files leads to complete loss of it data in shader, which is obvious. But I can't recover it in shader even though MicroSplatConfig generate them anew on "Update".
    Is it one way procedure on creating material?
     
  18. GarrettF

    GarrettF

    Joined:
    Jul 4, 2019
    Posts:
    43
    Hey your terrains look amazing! Thanks for sharing. I'd like to ask you a few questions if I may.

    So your terrains shape/geometry was designed in World Creator? The mountains look perfect and the geometry is blended nicely. Is this set in world creator and can you still modify them using the terrain tools in unity?

    Also what exactly do you use to get the textures automatically spread over parts of your terrain? Is it a combination of settings in microsplat or world creator? If there are certain modules in microsplat that project the textures exactly like how you have them I'd like to know. I've been trying to get my textures to project like that for a while and haven't been able to.

    Thanks!
     
  19. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,278
    Press Update on the texture array config and it will generate the _tarray files.
     
  20. SmithySFC

    SmithySFC

    Joined:
    Jan 15, 2021
    Posts:
    8
  21. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,530
    When I generate terrains they use at most 2 custom splat maps. Is there a setting I should be changing to reduce the number of custom splat map slots since they're unused? Or is there always 8 empty slots?

    BTW I am using 8 terrain textures o the MicroSplat config. Im not sure if that number 8 has anything to do with the number splatmaps used?

    Screen Shot 2021-03-04 at 5.26.13 PM.png
     
  22. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,278
    no, it just shows the max possible in that UI.
     
    protopop likes this.
  23. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,530
    Cool - thanks Jason
     
  24. hauwing

    hauwing

    Joined:
    Dec 13, 2017
    Posts:
    69
    hello, may I know whether MicroSplat and it's modules support DOTS Hybrid Renderer (which in turn only support HDRP and URP)? thanks
     
  25. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,278
    No, the hybrid renderer is very much in alpha, and the first version lasted, what, 4 months before they killed it and replaced it with V2? Terrain also doesn't render with the hybrid renderer, so not a lot of reason you'd use it.
     
  26. McNellis

    McNellis

    Joined:
    Jan 8, 2015
    Posts:
    5
    It does. Except _normSAO_tarray file. Which is, as it appears, responsible for normal maps.
    But again. Once tarray files deleted and generated again, material no longer see\connected to this files. So I see blank material with no textures or whatsoever.
    upload_2021-3-5_19-20-12.png

    Assigning _tarray files manually give no result.
    Or am I doing it wrong?
     
  27. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,278
    You need to assign them to the material, like any other texture - you'd assign it to the material, not the shader itself.. Also, if you are not getting a _normalSAO file, it's because you've change the texture array packing mode to something other than fastest..
     
  28. Rastapastor

    Rastapastor

    Joined:
    Jan 12, 2013
    Posts:
    345
    Everything was done in World Creator (standalone), from terrain shape to texturing. World Creator have some rules implemented that helps with paintnig textures. I simply create eveyrthing terrain related and import it to Unity. I haven't used yet the procedural texturing from Microsplat, so hard to tell if Microsplat can do what World Creator does, especially the concave and convex distribution for textures.
     
  29. carlyyzo

    carlyyzo

    Joined:
    Mar 6, 2021
    Posts:
    1
    Well, could be a ton of different things, actually. First, can you repro on URP 7 series to make sure it's not a URP version thing?

    ----
    Best regards Palu "carlyyzo"
     
  30. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    2,937
    Animated Trax is always better than images :)



    Performance is awesome. Every single Wolf is on the Trax layer.
     
    Last edited: Mar 6, 2021
  31. Glacier-Games

    Glacier-Games

    Joined:
    Jan 26, 2013
    Posts:
    11
    Hey there! Just downloaded MicroSplat and love it! However, I'm working in HDRP and downloaded the HDRP module and the Anti-tiling module, and all of it seems to work well except for the distance resampling. The "Resample Begin/End" parameter seems to have no effect, and I can see the larger scaled texture albedo and normal at any distance, no matter what I set it to.
     
  32. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,278
    Yeah, a patch for that should be available on monday..
     
  33. andrew210

    andrew210

    Joined:
    Apr 23, 2014
    Posts:
    221
    Since moving to Unity 2020.2.X we've encountered this issue with our microsplat, but only on iOS. Downgrading back to 2020.1.X fixes the issue (I'm assuming its something in Core RP Library which is 10.x.x in 2020.2 and 8.x.x in 2020.1)

    I've removed anything microsplat, redownloaded (now using 3.733 from March 4th) and reimported it all and recreated it but no luck. Enabled modules (for mobile version of the game) include Streams&Lava + Detail noise. I've been eagerly awaiting new versions of the Core RP library and patches for unity over the past few weeks to see if they'll fix it their side but wanted to check to see if anyone else has an idea what could be going wrong.

     
  34. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,278
    I only support SRPs in LTS versions of Unity, which should be fairly soon for 2020.3. That said, there’s no description of what the actual error you have is?
     
  35. andrew210

    andrew210

    Joined:
    Apr 23, 2014
    Posts:
    221
    I see thank you! The main motivator for using 2020.2 is because unity crashes on startup on macs unless i delete projectsettings.asset before every load. I'll persevere and await 2020.3. I didn't see any console errors or anything thrown but will have a second look as soon as i start work tomorrow to see if i can help with anything.
     
  36. andrew210

    andrew210

    Joined:
    Apr 23, 2014
    Posts:
    221
    Code (CSharp):
    1. Autoconnected Player async texture load: failed to load MicroSplatConfig_normSAO_tarray from /private/var/containers/Bundle/Application/C20D9C3A-4718-4187-9AA0-41E31E3DFF76/HorseAcademy.app/Data/sharedassets5.assets.resS
    Sorry I didn't find this originally, but this would appear to be the culprit of whats causing this issue. I'll downgrade on one Mac and set the other Mac up for trying to find a way to fix
     
  37. madruytb

    madruytb

    Joined:
    May 10, 2018
    Posts:
    26
    Hey is there anywhere I can find how to make Microsplat work with URP? (2020.1) ?
     
  38. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,278
    Pretty sure it does- but I only officially support LTS releases.
     
  39. metekavruk

    metekavruk

    Joined:
    Sep 18, 2015
    Posts:
    2
    Amazing.. wish you good luck and success...
     
    Rowlan likes this.
  40. mauris_game

    mauris_game

    Joined:
    Jan 16, 2021
    Posts:
    1
    Hello, I have a problem with shaders for HDRP.
    The crux of the problem is Assets

    Used Graphic assets

    1) Crest Ocean System
    2) Digger PRO
    3) Object2Terrain
    4) Enviro Pro
    5) Bird Flocks
    6) Tropical Forest Pack (TFP)
    7) Jungle - Tropical Vegetation
    8) Vegetation Studio

    Other assets
    1) Demigiant (DOTTween)
    2) L2 (Localization)
    3) ooti
    4) UniRX
    5) Zenject
    6) Xnode
    7) Polybrush

    Unity version: 2020.2.6.f.1
    HDRP: 10.3.1
    OS Windows 10 Pro 19041.804

    When imported into a working project, the shaider fails compilation and displays errors. If you upload a new project and upload microsplat there, then everything works, shaider compile, and no errors


    Example

    изображение_2021-03-10_160338.png

    When trying paint изображение_2021-03-10_160703.png

    Another new scene изображение_2021-03-10_161857.png
    изображение_2021-03-10_162009.png
     
  41. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,278

    I only support LTS versions of the SRPs, as listed on the asset description. If you want to run alpha/beta/tech releases of SRPs, you'd have to upgrade the system yourself as SRPs change constantly and have no documentation or consistent API between releases.
     
  42. AbsolutelyAdrian

    AbsolutelyAdrian

    Joined:
    Jul 20, 2020
    Posts:
    2
    @jbooth, FYI:
    Regarding a post by WildRiverGames a while ago regarding double underscore (__) being reserved, this double underscore occurs because of macros like this:

    #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler_##name);

    ... that prepends an extra underscore to the texture name (e.g. _Diffuse becomes sampler__Diffuse).

    Changing all references to sampler_ with something that doesn't cause the doubling up (e.g. sampler_t or just sampler) will get rid of this problem. (if you do a search and replace, make sure it's case sensitive ..)

    Would be nice to see that updated in a future Microsplat release if possible?
     
  43. MrCool92

    MrCool92

    Joined:
    Jul 13, 2015
    Posts:
    25
    sAllConfigs under TextureArrayConfig.cs keeps everything cached and loaded while in editor... Unloading a scene in editor does not free memory. Can sAllConfigs be somehow cleared when not needed? Is config caching that important?
     
  44. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,278
    I don't define those macro's, those are unity's macros. I do define them on SRPs for compatibility, but they do not have the double underscore:

    Code (CSharp):
    1. #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name);
    2.       #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name);
    3.       #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name);
    4.       #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex);
    Having a double underscore would break the functionality of them being associated with a texture, since unity considers sampler_texname to be the sampler that gets it's settings from _texname.
     
  45. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,278
    You have a very old version of MicroSplat, that's long gone.

    Delete your package manager cache before downloading, otherwise it will keep installing old versions, cause Unity can't even get downloading to work right..
     
    MrCool92 likes this.
  46. DanielSnd

    DanielSnd

    Joined:
    Sep 4, 2013
    Posts:
    380
    Will try that soon :) Thanks!!
     
  47. AbsolutelyAdrian

    AbsolutelyAdrian

    Joined:
    Jul 20, 2020
    Posts:
    2
    @jbooth
    See microsplat_terrain_unityld_adapter.txt for an example with the extra underscore:

    #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler_##name);

    I *think* our version of Microsplat is fairly up to date (within last month or so) ...
     
  48. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,755
    Hi @jbooth I'm using Microsplat in a Specular Terrain workflow, along with the Terrain Blending module.
    (Microsplat shader generator v.3.7, Unity Standard Renderer, Unity v.2019.4.22).

    All seems to work well with one small exception... On the blended object, in the blended areas only, the Smoothness value seems to be getting multiplied or combined additively instead of an a/b blend. This is not very noticeable in lit areas (though there is a slight color cast because of it) but it is very noticeable in shadow areas and looks like a mistake in the specular.

    I've gone through all the settings I can think of both in microsplat and on my textures and materials. Nothing I try changes this behavior which makes me think it's a bug. Do you have any advice regarding this?

    The below pic shows the problem more clearly.... blended areas show a combined specularity error, while non-blended areas on the object and terrain show the expected specular.



    Also just a version note, the shader generator is listed in my project as v.3.7, though I noticed the current version on Asset Store is 3.74. I've seen your recent complaints about installing through package manager, and downloaded/installed through the asset store window, but shader gen is still listed as 3.7... I downloaded this morning. I don't know if that has any bearing on the above problem or not.
     
  49. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,278
    I suspect this is a bug in the terrain blended shader not handling specular workflow correctly, and if you were using a metallic workflow it would work. I'll glance through the code and see if it's anything obvious, but if not it would be useful to have a clear repro scene.

    The MicroSplat interface only shows the main version number - this is because it requires all versions be in sync, and releases like 3.74 are bug fix releases that don't require an API change between the modules (and everyone having to download them all). Had I realized Unity was going to break the package manager and leave it not working in a years worth of Unity versions, I'd have added some kind of "asset store version" system - but you know, I figured they could get asset updating right - boy was I wrong..
     
    chingwa and Lars-Steenhoff like this.
  50. ibernd

    ibernd

    Joined:
    Jun 24, 2019
    Posts:
    15
    Hi!
    the new snow sparkles are great. I've waited for that..

    I had hoped that this effect would be independent of snow (e.g. in wind & glitter module). so that it would be possible to also produce sand sparcles (like in "Journey")
    Is there a chance that this will be possible later?
     
    Last edited: Mar 14, 2021
unityunity