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

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Oh, interesting- that kind of makes sense- because in some modes of distance sampling it only samples top 2 most weighted samples. But in 4 layer mode it doesn't sort the samples into the four highest, because there is no need to cull samples - when you switch to Max Count 8 it does the sort, and then everything works. Ok, I guess if distance resampling is on I'll sort the list even in 4 texture mode..
     
  2. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    This will be fixed in the next patch..
     
    camta005 likes this.
  3. Unlimited_Energy

    Unlimited_Energy

    Joined:
    Jul 10, 2014
    Posts:
    469
    4 textures height offset blend working great in Microsplat. I just cannot get results like this with any other asset ive tried. Works great. Last picture is roots that use displacement. 8 textures total in this scene.
    Path Pot Grow Game.jpg Path.jpg Roots.jpg
     
    Willbkool_FPCS, camta005 and Rowlan like this.
  4. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    335
    Looks cool !! what resolutions are your textures ?
     
    Unlimited_Energy likes this.
  5. Unlimited_Energy

    Unlimited_Energy

    Joined:
    Jul 10, 2014
    Posts:
    469
    2k
     
    f1chris likes this.
  6. MrRightclick

    MrRightclick

    Joined:
    Nov 14, 2012
    Posts:
    19
    Hello Jason!
    We wanted to add some extra detail to our terrain for a mobile game, so we tried implementing Microsplat with the LWRP plugin, as we're currently using LWRP.

    Problem is, in the build, when Microsplat is added to a terrain (currently just using two textures, for grass & roads), the game grinds to a ~30fps for modern phones and ~10fps for older ones. The test scene consists of a camera, a small (100x100) terrain with painted on textures using Microsplat and some objects (trees, rocks and whatnot). We've made controls to enable/disable vsync and change the FPS cap dynamically, but it never goes over ~33 FPS.

    We're guessing it has something to do with LWRP, as building the scene in Standard pipeline seems to work just fine in capped 60fps. It is possible for us to change to Standard, but we'd rather use LWRP for now.

    Also removing the terrain completely from the scene causes the build to jump back to 60fps.

    Could you have any pointers to what the problem might be? We've tried building the scene in both Unity 2018.4.11f1 (our current main Unity version) with LWRP version 4.6 and Unity 2019.2.11f1 (LWRP version 6.9), but both resulted in ~30fps builds. I noticed the LWRP plugin seems to support LWRP up to 5.13. We've yet to try with 5.13, would that help? Not even sure which version of Unity supports 5.13, as 2018.4.11f1 only goes up to 4.6.0 and 2019.2.11f1 only seems to go as far down as 6.9.0.

    Thanks in advance! Other than our current dilemma, the plugin is great! :)
     
    Last edited: Nov 6, 2019
  7. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Hmm, I would not expect the LWRP wrapper to make much difference in performance from standard to LWRP. Essentially the LWRP module spits out a shader with the required passes, packs up the data from LWRP into surface shader format, and calls into the same code. Since shaders don't really have structures, this all gets stripped out by the compiler, and should result in extremely similar code on both, as the LWRP is very similar to the forward renderer in the standard pipeline. As for versions, I have no idea- the bulk of my work with LWRP involves updating MicroSplat to run with new versions.

    Have you checked it out with a GPU benchmarking tool like Instruments (OSX) to see where it says the bottleneck is? Instruments can actually tell you how long the shader is spending in each part of the code.
     
  8. MrRightclick

    MrRightclick

    Joined:
    Nov 14, 2012
    Posts:
    19
    Thanks, so LWRP should be good to go then. We'll try profiling a bit more. I don't currently have access to OSX, so I can't try Instruments. :/

    I'm sure it's got something to do with the terrain, so I'll try to fiddle around with the terrain settings a bit to see if something there is causing the problems.

    I did profile a bit through Unity (only CPU side, Android debugging doesn't support GPU AFAIK), and it seems Gfx.WaitForPresent is taking around 60% when FPS cap is set to 60, and -- as expected -- WaitForTargetFramerate is doing the same when FPS is uncapped (which defaults to 30 on Android). The former I'm not sure about, but I guess it can be caused by a lot of different things...

    Thought I should note we're getting a bunch of errors in the Editor like these:


    I'll report back if I get this solved, could be just something related to our project setup too...
     
    Last edited: Nov 7, 2019
  9. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    so what’s calling blit with the terrain shader? Sounds like something is using the terrain shader that shouldn't be. I agree with your overall analysis though- but without getting onto a device and looking at what the GPU is doing it's hard to know what the issue is.
     
  10. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    335
    I don't want to build my game with Substance plugin, it's causing Bitcode issue.

    When I remove the plugin, Microsplat complains with file TextureArrayConfig.

    Anyway I can use Microsplat on 2013.3 URP without that file ?

    thx
     
  11. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    substance has left defined in your build settings; remove the define as other tools use that to know to compile in substance code.
     
    f1chris likes this.
  12. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    A few announcements:

    First, the HDRP module has been submitted. It still has a few issues that I'm working on, mainly that tessellation doesn't work yet and the Terrain Blending doesn't quite match at the seems like it should. But as far as I know everything else is working fine, so it seemed like the time to release it and find out. It will be in the store whenever Unity approves it..

    Second, I'm looking for screenshots of the terrain in your projects to use for marketing. I need them 2k in size or greater, with whatever logo's or credits you'd like to have on them (I'll do the compositing, as different uses have different guidelines about where text and logos can be). If you have shots showing off particular features of MicroSplat, that would be extremely helpful as well. Thanks!
     
    Weendie-Games likes this.
  13. GlutenFreeGames

    GlutenFreeGames

    Joined:
    Jun 13, 2013
    Posts:
    51
    I am getting the following warning on Android:
    "'ETC2_RGBA8' is not supported on this platform. Decompressing texture. Use 'SystemInfo.SupportsTextureFormat' C# API to check format support."

    I guess its from the texture arrays Microsplat creates. Is there a way to choose our desired Texture Format?
     
  14. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yes, in the texture array config. Though I thought ETC2 was supported on all android devices openGLES3.0 or above?
     
  15. GlutenFreeGames

    GlutenFreeGames

    Joined:
    Jun 13, 2013
    Posts:
    51
    Not sure, was this a change in the newest update? Microsplat was working prefectly fine till now on openGLES2.0
     
  16. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    MicroSplat has never worked with openGLES2.0 - that doesn't support texture arrays.. And nothing has changed with texture code in a long time- latest update was all to add compiler support for HDRP..
     
  17. GlutenFreeGames

    GlutenFreeGames

    Joined:
    Jun 13, 2013
    Posts:
    51
    Bizarre cause ive been using it on openGL2.0 for a while with no issues. Clearly I need to get a better handle on the situation, appreciate the info / help.
     
  18. GlutenFreeGames

    GlutenFreeGames

    Joined:
    Jun 13, 2013
    Posts:
    51
    Ok so just in case you were curious, Microsplat runs fine on openGLES2.0 as long as parallaxing is on. No idea why, but I had turned it off to reduce the texture array samples and my terrain was all white, clicked it back on and rebuilt and poof, working again on openGLES2.0.
     
  19. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    So, some hardware may have supported the texture array extension before it was approved and required by OpenGLES3.0, but even so it seems surprising to me since OpenGLES2.0 does not support a lot of additional features, but maybe that particular device has all the 3.0 extensions? Why parallax would make a difference is also a complete mystery.
     
  20. Abrasive

    Abrasive

    Joined:
    Jul 24, 2019
    Posts:
    11
    Hi! We need previous version of MicroSplat - 2.68
    Do you have GitHub or something like that?
    Can you send a link of 2.68 in PM please? o_O
     
  21. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Why?

    99% of the time someone requests this it's because they pirated some of the modules, updated core, and now don't have compatible versions of the modules.
     
  22. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
  23. Abrasive

    Abrasive

    Joined:
    Jul 24, 2019
    Posts:
    11
    Programmer with all that MicroSplat stuff has left our small team.
    So we need previous version to continue our work.
    Ok, we'll try to find a solution anyway.
    Thanks for great terrain shader system!
     
  24. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Legally the Unity Asset Store license requires one seat per user for all editor tools, so right now, agree with it or not, you are illegally using my tools.
     
    Abrasive likes this.
  25. Abrasive

    Abrasive

    Joined:
    Jul 24, 2019
    Posts:
    11
    Yes, I see now :)
    We'll buy it again then.
    Thanks again for great stuff!
     
  26. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
    It this still the case? no mesh support only terrain?

    Because I have some tools that can convert my terrain to mesh and it would be nice if I can use the MicroSplat on that.
     
  27. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Look about 4 posts up..
     
    Lars-Steenhoff likes this.
  28. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
  29. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
    I'm trying to get tesselation to work on mac, build platform ios and metal as the render mode in default renderpipeline
    forward render.

    is this supported?

    I'm getting strange artifacts when zooming close.


     
  30. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    That's really odd- I dev on mac as well. What version of unity? And have you tried in a fresh project?
     
  31. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
    In a clean project it works !
    Unity version 2018.4.12f1

    I'm using it mapmagic, and perhaps I use some wrong settings,
    I will check how to reproduce in the clean project ( if I can )
     
  32. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
    Ok found the issue, the terrain base map distance was not on zero.

    Edit: still not sure if its working how it should

    I will check more
     
    Last edited: Nov 13, 2019
  33. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    So, the base map distance is used to set the shader to switch at the end of the tessellation- MS outputs two shaders, one with and one without tessellation, and uses unity's base map as the non-tessellated one.. The base map distance should be set by the MicroSplat component on the terrain.
     
  34. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
    I got some more digging done

    New project 2018.4.12f1
    - platform macOS
    - import microsplat
    - import tessellation
    - open tessellation demo scene
    - works
    - enable Draw instanced in terrain setting - stops working

    Can you confirm if draw instanced is supported or not?
     
  35. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Draw Instanced doesn't work with Surface Shader tessellation (this is a Unity bug in surface shaders which they will likely not fix, considering they are trying to push everyone to SRP). The newer version of MicroSplat should turn off draw instanced when tessellation is enabled though, but if you're having MapMagic manage everything it might be going through its own code paths..
     
  36. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
  37. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    They closed mine as fixed when it's clearly not. Several people have bug's on it, but no motion. Basically they don't copy the instance ID between some of the tessellation stages correctly, and is most likely a very easy fix- you can in fact see the bug in the output shader code if you display it. But getting someone to do it is the issue.

    Perf wise, draw instance is a big help on the CPU, so if your CPU bound it can make a nice difference.
     
    Abrasive likes this.
  38. mrCharli3

    mrCharli3

    Joined:
    Mar 22, 2017
    Posts:
    976
    Does Microsplat or any of its modules support height/slope based auto-painting?

    i.e, if the terrain is flat I want grass, if its a slope I want a mountain side, and so on, basically allowing me to skip manual painting, and unlocking the ability to do proper runtime alterations to terrain that will auo-paint. I watched your entire video but did not find any reference to this.
     
  39. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Runtime Procedural Texturing

     
    mrCharli3 likes this.
  40. blacksun666

    blacksun666

    Joined:
    Dec 17, 2015
    Posts:
    214
    Have you checked out https://www.assetstore.unity3d.com/en/?stay#!/content/143039
     
    mrCharli3 likes this.
  41. mrCharli3

    mrCharli3

    Joined:
    Mar 22, 2017
    Posts:
    976
    Awesome, didnt know the name for it :)
    With this plus the LWRP module this should work fine for LWRP yes? Always a bit worried about installing external shaders nowadays.
     
  42. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yes
     
    mrCharli3 likes this.
  43. mrCharli3

    mrCharli3

    Joined:
    Mar 22, 2017
    Posts:
    976
    Think Ill just buy Megasplat, looks like a great product. Will assume it works with LWRP since microsplat does :)

    EDIT: Crap, saw in the reviews that its not supported. Microsplat it is.
     
    Last edited: Nov 14, 2019
  44. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
    Don't assume too much too soon...
     
  45. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Supporting an SRP is a pretty massive undertaking unless you build all your shaders in Unity's shader graph or ASE and they've effectively done the work for you- but it's simply not possible to do the kind of work I do in a shader graph, both complexity and performance wise.
     
  46. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Some info:

    - HDRP module has shipped to the store. Currently the only thing it doesn't support is tessellation, and currently the normal doesn't blend quite as well when terrain blending as the surface shader one does.
    - LWRP has been re-written from scratch to be much closer to the HDRP module, which will make it easier to support. Currently no tessellation and the normal in the terrain blend is a bit off, but several lighting bugs with shadows were fixed in the process and overall it's a lot better than it was.
    - Mesh Terrain module has shipped to the store and is waiting for review.
    - Added a emission boost option to Lava
    - Added custom presets to the Procedural module, so you can quickly select stuff like "Put this on cliffs" and such. Should greatly help with user confusion..
     
  47. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
  48. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
  49. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I haven't tested in 7.1.5 yet, that's only for a Unity beta right?
     
  50. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Yes, for 19.3!
    However HDRP is out of preview 7.1.5 ( not considered beta now ) so i though you might have checked it !
    No worries will wait till 19.3 is out of beta !
     
Thread Status:
Not open for further replies.