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. AnneDraaisma

    AnneDraaisma

    Joined:
    Jul 14, 2014
    Posts:
    14
    Hi,

    I've imported an project from Unity 2017 into 2018.4.19. I've removed the MicroSplat folder and have imported the latest version of MicroSplat Core, Anti Tile, Global Textures and Tesselation.

    Now when I load in my scene with my terrain, I get the following error and my terrain is magenta:


    IndexOutOfRangeException: Index was outside the bounds of the array.
    MicroSplatPropData.RevisionData () (at Assets/MicroSplat/Core/Scripts/MicroSplatPropData.cs:175)
    MicroSplatPropData.GetTexture () (at Assets/MicroSplat/Core/Scripts/MicroSplatPropData.cs:309)
    MicroSplatObject.ApplySharedData (UnityEngine.Material m) (at Assets/MicroSplat/Core/Scripts/MicroSplatObject.cs:151)
    MicroSplatTerrain.Sync () (at Assets/MicroSplat/Core/Scripts/MicroSplatTerrain.cs:138)
    MicroSplatTerrain.Awake () (at Assets/MicroSplat/Core/Scripts/MicroSplatTerrain.cs:50)
    UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)


    How can I fix this?

    Thanks in advance.
     
  2. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    You could delete the propdata object and let MicroSplat recreate it.
     
  3. ibernd

    ibernd

    Joined:
    Jun 24, 2019
    Posts:
    16
    I Have updated to URP 1.7.2 but the terrain still doesn't change with the ambient light. Fog seems to work..
    2019.4.20f1
     
  4. pab

    pab

    Joined:
    Jul 2, 2013
    Posts:
    6
    MicrosplatBlending.png I cannot get Terrain Blending to work with HDRP - created new project with just Microsplat Core 3.72.0 , HDRP 3.72.0 , and Terrain Blending 3.71.0 modules. See screenshot. Using LTS version 2019.4.20f1. MicrosplatBlending2.png
     
    Last edited: Feb 19, 2021
  5. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Fixed, will get patched around monday.
     
  6. Lesnikus5

    Lesnikus5

    Joined:
    May 20, 2016
    Posts:
    131
    For custom splatmaps, I use a non-standard textures with a resolution of 513x513 (equal to heightmap resolution). This is dangerous? Could this cause errors on certain hardware/platforms? In the editor and in the Windows build, this definitely works.
     
  7. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I mean that's a pretty standard resolution for unity terrains- it defaults to using power of 2 + 1 texture sizes.
     
  8. Lesnikus5

    Lesnikus5

    Joined:
    May 20, 2016
    Posts:
    131
    No, this is for heightmaps. I'm asking about splatmaps. For example, the heightmap is 513x513, and the splatmap is 512x512. I want to use a 513x513 splatmap equal to the heightmap resolution.

    In my game, the player can change the terrain and I need a stable correspondence of the splatmap texels with the corresponding vertices (geometry) of the terrain. The standard case, when both textures are not the same, the splatmap texels "walk" relative to the vertices in different parts of the terrain. I find it difficult to create a drawing algorithm that would accurately compensate for this shift. By applying splatmap textures that match the heightmap resolution, each painted texel have stable position relative to its vertex position.
     
    Last edited: Feb 20, 2021
  9. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    This will 'uncenter' the splat map from the terrain though - the height map is at 513, and the splat map is at 512, because there are 512 center positions in the resulting geometry. Essentially, shaders remap the UV space so that the splat maps line up to the center of each terrain quad. Something like uv = ((uv * heightMapPixels) + 0.5) / heightMapPixels.

    That said, the only issue you'll have with non-powerof 2 splat map textures would be if you tried to compress them (they'd either get shrunk to 512, or expanded to 1024).
     
  10. Straafe

    Straafe

    Joined:
    Oct 15, 2012
    Posts:
    73
    Hello,

    I just started a new project in 2020.2.4f1 to try out MicroSplat and ran into an issue with the Tesselation Module and the Procedural Texturing Module when used together. It should be easily re-createable as all I did was create a brand new untextured terrain, convert it to Microsplat, add a few textures from Substances, and then enabled both modules. Both modules work independently, but throw shader errors if used together. Are these two modules not compatible with each other, or perhaps this is an issue with using this version of Unity?
     
    Last edited: Feb 21, 2021
  11. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Fixed..
     
  12. SuperNewbee

    SuperNewbee

    Joined:
    Jun 2, 2012
    Posts:
    196
    Installed Microsplat into clean project
    Installed URP addon
    Installed Wind and Glitter

    Opened example wind scene but I can not see any wind. Is there a setting that I am supposed to enable?

    Added screenshot - No wind ? nowind.jpg

    settings.jpg

    Unity 2019.4.20f1
    Microsplat 3.72.0
    Microsplat URP 3.71.0
    Microsplat Terrain Collection 3.72.0

    (all downloaded 2 hours ago with old cache deleted)
     
  13. Straafe

    Straafe

    Joined:
    Oct 15, 2012
    Posts:
    73
    Awesome!

    Another minor issue on 2020.2.4f1 which is annoying but not breaking is that every time I save the scene, the model is displayed as pure black. Disabling/Re-enabling the object or messing with certain settings in the shader seem to fix it, but it's a minor annoyance because it happens every time you save.



    I created an identical project but in 2019.3.7f1 and this display issue on save didn't happen.

    Last issue I am noticing in the Unity 2020 version, I am getting this error periodically (haven't exactly narrowed down when/why it is happening) and the terrain either turns black or very dark until you revert settings or fiddle with them and recompile the shaders:


    In the identical project in Unity 2019 this does not occur and everything works as expected without the error.
     
    Last edited: Feb 22, 2021
  14. Lesnikus5

    Lesnikus5

    Joined:
    May 20, 2016
    Posts:
    131
    Well I'm not going to compress them. Unless it's automatically compressed somewhere inside the video memory.
     
  15. SuperNewbee

    SuperNewbee

    Joined:
    Jun 2, 2012
    Posts:
    196
    I am really having a hard time getting wind particles to show with URP. I can get it working in Standard and some HDRP versions, but no matter what I try I can not get URP wind working. If anybody owns wind and URP addons could they install latest asset store version on any Unity version and tell me if example scene is working as as expected? ARe we supposed to say yes or no to the API updater?
     
    Last edited: Feb 22, 2021
  16. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Fixed.. And yes to the API updater, though that wasn't the problem in this case.
     
  17. Lesnikus5

    Lesnikus5

    Joined:
    May 20, 2016
    Posts:
    131
    It's strange. What you say must be correct. But this is actually not the case.

    Heightmap 513x513, splatmap 512x512, this is what we have:

    1 1.jpg

    2 2.jpg

    3 3.jpg

    How do you see:

    x = 2: vertex is painted.
    x = 249: quad is painted.
    x = 509: vertex is painted.

    This is if the alphamap is 1 less than the height map (Heightmap 513x513, splatmap 512x512). Thus, the splatmap does not align with the center of each terrain quad. Closer to the middle of the terrain - yes, but closer to the outer coordinates of the grid, splatmap moves to the vertices. Therefore, I use non-standard splatmap 513x513, then it is stably positioned relative to the geometry at any point in the terrain.

    What is it? Bug or norm? Your previous statement confused me because now I do not understand if it should be so.
     
    Last edited: Feb 22, 2021
  18. MAXFORCE

    MAXFORCE

    Joined:
    Mar 4, 2014
    Posts:
    51
    There is one bug, when you use textures not power of two - you have memory leak in unity. Use only 2, 4, 8, 16, 32, 64, 128, 512, 1024, 2048, 4096 and so on. Memory leak, when memory consumpsion will be bigger and bigger when need to load in and unload from memory textures. But when you use not power of two, texture will not unload from memory.
     
    Lesnikus5 likes this.
  19. Lesnikus5

    Lesnikus5

    Joined:
    May 20, 2016
    Posts:
    131
    When I read your post, it almost gave me a heart attack. But then I remembered that the architecture of my game is built in such a way that alpha maps are created in memory 1 time, then the data in them is deserialized when loading / starting a new game / moving to another level. These textures always exist. So I don't think a memory leak will happen in my case.
     
  20. Sovcenko

    Sovcenko

    Joined:
    Apr 17, 2018
    Posts:
    6
    Hello !
    I'm coming back after several tests, we tried everything and maybe you can help ... The issue is the same : The terrain is not displaying on Nintendo Switch. Here's the summary of the issue and what we've tried :

    If you want/need, we can send you the full logs.
    We know that you're busy but this feature is critical to us and to our planning. Any help from your side could potentially save our lives haha !
    If you need anything else, if you want us to run some tests on the Switch or anything else, please let me know.

    Thanks in advance!

    - Matteo
     
  21. Straafe

    Straafe

    Joined:
    Oct 15, 2012
    Posts:
    73
    As a quick/dirty bandaid for this issue if anyone else is having it, you can use AssetModificationProcessor.OnWillSaveAssets to disable and immediately re-enable your Terrain objects when you save, then the terrain will not appear black. I didn't realize how often I reflexively hit CTRL+S until every time I did it caused the entire terrain to go black :p
     
  22. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    No idea- but note it complains about things with double underscores, not single underscores. An underscore before a variable name is unity's convention, and all of their shaders have underscores before the variable names, so I don't see any way that the variable naming is the issue, otherwise every Unity shader wouldn't compile on switch either.
     
  23. Sovcenko

    Sovcenko

    Joined:
    Apr 17, 2018
    Posts:
    6
    We thought about that, yes, but we tried in that direction just in case. Any other lead ? Is it linked to OpenGL ? We're kinda desperate ... That would mean redo all the terrains of the entire game for the Switch version only.
     
  24. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    No idea, I don't have any access to the switch SDK or hardware, so no real way to know. I would ask someone from Unity or Nintendo if you have a contact at either place.
     
  25. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,561
    I currently use 3 colors ground textures that I tint externally. I am thinking I could use one texture to save memory since the texture details for all 3 are the same, and just change the tint dynamically via script as I move around the world

    Can I change the tint of one MicroSplat texture at runtime, and if yes, how would I do this in a script?
     
  26. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    There's an API on the propData object, which will let you set any per-texture property using an enum so you don't have to understand the index mapping.
     
    protopop likes this.
  27. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,561
    That was fast - thanks Jason , I will give it a try. I am guessing whatever overhead there is to changing a texture tint will be worth the trade off in saved texture memory - a bit of testing should help me find out :)
     
  28. shadow_tm

    shadow_tm

    Joined:
    Jul 2, 2014
    Posts:
    10
    Hey! I'm having problems with textures. They have changed the color in the present and I cannot fix it. What could be the reason?

    upload_2021-2-23_14-1-0.png

    upload_2021-2-23_14-3-0.png
     
  29. pab

    pab

    Joined:
    Jul 2, 2013
    Posts:
    6
    Thanks - good news - HDRP blending working with 2020.1.1f1.

    Bad news - not working with 2020.2.4f1 - see screenshot. By the way - in Game View - the cube is pink and flashing at high frequency.

    Error message is
    Shader error in 'Terrain_TerrainObjectBlend': undeclared identifier '_BlendMode' at Projects/MicroSplat/Library/PackageCache/com.unity.render-pipelines.high-definition@10.3.1/Runtime/Material/Material.hlsl(51) (on d3d11)

    Compiling Vertex program with DECALS_4RT SHADOW_MEDIUM USE_CLUSTERED_LIGHTLIST _BLENDMODE_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 DEBUG_DISPLAY LIGHTMAP_ON DIRLIGHTMAP_COMBINED DYNAMICLIGHTMAP_ON SHADOWS_SHADOWMASK DECALS_OFF DECALS_3RT USE_FPTL_LIGHTLIST SHADOW_LOW SHADOW_HIGH GPU_FRUSTUM_ON INSTANCING_ON PROCEDURAL_INSTANCING_ON _ALPHATEST_ON _BLENDMODE_ALPHA _BLENDMODE_ADDITIVE _BLENDMODE_PRE_MULTIPLY 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

    MicrosplatBlending3.png
     
  30. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461

    Yes, that's because I only support LTS versions of SRPs and you are running a preview build on a tech release. You'll have to wait until the 2020.3LTS version is released.
     
  31. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Maybe you have the wrong texture arrays assigned to the material..
     
  32. Matthias1231

    Matthias1231

    Joined:
    Aug 20, 2012
    Posts:
    62
    Since updating from 3.6 to 3.7 tessellation no longer shows when the terrain location is not at 0. It looks like it's not taking the terrain offset into account.
     
  33. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I fixed and submitted a patch for this about 10 minutes ago..
     
    Matthias1231 likes this.
  34. Matthias1231

    Matthias1231

    Joined:
    Aug 20, 2012
    Posts:
    62
  35. willwlh

    willwlh

    Joined:
    Sep 19, 2020
    Posts:
    3
    Can MicroSplat supporting the Curved World.I tried adding the code manually, but it didn't work.
     
  36. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    You'd have to add it to the files in the fragment folder, not the output shader code.
     
  37. willwlh

    willwlh

    Joined:
    Sep 19, 2020
    Posts:
    3
    I don't know how to add it to the folder, please help me,thank you.
     
  38. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    MicroSplat generates shaders from text files inside fragment folders- so when you want to modify the shader code, you modify those source files, and it generates the shaders from that. There's a "how to write a module" document in the documents folder than explains how things work.
     
  39. thenerdgian

    thenerdgian

    Joined:
    Feb 12, 2019
    Posts:
    1
    Hi, I recently purchased the Terrain Blending module is there any way to have it work with static objects? I currently get a warning about the object having multiple sub-meshes despite there only being one originally.
     
  40. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    No, Unity won't let you have multiple materials on static objects.
     
  41. Irina-uk

    Irina-uk

    Joined:
    Feb 14, 2014
    Posts:
    62
    Sorry, maybe not on-topic, but I searched in Google for an answer and could not find it. Standard unity shader diffuse 4 textures 256x256 on a mobile device 50 fps, MICROSPLAT with 4 textures 256x256, the fastest that could achieve 30 fps, the render quality is noticeably worse than the standard shader. Maybe I missed something. why praise MICROSPLAT if it can not give a decent speed on a mobile device ???
     
  42. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Read the optimization guide - the default MicroSplat texture is packed at 1024 anyway, so most likely you didn't set the size right and ended up scaling your 256 textures to 1024 without realizing it because you haven't really understood the system before trying to benchmark it.
     
    blacksun666 likes this.
  43. Irina-uk

    Irina-uk

    Joined:
    Feb 14, 2014
    Posts:
    62
    Maybe I missed something. Below are screenshots of how I have MicroSplat configured, this configuration is 50% slower than the standard Diffuse Terrain Unity. MicroSplatConfig_diff_tarray - 256x256 texture
     

    Attached Files:

  44. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Well as an example, you're still doing height based blending which the default unity shader does not do, and using full PBR lighting, which the diffuse version of the terrain shader does not do, so you should expect it to be slower until it's not running with extra features that the diffuse shader doesn't support.

    MicroSplat, by default, is setup to be a more advanced shader than the default Unity one- and specifically designed to outperform other shaders when dealing with high texture counts and complex shader features, none of which you are using - it is not designed around targetings the bottom of the speed/quality tradeoff for low end devices, though it provides a lot of mechanisms to disable features to get it to run well on low end devices (such as simpler lighting models, disabling height blending, etc).
     
  45. Seto

    Seto

    Joined:
    Oct 10, 2010
    Posts:
    243
    It seems that the ultimate bundle is of the version older than the terrain collection.
     
  46. Straafe

    Straafe

    Joined:
    Oct 15, 2012
    Posts:
    73
    If you purchase the ultimate bundle it just discounts all of the other module assets to be free, so you then download each of them as needed individually on their respective asset store pages and it will be the latest version.
     
  47. Kojote

    Kojote

    Joined:
    May 6, 2017
    Posts:
    200
    Hi!
    I have a question about the component "Micro Splat Terrain". Here I find "Bake Procedural to Terrain".
    Question: What is this for? I didn't find anything in the documentation. Does it have any advantages or disadvantages?
    Thanks! :)
     
  48. DGordon

    DGordon

    Joined:
    Dec 8, 2013
    Posts:
    649
    Any chance you can ever give us a way to control shadow color per texture or hardness? I'm using this with RealToon for everything else and its looking great, but the one thing I wish I had was better control over shadowing like a dedicated toon shader has on regular objects ... at that point, everything would gel perfectly.

    I would happily purchase this as another add on.
     
  49. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Read the docs on the procedural module.
     
  50. Irina-uk

    Irina-uk

    Joined:
    Feb 14, 2014
    Posts:
    62
    Tell me if there is any help on how to configure the shader for mobile devices? In the microplate package, I couldn't find any help with setting up a shader for a mobile device. I don't want to lose 50% of performance on medium mobilie devices. The rendering of the terrain in the microsplat looks more interesting.
     
Thread Status:
Not open for further replies.