Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    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:
    4,192
    So I would try in a non-beta version. That said, last night I managed to repro and fix a bug with trax where when the world size was set large, the buffer would sometimes initialize uncleared in certain sections, causing part of the terrain to be depressed when it shouldn't be. I submitted a patch already, hopefully it'll get approved tomorrow, or Tuesday at the latest, but it only seems to affect world sizes greater than 1650 in my demo, and 350 in someone else's project.
     
  2. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    242
    Hi.

    I have switched from CTS to Microsplat.

    I like it much more, the truth.

    I have activated quite a few options looking for quality. I have bought TRAX, I have activated it in my car, I have activated Enviro compatibility ...

    The problem is the FPS has dropped dramatically. I have gone from 62 to 38 and it is difficult for me to go back to see what affects me the most.

    Could you please indicate which features, shaders, effects .... are the most punished by the FPS to assess if they are worth it or not in my game?

    Thank you.
     
  3. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,192
    There's an optimization guide in Core/Documentation which has a lot of information on this topic, along with a few YouTube videos on it. The main bottleneck in a terrain shader is the number of texture samples you have to take, so reducing those numbers is usually the best thing. MicroSplat displays the number of potential samples taken in the debug section of the shader, and has debug display modes to show exactly how many samples are actually taken on a given pixel. The most expensive features are ones which multiply you sample count, like triplanar and stochastic, which both triple the sample count (or 9x when used together), but the branch samples optimizations can reduce the cost of these considerably.



     
    protopop, Rowlan and Barritico like this.
  4. unity_9rBp5m5c2_ph5g

    unity_9rBp5m5c2_ph5g

    Joined:
    Apr 28, 2020
    Posts:
    7
    Hi, First off Great Tool. I'm having a bit of trouble though and I'm relatively new to Unity so I'm probably just missing something obvious, lol. When I apply the Splatmap all of the textures on my terrain turn Grey? Any idea what could cause this?

    upload_2020-5-6_12-5-42.png
     
  5. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,192
    Going to need a lot more info than that. Are you in a Scriptable Render Pipeline, screenshot of the texture array config, what do you mean by apply the splatmap - is this coming from an external program?
     
  6. unity_9rBp5m5c2_ph5g

    unity_9rBp5m5c2_ph5g

    Joined:
    Apr 28, 2020
    Posts:
    7
    Hello,

    Ok, I'll do the best I can.

    Running Unity 2019.3.12

    I created a brand new scene and imported the MicroSplat from the Unity Store.
    I receive some errors in the Console upon import. (Maybe this is part of the problem.)
    upload_2020-5-6_17-1-53.png

    I create my terrain and assign 2 textures. So my terrain currently looks like this.
    upload_2020-5-6_17-5-19.png

    I then Add Component - Micro Splat Terrain
    Select a Template and Convert to Microsplat (Sorry in my previous message I accidentally typed splatmap, when I ment microsplat)

    upload_2020-5-6_17-7-42.png

    And then my terrain turns grey. I can apply the roughness, ao maps, etc. but nothing changes the color.

    upload_2020-5-6_17-8-31.png

    upload_2020-5-6_17-12-1.png
     
  7. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,192
    Your height map is red, but you're pulling the data from the green channel. Otherwise, make sure the arrays are assigned to the material - should have happened automatically, but it's possible the diffuse/height array isn't assigned..
     
  8. unity_9rBp5m5c2_ph5g

    unity_9rBp5m5c2_ph5g

    Joined:
    Apr 28, 2020
    Posts:
    7
    I can change the height map to the red channel, but it doesn't change anything with the color unfortunately.

    I think I found the problem in the shader. By default the max texture count is 4, as soon as I changed that value the textures loaded. I could change it back to 4 and it stays working, very odd, but at least now it works. :)

    Thank you for the help and pointing me in the right direction.
     
  9. Don-Gray

    Don-Gray

    Joined:
    Mar 18, 2009
    Posts:
    2,276
    Hi,
    I own MegaSplat and all the MiroSplat modules.
    Is it safe to assume MicroSplat needs to be installed for the modules to work?
    When I import MicroSplat 3.401 into Unity 2019.3.13f1, I get these two errors:

    Assets\MicroSplat\Core\Scripts\MicroSplatObject.cs(50,11): error CS0246: The type or namespace name 'MicroSplatProceduralTextureConfig' could not be found (are you missing a using directive or an assembly reference?)

    ssets\MicroSplat\Core\Scripts\TextureArrayConfig.cs(275,17): error CS0246: The type or namespace name 'Substance' could not be found (are you missing a using directive or an assembly reference?)

    I've not used MicroSplat in other versions.
     
  10. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,192
    It looks like you project once had procedural texturing and substances plugin installed, and when removed the defines left in the build settings were not removed, so the code is attempting to link to those assets. So either install them again, or remove the defines from the build settings and it will compile.
     
  11. Don-Gray

    Don-Gray

    Joined:
    Mar 18, 2009
    Posts:
    2,276
    ok, I'll check it out.
    Thank you
     
  12. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    304
    My project terrain (2k x 2k ) is using all Microslat assets and things work great but I would like to by Path Finder. Seems a good tool to paint paths on terrain but was wondering if someone here knows if it works fine microsplats.

    Anybody tried both together ?

    thx
     
  13. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,192

    https://github.com/Roland09/PathPaintTool
     
  14. firefly9000

    firefly9000

    Joined:
    Dec 7, 2016
    Posts:
    13
    Apologies if this is not the right place to ask this but I just purchased Megasplat and would like to review docs on how it works with ASE. I cannot seem to find the documentation (or tuts on this). * or even the regular Megasplat docs.
     
  15. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,192
    Honestly it's been so long I have no idea if it even does anymore. ASE has gone through a ton of versions, and the nodes were not used by many people as far as I know. But basically there were nodes to decode the texture indexes and weights, and sample the textures from the texture array. And another node to read the per texture property data..
     
  16. firefly9000

    firefly9000

    Joined:
    Dec 7, 2016
    Posts:
    13
    I understand. We have a terrain shaded with a custom ASE shader. I saw intro video for Megasplat and saw there's a conversion from a regular terrain to Megasplat.

    Is there any way to salvage the work done with the ASE shader or do we have to redo it from scratch in Megasplat? Thanks
     
  17. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,192
    MegaSplat uses a fundamentally different technique that Unity terrain uses, so it's a really different beast, with its own data format at tools workflow. MicroSplat works with the standard Unity formats. But neither is meant as something you can insert into an existing shader somehow..
     
  18. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    304
  19. nsxdavid

    nsxdavid

    Joined:
    Apr 6, 2009
    Posts:
    397
    Loving MicroSplat!

    Just thought I'd try out the wind and glitter module on our sand areas. Doesn't seem to behave like I'd expect. Across the terrain that is lit, it works find, but in shadow these areas become dark splotches that doesn't look like drifting sand at all.

    upload_2020-5-9_13-49-25.png
     
  20. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,192
    Do you have shadows turned on the wind feature? I suspect they are what's producing the darkening effect.
     
  21. nsxdavid

    nsxdavid

    Joined:
    Apr 6, 2009
    Posts:
    397
    I thought so too, but no... same with shadows on or off.

    upload_2020-5-9_18-11-38.png
     
  22. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,192
    The effect itself doesn't know about its lighting condition, rather it adjusts the inputs to the lighting. A mask is calculated, the albedo is interpolated towards the wind color based on that mask. Then the other components are ramped down according to the mask (normal gets weaker, AO increases, less smoothness, etc). What I suspect is happening in your case is that the ambient occlusion being reduces is creating a darkening effect. I will add a parameter so you can control how much the ambient intensity is modified.
     
  23. nsxdavid

    nsxdavid

    Joined:
    Apr 6, 2009
    Posts:
    397
    Why would my case be any different than anyone elses?
     
  24. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,192
    Not saying it is- just that no one has ever brought up the issue before. Anyway, in the next version an AO slider is exposed so you can say how much of the AO gets dampened by the wind..
     
  25. nsxdavid

    nsxdavid

    Joined:
    Apr 6, 2009
    Posts:
    397
    I use screen space AO. So I'm not really following what you mean by AO being affected by this.
     
  26. nsxdavid

    nsxdavid

    Joined:
    Apr 6, 2009
    Posts:
    397
    In the feature request bucket, it'd be nice to be able to attenuate the wind/dust effect by the various wet maps (wetness/puddles/streams) as it doesn't look quite right for sand to blow "over" these areas.
     
  27. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    242
    Hi.

    Regarding TRAX.

    Imagine a car that leaves some marks (with TRAX) for the places where it circulates.

    Is there any way, or can you give me any idea, if I could "burn" those marks (or the terrain WITH those marks) so that, in the next load of the scene, they would appear already created?

    Thank you.
     
  28. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,192
    textures have AO maps; these are affected by wind. It has nothing to do with screen space ao.
     
  29. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,192
    you can serialize and restore the Trax buffers if you want them persistently; but remember they are relative to the trax managers location, so that would need to be positioned the same on load.
     
    Barritico likes this.
  30. RPowers

    RPowers

    Joined:
    May 14, 2015
    Posts:
    113
    Hi. I'm experiencing a small issue with URP 7.3.1 and the Base Map Dist. terrain setting. It's not doing anything. There's a clear line in my terrain where the texture resolution drops after a certain distance from the camera (see image). I must be missing something, but I though this was what the Base Map Dist. slider was for but it's not working. Is there another setting somewhere I have to change? I'm not even sure if this is a Microsplat related issue or a Unity terrain w/ URP issue, but any help would be greatly appreciated.
     

    Attached Files:

  31. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,192
    The basemap is not used like it is in the Unity shader. Most likely the line you see is the mip map changing levels because the array is set to bilinear instead of trilinear shading. You can change it on the Texture Array Config.
     
  32. Createman

    Createman

    Joined:
    Apr 14, 2013
    Posts:
    13
    I'm using the terrain blending module (and triplanar module). Is there a way to get more precision/resolution for the placement of the terrain blending material? I mean the terrain descriptor. I'm trying to create a very narrow blending but it's located a bit off when the terrain has more shape.
     

    Attached Files:

  33. nsxdavid

    nsxdavid

    Joined:
    Apr 6, 2009
    Posts:
    397
    Okay, some confusion here...

    What is the difference between the Terrain Painter and the VFX Painter? I'm having an issue where there is a Terrain_stream_data.tga and Terrain_steram_data.png. One updates the former and the other updates the latter. Both seem to show on the terrain (streams, water, etc.), but when I restart unity the tga settings are lost, so it must be using the png? Confused what's going on.
     
  34. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,192
    Use float precision on the terrain descriptor instead of half, which is the default...
     
  35. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,192
    The FXPainter is no more- unfortunately the asset store won't delete files, so while it's not included in the package anymore, there's no way for me to delete it off your system.. Either install the module fresh, or just delete the old FX painter from the Streams/Scripts/Editor folder.
     
  36. Createman

    Createman

    Joined:
    Apr 14, 2013
    Posts:
    13
    Yea tried it but didn't help much. Is there a way to make the texture 4k for example? I could edit some code if you could point to right direction.
     
  37. nsxdavid

    nsxdavid

    Joined:
    Apr 6, 2009
    Posts:
    397
    Okay, but the problem is that when I use the new one it changes the tga file, and everything paints as I expect live. But when I restart Unity, all the work is gone. It seems to be loading the png version of the splat map for streams even though it saves the tga version.

    Super confusing.
     
  38. nsxdavid

    nsxdavid

    Joined:
    Apr 6, 2009
    Posts:
    397
    BTW, even though you cannot delete files, you can change the file so that it no longer does anything... kind of a dummy C# class. That'll remove it from the Window menu and avoid confusion.
     
  39. nsxdavid

    nsxdavid

    Joined:
    Apr 6, 2009
    Posts:
    397
    I can confirm that the MicroSplatObject's streamTexture is referencing the .png file and not the .tga file. Still trying to understand what's going on... it clearly has to do with the attempt in the code to move from .png to .tga, but haven't figured out why it's not working for me. It does save the stream splat as TGA but it doesn't use the TGA file, but instead insists on using the .PNG file.
     
  40. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,192
    You have the PNG file assigned in the terrain component, and I bet it's grabbing it from that.
     
  41. RPowers

    RPowers

    Joined:
    May 14, 2015
    Posts:
    113
    Thanks for the response! The problem did have to do with the Aniso of the textures, which apparently weren't being applied to my terrain textures at all. Even when I set trilinear filtering and my ground texture's Aniso level to 16 it did nothing. For some reason I had to set Anisotropic Textures in Quality Settings to "Forced On" in order to get Aniso levels to work at all with my terrain. "Per Texture" doesn't turn on Aniso of terrain textures even though my texture's Aniso Levels are set high. Not sure why that is, but it feels like a bug maybe with Unity's terrain and URP. For my needs though I'm all set so thanks! I want it set to Forced On anyways since it greatly improves my overall quality for what seems to be little performance cost.
     
  42. LordSwaggelore

    LordSwaggelore

    Joined:
    Mar 14, 2019
    Posts:
    5
    Hello, I saw dynamic terrain deformation in your MicroSplat Features Video at 2:30 (a projectile hit the ground and left a hole). How is this done and which module from MicroSplat is used for this?
     
  43. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,192
    The hole is created with Digger Pro and my Digger integration module.
     
    LordSwaggelore likes this.
  44. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,192
    You have to set the aniso level on the Texture Array Config, since it is going to repackage your source textures into texture arrays..
     
    RPowers likes this.
  45. nsxdavid

    nsxdavid

    Joined:
    Apr 6, 2009
    Posts:
    397
    Where do I find the place to change this in the blizzard of UIs? (not complaining, it's a complicated thing you are doing)
     
  46. RPowers

    RPowers

    Joined:
    May 14, 2015
    Posts:
    113
    Ahh ok that makes a lot of sense. Thanks again!
     
  47. nsxdavid

    nsxdavid

    Joined:
    Apr 6, 2009
    Posts:
    397
    Spent a lot of time looking, I still cannot find where I can change what texture is used for the stream splatmap. I get the impression I'm going to be pretty embarrassed when it was right in front of me the whole time... but just don't see it anywhere.
     
  48. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,192
    On the MicroSplatTerrain component, it has a link to the stream data for that terrain, since in a multi-terrain setup each would have it's own painting data.
     
  49. nsxdavid

    nsxdavid

    Joined:
    Apr 6, 2009
    Posts:
    397
    Okay, I give up. Here is the MicroSplatTerrain component in all it's glory. Where is the Stream Splat map referenced in this UI?

    upload_2020-5-11_19-10-8.png
     
    camta005 likes this.
  50. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,192
    Awe crap, you're right - the code in the editor got removed for it.

    In MicroSplatTerrainEditor.cs add the following around line 172:

    Code (CSharp):
    1. #if __MICROSPLAT_STREAMS__
    2.       MicroSplatUtilities.DrawTextureField (t, new GUIContent("Streams"), ref t.streamTexture, "_WETNESS", "_PUDDLES", "_STREAMS", "_LAVA", false);
    3. #endif
    That'll be in the next patch too. You can also use the debug inspector to replace it if you're not used to editing code (there's a gearbox at the top of the inspector window).
     
unityunity