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

    KomatsuMTS

    Joined:
    Jul 18, 2016
    Posts:
    22


    I just noticed the "Unknown package ID". Is this the problem? If so, this was from Asset Store.

    Showing the Add Component, and console errors.





    Showing the missing textures




    Info on PC.

     
  2. blitzvb

    blitzvb

    Joined:
    Mar 20, 2015
    Posts:
    284
  3. KomatsuMTS

    KomatsuMTS

    Joined:
    Jul 18, 2016
    Posts:
    22
    Thanks blitzvb. I discovered this minutes ago.. i am a document reader, and it did not mention that part in the tessellation documents. (smacks himself). Mr. Booth, would it be too much to ask for an edit to the main Tess document to mention "requires" ? Just askin. Thanks for the laugh at myself everyone.
     
    eaque and blitzvb like this.
  4. JohnTomorrow

    JohnTomorrow

    Joined:
    Apr 19, 2013
    Posts:
    135
    Hi, I am new to this asset so forgive my ignorance!

    I am trying to hook Microsplat up to MapMagic. We use MapMagic to generate terrain procedurally at runtime. MapMagic creatures tiles with the textures it needs per biome. It never includes any extra textures. In cases where multiple biomes intersect, it adds each biomes textures to the terrain tiles. This means that different terrain tiles can have different textures for the same texture indexes.

    Am I correct to assume Microsplat only cares about the terrain texture indexes? This seems it will be a deal breaker :( Is there any way to work around this?
     
  5. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    I think there is a setting in MapMagic to have all textures added to all terrains. Even if they are not present on that terrain tile.
     
  6. JohnTomorrow

    JohnTomorrow

    Joined:
    Apr 19, 2013
    Posts:
    135
    I don't see that setting, but I'm new to this asset as well. I suppose if it doesn't exist it shouldn't be too difficult to create a custom texture output node that does this...
     
  7. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    MapMagic output in the same format that MicroSplat reads, which is the standard Unity terrain format for texturing. There's a post in the MapMagic thread about doing proper integration of infinite terrains as well, including a script for it. It was also posted in the Discord channel:

    Code (CSharp):
    1.  
    2.  
    3. using UnityEngine;
    4. using JBooth.MicroSplat;
    5.  
    6.  
    7. namespace EternalLife
    8. {
    9.     public class MicroSplatMapMagicSync : MonoBehaviour
    10.     {
    11.         public Material MicrosplatMaterial;
    12.         public MicroSplatPropData PropData;
    13.  
    14.         public void Start()
    15.         {
    16.             MapMagic.MapMagic.OnGenerateFailed -= MapMagic_OnGenerateFailed;
    17.             MapMagic.MapMagic.OnGenerateCompleted -= MapMagic_OnGenerateCompleted;
    18.  
    19.             MapMagic.MapMagic.OnGenerateFailed += MapMagic_OnGenerateFailed;
    20.             MapMagic.MapMagic.OnGenerateCompleted += MapMagic_OnGenerateCompleted;
    21.         }
    22.  
    23.         private void MapMagic_OnGenerateCompleted(Terrain terrain)
    24.         {
    25.             MicroSplatTerrain mst = terrain.GetComponent<MicroSplatTerrain>();
    26.             if (mst == null)
    27.             {
    28.                 mst = terrain.gameObject.AddComponent<MicroSplatTerrain>();
    29.             }
    30.             mst.templateMaterial = this.MicrosplatMaterial;
    31.             mst.propData = this.PropData;
    32.             MicroSplatTerrain.SyncAll();
    33.         }
    34.  
    35.         private void MapMagic_OnGenerateFailed(Terrain terrain)
    36.         {
    37.             Debug.Log("Generation failed for terrain: " + terrain.name);
    38.         }
    39.  
    40.         public void OnDestroy()
    41.         {
    42.             MapMagic.MapMagic.OnGenerateFailed -= MapMagic_OnGenerateFailed;
    43.             MapMagic.MapMagic.OnGenerateCompleted -= MapMagic_OnGenerateCompleted;
    44.         }
    45.     }
    46. }
     
  8. JohnTomorrow

    JohnTomorrow

    Joined:
    Apr 19, 2013
    Posts:
    135
    Yes thanks I have seen that. It helps but is not a 100% solution. The problem I was facing is that when MapMagic assigns textures it is not consistent. This means texture at index 0 in biome A does not match the texture at index 0 in biome B. This messes up Microsplat. I digged through its source and found its splat output node. A few minor tweaks and I was able to make it output all the biome textures in the same order :)
     
    jbooth likes this.
  9. Rastapastor

    Rastapastor

    Joined:
    Jan 12, 2013
    Posts:
    589
    Island i've been working on recently

    In World Creator 2



    In Unity with all microsplat blows and wistles :) (excpet tesselation ofc, its too heavy for my GPU)





    I will post more when i work more on it tommorow :)
     
    eaque, coverpage, camta005 and 5 others like this.
  10. wmpunk

    wmpunk

    Joined:
    Sep 5, 2015
    Posts:
    71
    Advanced Details module is now live!
    Starting with a sale price of 7USD that will increase to 15 after the next big update.
    Pick it up while its cheap!;)

    For more information and support please use the thread here.
     
  11. greyhoundgames

    greyhoundgames

    Joined:
    Jan 24, 2014
    Posts:
    32
    So I am new to microsplat and 3d\terrain stuff in general. I grabbed Gaia and a few other things, I added the microsplat component to my terrain and ran everything as directed. Everything works but the before and after microsplat(compared to just plain gaia, no CTS) there wasn't much of a difference that I could tell. I am sure its just because I have the plain 4 textures that are used by default in terrain\gaia. Can anyone point me to a write up on how to combine gaia, more textures and what kind of textures to get the amazing visuals that some people are getting? Thanks!
     
  12. Rastapastor

    Rastapastor

    Joined:
    Jan 12, 2013
    Posts:
    589
    Terrain made by Yanik from World Creator 2 discord, i took it to Unity :) and added Micro goodness :)



     
    eaque, Akshara, coverpage and 2 others like this.
  13. antoripa

    antoripa

    Joined:
    Oct 19, 2015
    Posts:
    1,163
    Hello,
    terrain shader in general require that you have already created your terrain splatmap. You can change the Gaia splatmap textures adding more and changing the rules. After you can enrich the rendering with Microsplat and its modules. I would take the opporunity to share the link to a new asset I have been coding that it is dedicated for splatmap generator and support 100% Microsplat and it's addon .

    https://forum.unity.com/threads/bet...latmap-generator-multi-tiles-terrains.510887/
     
  14. Rastapastor

    Rastapastor

    Joined:
    Jan 12, 2013
    Posts:
    589
    I did some changes to the coloring of the sky and color grading (according to the creator of the terrain feedback) so it looks better now



    Here is the link to the build where u can run around and see it in full glory :), dont mind the sounds :D :D

    https://1drv.ms/u/s!AlDPbyn91-DHgZVXBsslKwVB6qOhkg
     
    eaque, Rowlan, camta005 and 4 others like this.
  15. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    Thought I would share a little video we made with all free assets except for microsplat add-ons. We are using it as a demonstration (how to start with Unity) at our local Unity User group. I added the moving sand to see how it looked in the scene. :) Not really Mars, more like just any generic alien planet.

     
    Jaimi, protopop, Akshara and 3 others like this.
  16. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,295
    I tried the build, looks awesome. Definitely have to get the Wind & Glitter module. Question: There is severe distortion in the distance on the bottom of the rocks. Do you know what's to blame for that?
     
    eaque likes this.
  17. Rastapastor

    Rastapastor

    Joined:
    Jan 12, 2013
    Posts:
    589
    Another day, another fun.

    This time the terrain is fully made by me.

    In World Creator 2



    In Unity





    Sadly I haven't worked on "tropical" foliage yet, so i use the assets i have (advanced foliage pack and free palm tree from speedtree, foliage distribution via Vegetation Studio)

     
    nirvanajie, eaque, protopop and 3 others like this.
  18. Teosis

    Teosis

    Joined:
    Jan 24, 2018
    Posts:
    22
    Could you please specify the exact lines and the script which should be tweaked? I gather it should be the TextureArreyConfig maybe and I see parts regarding the Substance there but I think I did something wrong as nothing has changed in regard to the substances.
     
  19. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    search for #if UNITY_2017_3_OR_NEWER in the project and remove it and the associated #endif block to re-enable the substance code. I believe it will be in the TextureArrayConfigEditor.cs file or TextureArrayConfig.cs

    When you upgrade to 2018, which has all substance code removed by Unity, this will not compile anymore.
     
  20. jebediahh

    jebediahh

    Joined:
    Feb 20, 2017
    Posts:
    26
    Hi - I'm looking for a way to paint a texture onto a terrain at runtime.. Do your products support anything like that? For context - I want the player to be able to prepare a little square or small area at a time for planting a garden.. So - they would pick a spot where there's grass texture or something, then use their garden tool and it and it turns to some dirt texture ready for planting.
     
  21. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Works just like doing this with standard Unity terrains..
     
  22. frogwise

    frogwise

    Joined:
    Nov 27, 2009
    Posts:
    103
    Hi there! I am finding an issue building my microsplat terrain to WebGL 2.0. Here is the error and my microsplat setup.

    Error after trying to launch the build in a browser:

    Argument 8 of WebGL2RenderingContext.compressedTexSubImage2D is not an object.


    My Setup:


    upload_2018-2-4_12-19-57.png
     
  23. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Are you sure Unity supports texture arrays in webgl? I know the spec for WebGL supports them, but I haven't seen any patch notes which say that Unity has added support...
     
  24. frogwise

    frogwise

    Joined:
    Nov 27, 2009
    Posts:
    103
    Interesting - I could have sworn I saw support for WebGL listed on the Microsplat asset store page.

    Also, it says in the manual that it is supported:

    upload_2018-2-4_21-44-52.png
     
  25. frogwise

    frogwise

    Joined:
    Nov 27, 2009
    Posts:
    103
    Here is the error in full:

    upload_2018-2-4_21-58-0.png
     
  26. ThisIsKetts

    ThisIsKetts

    Joined:
    Jun 29, 2015
    Posts:
    1
    Fixed, deleted the microsplat data, and all the script attached the terrain reattached the script and remade all the data again and it fixed it.


    I closed down unity last night with my scene view looking fine and textured, I open up today with this error. I am only using the core module
    Code (CSharp):
    1. Could not create a custom UI for the shader 'MicroSplat/Terrain'. The shader has the following: 'CustomEditor = MicroSplatShaderGUI'. Does the custom editor specified include its namespace? And does the class either derive from ShaderGUI or MaterialEditor?
    2. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    This is what my scene looks like
    erm ok.PNG

    This is what it used to look like
    My terrian so far.PNG
     
    Last edited: Feb 5, 2018
  27. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    That error looks like some of the MicroSplat files are not in your project, or perhaps you have a compile error?
     
  28. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    860
    Hello Jason,

    What a great asset "Microsplat" is! Hey man I am having this error log in my Xbox One Console:

    Shader 'MicroSplat/TerrainWithTC': dependency 'AddPassShader' shader 'Hidden/MicroSplat/AddPass' not found

    Any idea of what this means?

    Regards,
    Carlos
     
    antoripa likes this.
  29. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Try adding the add pass shader to the included shaders in the build setting; the error won’t cause any visual issues, but using that add pass shader is an optimization over the one Unity uses.
     
  30. Thall33

    Thall33

    Joined:
    Sep 18, 2013
    Posts:
    134
    Hi Jason,

    Amazing system, just been digging into it. I was most intrigued by the terrain blending tool as this feature really separates environment creation from the previous gen to now with this enhancement.

    Am I correct the the way it functions is to project downwards from the Y value? I was wondering if there is a solution for this sort of stretching on high vertically objects, I tried an array of settings and tweaks to the model without much success. Thoughts?

    Thanks for your time!

    Capture.PNG
     
    Last edited: Feb 12, 2018
  31. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Use triplanar mapping instead, and the terrain on the object will be triplanar mapped as well..
     
  32. acaton

    acaton

    Joined:
    May 27, 2013
    Posts:
    28
    Hi Jason,
    I've really been enjoying your system and have added quite a few features that my game requires, tweaking the txt files to do so. Your code is really easy to understand and my changes have been going smashingly. I do have 2 quick questions for ya, if you have time:

    1) My friend keeps suggesting I set up a geometry shader to implement a fix I can't quite do with the vertex shader. I've found several examples of geometry shaders elsewhere, but have had trouble getting it to build with MicroSplat. Any chance you could send me a small snippet of a geom shader I could add. I know how to find everything in your system (I think), so I can add the pragmas to your cs files and stuff, but I think you need to change the return values of things like your disp method to serve as input to the geom shader, right? My current issue seems to center around undefined TriangleStream, but there could easily be a larger systemic issue I don't understand.

    2) I'm having unity culling issues because the vertices are being shoved around so art is actually appearing quite a ways away from where unity believes the terrain to be. I've seen 'bounds' in terrain which appears right based on its old position, but it's read-only so I can't tweak it. There's a bounds multiplier which helps when I set multiplier to like 50, but that kills fps and doesn't always work. I've also tied onprecull for the camera and turning off culling on the camera (which didn't appear to do anything) without success. Do you know how I can tell Unity to consider my terrain to have different bounds OR (if easier) just force it to draw my terrain regardless?
     
  33. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    In general, I would suggest you never use a geometry shader for any reason what so ever. They aren't supported on Metal, and modern pipelines avoid them by using a compute shader instead. They are also very slow, and Unity does not expose them well in surface shaders (or maybe at all?).

    As for the bounds issue, I'm not sure there is much you can do if you cannot edit the bounds itself. You might be able to grab the renderer from the terrain and set it there (internally it has it's own renderer), but I've never tried that.
     
    Flurgle likes this.
  34. acaton

    acaton

    Joined:
    May 27, 2013
    Posts:
    28
    Jason,

    Thanks for the quick reply!

    You said I might be able to grab the renderer from the terrain? I haven't seen that--do you know where I can find it? Is it set in the terrain settings? Do you know if it's the one that converts heightmaps into triangles for the shader to use? I've been looking for that missing link between the terrain data we enter in unity and MicroSplat--that might be just the puzzle piece I need!

    Thanks again and have a great afternoon!
     
  35. eaque

    eaque

    Joined:
    Aug 20, 2014
    Posts:
    764
    Hi, sorry to bother again i'm keeping on giving microsplat a try, but am i the only one who has to choose beetwin artefacts or blurry textures??
    When i convert the terrain to microsplat i loose all the blending so i go into the settings to tweak "interpolation contrast" but can't get rid of the artefact without loosing the definition!!
    thx in advance for your help
     

    Attached Files:

  36. eaque

    eaque

    Joined:
    Aug 20, 2014
    Posts:
    764
    other shots...:(
     

    Attached Files:

  37. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Read the section on per-texture UV scales in the documentation..
     
    eaque likes this.
  38. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    You might be able to do a GetComponent<Renderer> to grab it, I can't remember if it secretly has one or not..
     
  39. eaque

    eaque

    Joined:
    Aug 20, 2014
    Posts:
    764
    ok i will, thanks for your answer!
     
  40. acaton

    acaton

    Joined:
    May 27, 2013
    Posts:
    28
    Thanks, I'll check it out. Take care.
     
  41. JohnTomorrow

    JohnTomorrow

    Joined:
    Apr 19, 2013
    Posts:
    135
    I am getting errors running Microsplat on OSX. Everything works fine on Windows machines. I get the following errors:

    -------- GLSL link error: WARNING: Output of vertex shader 'vs_TEXCOORD7' not read by fragment shader
    ERROR: Implementation limit of 16 active fragment shader samplers (e.g., maximum number of supported image units) exceeded, fragment shader uses 17 samplers


    -------- GLSL link error: ERROR: Implementation limit of 16 active fragment shader samplers (e.g., maximum number of supported image units) exceeded, fragment shader uses 18 samplers


    Shader error in 'Hidden/MicroSplat/Terrain 0,0_Base504548427': invalid subscript 'instanceID' 'UnitySetupInstanceID': no matching 1 parameter function at line 1708 (on glcore)

    Compiling Vertex program with DIRECTIONAL LIGHTPROBE_SH INSTANCING_ON
    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

    How can I fix this?
     
  42. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    OSX does not support sharing samplers like windows does, so you have a limit of 16 possible texture samplers in use. You'll have to turn off some features to make it fit within OSX's driver limit (the hardware supports everything, but OSX drivers suck)
     
  43. eaque

    eaque

    Joined:
    Aug 20, 2014
    Posts:
    764
    I 'm on it, so correct me if i'm wrong...

    1-To avoy artefacts i changed sampler mode from default to gradient, artefacts are gone but texture are blurry

    2-to avoy that refering to your answer and the docs i have to change the uv scale ? right ?but it changes the entire look of the texture cause under 0.5 it's blurry
    As you write in the docs it's better not to change large values so here is my question:
    Maybe i'm unlucky but does that mean that i can't set the scale i want ? and there is no other solution :(, right? i admit i'm a bit lost with all those settings so i don't wanna miss something...
    thx in advance;)
     

    Attached Files:

  44. JohnTomorrow

    JohnTomorrow

    Joined:
    Apr 19, 2013
    Posts:
    135
    Great, got it to work. Thank you. Anyway to make this dynamic in the future? Would be nice if Microsplat automatically reduced clusters or other settings based off of built platform to get things to run instead of erroring out.
     
  45. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    There's no easy way to know how many samplers a shader uses, because Unity generates variants of shaders based on the lighting conditions. For instance, if you were to change the way your scene was lit, it might use a variant of the shader which needs another sampler for, say, light probes, and fail to compile that variant. It's a really annoying issue, as the hardware is capable of sharing sampler states but Apple just hasn't made their drivers do that..
     
  46. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    The main UV scale doesn't matter, it's the per-texture UV scale that causes the issue. Ideally you never use per-texture UV scales, because that creates inconsistencies in texel density - but in practice sometimes the texture data you have is just the wrong scale, and reworking the texture is not an option.

    The reasons for the artifact issue are deep in "how a GPU works" land, and described in this thread somewhere, but basically when using the LOD sampler I select the mip map in the shader rather than letting the hardware do it, which fixes the issue (but breaks anisotropic, which makes things blurrier on certain angles). Note that this issue only seems to happen on some GPUs, which makes it even more annoying.
     
    eaque likes this.
  47. JohnTomorrow

    JohnTomorrow

    Joined:
    Apr 19, 2013
    Posts:
    135
    Ahh right, yeah that is. I'll create a low quality Microsplat setup to be assigned at runtime if the runtime platform is OSX to avoid this issue.
     
  48. @jbooth

    Hi Jason,

    First of all, thank you for all of your hard work. I'm a big fan of your products. I have the Megasplat for a time now, played around with it and I really like it. Unfortunately I didn't have the opportunity to use it in any real product yet, but sooner or later.
    I have to say this, I've read through your support threads and your insights on the beta forums as well and I think you're doing an excellent work. Although I really don't need them at the moment, but I decided to buy all of your extensions for the Microsplat as well, just because I can and I want to support your work. I'm sure this time I will use some of them in real project. :D

    So, thank you for all the shaders and systems and relentless work and support and fish, you're one of the best developers on the UAS.
     
    Akshara, jbooth and camta005 like this.
  49. eaque

    eaque

    Joined:
    Aug 20, 2014
    Posts:
    764
    I see, unlucky this time! :( Maybe time for me to change my old gt660 ti :p
    Anyway thanks for your always clear and very fast answers!
     
  50. kepesh

    kepesh

    Joined:
    Dec 29, 2017
    Posts:
    92
    Is it possible to get the microsplat shader to work with ambient occlusion? I'm using deferred rendering and the post processing stack, everything gets affected except the terrain. I'm guessing it has something to do with the G buffer or something?

    Thanks!
     
Thread Status:
Not open for further replies.