Search Unity

[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,724
    So, Falcon Age is releasing soon and uses MicroSplat, and it made me thing a few things:

    - I'd love to know the games that are released using my assets
    - I should likely use that information to promote my assets (I'm pretty lax with stuff like that)

    So if anyone has a game that's released or in early access using MicroSplat, please let me know what it is and if you mind me using a screenshot for promotional uses. (If you have a great screenshot showing off MicroSplat use that would be amazing, and if you can tell me what features your using that would be fun to know too!)
     
    mmaclaurin, gecko and Baraff like this.
  2. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,724
    Runtime Procedural Texturing is now available in the asset store..
     
  3. StevenPicard

    StevenPicard

    Joined:
    Mar 7, 2016
    Posts:
    651
    This is a must get for me!
     
  4. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,724
    BTW- they didn't make the initial versions, but I'm including code to sample the procedural texturing on the CPU. There are two versions, one written in the traditional style, and one designed to run from jobbified code using NativeArrays and the new mathematics library.
     
    StevenPicard likes this.
  5. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,724
    MicroSplat 2.6 pushed to the store:
    - MicroSplat now supplies a custom basemap shader for 2018.3, and allows the basemap to be sizes > 16. Turns out, GI in some lighting mode simply grabs the basemap texture and does not use the meta pass or original shader to generate GI data. This allows GI to bounce correctly on a MicroSplat terrain and fully reflect options like per texture tint, etc.
    - When using worldspace UVs, antitile features like noise normal and detail texturing also use world space UVs - note this means the scale settings on those textures will need to be updated, as the scales for worldspace UVs are much smaller than regular UVs
    - Ability to adjust contrast on stochastic cluster mode per texture
    - Ability to turn off sttochastic mode per texture. Note this provides no cost savings.
    - In 2018.3, SplatCount tag is now set to reduce draw calls on >4 texture terrains
    - GeoHeight texture can now be normal mapped
    - GeoHeight texture can now be filtered by global height
    - Undo support for most material operations
    - Procedural Texture module now has CPU functions for getting the texturing at locations when procedural texturing is used in runtime. A version of these functions for Unity's job system is included in a Zip file because it requires Unity.Mathematics and Unity.Collections to be installed from the package manager.
     
  6. Monorio1

    Monorio1

    Joined:
    Dec 10, 2018
    Posts:
    17
    Am I right in assuming that the blending module is using instanced properties? I'm trying to hook up the blending of objects to GPUInstancer plugin and instanced properties don't play nice. How could I set up the meshes to work without the instanced properties?
     
  7. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,724
    Yeah, they were put in for Vegetation Studio, but the integration didn't happen due to some internal VS stuff. Basically, you can modify the instanced property stuff in the fragment file included with the module. If you figure out what you need to get it to work, let me know and I could make it an option in the module or something..
     
  8. docsavage

    docsavage

    Joined:
    Jun 20, 2014
    Posts:
    996
    Hi @jbooth, When selecting the Stochastic system dropdown in the Texture clusters add-on it seems to have no effect on the snow from the microsplat snow add-on.

    Thanks
     
  9. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,724
    Yeah, I should add support for stochastic snow and possibly texture clustering the snow..
     
  10. docsavage

    docsavage

    Joined:
    Jun 20, 2014
    Posts:
    996
    Sounds great. Thanks
     
  11. chris54321

    chris54321

    Joined:
    Nov 5, 2013
    Posts:
    11
    The procedural texturing looks very promising! Unfortunately we have more than 4 biomes in our project and I wonder if this can be extended easily to f.e. 16 biomes. Maybe I am wrong but it seems the biome mask is OR connected, would it make sense to use an AND connection? I quickly tried it and if I change the shader code here

    bWeight = bMask.x * bMask.y * bMask.z * bMask.w;
    bMask *= params2;
    bWeight = max(max(max(bMask.x, bMask.y), bMask.z), bMask.w);
    to
    bMask.x = 1 - abs(bMask.x - params2.x);
    bMask.y = 1 - abs(bMask.y - params2.y);
    bMask.z = 1 - abs(bMask.z - params2.z);
    bMask.w = 1 - abs(bMask.w - params2.w);
    bWeight = bMask.x * bMask.y * bMask.z * bMask.w;

    the resuls look pretty much like I can use the biome mask exclusively now, resulting in the support of 16 biomes. Any comments are welcome :)
     
    Bodyclock likes this.
  12. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,724
    Your thinking 4 biome textures instead of 1? It could be done, but at that point why not just generate 4 splat textures? Is it because the biome masks can be low res?
     
  13. chris54321

    chris54321

    Joined:
    Nov 5, 2013
    Posts:
    11
    With my change, one biome texture can support now 16 biomes. You need to use mixed colors, like f.e. R=1,G=1,B=0,A=0 in the biome texture and it will only hit the rule if the mask is 1 1 0 0. So we can have one (hi res) biome texture that supports f.e. 10 biomes and have another 6 rules for f.e. roads (also in the biome texture). We won't need any splat maps. But maybe this is something only few people need and you don't want to include it in the default shader.
     
    Bodyclock likes this.
  14. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,724
    Oh I see- yeah, this is a useful addition, and I could add it to the module so you don't have to make the change over and over when things get updated. It definitely needs a name for the option though..
     
    eaque, Bodyclock and chris54321 like this.
  15. Bodyclock

    Bodyclock

    Joined:
    May 8, 2018
    Posts:
    107
    This would get my vote :)
     
  16. eaque

    eaque

    Joined:
    Aug 20, 2014
    Posts:
    596
    From what i read here and the youtube video, this module is a must have, many thanks for this !
    I suppose there shouldn't be any issue with multi terrain seams, i have some issues with vs pro.

    (Some noob questions, sorry about that. I use Vs pro to texture and populate veg):

    1-can i use this module to texture my biomes and still use vs pro to spawn veg with texture rules?
    2-i don't use the last jobs and maths packages, i suppose it's not a problem?

    thanks in advance:)
     
  17. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,724
    There’s currently no integration with VSP for it to read my texturing output; however all the functions are included to do this in both a traditional and threaded via Unity jobs way. Alternatively it can bake the splat choices back to the terrain. Lennart and I are using this on a project together, but it would be up to him to release an integration.
     
    eaque likes this.
  18. eaque

    eaque

    Joined:
    Aug 20, 2014
    Posts:
    596
    many thanks! i bought it!:)
    Gonna bother Lennart with that!;)
     
  19. eaque

    eaque

    Joined:
    Aug 20, 2014
    Posts:
    596
    how does the biome system work? 1 texture defining zones for the entire world? or multiple textures to define the position?
     
  20. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,724
    It's one texture with biome weights in RGBA, but you can have a unique biome mask per terrain. I'm going to add a mode that allows for 16 biomes from a single texture, as mentioned above, as well.
     
  21. eaque

    eaque

    Joined:
    Aug 20, 2014
    Posts:
    596
    ok thanks!
    btw microsplat is really impressive !:) i'm still a bit confused with some settings like distance resample (begin and end) distance...i don't really get the logic:oops: but the results are great! and your wind module is a fine detail i appreciate very much in my project!
     
  22. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,724
    Distance Resampling basically resamples the textures at a different UV scale, so the begin/end distance is for the cross fade into the new UV scale. I often express these types of settings as 4 values, so it's two distance values and the weights at those distances, so for instance you might still blend in 20% of the original texture at the far scale..
     
  23. eaque

    eaque

    Joined:
    Aug 20, 2014
    Posts:
    596
    actually i don't get the begin and end.:oops:...Is that it will sart resampling at (begin float) from the camera and stop resampling at end float.
    If i want my resampling to start at 80 unit from the cam what should i do?

    thx
     
  24. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,724
    I don’t have access right now, but if it’s a vector4 then I would expect it to be start distance, start weight, fade distance, end weight.
     
  25. eaque

    eaque

    Joined:
    Aug 20, 2014
    Posts:
    596
    ok, thanks for your prompt answers. WIll have a look tonight!
     
  26. miklelottesen

    miklelottesen

    Joined:
    Mar 7, 2015
    Posts:
    19
    My jaw literally dropped when I saw the procedural texturing module! Especially with the new support for 16 biomes. I'm definitely gonna get into it as soon as my SpeedTree month is over!

    I have a few questions about how the biome mask works, however:

    1. Is it absolute, or does it fade between the biomes? If yes, how does it work with the 16 biome feature? Say we assign red to Taiga, green to Tundra and yellow to Temperate, how is it possible to create a 50/50 mix between Taiga and Tundra without making the shader interpret it as temperate? And how does it know the difference between an even mix of all 16 biomes, and a mix of just the 4 biomes assigned to RGBA?

    2. Is it possible to have multiple biome mask biases per layer, so that some of the 16 biomes could be used as sub-biomes?
     
  27. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,724
    In 4 layer mode, it blends as you would expect. In 16 layer mode, it effectively depends on which biomes your talking about- basically you will only get the yellow biome when your 100% yellow, and it will be a mix of the pure color biomes until that point.

    Each layer has a single mask value - not sure exactly what your trying to achieve?
     
  28. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    12,223
    Using MciroSplat 2.61 and the old Alpha Hole / Clip Map compile errors from 2.54 are gone, but now I get new ones:
    Code (csharp):
    1. Shader error in 'MicroSplat/Island3_Shader': Unexpected identifier "tex2D". Expected one of: typedef const void inline uniform nointerpolation extern shared static volatile row_major column_major struct or a user-defined type at line 952
    Code (csharp):
    1. Shader error in 'Hidden/MicroSplat/Island3_Shader_Base1940495933': Unexpected identifier "tex2D". Expected one of: typedef const void inline uniform nointerpolation extern shared static volatile row_major column_major struct or a user-defined type at line 953
    Edit: Things seem to work fine if I change "tex2D" to "sampler2D" in the shader. So it's not stopping me from carrying on.
     
  29. Redrag

    Redrag

    Joined:
    Apr 27, 2014
    Posts:
    128
    Hi Jason - I need to support Windows 7 so do all W7 machines have the capability to use DX11 or Open GL 3.0? And on Mac do you know the earliest OS I can run with Micorsplat?
     
  30. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,724
    I think they all can; MicroSplat requires texture arrays, so as long as the platform supports that it should be fine.
     
  31. miklelottesen

    miklelottesen

    Joined:
    Mar 7, 2015
    Posts:
    19
    Ah, ok - I suppose the 16 layer mode isn't quite what I was looking for after all, as I need to be able to blend smoothly between several different biomes. Would it be relatively straightforward to implement additional biome maps on my own? (I'm decently experienced with shader coding)

    As for multiple biome masks per layer, I suppose it wouldn't make sense with the 4 layer mode, nor with the 16 layer mode given how it works. But what I meant was basically being able to multiply two (or more) different biome masks for a single layer, for instance so that the weight of layer 1 could be taiga * forest, and layer 2 could be taiga * plains - that would eliminate the need to create a "forest" and "plains" variety for every biome (thus allowing for shared sub-biomes). Also, it would make it possible to use a texture in more than 1 biome without either having to make an additional layer or use it in all biomes.
     
  32. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,724
    Yeah, just sampling some extra textures. It wouldn't be hard for me to add this either, but I guess when I wrote it I didn't see the reason someone would want that many biomes in the first place, since at some point it's just easier to paint the weights of your textures than to manage more biome masks.

    You can use the same texture in multiple biomes - the layers are not directly tied to the textures, but rather reference it. Each layer is really a procedural evaluation, which then maps whatever texture you select to that result.
     
  33. niallmc

    niallmc

    Joined:
    Sep 3, 2015
    Posts:
    10
    Hey JBooth, thanks again for a great asset. I have 2 questions.

    1: Has there been any update / response from unity about the tessellation / Draw Instanced issue with the terrains?

    2: It is possible to set the Tessellation Mip Bias or Shaping on a per texture basis?

    Thanks for your time!
     
  34. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,724
    Nope- Filled a bug and haven't heard anything. Though someone mentioned in discord that there was something in the latest patch releases about a tessellation bug and I haven't had a moment to test it yet.

    It's possible to add, yes. But not in there right now.
     
  35. miklelottesen

    miklelottesen

    Joined:
    Mar 7, 2015
    Posts:
    19
    I suppose my setup is a bit unusual - I have a rather big world consisting of roughly 3.7 million terrain tiles (and that's not even counting LOD tiles), so I use a homemade streamer to spawn and de-spawn a handful of tiles around the player, as the player moves. The streamer uses a compute shader, which procedurally generates a heightmap, splatmaps and biome maps (which I use for spawning vegetation) for each tile.

    The problem is that my splatmapping algorithms suck, and I've spent countless hours unsuccessfully trying to achieve a satisfying result - that's why this module seemed like a godsend, because I'd then be able to omit the splatmaps altogether and just use the biome masks, and even see the results immediately in the editor as I set the rules! There's definitely no doubt that I'd get it, if support for multiple biome masks were added!

    I just rewatched the demo video you made, and apparently I missed some things the first time - if I understand correctly, each layer will get a slider for each color in the biome map if enabled?
     
  36. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,724
    Each layer has some rules, a texture it applies, and a Vector4 which acts as weights for each biome. In the 4 layer mode, they are multiplicative. So if your biome mask paints R and G at one, and your V4 has is 0.5, 1, 0, 0, you'd get a weight of 1 for the Green channel and 0.5 for the red in that area.

    Your use case is actually exactly what I wrote the module for as I have a similar issue in a project I'm working on. Storing or generating actual splats could not be done at a reasonable resolution, so generating the data on the fly seemed best.
     
  37. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    382
    Hey Jason, I'm using microsplat and the blending module, when ever I try to blend an object that is near a light source the blend material gets the wrong lighting, its almost like its using the forward version of the microsplat shader, I'm using deferred, take a look at the bottom of the big rock

    error.jpg
     
  38. niallmc

    niallmc

    Joined:
    Sep 3, 2015
    Posts:
    10
    Tested on 2019.1.0f2 - Draw Instanced still isn't working. Hopefully they look into this soon.

    Is this something you would look to add in the future? We are <12 months out from release and it would make a big difference to have per texture shaping and mip bias. Thanks again!
     
    camta005 likes this.
  39. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,724
    The blending shader gets applied in a second pass, which I believe forces it to render forward. You could check in the frame debugger to verify this.
     
  40. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,724
    Yeah, I can add them in my next pass.
     
    niallmc and camta005 like this.
  41. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    382
    does that mean the lighting will always be incorrect on blends in deferred mode currently?
     
  42. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,724
    For the most part, lighting should be the same in forward or deferred, except for deferred only light styles (area lights). So it should look the same.. It does blend the normals though, so you might try setting the normal blend distance to 0, as that might be your issue?
     
  43. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    382
    nah I tried that, that was my first thought I'll see if I can debug it a bit more
     
  44. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    382
    I figured it out, it's cos I'm using Alloy also its NOT an issue with Microsplat thanks anyway
     
  45. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,724
    Not really, all hacks involve managing the physics as you pass through the hole. At least until Unity allows for proper holes, which I think is in 2019.3 or something.
     
  46. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,111
    As I deleted my post you replied, so you didn't need to reply - less support and all that :) I managed to work out a solution on paper to make a Physics Filter Manager that would allow anything through the trigger box based on its tag or layer. Ideally I wanted to allow the ability for weapon projectiles also to go through and not stop at the terrain. I'm using 2017.x so no chance of me upgrading to 2019 anytime soon, with every upgrade adds a whole lot of work to make sure everything works.
     
  47. stefankohl

    stefankohl

    Joined:
    May 30, 2014
    Posts:
    43
    Hey jbooth,

    I'm using MicroSplat with Triplanar-UVs and LWRP. I have a very basic setup, but run into issues related to terrain shadow casting (self-shadowing) causing ugly stripes - see the image below. It only happens with LWRP shaders.

    Do you have any idea how this can be fixed?

    Btw, performance is pretty nice on the Nintendo Switch.

    upload_2019-4-29_15-23-30.png
     
  48. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,724
    Most likely something changed in the LWRP shaders that needs to be changed in my shaders. This is one of the big reasons I'm a fan of the surface shader abstraction, because it abstracts away all this nonsense and just makes things compatible. If you can send me a repro project (setup with your version of LWRP, etc) I can take a look and see what's going on.
     
  49. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    202
    Hi.

    I have a new doubt.

    In my game - off road car races - it is essential to detect the texture that the tires are touching.

    I do not know if at the time of rendering, Microsplat "compiles" all the texture in one. If so, it would not be useful to me.

    So the questions are.

    Is it like that?
    If yes ... is there a way to modify it?
    If yes ... by modifying it, the power of Microsplat is lost?

    Thank you.
     
  50. Redrag

    Redrag

    Joined:
    Apr 27, 2014
    Posts:
    128
    A quick question about the hole system. I am trying to make a sea level cave. I put a plane in front of the terrain, changed the render queue and voila - a nice hole. Unfortunately the sea is also masked! Does the Microsplat hole system have the same issue - all transparent stuff will get masked too?