Search Unity

  1. Unity 2019.2 is now released.
    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:
    3,622

    If your doing AO in post processing, then it should work fine..
     
  2. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    645
    Can MicroSplat be used with meshes somehow (manually assigning splat maps to the _controlX slots just seems to break things) or do i have to use MegaSplat for this?
     
  3. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,622
    If the meshes are basically terrains, then yes- you can rewrite the MicroSplatTerrain component to do the management. If your talking about arbitrary meshes, then not really, because it is assumed your dealing with terrains and don't have things like overlapping UV coordinates, etc..
     
  4. docseuss

    docseuss

    Joined:
    Apr 5, 2016
    Posts:
    38
    Jason,
    I also own Megasplat and have it built into my mapmagic workflow, however I have now started playing with MicroSplat and have bought most of the modules for it. I am now going back to some of my MapMagic projects that generate terrain at runtime and I am wondering if there is away to swap out Megasplat for Microsplat with MapMagic? I know I can just attach the shader/material to the Terrain, but I need to be able to generate textures using the canvas like I can for Megaspalt. Is that possible? Did I make that clear as mud?
     
  5. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,622
    You mean using the texture graph in MegaSplat, or Map Magic's graph? Because the Map Magic graph can generate texture data for the terrain- pretty sure many people are using it for that in this thread..
     
  6. docseuss

    docseuss

    Joined:
    Apr 5, 2016
    Posts:
    38
    Jason,
    My apologies as I thought what I was asking might be clear as mud. should have taken more time to explain what I was asking.

    Right now in MapMagic I generate a Megasplat Material from the shader and use that as the custom shader for Map Magic. Also when I install Megasplat I get an output generator for Megasplat to use in the Map Magic graphs (node editor). I do not see the same functionality for MicroSplat and so I am unclear how to map my textures in the generator for a runtime procedural generated infinite terrain.

    Does that make more sense? Am I over thinking it?
     
  7. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,622

    I think you can use the custom output node for MapMagic; you can also find a script and instructions for infinite terrain mode in this thread or the map magic one.
     
    Rowlan likes this.
  8. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,093
    @jbooth thank you for sharing the MicroSplat MapMagic sync script. It worked like a charm. What i really love about MicroSplat is this lightweight approach you took, and how the framework feels efficient - that goes a long way to making an asset pleasurable to use.
     
  9. moxi299

    moxi299

    Joined:
    Jul 6, 2015
    Posts:
    36
    do you have an approximate date for this?
     
  10. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,622
    Nope..
     
  11. Vanidash-Studios

    Vanidash-Studios

    Joined:
    Mar 9, 2016
    Posts:
    71
    Hi, im having some trouble with scaled uv textures, already tried the mip and gradient options, but im still seeing a very thin line in the terrain, any solution for this? already tested with nvidia and amd gpus, same result
     
  12. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,622
    I have never seen this issue appear when using LOD samplers. Got a screenshot?
     
  13. Vanidash-Studios

    Vanidash-Studios

    Joined:
    Mar 9, 2016
    Posts:
    71
    Tried taking a screenshot, but its not showing, its more noticeable in game, because it kinda moves (like a hard edge i would say). Also when i use the lod sampler, some parts would become "noisy"

    edit: also noticed its only happening around a small place where i painted a new texture, very close to its border.

    edit2: i changed every texture to use the same uv scale number, and its working properly now.
     
    Last edited: Feb 25, 2018
  14. OldLadyNevermore

    OldLadyNevermore

    Joined:
    Jul 17, 2013
    Posts:
    5
    Hello, Just installed the core for microsplat and I do not see how to access the 'terrain paint' window you mention in your video. Is this the correct location to ask for advice?
     
  15. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,622
    You use the Unity tools for painting terrain.
     
  16. blitzvb

    blitzvb

    Joined:
    Mar 20, 2015
    Posts:
    284
    Hey,

    Do you have any plan to provide a shader graph MS module or Amplify Shader ?

    It would be awesome to add gameplay shader feature for shader noob like me. I would pay big bucks for a module like that.

    Thanks in advance.
     
  17. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,024
    I'm trying to use MicroSplat in a mobile game. I don't need a lot of features, so just have Core and Anti-Tiling set up. But on iPad Air, it runs very slowly (9fps, with 100+ WaitforGFX). On iPhone X, it runs great. So I may have to default to standard terrain shader on older devices....or do you have any suggestions on how to get MS to run decently on them?
     
  18. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,622
    Keep an eye on the sampler count in the debug section and possibly experiment with other quality settings (LOD sampler, blend quality, etc)- also, you can run it in Instruments and take a GPU capture and see which lines of the shader are taking the most time, if you are memory or ALU bound, etc.
     
  19. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,024
    Hmm, the app crashes when I start to collect data in Instruments. But anyways, another problem: I noticed a warning in xcode about the MicroSplat AddPass shader not being included, and I remembered a note about that here, so found that and added that shader to the project Graphics settings...but xcode still says it's missing:

    Shader 'MicroSplat/TerrainOriginal': dependency 'AddPassShader' shader 'Hidden/MicroSplat/AddPass' not found
    UnloadTime: 3.330458 ms
    ERROR: Shader Shader is not supported on this GPU (none of subshaders/fallbacks are suitable)WARNING: Shader Unsupported: '' - Setting to default shader.

    (Not sure if that "shader shader" is related to microsplat or not.)

    And you can see it's added to the graphics panel -- any ideas? Or is it not something to worry about?
    Screen Shot 2018-02-26 at 3.50.29 PM.png




     
  20. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,622
    That shouldn't cause an issue- but it not being found could slow down the shader. Perhaps it's not finding the name correctly?
     
  21. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,024
    Dunno, I just dragged the MS AddPass shader into the slot, no typing involved. Puzzling.
     
  22. StuntFriar

    StuntFriar

    Joined:
    Sep 10, 2015
    Posts:
    8
    Hi Mr Booth,

    We've been getting many variations of the following error in our game when building on consoles:

    Shader error in 'MicroSplat/Terrain': invalid subscript 'instanceID' 'UnitySetupInstanceID': no matching 1 parameter function at line 1109 (on glcore)

    Compiling Vertex program with SHADOWS_CUBE INSTANCING_ON
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_NO_SCREENSPACE_SHADOWS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF2 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP​

    Based on an earlier reply on this thread (to JohnTomorrow), we assumed it had something to do with the consoles (as with OS X) not being able to share samplers or having another problem with a similar issue.

    I wasn't sure exactly which features needed to be turned off, so I had simply set the Max Texture Count to 12 and set the Lighting Model to "Simplified".

    This got rid of the errors, but when we then upgraded from Unity 5.6.3p3 to 5.6.5p1, the errors came back *occasionally*, in that the errors would disappear when we made subsequent builds (with no changes).

    Is this ok, or is something sinister potentially happening under the hood? Everything seems to be working fine in game.

    The main issue with this is that it screws up our automated build processes because builds sometimes fail. Any idea why the errors would only pop up sometimes?

    FYI, we're getting this in both Microsplat 1.5 and 1.72.

    Cheers.
     
  23. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,622

    Unfortunately without console access it’s not possible for me to test. But if I were to guess, it’s that you are going over the sampler limit (16, which without sharing is easy to get beyond). Thing is, different lighting conditions can use different numbers of samplers for lighting; so you could have everything working fine, add a reflection probe, and end up over 16 samplers without changing the shader. (Internally Unity compiles variations for different lighting conditions).
     
  24. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,622

    On second look, it looks like it’s failing to compile he vertex program, not the fragment?
     
  25. Frank-1999-98K

    Frank-1999-98K

    Joined:
    Jun 30, 2015
    Posts:
    13
    Hello,
    I've seen MicroSplat on the Asst Store and it looks really amazing.
    But before buing all the extensions for it, I'd have a couple of questions:
    1) Can Iuse it with TerrainComposer 2?
    2) Are the textures from MegaSplat Available in MixcroSplat? Because I'm very interested in them, since is hard to find good textures for the terrain.
    p.s. If i missed that they're included/avaliable somewhere, i apologize
    3) I can't use a wet texture unless I buy the MicroSplat 'Puddles, Streams, Lava & Wetness' extension? Or the extension is just to make a wet effect without actually having a wet texture?

    Thank you in advance,
    Looking forward
    --
    Diego Franchini
     
  26. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,622
    1. Yes
    2. No, well, a few are in MicroSplat's demo scenes, but the bulk are not.
    3. There is no wet texture, it's an effect that generates wetness/puddles/streams/lava based on a painted height vs. the height field.
     
  27. StuntFriar

    StuntFriar

    Joined:
    Sep 10, 2015
    Posts:
    8
    The vertex program fails on XboxOne and Switch, but on PS4 it's the fragment program.

    It all still works in-game as intended on all platforms, so it's a problem we can live with.

    Thanks for the quick responses, btw.
     
  28. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,622
    It must be some variant that it’s compiling but isn’t actually being used at runtime. If you get any more info let me know..
     
  29. Corodius

    Corodius

    Joined:
    Dec 14, 2014
    Posts:
    4
    Hello Mr. Booth!

    First I would like to say, thank you for Providing this package. MicroSplat is definitely quite a powerful setup, and very nice to use.

    I have been investigating MicroSplat as a replacement for our current terrain shader setup. There is one problem that is really a big issue for us, and very much a "Show Stopper" for our use.

    We have this problem, that you have mentioned earlier in the thread, with the "Artefacts" between textures when using a different per-texture UV Scaling.

    I noticed you mentioned this was fixed in v1.3, however we are using the latest v1.73 and still see this issue.
    It shows in both "Default" and "Gradient" Sampler mode, it is not there in "LOD" Sampler mode, however this also makes the rest of the terrain blurry when seen from a distance, so this is not really acceptable either for our use.

    Also of note, this is very visible even in the test Scene provided in the package. As shown in my examples, I am using the Test Scene, and simply set the Per-Texture UV Scaling for the first texture to 3,3 (x,y).



    I look forward to hearing from you on this issue! If you need any more information please let me know. Hopefully this is something that can be fixed, as we would really like to use MicroSplat.

    Thank You!
     
  30. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,622

    Use the LOD sampler, or don't use per-texture UV's, those are the current choices. The reason the LOD sampler is blurrier is because it's bypassing the hardware mip selection and doing it in the shader (which is also faster, strangely), and in the shader you can't properly handle anisotropic sampling and other filtering methods the GPU might be doing. At one point I had a bias and fake anisotropic option in there, which I might experiment with again at some point.
     
    protopop likes this.
  31. wwg

    wwg

    Joined:
    Apr 2, 2014
    Posts:
    121
    @jbooth
    It seems that MicroSplat keeps setting my terrain Base Map Distance to 60. I think this started after I was adding microsplat to a terrain (one of several terrains in the scene) and may have had a mistmatched propdata file into the Microsplat PerTextureData slot. :oops:

    Any suggestions for correcting this?

    Thanks!
     
  32. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,622
    Yes, it manages the basemap distance for you - basically, when you have features like tessellation or detail noise on, it creates a different shader without those features for use in the distance, and sets the basemap distance such that the shaders are swapped and you don't pay for them on distant geometry.. When not using those features, basemap is set to 0, which stops Unity from trying to draw multiple passes on those terrain elements.
     
  33. wwg

    wwg

    Joined:
    Apr 2, 2014
    Posts:
    121
    Ok...that makes sense. The problem I'm running into is that the transparency of my Aquas water plane isn't visible at a distance, unless I increase the base map distance (see image). Maybe this is not a MicroSplat problem, but everything was working fine until I added Microsplat to this latest terrain.
     

    Attached Files:

  34. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,622
    Strange- the shader used is exactly the same as the one used close up, just with some features turned off to make it faster..
     
  35. wwg

    wwg

    Joined:
    Apr 2, 2014
    Posts:
    121
    Maybe this is an Aquas issue. The only other thing I can remember changing is: I may have selected 'Enable GPU Instancing' on the Aquas shader around the same time that I added MicroSplat to the new terrain.

    Increasing the terrain Base Map Distance does fix the issue, so I thought it might be a MicroSplat issue.
     
  36. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,622
    You could try disabling various features and see which one conflicts- you can see which ones are used to compute the base map distance in the MicroSplatTerrain.cs file..
     
  37. acaton

    acaton

    Joined:
    May 27, 2013
    Posts:
    25
    Hi again! I was just curious about directional lights in scenes with MicroSplat. I'm getting an approximate 1/8 second 'hitch' every time I rotate my directional light through a runtime script (cs) and was wondering if you might have any insights into why. I've removed all other objects except light, camera, and terrain, but, when I change light direction in a script, it chugs badly. I've turned off all 'static' check marks I can find so was wondering if you might have any idea why it appears to be recalculating static lighting. Another hint is that, when I move the light in scene, the game bakes lighting (the blue progress bar on bottom appears momentarily).
    BTW, I've also tried all the graphics settings, as well as settings in the light and camera objects I can find. Could MicroSplat be perhaps resetting the static flag or something? I've been stuck on it for about 8 hours, simplifying the test until only terrain and light/camera remain and trying all game/light/camera/terrain settings I can find.
    If you remember, I'm spawning about 30 terrain 'chunks' at runtime so the world is modular and extensible, but I'm not spawning any more than the initial 30 for the base level in this test. Just mentioned it in case multiple terrains could somehow cause light baking issues somehow.
     
  38. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,622
    MucroSplat doesn’t have any lighting code in it; it just generates surface shaders, which is Unity’s abstraction around lighting. I suggest you use the profiler to see what’s really going on.
     
  39. Hexaedre

    Hexaedre

    Joined:
    Jan 23, 2015
    Posts:
    109
    Hi,

    Concerning the wind module, it looks very pretty in the light but in the shadows its way too dark.
    You can see it in your example scene, if you turn on the shadows and generate the lighting. It is more obvious if the shadow strenght in the directional light settings is set to 1.

    Do you plan to do something about that ?

    Cheers
     
  40. Corodius

    Corodius

    Joined:
    Dec 14, 2014
    Posts:
    4
    Ah I see, well thank you for the fast reply! This would be a nice feature if added, but I understand it is probably not high on the list of priorities.

    However, we are having some other problems crop up, that perhaps need adjusting or maybe we are doing something wrong here. This is always a possibility ;)

    First problem/issue: When using both the Distance Resampling from the Anti-Tile module, and also using the Texture Clustering module, the texture clusters are lost/missing when seen in the distance.

    Close up, showing the variation from the Texture Clutering:


    Zoomed out a bit, to when the Distance Resample kicks in: (Especially visible on the reddish/orange texture here)



    Is there perhaps something we are missing here, or is this "Working as Intended"?

    The Second issue, when using the Distance Resample, having the Distance Resample set to "Fast" looks fine, however when setting to "Full" it has this weird "Streaky"/Lined pattern:

    Distance Resample set to "Fast":


    Distance Resample set to "Full" (Specifically visible on the brown texture shown here, bottom left of the image shows this quite a lot):


    Finally, 2 sets of errors we see with Emissive/Metal array enabled, along with other features.
    When Emissive/Metal array is enabled, and Sampling Mode is set to LOD Sampler:


    and with the Emissive/Metal array enabled, and Texture Cluster Mode set to Three Variants:


    Thank you again!
     
  41. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,622
    Hmm, the distance resampling should cluster as well, but at the alternate scale. I'll double check the code for that, though I'd advise using one or the other for performance reasons- distance resampling requires a resampling of the albedo array, which when clustered means an additional 12 or 24 samples, so that's an expensive combination.

    The difference between the two modes is on Fast you only sample the albedo, on full you resample the normal too. Could there be something in your texture only in the normal/smoothness/ao map?

    Ok, that should be a quick fix..
     
  42. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,622
    You mean the wind effect itself, or the wind effect's shadow? You can control the latter.. MicroSplat is a surface shader, so it doesn't have any code that knows about the lighting it's under (this is handled by the surface shader abstraction). It just gets lit as normal. So the lighting of the wind effect is physically accurate - perhaps what you want is a way to make it emissive?
     
  43. Corodius

    Corodius

    Joined:
    Dec 14, 2014
    Posts:
    4
    Yes, it might end up a bit expensive, but to be honest even with this, and the added Visual benefit, it may end up being faster than our previous solutions. So it would still be very ideal to have the option if possible.

    I see, however while we see this on our own textures/project, this example I posted is from your example scene and textures provided with the asset, and I see the same patterning in both cases (our own textures/arrays, and the ones from the Example Scene/Arrays within the MicroSplat asset).
    I have been making sure to reproduce these issues in the example setup provided, to make sure it is not something in our project causing the issue ;)

    Awesome! :) and thank you so much for taking the time to reply and investigate these issues. If you require more information, or anything else to help, please ask! I would be more than happy to provide anything else needed.
     
  44. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,622
    I will have to make it it's own option so as not to change the current behavior. Not sure exactly what to call it, since it's an option only useful when two modules are used together.. It will also require a core update, so it will have to wait for 1.8..
     
    Last edited: Mar 2, 2018
  45. Corodius

    Corodius

    Joined:
    Dec 14, 2014
    Posts:
    4
    That is fair enough, on both counts, and would be greatly appreciated. Though I would not be much help for a specific name either ;)

    Thank you!
     
  46. acaton

    acaton

    Joined:
    May 27, 2013
    Posts:
    25
    Okay, thanks for the help. I'll try profiling. :)
     
  47. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,622
    Found the streak issue as well while adding that feature.
     
    protopop likes this.
  48. Hexaedre

    Hexaedre

    Joined:
    Jan 23, 2015
    Posts:
    109
    The wind itself is black in the shadows, the terrain is lit correctly. Here is a picture :

    https://imgur.com/a/mwkbF

    It is the example scene with the light's shadows turned on, the shadow strenght set to 1, the lighting generated, and without wind's shadows.

    Maybe that making it slightly emissive could be a workaround.
     
  49. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,622
    Or having some kind of ambient boost term?

    The way this works is that it's all part of the terrain rendering, and the wind/shadows are all applied as part of the regular shader (before lighting), then the terrain gets lit by Unity's surface shader code. The problem with this is that there's no access to things like the GI terms, so applying fake shadows, for instance, means darkening the diffuse and softening the normal/specular terms before they get lit; not actually modifying the lighting functions themselves..
     
  50. Hexaedre

    Hexaedre

    Joined:
    Jan 23, 2015
    Posts:
    109
    Some kind of ambient boost on the wind effect could work greatly, do you plan to do it ?

    Beside this issue, having the ability to make the wind emissive could be nice to achieve some kind of fantasy effect.