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,785
  2. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,785
    You should look in the frame debugger and watch the draw order to see if the terrain is being drawn after the projector, this will verify or disprove the assumption..
     
  3. RyanDunne

    RyanDunne

    Joined:
    Mar 30, 2017
    Posts:
    13
    I have a plan of painting city texture on the terrain for distant cities you won't go near, and foggy enough to mask it looking like it's flat. My problem is I tried it with standard shader and it worked great, but with microsplat it's blurry. Any advice?
     
  4. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,785
    Are you using the LOD sampler mode by chance?
     
  5. BlankDeedxxAldenHilcrest

    BlankDeedxxAldenHilcrest

    Joined:
    Jul 10, 2018
    Posts:
    292
    I'm sure I missed something simple. After installing Microsplat my level texture got a little wonky. My aim is to paint over the terrain texture anyway so I started loading some test textures into my test scene to make some lemonade and just get used to the new software. When I paint though it came out looking distorted like my terrain's texture became.


    I gotta double the size of my terrain, so on a previous import I tried doubling the heightmap length and width and I got similar results. The terrain was more legible, but it was all in the wrong place.
     

    Attached Files:

  6. basil3

    basil3

    Joined:
    Dec 3, 2015
    Posts:
    28
    Thanks for the help - Checked the debugger and terrain is being drawn prior to the projector so I would have thought it would project onto the tessellated surface but it still does not.

    I will keep digging.

    Ste.
     
  7. DespairBear

    DespairBear

    Joined:
    Nov 1, 2013
    Posts:
    216
    Out of the box for the base microsplat asset I'm getting some banding on my terrain when I move? Idk how else to describe it, it's like I can see the terrain texture detail being increased as I move forward and it creates a visible sort of line similar to a screen scan on old televisions. It looks like it's blurring textures outside of a very short range of the camera (a few feet in front of it)

    I'm assuming this is for optimization purposes. Is there any way to increase the distance that these things are drawn?
     
    Last edited: Sep 14, 2018
  8. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,785
    Have you tried changing the filter from bilinear to trilinear on the texture arrays? It sounds like a mip filtering issue..
     
  9. hungrybelome

    hungrybelome

    Joined:
    Dec 31, 2014
    Posts:
    279
    Hi, been trying out MicroSplat and it is amazing. Is there some sort of module for exporting terrain to a mesh? I tried using https://assetstore.unity.com/packages/tools/terrain/terrain-to-mesh-47276 but the resulting mesh can't use the MicroSplat material, of course. I really want to be able to use the MicroSplat PBR shader with a static mesh if possible, since my game is for mobile and the terrain is only 20x20.
     
    Last edited: Sep 14, 2018
  10. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,785
    I have a module for this, but haven't released it yet.. You can see a demo on my YouTube channel..
     
  11. hungrybelome

    hungrybelome

    Joined:
    Dec 31, 2014
    Posts:
    279
    Wow, is it possible to buy the module now it in advance? And do you know when your One Batch tool will be released? I've been working on a crude version of the Standard shader with texture arrays for each inputs as well, but the workflow is a pain. I'd love to purchase an actual tool that does that!
     
  12. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,785
    Both are basically done, but I'm being lazy on doing the marketing materials and such for them. They could both use some more beta testers who will give me some actual feedback though..
     
  13. DespairBear

    DespairBear

    Joined:
    Nov 1, 2013
    Posts:
    216
    Looks like it was something with how Gaia was setting up textures. Or maybe something in my configuration of the texture spawner. Recently switched over to MapMagic and haven't had the problem since. Thanks for the response
     
  14. TehReason

    TehReason

    Joined:
    May 14, 2013
    Posts:
    53
    is there a chance to add support for 2018.3 and the new terrain layers? :)
     
  15. tduriga

    tduriga

    Joined:
    Dec 9, 2015
    Posts:
    6
    Hi, I really like the Microsplat and I'm planning to use it in my next mobile game, but there is one big issue and i don't know how to fix it.

    As I understand Microsplat should work on Opengl ES 3.0 and higher, but on mobile devices with Opengl ES 3.0 the terrain is just gray (terrain works ok without Microsplat). What I found out is, that Unity will use the "bitfieldInsert" function when compiling the shaders, but this function exists only in ES 3.1 and higher (see: http://docs.gl/el3/bitfieldInsert).
    It seems that it happens when using bitwise operators in shader, but I haven't found any. Unity seems to know about this issue, because I found this workaround on their Github for SRP: https://github.com/Unity-Technologi...oreRP/ShaderLibrary/UnityInstancing.hlsl#L141

    Here is the LOG output from the Android device, where the shader compilation points to the bitfieldInsert function https://pastebin.com/k918S8fE and I'm using Unity 2018.2.6.
    I hope you will know what is the cause of this. Thanks.
     
  16. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,785
    I don't typically support beta's, as the APIs tend to shift around a lot. I did try it on 2018.3, and submitted a bug to Unity already (they aren't autoupgrading some things correctly), so eventually support will be there. It does run fine if you fix the minor compile errors they don't autoupgrade though.

    I don't use any bit operations in MicroSplat, so this must be something the surface shader system is generating.
     
  17. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,730
    @jbooth I'm not understanding the use of the Angle Mask in the Wind & Glitter module. I can get a nice effect of the snow moving along the landscape, but no matter what I set the Z & W values to, I see the effect everywhere no matter what the slope of the terrain is. For example, I've tried X,Y,Z,W of:

    -1, -1, .1, .3

    But the effect is still seen even on steep slopes. I know the values are between 0 and 1 so I'm just guessing that 0 is a 0 degree angle and 1 is a 90 degree angle. But maybe I'm wrong. In any case, I've tried super small values too like .01 and .02, but it still shows up on all slopes.

    Am I missing how this is supposed to work?
     
  18. tduriga

    tduriga

    Joined:
    Dec 9, 2015
    Posts:
    6
    Ok, so after more testing with clean project I found out that the issue is present only when I add Microsplat to the terrain. I tested it with Unity 2017.3 (it crashes immediately) and 2018.2 (terrain is gray - without any texture), when i remove the Microsplat everything works fine (terrain, textures, trees, etc.). The "bitfieldInsert" function error was from built-in "CameraFacingBillboardTree" and I've probably fixed it since it's no longer showing up in the log output, only errors I get now are like this:


    09-17 17:41:44.942: D/Unity(31087): WARNING: Shader
    09-17 17:41:44.942: D/Unity(31087): Unsupported: 'Hidden/MicroSpat/AddPass' - Pass 'FORWARD' has no vertex shader
    09-17 17:41:44.942: D/Unity(31087): WARNING: Shader
    09-17 17:41:44.943: D/Unity(31087): Unsupported: 'Hidden/MicroSpat/AddPass' - Pass 'PREPASS' has no vertex shader
    09-17 17:41:44.943: D/Unity(31087): WARNING: Shader
    09-17 17:41:44.943: D/Unity(31087): Unsupported: 'Hidden/MicroSpat/AddPass' - Pass 'PREPASS' has no vertex shader
    09-17 17:41:44.943: D/Unity(31087): WARNING: Shader
    09-17 17:41:44.943: D/Unity(31087): Unsupported: 'Hidden/MicroSpat/AddPass' - Pass 'DEFERRED' has no vertex shader
    09-17 17:41:44.943: D/Unity(31087): WARNING: Shader
    09-17 17:41:44.943: D/Unity(31087): Unsupported: 'Hidden/MicroSpat/AddPass' - All passes removed
    09-17 17:41:44.943: D/Unity(31087): ERROR: Shader
    09-17 17:41:44.943: D/Unity(31087): Shader is not supported on this GPU (none of subshaders/fallbacks are suitable)


    Do you think it's Unity issue? Or do you use some shader functions that are present only in Opengl ES 3.1? It's happening only on devices with Opengl ES 3.0 (target 3.5), on devices with 3.1+ (target 4.0) everything works fine. I've tested 3 different phones already, so it's not device specific issue. Thanks.
     

    Attached Files:

  19. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,785
    Well, those shaders definitely have vertex shaders, so I'm thinking it's likely a wrong error message. I had though Texture Arrays required 3.0, not 3.1, but I may be wrong. Other than arrays, the only thing I can think of which are not 2.0 instructions are the derivative instructions (ddx, ddy).
     
  20. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,785
    It's been a while and I haven't looked at the code, but I think it only handles angles between 0 and 1, as terrain never has negative dot's against an up vector.
     
  21. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,730
    Can you explain in more detail? I'm not sure what you mean. Can you give an example of usage that explains the behavior? Is there a way to achieve what I'm after?

    [EDIT]
    Do you mean that the default X,Y values of -1 are invalid and would cause issues?
     
    Last edited: Sep 17, 2018
  22. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,785
    So, your terrain never points down- so -1 to 0 would be from pointing sideways to down. So the usable space is in the 0-1 range. A terrain pointing directly up would be 1, and a terrain pointing sideways would be 0. So something like 0.8, 0.9, 1, 1 would make the effect start fading in as the terrain gets close to flat (0.8), be fully faded in by, which is only slightly sloped 0.9.
     
  23. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,730
    Ah, I see. It was unclear how to make that work. I would suggest putting your example in the document to help others in the future. Thanks.
     
    jbooth likes this.
  24. TehReason

    TehReason

    Joined:
    May 14, 2013
    Posts:
    53
    ok, cool awesome :) (On my side it was working fine by itself, just not using the new terrain layers but the old obsolete splatmap interface)

    i was mostly talking about the instanced rendering part which the auto upgrade isn't taking care off.
    Will you add support for this as 2018.3 will get released?
     
  25. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,785
    Yes.. likely well before then..
     
  26. RyanDunne

    RyanDunne

    Joined:
    Mar 30, 2017
    Posts:
    13
    Thanks jbooth, I knew it was something simple I was missing. I was using Gradient sampler and changed to LOD and looks good. Thanks again!
     
  27. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    584
    Hello jbooth,

    now I also have this GFX.WaitForPresent problem under 2017.4.11f1 Personal. Use your scene in the core folder, install all your microsplat assets, set 32 textures, enable snow, wetness, streams, lava and set 'Particulate With Shadows'. After you will see the GFX.WaitForPresent in the profiler very well. The more features you activate the more CPU performance is needed for GFX.WaitForPresent. I did not notice this under Unity 5.6.6f2 Pro. VSync is off.

    Edit: For the same project under Unity 5.6.6f2 Pro GFX.WaitForPresent are available, but hardly recognizable. About 30 time less.

    Edit: Same issue with Unity 2018.2.8f1. In my test scene Unity 2018 and Unity 2017, due to the GFX.WaitForPresent, the CPU load was mostly on 4ms. In Unity 5.6.6f2 at 1ms.
     
    Last edited: Sep 21, 2018
  28. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,785
    GFX.WaitForPresent happens when the GPU hasn't finished rendering the frame, so the CPU just has to spin and wait for it to finish. It's not actually using CPU, it's using GPU and the CPU is stalled waiting for the graphics card to finish.
     
  29. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    584
    Do you know what changes in Unity 2017 caused this issue? My test project In Unity 5.6.6f2 needs 1ms, in 2017, 2018 4 ms because of GFX.WaitForPresent. Both uses DirectX 11.
     
  30. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,785
    Do you have vsync on? Cause if you do it has to wait for the vsync refresh before it can start the next frame, so that would stall it as well.
     
  31. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    584
    VSync is off. GPU is NVidia 1050 4gb, Notebook. I converted the same project between Unity 5, 2017 and 1018. Nice thing in Unity 2017 is, that it can be converted back to Unity 5 ;)
     
  32. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,730
    @jbooth How do I add additional textures to a terrain that's already converted to Microsplat? I tried adding it through the normal terrain options, but when I hit Sync on Micropsplat it just removes it. So, where can I add it in so that I can then paint the new texture on the terrain?
     
  33. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,785
    In the TextureArrayConfig, which is in the MicroSplatData directory. It's done this way because there's no way to put in all the textures from the Unity interface.
     
    magique likes this.
  34. ice2011

    ice2011

    Joined:
    Jan 5, 2015
    Posts:
    7
    Hey, Jason

    I am also experiencing similar very frustrating complications. Using Unity version: 2018.2.8f1 my Microsplat textures appear white or solid color after importing my project from previous Unity version. I've tried re-installing Unity and re-downloading the assets along with removing all compiler errors. I also followed through with your previous posts regarding removing the LDRenderingLoopAdapter script to no avail. Any idea as to why this issue continues to come up?

    Thank you, AJ
     
  35. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,785
    Well, did removing the LDRenderLoopAdapter class fix the compile errors, or are their more? When you re-download and install assets from the store, it won't delete file that have been removed from the project, which is why that file still hangs around from a previous version. However, once that file is removed and everything compiles again, it should be fine. If not, please post the compile error so I can see what's happening.
     
    ice2011 likes this.
  36. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    288
    I have source normal texture in BC5 format. Would it be packet into texture array correctly?

    As I understand normal packed in R, G channels of normSAO array, smoothness in B and AO in A, is this correct?
     
  37. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,785
    It will be read from your source texture and recompressed into whatever format you have the array set for. The normalSAO array is no longer packed that way- instead, it's Normal in G/A channels, with smoothness and AO in RB.. You shouldn't have to do this manually at all though, it handles everything as part of the texture packing system.
     
  38. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    288
    Thanks. I know, I just tried to write simple terrain shader for Planetary Terrain, using your packing system and shader graph (hdrp). And it worked.
     
  39. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    584
    No GFX.WaitForPresent issue on my desktop PC. NVidia 970. Strange...
     
  40. holdingjason

    holdingjason

    Joined:
    Nov 14, 2012
    Posts:
    91
    How do we remove microsplat and go back to a standard terrain? I figured we would be able to simply remove the script and change the shader back to default however that does not work. The splats show up as basic colors etc. If we edit something ie click paint and drag the moment we press down to paint the correct splats show up but disappear again as soon as we release the paint button. Just trying to test some things but did not want to have to revert all the way back to a version before applying microsplat.

    Any thoughts.

    Here is a shot of the terrain yanking all the microsplat stuff.

    upload_2018-9-26_12-47-30.png

    here is when we try and paint things on it from the normal terrain editor.

    upload_2018-9-26_12-48-19.png
     
  41. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,730
    I had the same thing. Just go to your terrain settings and change the Base Map Distance to something other than 0.
     
    eholding007 likes this.
  42. holdingjason

    holdingjason

    Joined:
    Nov 14, 2012
    Posts:
    91
    Great thanks that did it.
     
    magique likes this.
  43. holdingjason

    holdingjason

    Joined:
    Nov 14, 2012
    Posts:
    91
    Another issue with Triplaner. We are suppose to be able to turn this off on a material by material bases but that is not happening. I want some of the materials to work as if Triplaner was completely off.

    Here is a shot with Triplaner set to disabled. The rocks are all stretched which is fine since that is what tri should fix. The sand shows the way we want in the foreground.
    upload_2018-9-26_13-10-30.png

    Now here is the same shot with Triplaner on but set to disabled on the sand material ie set to value of 1. You can see the rocks in the background have tri on which is great but the foreground sand on the dunes is not correct. Something odd is happening to the splat which is very different from the first shot (which is what I would expect). Its like the UV scale is getting messed up. You can see how it is similar to the first shot but almost like the scale is zoomed in.
    upload_2018-9-26_13-8-22.png
     
  44. ice2011

    ice2011

    Joined:
    Jan 5, 2015
    Posts:
    7
    Jason,

    Updating to your most recent version of Microsplat+removing the LDRenderLoopAdapter script using Unity version 2018.2.8f1 got rid of the compiler errors! THANK YOU for that.

    The last problem I'm having is heavily pixelated texture edges.
    I'm also using Vegetation Studios. Didn't know if that could have any effect on this situation.

    Screenshot of the issue below.

    Any idea of how to get rid of this?

    Best regards,
    ice2011
     

    Attached Files:

  45. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,785
    Looks like your texture array is set to point sample instead of bilinear or trilinear..
     
  46. holdingjason

    holdingjason

    Joined:
    Nov 14, 2012
    Posts:
    91
    @jbooth any thoughts on that Triplaner issue? Anything you can think of that I can try to track down the issue or something else I could provide to give some insight on it?

    Thanks.
     
  47. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,785
    Haven't had time to try to repro it yet, I'll look at it shortly and make sure everything is working on my end..
     
  48. holdingjason

    holdingjason

    Joined:
    Nov 14, 2012
    Posts:
    91
    Oh ok no problem just checking. Thanks and appreciate the help.
     
  49. kilian277

    kilian277

    Joined:
    Jul 13, 2012
    Posts:
    54
    Hello!
    Awesome asset , but i have a question , i have a terrain with 16 textures already + the texture array filled , now i wanted to add a 17th texture , so i need to set the texture count in the material to 20 and then add another texture in the array , after i hit update , the the 16th texture becomes black and i can't paint the 17th texture.
    Any ideas ?
     
  50. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,785
    None, but there was a bug a while back where the texture array updating code had a 16 texture clamp in it when it shouldn't- but that got fixed..

    Worse case, send me a repro and I'll take a look..
     
unityunity