Search Unity

  1. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  2. 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,901
    i don’t give timelines.
     
  2. GXMark

    GXMark

    Joined:
    Oct 13, 2012
    Posts:
    442
    I'm using the unity 2021.1.7f1 <DX11> with latest microsplat HDRP 2020 and Triplanar addons. Noticed that saving the terrain causes the terrain to lose its detail (like a triplaner with its tiling set wrongly). Anyone else noticed this issue?



     

    Attached Files:

    Last edited: May 16, 2021
  3. SOIL

    SOIL

    Joined:
    Sep 2, 2011
    Posts:
    213
    Hi Jason!

    I have a question regarding One Batch: Would it be technically possible to make this one for URP as well? And if, are you planning to do it? I am not a programmer, however, I guess in URP this is not possible. Correct me if I am wrong. Anyhow, this would be an absolute advantage for mobile-XR/VR

    *-* *dreaming*
     
  4. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,901
    Yes, it's a Unity bug:

    https://issuetracker.unity3d.com/issues/all-the-textures-are-cleared-when-creating-texture-array

    Possible, yes, am I doing it? No..
     
  5. hauwing

    hauwing

    Joined:
    Dec 13, 2017
    Posts:
    52
    Hi Jason

    just got another case that needs your help. I was trying to create a mesh from a terrain. My terrain will be around 1024 x 1024 with heightmap 1025 x 1025, but I found that the Terrain To Mesh module only allows up to 170 subdivisions, so I modified the TerrainToMesh.cs to increase this limit.

    settings.subDiv = EditorGUILayout.IntSlider(CSubDiv, settings.subDiv, 16, 2048);


    Then I exported the terrain with 2 chunks and 512 subdivisions, but the meshes are not correctly generated which only have 2 slim stripes. It looks like that switching back the subdivision to something like 200 is fine (at least I can see the colliders can cover the whole terrain), but I then need to increase the chunk otherwise I will lose heightmap resolution.

    upload_2021-5-17_15-56-12.png

    And yes those error is another issue, but I want to focus on the mesh collider first, thx
     
  6. okrongly

    okrongly

    Joined:
    Dec 23, 2019
    Posts:
    45
    Hi, is there any reason that I missed when I change Weight limiting to 2 on micro splat terrain script , it comes back to 4. Thanks
     
  7. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,901
    If you start modifying the code, it's no longer my support issue. The subdivision limit is there to fit under the mesh limit of 65k in some versions of Unity, but it's also not a great idea to have really large meshes, and a better idea to have multiple meshes, which is the whole point of the subchunk system.
     
  8. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,901
    Because it's not an active control that needs to be serialized, it's only used when you run the weight limiting tool.
     
    okrongly likes this.
  9. Black_Raptor

    Black_Raptor

    Joined:
    Nov 3, 2014
    Posts:
    171
    Hi !

    I have an issue with MicrSplat and Triplanar, on the demo scene everything work, but on my own scene the triplanar doesn't work this what i got :
    https://gyazo.com/b17728db271e0f3cf68cd45a4a8ccbc8
    I don't know why, in the documentation nothing help me to understand why i got this problem.
    And also when i turn on Draw instanced the terrain disappear.
     
  10. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,901
    It's because Terrains are smoothed, and thus the normal angle for your cliff is not straight sideways, rather it's a giant interpolated curve from pointing up to pointing sideways and then pointing up again (as the terrain goes from flat to cliff to flat again). If you were to model something like this in a 3d program, you'd either bevel the edge or give it a hard edge, but Unity terrains don't work like that.

    There is a slider which will switch triplanar to use the face normal instead of the smoothed vertex normal, but that will introduce discontinuities in your texturing.
     
  11. Tayrtahn

    Tayrtahn

    Joined:
    May 18, 2013
    Posts:
    6
    Thanks for your previous help!

    Would you be willing to explain how the Mesh Workflow in vertex painting mode encodes the textures into the vertex data? I'm trying to determine which texture is dominant at a collision point (ex: to play an appropriate footstep sound). I worked out how to read the splatmaps for terrain data, but I'm having some trouble understanding how to interpret a texture index from the vertex color (and other vertex data fields).
     
  12. Black_Raptor

    Black_Raptor

    Joined:
    Nov 3, 2014
    Posts:
    171
    Thanks for your quick reply ! It's sadly not the problem, the is made inside unity with unity terrain, i smooth the terrain and the triplanar still not work :
    https://gyazo.com/eb038e2c71e9b7ed645378b0d6894380
     
  13. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,901
    there are functions in the vertex painter to read/pack/unpack the data. I stuff 4 weights into each component of the vertex color, then more into the texcoords if your above 16 textures or are painting streams, etc.
     
  14. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,901
    you sure your editing the right material? The only other thing I can think of is if you have per texture triplanar turned on and have turned triplanar off for that texture.
     
    Black_Raptor likes this.
  15. Black_Raptor

    Black_Raptor

    Joined:
    Nov 3, 2014
    Posts:
    171
    I re-importe the asset and it's auto fix the problem i don't change nothing, so i don't know what was not working.
    Also the draw instanced now work.
     
  16. byCDW

    byCDW

    Joined:
    Jan 31, 2016
    Posts:
    14
    Hey there,

    how can I add new brushes to the Mesh Workflow addon? I put some grayscale .tga files into the MicroSplatBrushes folder of MWF but they don't appear within the painter. Same import settings than original files are used.

    I just put a normal map only as 2nd texture into the array and upon enabling it's uv scale settings the whole thing turns pink. Can't be reverted as it seems.

    BTW thank you for making such a great tool
     
    Last edited: May 17, 2021
  17. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,901
    You likely have to restart the tool (or possibly unity) as I think it only does the scan for brush files on startup..
     
  18. byCDW

    byCDW

    Joined:
    Jan 31, 2016
    Posts:
    14
    Thank you for responding but restarting Unity doesn't do the trick.

    It seems like every Material turns pink when I tick the UV Scale box. Using Mesh Painter that is.
     
  19. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,901
    Compile errors in the console?
     
  20. homemacai

    homemacai

    Joined:
    Jul 22, 2020
    Posts:
    21
    I have a couple issues with digger integration. It worked just until i removed digger from the scene and tried to set it up again. All digger materials are invisible/transparent or pink, depending on which step of the re-installation is at the moment. With all the steps done and redone a couple of times. Anything i should delete to be able to reset it? already made a clean install of everything to no avail.
     
  21. superkratos

    superkratos

    Joined:
    Sep 4, 2017
    Posts:
    112
    Hi, Jason. After recent upgrades, I found this difference of terrain-blending module in HDRP environment.. How can I get the shadow part look right?
     

    Attached Files:

  22. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,901
    Shadowing isn't working on the terrain blended area in HDRP2020, haven't been able to figure out why yet. Would be nice if Unity documented anything..
     
  23. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,901
    My part just generates a special shader which digger uses, no idea about the digger side.
     
  24. hauwing

    hauwing

    Joined:
    Dec 13, 2017
    Posts:
    52
    never mind I've found a solution thx
     
  25. homemacai

    homemacai

    Joined:
    Jul 22, 2020
    Posts:
    21
    Was able to recover the scene by lowering the layer count, and then redoing all the materials. But got the issue where the digger material should join with a tessellated material, and they are separated, any way to mitigate this, or should not use displaced materials at all with digger and microsplat? I do believe that once got it looking correctly, but maybe I am remembering wrong
     
  26. superkratos

    superkratos

    Joined:
    Sep 4, 2017
    Posts:
    112
    We are using MicroSplat HDRP 2019 support, and HDRP 7.4.3 in our project, with Unity version 2019.4.9f1. And we still miss the shadow, so is this a normal situation?
     
  27. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,901
    Maybe? I could have sworn it was only broken in 2020, but perhaps I'm wrong as I've just been looking at that case.
     
  28. superkratos

    superkratos

    Joined:
    Sep 4, 2017
    Posts:
    112
    This screenshot was made using the same version of unity and HDRP, just before and after importing the new version of MicroSplat series.
     
  29. jaripam

    jaripam

    Joined:
    Apr 5, 2021
    Posts:
    7
    Beginner question regarding workflow (difficult to search for this in forums)

    How would experienced developers use Microsplat in general.

    Would you use Microsplat directly after terrain creation and barely touch it afterwards?
    Would you use Microsplat at the later stages of development after the environment is final?

    The reason I'm asking this way is because I have some weird issues after playing around with Microsplat settings (not even touched the advanced section) like starting the game takes 5-10min. instead of 10 seconds or terrain switches to sometimes black, sometimes darkened without changing settings in that moment.

    Makes me think one should be very careful with this asset and implying it in the final stages would be risky?
    But only my 2 cents, maybe for experienced users it doesn't matter when you know exactly what you're doing?

    I removed every component and deleted microsplat but project is basically gone.
    It was only a test project, but that's where my questions come from.
     
    Last edited: May 18, 2021
  30. homemacai

    homemacai

    Joined:
    Jul 22, 2020
    Posts:
    21
    Found a few culprits with Digger Integration, whenever I turn wetness on, with or without streams and puddles, Digger integration stops working. Also noticed that i have no updated digger editor with the wetness options. Thinking it could be that I only had 24 texture slots so raised to 28, so that digger could use those extra four it needs, but now even without wetness on I only get pink digger textures. Returning to 24 slots without wetness makes it work again. So anything above 24 textures gives me pink shaders. Or any number of textures with any of the wetness features on also gives me pink shaders. Should I update it manually somewhere? Or is it an URP thing?
     
    Last edited: May 18, 2021
  31. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,901
    There's a limit of how many interpolators can be used based on shader model. Are you actually using 24 textures on your terrain? The streams module data doesn't count as texture data, only the number of entries in the texture array. If you actually need 24 textures + streams, you might have to raise the shader model to 5.0 in core/advanced.
     
  32. byCDW

    byCDW

    Joined:
    Jan 31, 2016
    Posts:
    14
    No errors but warnings:

    > There are inconsistent line endings in the 'Assets/MicroSplatMeshData/MicroSplatData/MicroSplat.shader' script. Some are Mac OS X (UNIX) and some are Windows.
    This might lead to incorrect line numbers in stacktraces and compiler errors. Many text editors can fix this using Convert Line Endings menu commands.
    UnityEditor.AssetDatabase:Refresh ()
    MicroSplatShaderGUI/MicroSplatCompiler:Compile (UnityEngine.Material,string) (at Assets/MicroSplat/Core/Scripts/Editor/MicroSplatShaderGUI_Compiler.cs:591)
    MicroSplatShaderGUI:TriggerCompile () (at Assets/MicroSplat/Core/Scripts/Editor/MicroSplatShaderGUI.cs:415)
    UnityEditor.EditorApplication:Internal_CallDelayFunctions ()

    >
    Shader warning in 'Shader Graphs/PW_Water_RP': 'cross': implicit truncation of vector type at line 3414 (on d3d11)

    Compiling Vertex program with _BLENDMODE_OFF _REFRACTION_OFF
    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_FULL_HDR
    Disabled keywords: _SURFACE_TYPE_TRANSPARENT INSTANCING_ON _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY _DOUBLESIDED_ON _ADD_PRECOMPUTED_VELOCITY _TRANSPARENT_WRITES_MOTION_VEC _ENABLE_FOG_ON_TRANSPARENT _DISABLE_DECALS _DISABLE_SSR _DISABLE_SSR_TRANSPARENT _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN UNITY_NO_DXT5nm UNITY_ENABLE_NATIVE_SHADOW_LOOKUPS UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 UNITY_PBS_USE_BRDF3 UNITY_NO_FULL_STANDARD_SHADER UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_HARDWARE_TIER3 UNITY_COLORSPACE_GAMMA UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_LIGHTMAP_DLDR_ENCODING UNITY_LIGHTMAP_RGBM_ENCODING UNITY_VIRTUAL_TEXTURING UNITY_PRETRANSFORM_TO_DISPLAY_ORIENTATION UNITY_ASTC_NORMALMAP_ENCODING SHADER_API_GLES30

    >
    Shader warning in 'Hidden/Terrain_0_0-20210509 - 232043_Base-531067177': pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them at line 3417 (on d3d11)

    Compiling Fragment program
    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_FULL_HDR UNITY_PASS_SHADOWCASTER
    Disabled keywords: INSTANCING_ON _ALPHATEST_ON UNITY_NO_DXT5nm UNITY_ENABLE_NATIVE_SHADOW_LOOKUPS UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 UNITY_PBS_USE_BRDF3 UNITY_NO_FULL_STANDARD_SHADER UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_HARDWARE_TIER3 UNITY_COLORSPACE_GAMMA UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_LIGHTMAP_DLDR_ENCODING UNITY_LIGHTMAP_RGBM_ENCODING UNITY_VIRTUAL_TEXTURING UNITY_PRETRANSFORM_TO_DISPLAY_ORIENTATION UNITY_ASTC_NORMALMAP_ENCODING SHADER_API_GLES30

    Also my terrain sometimes turns all black and shiny sometimes eg. upon saving the scene. Reloading fixes it. I'm on Windows, Unity 2020.3.7f1 HDRP
     
  33. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,901
    That's a known Unity bug in the 2020.3 LTS release. Fix is coming in a future patch release. Warnings shouldn't cause any issues. For pink shaders I would expect to see compile errors, a mesh not assigned a material, a material not assigned a shader, or the shader set for the wrong render pipeline.
     
  34. byCDW

    byCDW

    Joined:
    Jan 31, 2016
    Posts:
    14
    Well seems like any change triggers this somehow. Now I enabled 'smootheness strength'. It compiles and turns pink.

    MeshPaintError1.jpg MeshPaintError2.jpg
     

    Attached Files:

  35. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,901
    Is it just not syncing right? If you go to the mesh workflow component there's a button for clearing the cached materials, if you press it does it fix things? Does this repro in the example scene?
     
  36. byCDW

    byCDW

    Joined:
    Jan 31, 2016
    Posts:
    14
    I've tried pressing all the buttons before but no, clearing cache does nothing. I could try to reimport MWF maybe I messed something up somehow...
    MeshPaintError3.jpg
     
  37. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,901
    So playing around with this, I can get it to repro on the vertex workflow only, and pushing the "Clear Material Cache" button fixes it. So must be something wrong in the sync or cache. But from your screenshot, it looks like your getting it on all of them?

    [edit] fixed the instance I was able to find..
     
    Last edited: May 18, 2021
  38. byCDW

    byCDW

    Joined:
    Jan 31, 2016
    Posts:
    14
    It does happen on the vertex workflow too and the button does not fix it. I tried a different texture and reimported MWF but no success.
     
  39. mukki014

    mukki014

    Joined:
    Jul 30, 2017
    Posts:
    161
    @jbooth Hi sir what will the cost of having 16 different terrain materials using microsplat. Actually the scenario is Global tint map would be different for each map. I also have one single global tint map 8k resolution for a single 13km terrain. But problem is when I split the terrain into 4x4 single global map doesn't fit into the UV of terrain tiles.
    So what would be the cost of using 4different material if I decide to use only 4terrain tiles and other are meshes or even 16tiles.
    Arrays will be same for each tile.
    Hope you get my point sir.
    I'm building it for Android vulkan/open gl es 3.2 shader model 5.0
    Thank you
     
  40. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    308
    I am not getting any glossiness in the HDRP2020 version, any tips on what I could be doing wrong?
     
  41. jaripam

    jaripam

    Joined:
    Apr 5, 2021
    Posts:
    7
    I have an issue:
    When I save the project, my terrain changes from high res. to this:
    upload_2021-5-19_12-26-20.png
    I can go into the Microsplat material and for instance change shader type back and forth, and it looks fine again. I can also just hit play and it changes back to normal. When I save the project, terrain is back to low poly mode.

    Also sometimes when I enable tesselation, terrain changes to another low poly mode:
    upload_2021-5-19_12-37-18.png

    I can create the exact same terrain in the scene and set it up exactly the same but sometimes it does this after enabling tesselation, sometimes not.
     
  42. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,901
    Every terrain already gets it's own material instance, since the splat maps are different for every terrain. You don't need to create separate microsplat materials, you can just assign the tint mask to the override on the MicroSplatTerrain component.
     
    mukki014 likes this.
  43. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,901
    Well, technically PBR doesn't have glossiness, but semantics aside it should work just like it does in any other pipeline (smoothness value from the texture).
     
  44. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,901
    This is a Unity bug in 2020.3LTS:

    https://issuetracker.unity3d.com/issues/all-the-textures-are-cleared-when-creating-texture-array

    In discord I have a current unity bugs channel for this kind of stuff..
     
    olavrv likes this.
  45. mukki014

    mukki014

    Joined:
    Jul 30, 2017
    Posts:
    161
    Thank you Sir. I will let you the know results. Stay safe.
     
  46. RedSquirg

    RedSquirg

    Joined:
    May 20, 2021
    Posts:
    2
    com.jbooth.microsplat.core: Package [com.jbooth.microsplat.core@3.8.0] cannot be found
    allways get this ... fresh install / manualy json mod ...
     

    Attached Files:

  47. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,901
    Yeah, Unity approved 2 of the modules (decals and global texturing I think), then waited two days and decided to not approve the other ones for rather arbitrary reasons. So now I'm scrambling to resubmit them all so they match version match again. Hopefully they won't wait until next week to approve them.
     
    RedSquirg likes this.
  48. RedSquirg

    RedSquirg

    Joined:
    May 20, 2021
    Posts:
    2
    Ty for info!!
     
  49. ak98

    ak98

    Joined:
    Jul 23, 2014
    Posts:
    2
    Hi, not sure if this is already been answered or if there is a tutorial. But is there anything that needs to be changed in the microsplat settings or does anyone have a reccomended set up for building Android projects that use microsplat.

    EDIT: So after some more expereimenting and reading the very helpful documentation. I can ask more specifically is there a way that one can duplicate the per texture properties from one microsplat shader to another


    Also another question is... Say i want to work a new terrain in a new scene but use the same material settings from another microsplat terrain what stuff should i copy over?
     
    Last edited: May 24, 2021
  50. Fifa1987

    Fifa1987

    Joined:
    Feb 1, 2015
    Posts:
    1
    Hi, Now in 3.8.0 cant reference MicroSplatMeshTerrain or MicroSplatTerrain by code.
    using JBooth.MicroSplat / .core or whatever ... is broken or maybe I miss anything???
     
unityunity