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

    SgtLame

    Joined:
    Nov 26, 2015
    Posts:
    129
    Let's hope this time I am not asking another dumb question, but here goes: I need to play with the transparency of the multiple textures being applied on my terrain. In the below example, I want those "gray stains" (obtained with the noise setttings from the procedural texturing module) to be more transparent, or more blurrily blended on the underneath terrain. Using the per texture settings, I tried to play with the "interpolation contrast" setting and with the alpha value of the tint, but it does nothing. How can I achieve that?

    Clipboard02.jpg
     
  2. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Well first realize that things are not alpha blended, but height map blended - meaning it favors one texture winning over another based on the height map. If you turn off height blending, or adjust interpolation contrast all the way down, then it's closer to alpha. But in this case, since you are using procedural texturing, most likely what you want to do is lower the weight of that layer.
     
  3. TooManyPotatoes

    TooManyPotatoes

    Joined:
    Apr 11, 2014
    Posts:
    6
    Hey, I am new to microsplat and map magic 2 so excuse my ignorance. I've watched a couple tutorials and have begun messing with each package and trying to integrate them but I am running into a very simple issue. My terrain material is waaaay too specular. Every texture is reflecting way too much light, is there any way to mitigate this? I'll include an image for reference.

    https://imgur.com/a/TATJmwl


    Any assistance would be appreciated.
     
  4. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Adjust your smoothness maps..
     
  5. SgtLame

    SgtLame

    Joined:
    Nov 26, 2015
    Posts:
    129
    Ok, thank you for your answer. I gave it a try, and problem is, it is all or nothing when I try to adjust the weight of that particular texture:

     
  6. TooManyPotatoes

    TooManyPotatoes

    Joined:
    Apr 11, 2014
    Posts:
    6
    Within the per texture properties of the microsplat shader? Or do you mean adjust the maps of each textures files individually?
     
  7. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yes, because your noise value is -10 to +13; so you are generating a weight between -10 and +13, for a weight that maxes out at 0-1. You should re-read the docs, it talks about overdriving the noise values like this specifically.
     
  8. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    The most common cause of this is people put roughness or gloss maps into the smoothness slot, or pull from the wrong channel when reading the images, and have textures close to white for them.
     
  9. SgtLame

    SgtLame

    Joined:
    Nov 26, 2015
    Posts:
    129
    Thanks a lot, I read through the module documentation and got it to work as I needed.
     
  10. TooManyPotatoes

    TooManyPotatoes

    Joined:
    Apr 11, 2014
    Posts:
    6
    I guess it might have been that I was using a roughness map in the smoothness slot. Are these convertable maps? Can I convert a roughness map to a smoothness by inverting it or something. Again, thanks for the quick replies, I appreciate the help a lot.
     
  11. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yeah, there's an invert button on the texture array config you can use to do just that.
     
  12. TooManyPotatoes

    TooManyPotatoes

    Joined:
    Apr 11, 2014
    Posts:
    6
    Thanks, I'll try that out when I get home.
     
  13. SkandYxyz

    SkandYxyz

    Joined:
    Mar 13, 2015
    Posts:
    83
    Hey,

    upload_2021-1-22_22-55-48.png

    when I use Unity terrain in HDRP and bake lighting (lightmap, shadowmap etc. ) with Bakery, everything works fine. I applied Microsplat and now, something is messed up. Do you have an idea what could cause this?

    upload_2021-1-22_22-59-55.png

    lightmap seems to be baked correct.

    I am using Gaia Pro. Marking and saving each terrain/scene as instanced helps a bit.

    upload_2021-1-23_14-3-58.png

    upload_2021-1-23_14-21-58.png

    It turns out that terrain layers seem to be different. I can fix it by restamping the issued locations with gaia.

    Unity 2019.4.18f1
    Windows
    HDRP 7.5.2

    In my case shadowmaps did not work on Microsplat terrain whereas they did on Unity Terrain.

    Best,
    Andre
     

    Attached Files:

    Last edited: Jan 23, 2021
  14. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I have a repro I'm working on for some issues, not sure if they are the same or not though.. What version of HDRP/Unity/Platform?
     
  15. SgtLame

    SgtLame

    Joined:
    Nov 26, 2015
    Posts:
    129
    Hi,
    I need to use splatmaps in my project and I'd like to know if it is possible with Microsplat. The thing is, I'm not sure I have a good understanding of what a splatmap is, or if "splatmap" is the right word for what I need.
    What I want to do is being able to have textures applied in different regions of the terrain, using (what I believe is called) a splatmap, e.g. an image with different zones, each zone being painted with a specific color, each color being then associated with a specific texture/material to be applied on the area covered by that color. From what I could understand, textures can also be associated with the image RGBA channels. Anyway, I searched Microsplat's documentation and could find only two references to splatmaps, one in the mesh workflow, and one in the core documentation, through the "use custom splatmaps" option. I gave it a try, bud could not find where the user can supply his custom splatmap, and in the end I'm not even sure this option matches what I'd like to do.

    EDIT: Had a better look at the documentation, and I think I'm getting closer: It is done through the MicroSplatTerrain script attached to the terrain, in the "import splat maps" section. But I can't find what's wrong with my setup. See below:

    Clipboard02.jpg

    Regarding Splat import/export, documentation says "it will only import splat data for channels with textures assigned". I'm going to try with an image where mapping is done through RGBA channels.

    NEXT-EDIT: Ok, I think I'm close, but this is where I'm stuck. See the splamap image below:

    photoshop.jpg

    And here is the result in Unity/Microsplat:

    Clipboard02.jpg

    The R channel is associated with the texture with the 0 index, G channel with texture 1 and B channel with texture 2. But how come the splapmap is appled kind of "reverse"? And biggest issue: Why the texture 0 is applied on the whole image, but darker than the "R" spot?
    What am I doing wrong?
     
    Last edited: Jan 23, 2021
  16. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Splat maps need to be normalized to 1, so that the total of the R, G, B, A channels = 1. And if your working with more than 4 textures (multiple splat maps), then all of those channels need to total 1. The splat map importer/exporter expects the data in the orientation that Unity expects, so you may have to rotate/flip your image to match the internal Unity representation.
     
  17. Foulcloud

    Foulcloud

    Joined:
    Mar 23, 2014
    Posts:
    19
    I am having same problem as TipTop3D. When "Terrain Instanced" is on, the terrain disappears. This happened when I upgraded my Project to Unity 2020.2.latest. I have noted that after play has started, if I increase "Terrain Base Map Distance" on the terrain, the terrain will start to appear. By default, it seems that Microsplat sets this to 0 when scene starts.
     
  18. Da-Luk

    Da-Luk

    Joined:
    Apr 25, 2017
    Posts:
    53
    Hey, i dont know how that happened, this seems to be in my scene for a while. Any idea what im doing wrong? The colors are over my whole terrain and meet at the center.
    The lower part is all right how it should be, but top (green) left (yellow) and right blue are not. How to get rid of that colors ?
    Thanks in advance
     

    Attached Files:

    Last edited: Jan 23, 2021
  19. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Terrain Base Map is set to 0 when tessellation is not used- when tessellation is used, it uses the basemap shader as a fallback to the main shader. Most likely you issue with instancing can be solved by simply toggling an option on the shader features forcing it to reset the state on the material.
     
  20. Foulcloud

    Foulcloud

    Joined:
    Mar 23, 2014
    Posts:
    19
    I am not using tesselation. I have reset several options in the shader and updated the textures in the Microsplat Config and problem is the same. Another thing I have noted is that if I pause the Unity editor or activate my in game pause (timescale 0) then the terrain suddenly appears. Almost seems like the problem appears when game is under load. I am testing on two different scenes with medium sized terrain. This problem did not happen on other versions of Unity, the latest I used being 2020.1.16.
     
  21. NightElfik

    NightElfik

    Joined:
    Oct 27, 2014
    Posts:
    27
    Hi, I was testing out some anti-tiling features and when I switched to Resample Fade = "Noise", I got an exception below and the terrain resampling not working properly.

    Code (csharp):
    1. ArgumentException: Could not find MaterialProperty: '_DistanceResampleNoiseParams', Num properties: 10
    2. UnityEditor.ShaderGUI.FindProperty (System.String propertyName, UnityEditor.MaterialProperty[] properties, System.Boolean propertyIsMandatory) (at <af78ad00a40d4f61b82afc6cafb0a416>:0)
    3. UnityEditor.ShaderGUI.FindProperty (System.String propertyName, UnityEditor.MaterialProperty[] properties) (at <af78ad00a40d4f61b82afc6cafb0a416>:0)
    4. MicroSplatShaderGUI.FindProp (System.String name, UnityEditor.MaterialProperty[] props) (at Assets/MicroSplat/Core/Scripts/Editor/MicroSplatShaderGUI.cs:21)
    5. JBooth.MicroSplat.MicroSplatDetailResample.DrawShaderGUI (MicroSplatShaderGUI shaderGUI, MicroSplatKeywords keywords, UnityEngine.Material mat, UnityEditor.MaterialEditor materialEditor, UnityEditor.MaterialProperty[] props) (at Assets/MicroSplat/AntiTile/Scripts/Editor/MicroSplatDetailResample.cs:410)
    6. MicroSplatShaderGUI.OnGUI (UnityEditor.MaterialEditor materialEditor, UnityEditor.MaterialProperty[] props) (at Assets/MicroSplat/Core/Scripts/Editor/MicroSplatShaderGUI.cs:298)
    7. UnityEditor.MaterialEditor.PropertiesGUI () (at <af78ad00a40d4f61b82afc6cafb0a416>:0)
    8. UnityEditor.MaterialEditor.OnInspectorGUI () (at <af78ad00a40d4f61b82afc6cafb0a416>:0)
    9. UnityEditor.UIElements.InspectorElement+<>c__DisplayClass58_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <af78ad00a40d4f61b82afc6cafb0a416>:0)
    10. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    11.  
    Any idea what am I doing wrong? I do also use Mesh workflow.
    Thanks!
     
  22. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I just tried this, and it all seemed to work fine. An error like this can happen sometimes when the shader is not fully compiled but the GUI is trying to draw properties that aren't in the new shader file yet. The only time it would be an issue is if it throws this every time you touch the GUI..
     
  23. militiapc

    militiapc

    Joined:
    Nov 3, 2020
    Posts:
    14
    How and where do i get the Triplanar module to work. I added the core microsplat to my terrain and converted to microsplat, but I can't find how to use the triplanar.
     
  24. militiapc

    militiapc

    Joined:
    Nov 3, 2020
    Posts:
    14
    Nvm, I found it :D
     
  25. SgtLame

    SgtLame

    Joined:
    Nov 26, 2015
    Posts:
    129
    Thanks a lot, I now understand how it is done and it works like a charm!
     
  26. NightElfik

    NightElfik

    Joined:
    Oct 27, 2014
    Posts:
    27
    Thank you Jason for looking into it. This happens to me every time I switch to the noise overlay. I am on the latest LTS version (2019).

    Regardless, the strange part is that the distance resampling then does not work (in the noise resample fade option). It looks like the terrain has always the "further" samples, and missing the close original texture. Changing noise frequency has no visual effect. How would I go about debugging this? I wanted to use noise fading since constant distance creates this "lighter circle" circle effect while zooming in the transition area.

    Thanks!
     
  27. Rastapastor

    Rastapastor

    Joined:
    Jan 12, 2013
    Posts:
    589
    Terrain made with World Creator standalone. Textures from Game Textures library.

    Also used Enviro and Aquas. Standard pipeline.
     

    Attached Files:

    • 1.jpg
      1.jpg
      File size:
      562.7 KB
      Views:
      352
    • 2.jpg
      2.jpg
      File size:
      343.3 KB
      Views:
      347
    • 3.jpg
      3.jpg
      File size:
      494.2 KB
      Views:
      350
    • 4.jpg
      4.jpg
      File size:
      375.6 KB
      Views:
      348
    Mauri and ledshok like this.
  28. Matthias1231

    Matthias1231

    Joined:
    Aug 20, 2012
    Posts:
    62
    Hello,

    apologies if this has been asked before, but I haven't been around in a while.

    I think there is an issue with the MicroSplat tessellation offset blending. When blending between multiple terrain textures with the same offset, it appears the offset at the intersection blends towards 0 instead of the average offset of the contributing textures.

    For example when I have multiple grass textures on a flat surface, a tessellation offset of 0 results in a flat surface. But a tessellation offset of -0.5 on all textures results in little berms at the texture boundaries.

    I'm happy to post screenshots if this explanation is too cryptic.

    Matthias
     
  29. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I think I see what could be causing this- PM me, and I can send you a replacement file and we can see if it fixes the issue.
     
  30. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    I have a question about the Procedural Texturing module. We would love to use this for 95% of our terrain, but in a few places, allow our artists to hand-paint some paths or clearings or whatever. And in case it matters, our plan is to ultimately Bake the procedural texture out to normal splat maps.

    So the obvious approach is to use Procedural Texturing until we're ready to commit to its results, then bake it, and switch to entirely hand-painting thereafter. But this is less than ideal, because if we decide we want to tweak the procedural texturing a little bit more, we can no longer do so without losing our hand-painted areas.

    Is there any way to, for example, add a hand-painted layer on top of all the procedural layers, and keep that around even as the layers underneath do their procedural thing?

    EDIT: Never mind. I just found the "Non destructive workflow". Amazing! This looks like exactly what we want. Provided it all bakes out nicely — but by this point, I have no reason to doubt!
     
    Last edited: Jan 27, 2021
    jbooth likes this.
  31. Rastapastor

    Rastapastor

    Joined:
    Jan 12, 2013
    Posts:
    589
    Terrain made with World Creator 2 Standalone. Textures from Game Textures. Unity 2019.4 lts HDRP
     

    Attached Files:

    • 1.jpg
      1.jpg
      File size:
      487.1 KB
      Views:
      344
    • 2.jpg
      2.jpg
      File size:
      403.2 KB
      Views:
      344
    • 3.jpg
      3.jpg
      File size:
      501.2 KB
      Views:
      358
    • 4.jpg
      4.jpg
      File size:
      574.8 KB
      Views:
      342
  32. Wolfos

    Wolfos

    Joined:
    Mar 17, 2011
    Posts:
    951
    Any chance we might get Unity 2020 HDRP support any time soon? LTS is right around the corner and shouldn't be much more than a bugfix update.
     
  33. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    If it's so easy, go ahead and do the port yourself. I can't start on supporting 2020.3 LTS until they release it- last time they added shadow cascades to URP 3 days before LTS shipped, I'm not going to do weeks of work only to have it require re-doing a week later.
     
    Willbkool_FPCS likes this.
  34. Wolfos

    Wolfos

    Joined:
    Mar 17, 2011
    Posts:
    951
  35. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yeah, decals is pretty much a top to bottom rewrite- I fixed that computescreenpos issue a while back, you're likely downloading old versions from the package manager because it's completely broken and doesn't give you the latest versions unless you clear the cache every time- and shows you as having the latest, to make it even worse.
     
  36. dannygr40

    dannygr40

    Joined:
    Apr 24, 2020
    Posts:
    1
    ¡¡Hola!! Estoy usando Microsplat en la unidad 2019.3 HDRP no funciona ... cómo puedo solucionar esto ... gracias ... perdón por mi inglés
     
  37. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    You have to install the HDRP adapter and set the material's renderloop to UnityHD.
     
  38. tree_arb

    tree_arb

    Joined:
    Dec 30, 2019
    Posts:
    323
    Hi, would microsplat work properly with the unity "terrain tools" currently in preview?

    sorry it this is a common quesiton
     
  39. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Sure..
     
    tree_arb likes this.
  40. tree_arb

    tree_arb

    Joined:
    Dec 30, 2019
    Posts:
    323
    Hello, I just tried microsplat on mobile with unexpected results, perhaps someone can point me in the right direction.
    My goal is to get best performance out of unity terrain on mobile.

    I selected my terrain, add component microsplat terrain, convert to microsplat.
    my result is poor framerate.

    Using No microsplat:

    terrain disabled: 75fps / 90fps
    terrain enabled with 1 to 4 layers with NO normal maps (65fps / 90fps)
    (with no normal maps, extra texture layers seem to not impact performance much)

    Normal maps on just one of the terrain textures lowers to 59fps/76fps


    With microsplat: (and the 4 textures):
    25fps

    I figure this is due to the normal maps, so I select
    "normal map mode disabled"
    but still have low framerate.

    what might I be missing, and for mobile is it just accepted that terrains should not use normal maps?

    my test setup:
    Unity Terrain with some added complex and non-complex game objects in the scene ( 60-90fps variance reflects looking at these complex areas or not)
     
  41. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    "Mobile" is such a wide platform that it no longer has any meaning when talking about performance. There's an optimization guide in the docs folder, and the default texture size for MicroSplat's arrays is 1024, no idea what your using on the comparison terrain.
     
  42. Dobalina

    Dobalina

    Joined:
    Sep 6, 2013
    Posts:
    105
    Hi @jbooth I have a series of terrain islands that use microsplat. From what I can tell, when using microsplat procedural texturing, terrains come with a CPU cost even when the terrain is off screen. If I have that correct, is there any setting or method to prevent this off screen cost? (excluding baking the procedural texturing)

    Currently I'm having to manually turn off the entire terrain when out of screen bounds, though my method isn't ideal.
     
    Last edited: Feb 4, 2021
  43. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Runtime Procedural Texturing has no CPU cost per frame; the only time it does anything on the CPU is if you change some parameter and call the sync function, uploading the new data to the GPU.
     
  44. Dobalina

    Dobalina

    Joined:
    Sep 6, 2013
    Posts:
    105
    Ah I see, I must be altering it in some way. I'll dig deeper and see whats causing it. Thanks!
     
  45. eggsamurai

    eggsamurai

    Joined:
    Oct 10, 2015
    Posts:
    114
    2020.2 & hdrp10 ~
     
  46. DGordon

    DGordon

    Joined:
    Dec 8, 2013
    Posts:
    649
    I came on here to ask about what I assume this guy is asking.

    Any ETA on when 2020.2 will work with HDRP? I want to try out the tessellation ... I already own it, now I'm just waiting :).
     
    eggsamurai likes this.
  47. Kennth

    Kennth

    Joined:
    Aug 11, 2017
    Posts:
    116
    Quick question if I may...

    I got your MicroSplat - Terrain Collection Released Jan 7th 2019 https://assetstore.unity.com/packages/tools/terrain/microsplat-terrain-collection-135693#releases

    I recently noticed you have come out with a more complete bundle MicroSplat - Ultimate Bundle Released Oct 19th 2020
    https://assetstore.unity.com/packages/tools/terrain/microsplat-ultimate-bundle-180948#releases

    Thing is as far as I can remember all other similar type " upgrades " would have an automatic discount, since you had
    already bought the main asset ?

    Is this just an over sight ? or meant to be that I have to re-buy the assets I already have ?
    Apart from that.. Thank you very much for your continued hard work and constant upgrades to
    all your modules. Thanks so much.
     
  48. ViluGames

    ViluGames

    Joined:
    Oct 8, 2020
    Posts:
    2
    Hello, i've recently bought the MicroSplat urp support (3.61), but when i imported it, it didnt compile a script, it shows me this error:

    Assets\MicroSplat\CoreLD\Scripts\Editor\UnityLDRenderLoopAdapter.cs(128,64): error CS1061: 'MicroSplatShaderGUI.MicroSplatCompiler.AuxShader' does not contain a definition for 'customEditor' and no accessible extension method 'customEditor' accepting a first argument of type 'MicroSplatShaderGUI.MicroSplatCompiler.AuxShader' could be found (are you missing a using directive or an assembly reference?)

    Im currently using Unity 2020.1.17f1, with a fresh URP render asset and MicroSplat Core 3.64
    also the sample scene that comes in CoreLD shows the whole terrain in pink
    hope someone can help me with this.
     
  49. one_one

    one_one

    Joined:
    May 20, 2013
    Posts:
    621
    Sorry if this is a dumb question, but will your Better Shaders approach help you more easily port Microsplat? Or will you keep Microsplat 'bare metal' for performance reasons?
     
  50. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I officially only support LTS versions of HDRP, which 2020.2 is not. That said, the current version works in 2020.2, just not things which have changed in the SRP like the decal implementation.
     
    DGordon likes this.
Thread Status:
Not open for further replies.