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

[FREE]MicroSplat, a modular terrain shading system for Unity Terrains

Discussion in 'Assets and Asset Store' started by jbooth, Aug 9, 2017.

  1. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    292
    Hi.

    I have various doubts

    I am trying to create the TRAX effect in my off-road racing game.

    I have followed the video and everything is fine. But....

    1- Is it possible to achieve that a concrete texture is not "tessellation"? I have a road made with EASY ROAD and it is covered since it adjusts to the terrain.

    2- Is it possible to get some textures to have the TRAX effect and others not? In the landscape I have areas of sand dunes that should have that effect and others of gravel roads that should not.

    I am testing with the particular parameters of each texture, without success. Also, each modification makes me wait several minutes and I would appreciate knowing if what I am trying is viable or not.

    Thank you. GREAT JOB!!!!
     
  2. niallmc

    niallmc

    Joined:
    Sep 3, 2015
    Posts:
    34
    Hey @jbooth, Just got around too using Trax, it's awesome. Will be reviewing 5*

    Quick question, is there a way to access and clear down a particular area which has been imprinted via code?

    Thanks for your work on this, it's really very useful.
     
  3. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,427
    There's not an API for it or anything, but clearing the buffers to 99999 will do that..
     
  4. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,427
    1. You can use the per-texture property for displacement amount and set it to 0 and no displacement will applied
    2. There is a per texture property for trax opacity, set to 0, trax will not apply to that texture.

    If you are talking about modifications to the feature set causing a delay, this is because when you enable and disable features MicroSplat generates new shader code, so you always get the optimal performance from the shader. There is a button at the top of the UI which allows you to enter a bulk edit mode, so you can change as many options as you want and then exit that mode to regenerate the shader only once.
     
    Barritico likes this.
  5. niallmc

    niallmc

    Joined:
    Sep 3, 2015
    Posts:
    34
    What about clearing the imprint within a particular area. Any way that would be possible?
     
  6. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,427
    Yeah, you make a 1 pixel texture with Color(99999, 0, 0, 0) in it, and Graphics.Blit that to the area of bufferA and bufferB you want to remove the effect on..
     
  7. niallmc

    niallmc

    Joined:
    Sep 3, 2015
    Posts:
    34
    Will give that a go, thank you!
     
  8. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    3,517
    Hi @jbooth ,

    I have a bug with point light reflecting on distant terrain despite a low range. It seems to work in relation to camera. The point lights location is where the smoke plume is originating from.

    I believe the issue is related to the terrain shader, because I am not seeing this effect on objects with regular shader. (picture below shows sphere that is unaffected).

    I don't have any reflection probes in teh scene and am using realtime lighting (from enviro sky).


    upload_2020-4-27_17-2-14.png

    upload_2020-4-27_16-58-3.png

    update: Actually i think the camera relationship is just occlusion culling.If you are facing the light, even from a far distance it will not disappear. I've also tried changing out the light, and used different types of lights as well. No difference for any of that.

    Additionally, is microsplat supporting instanced terrain rendering? My terrain is automatically disabling instancing when entering play mode. Is tessellation incompatible with instancing perhaps?


    Any advice is apprecaited. Thanks
     
    Last edited: Apr 27, 2020
  9. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    292
    Hi.

    I am going to ask a series of questions, all related to MICROSPLAT TRAX. Just to know the current potential.
    My goal is to make the physical behavior of a vehicle react based on the "trax" performed.

    1- Is there a way to identify if "what treads" the car is the texture "before" having a trax or is treading on a "trax" already made?

    2- Is there a way to make "accumulations" of "trax"? That is to say that in the first pass a footprint of a depth x can be made, in the second of x + 1 and in the third of x + 2

    3- In the previous case, in case of a negative answer ... could you use three different textures depending on the passes made by the area? In other words, the original texture is number 1, if "it is stepped on" it appears 2 and if it "steps on it" it appears 3. This way it would be able to control the previous effect.

    With something like this you could do something very nice, adjusting the reaction of the vehicle to the "trax" performed. Even in a multiplayer game, the player to pass in position 10 will have the "trax" performed and his physics will be smoother.

    I just want to know the current possibilities to know to what extent I can take advantage of the code and the fantastic tool.

    Thank you.
     
  10. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,427
    When running on the standard pipeline, MicroSplat uses a surface shader. This, it has no lighting code, that is all handled by Unity. Terrain instancing is supported, but is disabled when tessellation is enabled because Unity has a bug in the Surface Shader system that doesn't work with terrain instancing. They won't fix this bug because they are trying to get everyone to move to SRPs, where they have even more issues and missing features..
     
    BIGTIMEMASTER likes this.
  11. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    3,517
    ah ok, so these two issues are actually related. i was just testing that after going through the documentation more carefully. i have to make a choice between tessellation or instancing it seems.
     
  12. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,427
    1. I'm not sure what you're asking here, exactly. The Trax buffer is generated by rendering the objects which make impressions into a custom buffer. This acts as a record of the physical depression, and takes the form of whatever was rendered. So if you have giant, modeled tire tracks, they will show up in the buffer. The terrain uses that buffer to perform physical deformation and texture changes, but the texture changes are completely optional, and you can control which texture gets blended in (a single texture) or have a unique texture for each texture on the terrain (grass->mud, sand -> hard sand, etc).
    2. There are two ways to achieve this. The first is not to accumulate, but rather to quickly repair. For instance, if you step in the mud, water often collects in the hole and as you pull your foot out, the mud comes back up and the water dissipates a bit. This can be simulated by using the time manager and having the trax buffer repair (and the puddles module), but stop before the repair is finished. Then when you run over it again, it gets pushed down and springs back again. The second way is to manage the height of the collision objects yourself, usually by having a proxy object only used for the trax rendering. In this case, you could move the object up or down to represent how far you want it to push into the buffer, like if your doing a mud runner and want to simulate the tire digging into the mud more over time.
    3. Right now there are two layers to work with - the original terrain and the depressed terrain, and a blend between them. Snow could be considered a third layer, since it sits on top of these with its own settings.
     
  13. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,427
    Unless Unity fixes their bugs, which I doubt, on standard, that is the choice.
     
    BIGTIMEMASTER likes this.
  14. zigongli36

    zigongli36

    Joined:
    Dec 16, 2019
    Posts:
    4
    Hi, I'm using Unity 2019 3.5 and URP 7.2.1 but the shader is not working.
     
  15. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,427
    Did you change it to LD in the render pipeline setting?
     
  16. Cvedia

    Cvedia

    Joined:
    Jul 14, 2017
    Posts:
    3
    I'm using MeshWorkflow, but I'm not able to remove a texture after I painted it.
    I'm painting on a mesh as it was a terrain. I fill it with the first texture (grass) and pain over the second texture (rocks). Then I want to remove some rocks area. I tried painting grass over the rock texture, or to set the target value of the rock to 0 and paint over. Nothing happens.
    What am I missing? Is it possible?
    I'm using the "Splat Map" mode.

    Also, when I use the triplanar shader, in Local coordinates the projection is broken. It moves with the camera translation.

    I'm in HDRP with the "HDRP Support" extension, and I have several warnings on the shader. Let me know if you are already aware of them otherwise I'll report them. Both on DX11 and DX12.
     
  17. zigongli36

    zigongli36

    Joined:
    Dec 16, 2019
    Posts:
    4
    @jbooth Hi, I'm using Unity 2019 3.5 and URP 7.2.1 but the shader is not working.
     
  18. zigongli36

    zigongli36

    Joined:
    Dec 16, 2019
    Posts:
    4
  19. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,427
    You should just need to paint grass over it to remove the weight on the rocks. What happens if you fill?

    I suspect the local space is to do with HDRP's camera relative rendering, if you turn that off for now it'll work. I'll have to modify the HDRP adapter to take that into account when using local projections.
     
  20. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,427
    So describe "Not Working", because that doesn't give me much to go on.
     
  21. zigongli36

    zigongli36

    Joined:
    Dec 16, 2019
    Posts:
    4
    upload_2020-4-27_19-50-58.png
    upload_2020-4-27_19-52-25.png
    Here I attached a screenshot of my shader and console
    @jbooth
     
  22. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,427
  23. Cvedia

    Cvedia

    Joined:
    Jul 14, 2017
    Posts:
    3
    No I can't paint over with the grass. Fill works:
    https://www.dropbox.com/s/a0l0oo377f2u3tc/vxKEx02oxl.mp4?dl=0

    Also, if I fill the second texture first and paint with the grass, it mix them, but not replaces them:
    https://www.dropbox.com/s/eus4t5wxqi4o2lb/9hww79EbPX.mp4?dl=0

    Few more issues.
    1. When I click in one place then I release and click on a different place, the painting continues for a while on the previous position. It's not a major bug, but sometimes it makes it difficult to be precise.
    Video: https://www.dropbox.com/s/7rvtfwzrp95icv9/JNX2qAZR6G.mp4?dl=0

    2. The undo is limited to one single history point.

    3. The brush color doesn't work. In the scene view is always red.

    4. The CPU (and fans) goes crazy while painting.
     
  24. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,427
    Ok, I'll see if I can repro these. This is in HDRP with the texture backed workflow, correct?
     
  25. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    581
    Sorry I used by mistake my company account. I'll continue with my personal one now.

    Yes HDRP, DX11.
    I don't think it's the baked workflow. I just imported a mesh and added a Micro Splat Mesh component on it. Created material, texture array, control texture and started to paint.
     
  26. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    581
    I disabled the relative rendering and indeed the projection stopped moving, but I got this funny result:
    upload_2020-4-28_3-31-51.png
    It's like the motion vectors are all wrong :)
    And it happens also on a simple Unity cube with Unity shader. So it's nothing related to MicroSplat. I'll revert back to World coordinates for now :p
     
  27. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,427
    Yeah, so these are unique to SRPs. They don't repro on standard at all, but on HDRP and URP they both happen. Very odd, not sure why any of this should be different on an SRP..
     
  28. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,427
    Aha, replace line 470 in MeshPainter_GUI.cs with:

    Code (CSharp):
    1. RenderTexture rt = RenderTexture.GetTemporary (tex.width, tex.height, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear);
     
  29. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,427
    MicroSplat 3.4

    • Unified painting system for terrains, allows you to paint wetness, puddles, streams and lava, along with global tint maps, and snow min/max
    • Wetness, Puddles, and Streams now correctly blend
    • Puddles appearance improved
    • Dynamic Flows for streams/lava now work in SRP pipelines. They also get a slight speedup due to using custom render textures instead of graphics.blit.
    • New Anti-tile technique, Noise height. Applies a noise texture to heights, breaking repeating patterns in the height map resolve. Cheap, and can really break tiling patterns in blends such as between terrain types and between snow and terrain. See docs for more details
    • Trax Buffers can now be half precision, which takes half the memory and often fine for most uses.
    • Fix to Mesh painter when running in URP/HDRP which would prevent it painting certain textures over other textures, or cause it to paint a mix of textures when you are clearly painting one.
    • URP template v2f structure trimmed, allowing more textures in Vertex/Digger workflows
    • Snow Mask map is now available. Painting a value of 0 in the R channel will prevent snow from ever accumulating in that location. Painting a value of 1 in the G channel will make snow always appear in an area regardless of accumulation. You can paint these directly in the editor with the new MicroSplat/Terrain Paint Tool
    • Origin Shifting option is available for large world support. Set via a global shader matrix.
    • Per Texture Interpolation contrast now blends correctly. There was a bug in the blending that made a line between the textures, especially noticeable in specular values.
    • When using auto-setup in pipelines that support a mask map, channels for smoothness/occlusion/height are now automatically set.
    • When using DrawInstance, manually recompute tangent space viewDir for parallax.
    • Optimizations to Trax memory use when using only repair without delays or stops
    • Textures set to shrink in the build are now uncompressed when compiling texture arrays, increasing quality of the resulting arrays.
    • Function to sample trax buffer on CPU.
    • Some features moved into an advanced section of the core module
     
    mcmorry, GarbageCat and Kirsche like this.
  30. m0nsky

    m0nsky

    Joined:
    Dec 9, 2015
    Posts:
    64
    Hi there, I'm thinking about giving MicroSplat + HDRP support a try. Does the "Dynamic Snow" module work with the HDRP? Thank you.
     
  31. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,427
    Yes..
     
  32. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    1,542
    It was a lot of fun to be in the Trax beta and an honour to have my video used in the recent MicroSplat trailer. I was asked how that Cowboy scene was created, so here is a scene from scratch in 10 minutes:



    If you have questions, just ask Jason :D Nah, just kidding. It's super easy to set up, as you can see. But if you have questions not related to MicroSplat, just pm me :)

    What's also impressive is the Stochastic Blend Mode. I totally forgot to enable it, so initially you see tiling. I thought I'd leave it in and activate it so that you can compare the effect.
     
  33. a_radarhead

    a_radarhead

    Joined:
    Feb 3, 2020
    Posts:
    5
    Hey! I just discovered this shader tool and it was a huge relief because it looks like it help in completing my senior game project. However, I'm not very technical minded, and in trying to set up Microsplat I've immediately run into an error: I've created a new terrain in a test environment, converted it to Microsplat, and set up two textures in the MicroSplatConfig tab. Unfortunately, immediately after conversion, my terrain turns black and can't seem to be painted at all. I suspect this has something to do with a "Object Reference not set to instance of an object" error I'm getting when I attempt to 'Update' the config. Any suggestions?
     
  34. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,427
    change the line throwing the error to:

    Code (CSharp):
    1. if (ti != null && (ti.maxTextureSize <= 256 || ti.textureCompression != TextureImporterCompression.Uncompressed))
     
    a_radarhead likes this.
  35. Redrag

    Redrag

    Joined:
    Apr 27, 2014
    Posts:
    150
    I just got the latest version and am still getting this warning:
    Duplicate basemap name: '_MainTex'. Ignoring.
    UnityEngine.Terrain:set_materialTemplate(Material)
    MicroSplatTerrain:Sync() (at Assets/Plugins/MicroSplat/Core/Scripts/MicroSplatTerrain.cs:161)
    MicroSplatTerrain:OnEnable() (at Assets/Plugins/MicroSplat/Core/Scripts/MicroSplatTerrain.cs:63)
     
  36. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,427
    Yeah, these are warnings and can be ignored. They happen because Unity has a bunch of assumptions about the terrain shader falling back to a basemap which just has a _MainTex, and Unity is going to be fixing these assumptions in a future version. They are harmless, however.
     
  37. zhn17

    zhn17

    Joined:
    Jul 30, 2019
    Posts:
    47
    Just bought Trax, watched Rowland's video on setting it up and the documentation, after messing around with it for quite some time I still can't seem to get it to work.
    Here's my configuration
    (Note) The TraxManager script is attached to a always active gameobject, not the actual cube.
     

    Attached Files:

    • LG.png
      LG.png
      File size:
      431.6 KB
      Views:
      50
  38. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,427
    likely best to look at the demo scene. Is the object you want to effect the terrain in the Trax Layer?
     
  39. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,427
    oh, yup. So does this cube fall and collide with the terrain?
     
  40. zhn17

    zhn17

    Joined:
    Jul 30, 2019
    Posts:
    47
    Yea it falls down, has the Trax layer but the terrain doesn't react to the object when it comes to changing textures.
     
  41. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    1,542
    Have you tried the most simple example?

    * create a sphere
    * give the sphere a collider and set the layer to a dedicated layer, eg a new trax layer
    * add the trax manager to the sphere and set the same layer

    That should definitely work. If it doesn't, let me know and I'll make a quick video just to be sure. I didn't have any problems so far. Also when you hit pause and change the trax or tessellation settings, you should see some changes.
     
  42. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    1,542
    Tried MicroSplat Mesh Blend Mode for a change
    2.jpg
    3.jpg
    4.jpg
    8.jpg
     
    Last edited: Apr 30, 2020
    jbooth and zhn17 like this.
  43. CoyoteFringe

    CoyoteFringe

    Joined:
    May 8, 2019
    Posts:
    19
    Thank you for populating the Unity world with all these professional-grade assets! These tools are beyond fantastic.

    Now that I've buttered you up, I have a question! (Kidding! I see how active you are without any butt kissing. Your assets are genuinely The S***.) Anyway, I don't see Trax listed as a limitation in the Mesh Workflow documentation. Is that correct? Does Trax work on meshes painted with your Workflow module?
     
  44. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,427
    Yeah, it works on any MicroSplat shader. For instance, in my latest feature demo, when the tank blows a hole in the ground (using Digger) the tracks still work on the hole. Note that Trax assumes a top down projection, so you can use it on a small planet without modification or something.
     
    CoyoteFringe likes this.
  45. CoyoteFringe

    CoyoteFringe

    Joined:
    May 8, 2019
    Posts:
    19
    Ahhh...excellent! Thank you!
     
  46. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    1,542
    Funny how things turn out. All I wanted was to try MicroSplat Mesh Blend mode. Accidentally saw a 10-minute How-To-Create-A-Hoverboard for Unity, tried it, started Substance Launcher, downloaded a Star Wars PodRacer by UnSweet from Sketchfab and ended up with a Pod Racer game. Who would have guessed :D

    pod 7.jpg
    pod 4.jpg
    pod 1.jpg

    Also, stochastic texture sampling really pays off in there. Performance is awesome. I should try using a height gradient though.
     
    Last edited: May 2, 2020
    camta005 and CoyoteFringe like this.
  47. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    1,542
    I just couldn't stop. Apologies for spam, but here's with digger pro integration :)

    pod 11.jpg
    pod 12.jpg
     
    Fibonaccov, camta005 and CoyoteFringe like this.
  48. zhn17

    zhn17

    Joined:
    Jul 30, 2019
    Posts:
    47
    Tried it and sometimes it draws the texture, but offset. Played around with the world size but never got any result that worked.
    Keep in mind that my project is in the latest Unity 2020 beta version.
     
  49. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,427
    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.
     
  50. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    292
    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.
     
unityunity