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

    superkratos

    Joined:
    Sep 4, 2017
    Posts:
    112
    You taught me to paint alpha this way last time so I tried:). I deleted all the other files in MegaSplat except Vertex Painter folder yesterday, and no errors have jumped out so far:D
     
  2. mwituni

    mwituni

    Joined:
    Jan 15, 2015
    Posts:
    345
    Regarding my earlier post with some screenshots of one of our beach scenes using VS and animated wetness in Microsplat mostly, some pm'd me asking for a short video, so I'm adding here ... I'm no good at video but managed to grab this. We need to still sort wave timing etc out.

    Without VS and microsplat it was not possible (for us anyway) to use all the assets we wanted to use in an outdoor scene ... VS totally revolutionalizes that by making dense foliage cheap. I seriously can't see many outdoor games not using these going forward....

     
  3. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    So, they haven't even approved the Texture Cluster module, and I'm almost done with the next one:

     
    mwituni and blacksun666 like this.
  4. coverpage

    coverpage

    Joined:
    Mar 3, 2016
    Posts:
    385
    You are single handedly making unity terrain solution better than the competiting game engines with these modules.
     
    jbooth likes this.
  5. superkratos

    superkratos

    Joined:
    Sep 4, 2017
    Posts:
    112
    Texture Cluster would be really really really helpful, Mr Booth! What's the price, by the way?:D In my opinion it should be as important as the terrain blend module, so they should share the same price?:rolleyes:
     
  6. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    What the hell? there's so many cool modules, I'll never catch 'em all!
     
    coverpage and one_one like this.
  7. coverpage

    coverpage

    Joined:
    Mar 3, 2016
    Posts:
    385
    I hope they approve before the big sale and that you're part of the sale. Gotta catch them all
     
  8. nbac

    nbac

    Joined:
    Jul 7, 2015
    Posts:
    267
    nice just requested the wind feature for rtp ;D and you did it! you easily could improve the quality of this even more.
    quasi dropshadow (same texture slightly offsetted and darker, offset direction maybe from sundir) and masking for the wind. often you want this dust/snow to appear just on elevations. also a distortion/flowmap like you have it for your water would be good to simulate swirls.

    example
     
  9. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Is it using normals? Seems more effective.
     
  10. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Unlikely- approvals are taking almost a month now.

    Not sure what you mean? My effect is essentially two parts, one that modifies the lighting inputs (normals, occlusion, smoothness) and another which modifies the color.

    I played a bit with swirls and it's something I'll likely play with more. Shadows are an interesting idea- by playing with the bias, you could likely control the height of the sand to some degree. I thought about parameterizing based on height or slope, but it can be difficult to adjust and you'd get small breaks from bumps - in the end, per texture parameterization makes more sense to me- just paint a different terrain down where you don't want it to go..
     
  11. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yes, but only one- the four effects share a single texture..
     
    gecko likes this.
  12. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    Thanks for anticipating my question...but which four effects? (There are four distinct effects in Wind and Glitter?)
     
  13. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    They work on snow as well as a separate set of effects - not sure if that's 2 or 4?

    Added a drop shadow system this morning as well, but I think I prefer using it for subtle coloring/depth effects over shadowing, but it can be used for both..
     
  14. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    BTW, Lennart and I just finished this up last night:



    The tree shadows in the video are generated by MicroSplat as part of the terrain shading. Custom data is output from Vegetation studio that allows me to raymarch these shadow approximations very cheaply, and we crossfade into them when nearing the far range of Unity's shadows.

    The Vegetation Studio integration is included free with MicroSplat Core, so once Vegetation Studio and MicroSplat 1.6 ship this will be available to everyone.
     
    mwituni, TeagansDad, osss and 5 others like this.
  15. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    I am so incredibly excited about that! (even if it does use up another sampler)
     
  16. mons00n

    mons00n

    Joined:
    Sep 18, 2013
    Posts:
    304
    That's fantastic!
     
  17. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    newer video:



    I'm thinking there may come a point where I look over all these modules and try to add some kind of combining option that stuffs one off textures into an array. They'd all have to be the same size/format/etc, but sometimes that's a better tradeoff..
     
    Baldinoboy likes this.
  18. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    I'd be very happy to but (EDIT: er, "buy") a module that does that.
     
    Last edited: Nov 22, 2017
  19. Zbad

    Zbad

    Joined:
    Nov 20, 2014
    Posts:
    15
    Hi, I get "TerrainData is missing splat texture 3" after installing the asset - Looks like it somehow forgets the last texture on the sample scene's terrain, from what I can gather online?
     
  20. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    It's actually there, Unity just throws this warning for no reason..
     
  21. superkratos

    superkratos

    Joined:
    Sep 4, 2017
    Posts:
    112
    Is that a shadow function for billboards, Mr Booth?
     
  22. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    It's based on the actual tree's and vegetation, not the billboard. Vegetation studio generates a distance field, which I use to raymarch the shadows in the terrain shader itself. Shadows are approximations, but are fully dynamic with sun direction and extremely cheap to render, especially compared to regular shadow techniques.
     
    Teila likes this.
  23. JRRReynolds

    JRRReynolds

    Joined:
    Oct 29, 2014
    Posts:
    192
    I noticed a review for the terrain hole module that the reviewer mentioned that the terrain holes do not support collision - meaning that the terrain collider didn't conform to the hole - making the hole a visual element not an actual usable element of the terrain (as no colliders could pass through it due to a terrain collider that did not reflect the hole). @jbooth Would you be able to confirm if this was true or not? I am curious if I should pick up this module - which looks great but may not be a viable solution for me if the holes do not support physics functionality.
     
  24. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Keep in mind that reviewer also gave the free core package a 3 star review because it threw an innocuous warning on install which has no effect on the actual project.

    There's a script posted earlier in the thread which shows you how to turn off a collider based on a trigger, which is what most people will need to 'walk' through the terrain, so to speak. I don't provide one because then people will expect me to customize it to do all kinds of wacky stuff for their specific needs or solve nonsense edge cases. I ran into a lot of this in MegaSplat by providing examples that would allow people to understand how to customize stuff further for their specific use case, so now I try to avoid including anything which will only generate requests like these.
     
  25. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Just added support for global properties:



    You'll find these "G" toggles at the end of some properties now. Turning them on will make the property read-only, and instead the system will use a global shader variable for the value. There's a table of these values in the core module documentation, but basically you can do something like:

    Code (CSharp):
    1. Shader.SetGlobal("_Global_SnowLevel", 0.5f);
    To set the global level of snow across all terrains and objects with snow on them. Hendrik will be adding support to Enviro for many of these values in his next update, allowing enviro to control the weather in your scene automatically.
     
    nirvanajie, gecko and Teila like this.
  26. superkratos

    superkratos

    Joined:
    Sep 4, 2017
    Posts:
    112
    Got your point, Mr Booth! Shadows cheaper!:D
     
    Teila likes this.
  27. Pikkewynman

    Pikkewynman

    Joined:
    Jul 16, 2017
    Posts:
    4
    I absolutely love the asset and the modules. looking forward to the new ones coming through approval.

    Got the tesselation module today and its working great. beautiful.
    What i'd like to know is how I can sample the tesselated height of a pixel at a position so I can use it in something like a foot planting ik script etc. not asking for a full implementation necessarily but just some guidance on how it might be possible would be great
     
    Last edited: Nov 27, 2017
  28. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    First, if you turn on per texture displacement offset and press the button that appears below it, it will compute the ideal offset for each texture to keep the displacement in the center. This can get you much closer to the original terrains tessellation factor.

    Beyond that, there's a few ways to interact with a tessellated mesh:

    - Tessellate an actual mesh to use as a collider around the player area. This is the most accurate and stable, but requires a lot of work. Basically you just make a subdivided mesh that moves around with the player and does the tessellation on the CPU, uploading the results each frame. Main advantage is that you are working with actual geometry in the physics engine, so everything just works, and you can match it up with the distance at which tessellation fades away. Main disadvantage is that it's going to be slow to do all of that on the CPU (though you could easily thread it).
    - Tessellate the contact point. This is something I did for MegaSplat, which is to basically take the collision response with the low res mesh, then perturb the hit position based on the displacement data modifying the result. Works reasonably well, but not really practical for full physics- just doing things like adjusting feet positions and such.

    In both cases, you can cache off a lower res version of your textures to work with, which will make lookups much faster. I've also found that the GPU and CPU don't always agree about the math, even when using the same math- I never did figure out why this was, but I have to think it's something in the blending I wasn't taking proper account of (triangle edge direction, perhaps?).
     
  29. Pikkewynman

    Pikkewynman

    Joined:
    Jul 16, 2017
    Posts:
    4
    I did find that ideal offset earlier and it helps a lot bringing the terrain to the base, thanks
    I dont even need to be super accurate in my use case.. just any mesh intersections annoy the perfectionist side of me lol.

    I saw something like what you suggest in the first point in a star citizen development video. seems like it would give perfect results just also seems like quite a heavy operation to do. maybe would be a good time for me to wet my feet in threading though.
    Ill see if i can hack together something like your second suggestion first. youve given me an idea how to get there.

    thanks for the tips, gives me some good ideas.
     
  30. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    So, the Texture Clusters and Wind and Glitter modules have both been approved!
     
    coverpage likes this.
  31. wwg

    wwg

    Joined:
    Apr 2, 2014
    Posts:
    130
    @jbooth have you been able to test the performance of the Texture Clusters module and how it stacks up to MegaSplat?
     
  32. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I haven't done a totally apples to apples comparison, but on 3 cluster mode with no other fancy features on MicroSplat still tends to be a bit faster than the equivalent in MegaSplat, and you can use a 2 cluster mode or turn down Blend Quality if you need it to run faster.

    For instance, 3 cluster mode with Blend Quality at Best is 24 samples per pixel, with every access operating in parallel because the textures are in different arrays. If you set blend quality to balanced and cluster mode to 2, it would only be 12 samples, so half the cost.

    In MegaSplat, a 2 layer shader is 12 samples. But here's the rub- in MegaSplat, these are all packed into a single array, where as in MicroSplat each cluster is it's own texture array. This means that the GPU can sample from each of those arrays in parallel instead of having to wait for the sampler to finish before starting the next sample. So basically microsplat can have 6 samples running in parallel, while MegaSplat can only have 2, so even thought the sample count is higher Microsplat out-performs it due to parallelism- or maybe just because the rest of the shader is faster- hard to tell without going under a deep GPU profile.

    Anyway, the only downside is that this chews up more sampler slots. This isn't a big deal on PC where you have 32 of them and can share samplers, but on Mac's Apple limited it to 16 and doesn't allow sharing, which is really annoying..
     
    wwg likes this.
  33. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461


    My new API for adding global shader variables to timeline, as well as a look at MicroSplat 1.6's global shader control system (weather integrations, etc).

    The API is available for free on my github and open source (MIT license), and makes it easy to add any shader globals you might need to timeline- not just MicroSplat ones..
     
    Akshara likes this.
  34. mons00n

    mons00n

    Joined:
    Sep 18, 2013
    Posts:
    304
    nooooo they're not on sale!! jk these modules are great at any price =)
     
  35. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Just submitted a quick patch for Wind and Glitter:

    - Fixed issue with it causing a darkening on the terrain when enabled
    - Added height/slope filters for the effect, so you can make it only show between certain heights or filter off slopes

    Note, does not require upgrading every module- no API changes..
     
  36. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    @jbooth Just updated microsplat and bought a few modules, including Puddles,Streams ... but it is having an issue. I am trying a move away from megasplat. Anyway, here are the errors:

    Assets/MicroSplat/Streams/Scripts/Editor/StreamPainterWindow.cs(64,19): error CS0103: The name `CreateTexture' does not exist in the current context

    and this one a few times:
    Assets/MicroSplat/Streams/Scripts/Editor/StreamPainterWindow.cs(108,47): error CS1061: Type `JBooth.MicroSplat.StreamPainterWindow' does not contain a definition for `OnSceneGUI' and no extension method `OnSceneGUI' of type `JBooth.MicroSplat.StreamPainterWindow' could be found. Are you missing an assembly reference?

    This is on 2017.1.0p5
     
  37. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461

    Sounds like the module didn't install correctly from the store? Can you try reinstalling it?
     
  38. MaxWitsch

    MaxWitsch

    Joined:
    Jul 6, 2015
    Posts:
    114
    Hey Jason,
    Micro Splat is a really great Terrain tool!

    Would it be possible that you could you make an Global Normal Baker for Terrains?
    So we could increase the Pixel Error without loosing all the details in the Lighting?
    This would be really useful.

    Thanks!
     
  39. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    It's actually already in there, as the terrain blending feature bakes out that data. I suppose you just want the ability to sample the normal from there instead of using the vertex normals? I can add that to core.
     
  40. MaxWitsch

    MaxWitsch

    Joined:
    Jul 6, 2015
    Posts:
    114
    Also a interesting Idea.
    But with the terrain Blending Sentence my question is answered.

    My thoughts were just for Global Normals.

    Thx!
     
  41. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yeah, I think what you want to allow for high pixel error is a way to sample the resulting texture in the shader to replace the per-vertex normals with per-pixel ones. This will be relatively easy to add, so I can get it into the next update. I will make it a separate texture output though, since the one used for Terrain Blending has to be 16bit uncompressed, and for visible normals 8bit compressed is likely a viable option to save bandwidth. But when terrain blending is enabled, maybe I disable that option and pull them directly from the high res texture instead to save the samples/memory. Hmm..
     
  42. MaxWitsch

    MaxWitsch

    Joined:
    Jul 6, 2015
    Posts:
    114
    yu know?
    this.PNG
     
  43. MaxWitsch

    MaxWitsch

    Joined:
    Jul 6, 2015
    Posts:
    114
    Awesome Thanks ! :)
     
  44. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    The problem is that the global texture in there is blended with the terrain normals, what you want is for it to replace the terrain normals all together.
     
  45. MaxWitsch

    MaxWitsch

    Joined:
    Jul 6, 2015
    Posts:
    114
    I see what you mean, would be awesome if you could add this feature to the next update.
     
  46. neon_teebar

    neon_teebar

    Joined:
    Jun 1, 2017
    Posts:
    46
    MicroSplat is so great, thanks for all your work.

    I'm wondering how I could add an option to spit out a second material where the following line would be in the vert function:
    i.vertex.y = tex2Dlod(_HeightMap, float4(i.texcoord.xy, 0, 0)).r * _MaxHeight;

    It's for a terrain creation editor extension I'd like to optimize for use with MicroSplat. While designing the terrain I keep it on the GPU (as a RenderTexture) for speed, and pass the results to a plane that has it's vertices offset. When editing is finished the RenderTexture gets read back to the built in terrain system which uses MicroSplat. But I'd like the plane to be rendererd with MicroSplat.

    This isn't a big deal, so if it can't easily be done that's cool, I can manually work it in.
     
  47. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    I have tried reinstalling. Deleting and reinstalling. Deleting the package and downloading again and then reinstalling. All with Unity reboots which often just fixes little anomalies like this. None of this has worked so far.

    Update:
    I managed to import it without error, but only after I deleted the megasplat scripts,
     
    Last edited: Nov 28, 2017
  48. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Hmm, I have had both MegaSplat and MicroSplat in the same project multiple times, but I'll do it again tonight and make sure there aren't any conflicts. The error looked like it was caused by some files being missing though..
     
  49. m506

    m506

    Joined:
    Dec 21, 2015
    Posts:
    93
    Hi there. I am using the asset with the anti-tiling module and its beeing great so far.

    One issue I found yesterday, however, is that for some reason uv tiled textures on big terrains produces a "dotted line" at the borders of the tile, which keeps blinking all the time, all over the terrain. See pictures below:
    uv bug.png uv bug2.png
    If I put the UV scale back to 1 (for the 1st texture) it removes the dotted line but it prevents me to adjusting the size properly.

    Am I doing something wrong or this will be a bug? Thanks in advance
     
  50. sylon

    sylon

    Joined:
    Mar 5, 2017
    Posts:
    246
    Did you update MicroSplat? I've seen this issue before and i think it's fixed.
     
Thread Status:
Not open for further replies.