Search Unity

[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, I've got a windows only bug I need to fix in it and just haven't had the energy to deal with it. It's actually been sitting in my depot for like 5 months now ;)
     
  2. razzraziel

    razzraziel

    Joined:
    Sep 13, 2018
    Posts:
    396
    Hi!

    I have some planes with custom surf shader on terrains. Would it be hard to add wind effect on these seamlessly?

     
    Last edited: May 25, 2019
  3. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    One way is to turn on the Terrain Blending feature, and set the blend distance up high. This will cause the terrain texturing to be drawn over your object, texturing it with whatever features the terrain has, including wind. You can paint in the vertex colors to control where the terrain is drawn as well- however, if you don't draw the terrain the wind effect won't persist there.

    Another would be to copy the code out of the wind shader and implement it in your own shader.
     
    razzraziel likes this.
  4. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,643
    How heavy do you think is the procedural shading on an old Intel HD 4000? If I use a terrain without micro splat and self shadow it performs at 60fps. With microsplat shaders it went down to 40,with a big spike during the terrain renderer. Didn't have the time to profile it properly as it may still be due to shadowing as well, but I suspect that the problem is the complexity of the pixel shader. Thoughts?
     
  5. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Completely depends on the features used- but try lowering screen resolution to see if your really GPU bound or not. I find it rare for that to be the case in most games.
     
  6. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,643
    Oh I did profile with Intel GPA and it's totally gpu bound also because there is just the terrain and nothing else in the scene. I just didn't have the time yet to pin it down to the shadow or the pixel shader. I was just asking about your experience and if you had suggestions in case.
     
  7. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Not without knowing your settings and the data your using (textures, etc)
     
    sebas77 likes this.
  8. Monorio1

    Monorio1

    Joined:
    Dec 10, 2018
    Posts:
    17
    How would I go about adding the required data to my prefabs so I can use instancing with blendable module?
    Do I need to manually create a material for every mesh I want it on, remove the material property blocks and assign the needed Arrays? Do I need to pipe in the Control0 to 3 too? Are these the splat maps?
     
    Flurgle likes this.
  9. Monorio1

    Monorio1

    Joined:
    Dec 10, 2018
    Posts:
    17
    Also as a follow up, the blendable section doesn't seem to be working with postprocess stack v2 ambient occlusion Scalable ambient obscurance doesn't shadow properly. The AO is being applied underneath, making for weird artifacts. Here's a screenshot:
    Ignore the white streak across.
    I'm using the defered path, a directional light, no GI, Unity v2018.3.2f1.
     

    Attached Files:

    Last edited: May 28, 2019
  10. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,643
    Hello I am back with more data, but first an unrelated question:


    upload_2019-5-29_11-38-59.png

    what should I do about this warning? Are Cavity maps needed and for what scenario?

    OK now back to our data:

    upload_2019-5-29_13-18-15.png

    as you can see the terrain rendering takes 8ms, and it's totally due to the pixel shader only (if I disable it it goes down to 0.9ms).

    5 textures are sampled (as you can see in the image)

    upload_2019-5-29_13-24-46.png

    We use two terrains, one it's called vista and all together is much faster. The only difference seems to be the resolution of the Base Texture Res and Control Texture Res, so we are currently investigating if we can lower the resolution of these textures on slower machines

    upload_2019-5-29_13-44-51.png

    Edit: please let me know when the warning spam is going to be fixed
     
    Last edited: May 29, 2019
  11. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,643
    I just realised that micro splat doesn't work if the Draw Instanced option is enabled, will this be fixed (currently I can't see why it shouldn't work)

    Edit: I also noticed this other warning today:

    upload_2019-5-31_15-6-55.png
     
    Last edited: May 31, 2019
    Flurgle likes this.
  12. razzraziel

    razzraziel

    Joined:
    Sep 13, 2018
    Posts:
    396
    Stochastic breaks the transition between terrains on same texture. Do you have any solution for this? Both have same settings on shader and texture properties.

     
  13. SLThompson

    SLThompson

    Joined:
    Feb 7, 2014
    Posts:
    49
    I'm using unity vers-2018.4.0f1, I got weird errors when I imported microsplat;

    Binary to YAML conversion: type UInt16 is unsupported

    ...any idea what's going on?
     
  14. SLThompson

    SLThompson

    Joined:
    Feb 7, 2014
    Posts:
    49
    Is there another way to get support, this forum thing is dead.
     
  15. sylon

    sylon

    Joined:
    Mar 5, 2017
    Posts:
    246
    I understand it can be hard to wait, but I would advice a bit of patience.
    I don't know why Jason is not responding this last week, but in the time i have been on this forum, i have found his support to be beyond excellent.
    You could try the discord channel (link is on page 1 of this thread)
     
    Willbkool_FPCS, Flurgle and sebas77 like this.
  16. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,295
    I toyed around with the terrain holes today and created a different script than the one that's linked in the description. For some reason the one in the description didn't work for me (maybe because my gameobject has colliders in the children?). Anyway, here it is in case anyone has use for it:

    Code (CSharp):
    1.     using UnityEngine;
    2.  
    3.     /***
    4.      * Add empty gameobject.
    5.      * Add collider to it, set to IsTrigger.
    6.      * Add rigidbody, enable IsKinematic, disable UseGravity.
    7.      * Add this script and set gameobject and terrain in inspector.
    8.      */
    9.     public class EnterHole : MonoBehaviour
    10.     {
    11.         public GameObject player;
    12.         public TerrainCollider terrainCollider;
    13.  
    14.         void OnTriggerEnter(Collider c)
    15.         {
    16.        
    17.             if( c.gameObject == player)
    18.             {
    19.                 terrainCollider.enabled = false;
    20.             }
    21.         }
    22.  
    23.         void OnTriggerExit(Collider c)
    24.         {
    25.             if (c.gameObject == player)
    26.             {
    27.                 terrainCollider.enabled = true;
    28.             }
    29.         }
    30.     }
    Please note it disables and enables the terrain collider for everything, but it was good enough for my sunday morning project. This is how it looks:

     
    Last edited: Jun 2, 2019
    camta005 and Willbkool_FPCS like this.
  17. Perillio

    Perillio

    Joined:
    Feb 4, 2019
    Posts:
    18
    I have a Problem with Microsplat:



    Using Unity 2019.3.0a2

    This happens when i add the Microsplat script to a terrain and press the convert button.

    Systemspecs (just to be sure its not because of that):
    AMD FX 8320e CPU, nVidia GTX 970, 64GB DDR3 Ram, 6TB HDD with ~1TB free as Datadisk (where the asset folder is) and a 320GB SSD as Systemdisk.

    Any Idea ? Because it happens always when i try to use Microsplat :/
     
  18. razzraziel

    razzraziel

    Joined:
    Sep 13, 2018
    Posts:
    396
    2019.3 is alpha (not even beta).
    solution: wait 6 months.
     
    Perillio likes this.
  19. sylon

    sylon

    Joined:
    Mar 5, 2017
    Posts:
    246
  20. Willbkool_FPCS

    Willbkool_FPCS

    Joined:
    Jun 13, 2018
    Posts:
    169
    He's been active on the One-Batch forum so maybe he's not receiving that there are new replies on this one. It happens to me almost daily that one of the threads that I'm subscribed to doesn't inform me that there are new replies.
     
    sylon likes this.
  21. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,295
    That's why I use the "Watched" link above. The "Alerts" popup doesn't show all.
     
  22. JasonBooth

    JasonBooth

    Joined:
    Jan 27, 2014
    Posts:
    651
    You only need the cavity map if you are using the erosion or cavity features in the procedural texturing system. Now, why it's taking 8ms can be a number of reasons- first, procedural texturing must be performed before anything else can be sampled, and depending on how many layers your using it can be expensive since it is computed per pixel. Baking the result to a splat map is always going to be faster, but it really depends on your workflow. Beyond that, without knowing your setup, I would check the debug section for how many samples you are doing per pixel, as that will give you an idea of memory bandwidth usage.

    The base texture is not really used by MicroSplat- it is however used by the Unity lighting system to compute GI bounce when lighting is baked.

    What warning spam are you seeing?
     
  23. JasonBooth

    JasonBooth

    Joined:
    Jan 27, 2014
    Posts:
    651
    It works fine in draw instanced mode, however, Unity doesn't currently support tessellation with surface shaders, so tessellation gets disabled when draw instance is enabled.
     
  24. JasonBooth

    JasonBooth

    Joined:
    Jan 27, 2014
    Posts:
    651
    Another user reported this, but thats some kind of internal Unity error since UInt16 is a c++ type, not a C# type, and I don't use any uints anyway. Not sure what I can do about this, but it appears harmless.
     
  25. JasonBooth

    JasonBooth

    Joined:
    Jan 27, 2014
    Posts:
    651
    Try waiting a moment- like, I'm a sole developer and have a right to my life, and am not bound to spend it chained to support forums for the tiny amounts of money I charge for this software. I also had my laptop stolen so am basically responding on a phone. This forum is hardly dead either, you'll see I post just about every day. You want better support, you can pay my hourly rate and put me on a retainer for faster support.
     
    Don-Whitaker and KeithBrown like this.
  26. JasonBooth

    JasonBooth

    Joined:
    Jan 27, 2014
    Posts:
    651
    Likely it can't write to your drive for some reason- maybe permissions? That said, I don't support beta Unity versions, hard enough to deal with the breakage in official versions.
     
  27. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Hmm, are you using world space UVs? I would expect that if you are it would transition fine.
     
  28. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I'll add support for Unity's hole solution when it ships, and likely support it in the core package and depreciate holes for 2019.3 and up (or leave it for people who already have it in place). While my solution has more options and is quite usable, I think the official one will be better for most people.
     
    Rowlan likes this.
  29. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Oh, I just noticed your using LWRP - I haven't tested instancing over there in a while, so will check that again. SRPs are a royal pain because it's like having to write to several different rendering engines..
     
    sebas77 likes this.
  30. wigglypuffs

    wigglypuffs

    Joined:
    Aug 10, 2015
    Posts:
    67
    I am using Microsplat with Mapmagic. I attempted to turn on Terrain Blending in the shader for Terrain 0,0 and then place an object on the terrain with the Micro Splat Blendable Object component following the instructions provided. However, the component indicates, "Terrain shader is not setup for blending"

    Is there a step I'm missing? Thank you.
     
  31. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yes, blending requires the terrainData to be generated, which you can do by pushing a button on the MicroSplatTerrain component to generate it. You’ll have to generate this data yourself somehow if map Magic is generating the terrain at runtime.
     
  32. wigglypuffs

    wigglypuffs

    Joined:
    Aug 10, 2015
    Posts:
    67
    This is what is happening even if I hit the Update Terrain Descriptor Data button on Micro Splat Terrain component in the Terrain 0,0:

    https://i.gyazo.com/86bc583ae057a111adab738413b010b9.jpg
     
  33. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Pink is usually a shader compilation error- do you have any errors in the console? Do the shaders in the MicroSplatData directory all compile?
     
  34. wigglypuffs

    wigglypuffs

    Joined:
    Aug 10, 2015
    Posts:
    67
    Only three warnings:

    https://i.gyazo.com/ed0a4f2f92d6bd39a0874b36d5d374fd.png

    When I reimport the microsplat folder and also recompile the shaders:

    https://i.gyazo.com/a21c4a62ef3d2d5d388ab5a4f9358714.png

    The TerrainBlending example in the MicroSplat folder doesn't have the issue. And, even after I recompile the MicroSplatData folder in that example shaders they don't have the same stream uninitialized warnings that my other scene does.

    I'm using Amplify Shader Editor, AmplifyOcclusion, AmplifyColor, VegetationStudio Pro, MapMagic, MicroSplat, Enviro, FogVolume 3, Lux Water, and Post Processing stack.
     
    Last edited: Jun 10, 2019
  35. wigglypuffs

    wigglypuffs

    Joined:
    Aug 10, 2015
    Posts:
    67
    Adding a blend mat in the Debug of the Micro Splat Terrain component of the terrain for MicroSplat_TerrainObjectBlend seemed to provide partial progress because now I can see the blending shader working.

    https://i.gyazo.com/ea7cac3f4e734e224e8e2bebdd0c8e36.jpg

    Obviously, this isn't blending the correct terrain at this height. It picked the wrong texture.
     
  36. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    The warnings shouldn't cause any issue. You could step through the code in MicroSplatBlendableObject to see if it's grabbing the right terrain and getting the data you expect. It basically raycasts down, finds the MST component on the terrain, and grabs the data the shader needs from that.
     
  37. txarly

    txarly

    Joined:
    Apr 27, 2016
    Posts:
    197
    Hi,
    i have 2 questions about procedural texture asset,
    - is there a way to avoid an area or areas to be painted in the terrain?
    - is possible to paint manually after create the layers?because i am trying to paint a river and i am not able
    thanks
     
  38. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    There’s no runtime way to combine a pre-generated splat map with procedurals if that’s what your asking. You can however bake the procedurals back to a splat map and paint from there.
     
  39. txarly

    txarly

    Joined:
    Apr 27, 2016
    Posts:
    197
    Thanks, can you tell me how to do that?sorry my newbie question
     
  40. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    There’s a button on the terrain component which will bake the procedural output back to the terrain. I’m still waiting on a replacement laptop for the one that stolen, so can’t really check right now.
     
  41. txarly

    txarly

    Joined:
    Apr 27, 2016
    Posts:
    197
    Screenshot_27.png

    this one?
     
  42. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,643
    Hello again!

    I appreciate that maintaining all the pipeline must be incredibly time consuming, but we started using microsplat because it declares LWRP support. I list again our current warnings/errors:

    Shader warnings:

    Shader warning in 'Hidden/MicroSplat/Map_01_Terrain_Base-1057449523': 'SAMPLE_DEPTH_TEXTURE' : macro redefinition at Packages/com.unity.render-pipelines.core/ShaderLibrary/API/D3D11.hlsl(114) (on d3d11)
    Compiling Vertex program with FOG_EXP _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_RGBM_ENCODING

    Shader warning in 'Hidden/MicroSplat/Map_01_Terrain_Base-1057449523': 'SAMPLE_DEPTH_TEXTURE_LOD' : macro redefinition at Packages/com.unity.render-pipelines.core/ShaderLibrary/API/D3D11.hlsl(115) (on d3d11)

    Shader warning in 'MicroSplat/Map_01_Terrain': 'SAMPLE_DEPTH_TEXTURE' : macro redefinition at Packages/com.unity.render-pipelines.core/ShaderLibrary/API/D3D11.hlsl(114) (on d3d11)

    Code warnings:

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

    Visual Errors:

    OK:

    upload_2019-6-12_14-45-2.png


    Draw instanced on (rock layer is gone):

    upload_2019-6-12_14-46-5.png
     
  43. Redrag

    Redrag

    Joined:
    Apr 27, 2014
    Posts:
    181
    Hi Just hit some errors when packing - any thoughts?

    Invalid texture format: 29
    UnityEngine.Graphics:CopyTexture(Texture, Int32, Int32, Texture, Int32, Int32)
    JBooth.MicroSplat.TextureArrayConfigEditor:CompileConfig(TextureArrayConfig, List`1, String, Boolean) (at Assets/Plugins/MicroSplat/Core/Scripts/Editor/TextureArrayConfigEditor.cs:1503)
    JBooth.MicroSplat.TextureArrayConfigEditor:CompileConfig(TextureArrayConfig) (at Assets/Plugins/MicroSplat/Core/Scripts/Editor/TextureArrayConfigEditor.cs:1663)
    JBooth.MicroSplat.TextureArrayConfigEditor: DelayedCompileConfig() (at Assets/Plugins/MicroSplat/Core/Scripts/Editor/TextureArrayConfigEditor.cs:989)
    UnityEditor.EditorApplication:Internal_CallDelayFunctions()


    Graphics.CopyTexture could not find destination D3D11 texture object. Maybe it is a RenderTexture that is not created yet?
     
  44. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461

    SRPs are a giant pain in the ass. Anyway, what version of unity and what version of the LWRP is this on, and what features are on in MicroSplat?
     
  45. wigglypuffs

    wigglypuffs

    Joined:
    Aug 10, 2015
    Posts:
    67
    I was thinking about you today while I was experimenting with HDRP because I remember what you were saying about SRPs. And, I remember thinking, man that guy could actually write his own SRP and tell people he only supports that and it'd probably be better.

    Have you ever looked into Unity's samples on developing a custom SRP? It looks pretty straightforward. You get full control of the pipeline. And, when customers ask about how to do xyz on lwrp/hdrp/etc you could just say I only support JBRP. xD
     
    Willbkool_FPCS and StevenPicard like this.
  46. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,643
    Unity 2019.1.2, LWRP latest version. About the features is a screenshot enough?
     
  47. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    We had a custom SRP at my last job. It’s great if you want that kind of control over the pipeline, but unless you’ve got graphics engineers to maintain and support it it’s not viable for many teams, and certainly not something designed for an asset store based environment. It’s real advantage is customizing it for a specific game, not the kind of thing you’d want to support for all possible games.
     
    sebas77 likes this.
  48. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yes, screenshot of the shader generation settings is enough.
     
  49. txarly

    txarly

    Joined:
    Apr 27, 2016
    Posts:
    197
    hi,
    i press "bake procedural to terrain" button and i get this error

    Screenshot_41.png

    any idea?

    thanks
     
  50. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yeah, this is the windows only compiler bug I'm looking into. Haven't found a workaround yet - works fine on OSX..
     
    txarly likes this.
Thread Status:
Not open for further replies.