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,733
    It's odd that you couldn't grab the texture from the material itself; you could try calling MicroSplatTerrain.SyncAll() afterwards, but you shouldn't have to.
     
  2. niallmc

    niallmc

    Joined:
    Sep 3, 2015
    Posts:
    10

    No luck with it sadly, I only have Sync() not SyncAll() as a function on the MicroSplatTerrain too

    If you ever get a chance to test it out please drop me a message, but I know your probably too busy for that. thanks for your time & a great asset
     
  3. niallmc

    niallmc

    Joined:
    Sep 3, 2015
    Posts:
    10

    Scrap that it's working now I'm using the Instance, that was my problem, thanks again for all the help!
     
  4. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,733
    MicroSplatTerrain.SyncAll() is a static function for syncing all terrains which use the same template material.

    Ah, yeah- I suppose I don't set the texture on the template material because that would create a savable reference to it, and the texture is generated on demand. So yeah, that makes sense.
     
  5. zombieguy

    zombieguy

    Joined:
    Mar 4, 2015
    Posts:
    10
    @jbooth Any updates on getting Microsplat or Megasplat working in HDRP?
     
  6. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,733
    No, still waiting for unity to stop changing it, and LWRP sales are a trickle, so not a lot of motivation for it right now.
     
    zombieguy likes this.
  7. spinaLcord

    spinaLcord

    Joined:
    May 25, 2015
    Posts:
    29
    Using current parallax module causes this blurry ring.

    2.53*
     

    Attached Files:

    • 2.jpg
      2.jpg
      File size:
      2 MB
      Views:
      249
  8. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,733
    I can't tell exactly what I'm seeing there- can you post your shader settings (top of the material) as well as your parallax settings? Note that with high parallax settings you can get texture stretching, so you want to keep it reasonable.
     
  9. spinaLcord

    spinaLcord

    Joined:
    May 25, 2015
    Posts:
    29
    i forgot to mention that i have anti tile and triplinar also installed. But it occurs also if i disable this modules.
     

    Attached Files:

    • #1.jpg
      #1.jpg
      File size:
      102.7 KB
      Views:
      222
    • #2.jpg
      #2.jpg
      File size:
      152.6 KB
      Views:
      221
  10. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,733
    So what is it that your actually seeing as the issue? Is it the texture smearing around based on the view but not in a parallax way? Because I have found cases where Unity’s shader compiler thinks the viewDir isn’t used and leaves it set to 0, which screws up parallax; but in these cases usually changing something in the shader fixes it; and I put some code in there which usually makes the compiler realize it’s being used so I haven’t seen this occur in a while.
     
  11. spinaLcord

    spinaLcord

    Joined:
    May 25, 2015
    Posts:
    29
    Changing something and recompile isn't working unfortunately for me. Or you mean that, you changed something in the shader src (then you can maybe ignore this post). But i try to describe. It's a blury ring based on Fade Start/Distance with Parallax Module. Happens only in a specefic terrain angle (not on flat areals) and on every texture. Parallax textures are showing correct depths. If i increase parallax height it seems the blurry ring sucks other texture inside. I also trye'd fresh reimport on asset store (MicroSplat import/ Parallax Module import/ convert) still happens with very basic config. On Parallax Example project it doesn't happen as far as i see.

     
  12. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,733
    Interesting, it does look like the viewDir is messed up somehow. I'll see if I can repro it..
     
    spinaLcord likes this.
  13. edwindejongh

    edwindejongh

    Joined:
    Jul 11, 2017
    Posts:
    2
    @jbooth When I try to enable Advanced Details I get a shader error and my whole terrain turns white. I tried reimporting and I made sure to update all modules to the latest, but it still persists. The shader error I'm getting is 'invalid subscript 'xy' on line 1074. Anything I can do to fix this?
     
  14. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,733
    That's @wmpunk module- I heard he had updated it recently on the store, but I can't push it to the asset store myself..
     
  15. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    12,225
    I'm setting up some automatic terrain hole generation with clip maps. Using MicroSplat 2.4 or 2.54 with the terrain holes package, when I set "Alpha Hole" on the material to "Clip Map" I get a couple of shader errors show up:

    Code (csharp):
    1. Shader error in 'Hidden/MicroSplat/Island5_TerrainShader_Base-624573087': Fragment program 'frag_surf': Unrecognized sampler 'sampler_diffuse' - does not match any texture and is not a recognized inline name (should contain filter and wrap modes).
    2.  (on d3d11)
    3.  
    4. Compiling Fragment program with UNITY_PASS_SHADOWCASTER SHADOWS_DEPTH
    5. Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_RGBM_ENCODING
    Code (csharp):
    1. Shader error in 'MicroSplat/Island5_TerrainShader': Fragment program 'frag_surf': Unrecognized sampler 'sampler_diffuse' - does not match any texture and is not a recognized inline name (should contain filter and wrap modes).
    2.  (on d3d11)
    3.  
    4. Compiling Fragment program with UNITY_PASS_SHADOWCASTER SHADOWS_DEPTH
    5. Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_RGBM_ENCODING
    In this state I can indeed supply a clip map and that works as expected, but the Editor frame rate drops to low single digits until I set "Aplha Hole" to something else.
     
  16. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    12,225
    Separately... this might be a bit of a nebulous question... Is there a performance difference between Clip Map and Splat Index modes?

    I'm going with Clip Map purely as it allows us to automate some tasks in the Editor. It's easy to re-generate the clip map when we move things that create holes in the terrain. If there's a performance benefit I could automate a conversion to Splat Index at build time.
     
  17. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,733
    This appears to be a Windows only compiler big. Easy to work around, so expect a patch soon. As for performance, it’s an extra sample to use the clip map, which is not much to worry around unless your on low end mobile or something.
     
    angrypenguin likes this.
  18. khalvr

    khalvr

    Joined:
    Sep 12, 2017
    Posts:
    36
    Not sure if this is related to MicroSplat or to Unity, but it seems like enabling instancing for terrain objects makes them unable to receive projectors. Sorry if this has been mentioned previously.
     
  19. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,733
    That's a unity issue - happens with their shader as well. There's a thread about it on the World Building forum; seems instancing was only partially baked when released.
     
    khalvr and angrypenguin like this.
  20. kepesh

    kepesh

    Joined:
    Dec 29, 2017
    Posts:
    85
    I'm getting this error using Unity 2017.4.3 with the latest update:
    Assets/MicroSplat/TerrainBlending/Editor/MicroSplatTerrainBlending.cs(92,43): error CS0246: The type or namespace name `MicroSplatKeywords' could not be found. Are you missing an assembly reference?
     
  21. Flurgle

    Flurgle

    Joined:
    May 16, 2016
    Posts:
    368
    TBH, I suspect HDRP sales will be better. Combing forums / discord, and twitter, a lot more hype for HDRP
     
  22. kepesh

    kepesh

    Joined:
    Dec 29, 2017
    Posts:
    85
    Has it ever happened that the blended mesh flickers to black for you?
    Using terrain blending.
     
  23. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,733
    You sure you have all the modules, including core, upgraded?
     
  24. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,733
    Nope- never seen that. Feel free to send a repro..
     
  25. kepesh

    kepesh

    Joined:
    Dec 29, 2017
    Posts:
    85
    Forgot to update all of them. Now it works.

    One other question.
    Is it possible to get puddles to reflect reflection probes or work with the post fx stack: screenspace reflections?
     
  26. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,733
    Should just work with SSR; it's post, so anything that writes smoothness reflects. Reflection probes should be automatic as well, but you might need a lot of them to have anything decent of an effect. I think @Seneral did some code for specific cube map reflections as well.
     
  27. Hallur90

    Hallur90

    Joined:
    Dec 4, 2017
    Posts:
    32
    Is there a way to use the terrain blending module on assets with LODs without getting this warning?

    warning.png

    I've tried putting the terrain blend script on all the LODs but that results in multiple warnings for each LOD.
     
    Last edited: Mar 22, 2019
  28. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,733
    As far as I know there is no way to disable this warning in Unity.
     
  29. Hallur90

    Hallur90

    Joined:
    Dec 4, 2017
    Posts:
    32
    Is it something I should ignore or is it not advisable to use the terrain blending on a LODed asset?

    It seemingly works fine when the game is running.
     
  30. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,733
    Ignore it- it's trying to warn you of something it thinks is a mistake, but in this case it's not.
     
  31. Monorio1

    Monorio1

    Joined:
    Dec 10, 2018
    Posts:
    17
    Hi,
    I'm having some trouble with the blending module. It's causing streaks along surfaces that are perpendicular to the terrain and sharp angles also are behaving weirdly. The object normal blending option is also giving me weird results on some meshes. sRGB is unchecked on the terrain descriptor texture. The blending mat is also assigned properly. The Blend Normal Distance doesn't seem to affect anything at all and there seems to be no normal blending happening. The project is in Deferred if that affects anything.
    Without object normal blending:

    With object normal blending:



    Thanks
     
  32. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,733
    It's actually working as expected- the module works by generating a custom shader with the terrain shader inside of it, and blending the results over whatever shader is on the object. This guarantee's that the behavior of the terrain shader and blend shader match exactly, regardless of whatever features might be turned on/off.

    In your case, you have a standard UV mapped terrain. If you were to create a perfectly vertical surface, then this is exactly what the terrain would look like (Though you can't, because terrain is a height map, so can never get to a full 90 degree angle- but if it could, that's exactly what the surface would look like). So if you want to support 90 degree cliffs, then you need a way to texture the terrain such that 90 degree surfaces are supported, like triplanar texturing.
     
  33. Protolith

    Protolith

    Joined:
    Jan 18, 2013
    Posts:
    16
    Hey Jason,
    Thanks for updating the triplanar projection method. Things are looking better now. Btw, I was playing with your new feature for selecting the triplanar projection type per texture, and when I pick the "Side Only" projection type in the slider, it seems that the Z projection is busted. Here is a screenshot..
    side_projection.png
     
  34. Monorio1

    Monorio1

    Joined:
    Dec 10, 2018
    Posts:
    17
    Thanks for the quick answer, much appreciated. I purchased the triplanar module and the issue is fixed on a number of meshes but remains on some of my bigger pieces. Also the slider of blend normal distance has no impact whatsoever. Blending Object normal is off in this screenshot.
     
  35. Ivoryjw

    Ivoryjw

    Joined:
    May 20, 2018
    Posts:
    31
    Hello again Mr.Booth,
    So I recently got into the render baking system for microslat and I ran into a problem with the albedos. Everytime I try exporting the albedo it always turns up black and unusable, Weird thing is that every other feature like normals, height, and occlusion works out just fine. Is this supposed to be this way? Using 2018.3.9f.
     
  36. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,733
    This has been reported - I believe it to be a winidows/osx thing, but have not had time to debug it yet.

    Blend normal distance controls how large the area for the blending of the terrain normal into the object normal is, which mostly affects lighting and is generally best near 0. I think it actually may be forced to 0 in some cases, but I can't quite remember which cases that is right now.
     
  37. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,733
    My Stochastic Height Blending node is now live in the asset store. It basically lets you use the stochastic height blending technique I use in MicroSplat's Texture Cluster module in your own shaders.
     
  38. miklelottesen

    miklelottesen

    Joined:
    Mar 7, 2015
    Posts:
    19
    Hi

    I apologize in advance if this has already been posted, but after searching this thread I was unable to find anything of relevance.

    I'm having some shadow issues, and I realized I've had them for a long time (until recently, I figured it was just bad lighting settings on my part).

    The transition between the detailed terrain and the LOD is anything but smooth:

    This is what the terrain looks like in full LOD - not bad, but obviously looks like crap when you get close to it; no tessellation, lo-res textures, etc.



    This is the terrain in full "non-LOD".



    This is where it gets ugly - this is what the transition between the two looks like.


    For comparison, here's the regular Unity terrain with MicroSplat disabled, in the same project, painted with a generic grass texture:

    ..and:

    Shadow-wise they look identical, and the transition between them is hardly noticable.

    Do you have any idea what the issue might be? I've tried tweaking all kinds of settings with no effect at all.


    Edit: I just noticed that there was a new version of MicroSplat and downloaded it. At the same time, I was in the progress of replacing every texture I have on that terrain. One of those two things solved the problem completely. Sorry for any inconveniences I may have caused.
     
    Last edited: Mar 31, 2019
  39. razzraziel

    razzraziel

    Joined:
    Sep 13, 2018
    Posts:
    137


    Cant find this tool, which pack has it?

    I have only vertex painter and it doesnt support brush textures.
     
    Last edited: Mar 31, 2019
  40. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,733
    It’s not released yet
     
  41. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,733
    Seneral, Willbkool_FPCS and Rowlan like this.
  42. Gojira96

    Gojira96

    Joined:
    Jun 18, 2015
    Posts:
    31
    Hey, I'm having problems setting Per-Texture properties. UV scale doesn't really respond, but I sometimes manage to set the Brightness value by setting it and then disabling/enabling it.
    Also, When I set up Global tessellation values everything is okay, but as soon as I turn on Displacement on any of the textures, all Global tessellation is gone and is not responding to any value changes. I'm using Unity 2018.3.6f1.
    What could be causing this?
     
  43. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,733
    Look in the debug section and make sure the PropData object is hooked up- it stores per texture values. If your moving files around and renaming them (in the MicroSplatData directory) it might cause it to get unhooked..
     
  44. Gojira96

    Gojira96

    Joined:
    Jun 18, 2015
    Posts:
    31
    It seems to be connected. I even tried deleting the entire MicroSplatData folder, reapplying old texture layers and converting the terrain again from scratch to MicroSplat Terrain. Didn't help.
    Also, I noticed that even when Per-Texture Properties do work, it always applies the values only to the second layer ( index 1), an not to the selected layer.

    TessOn.png TessOff.png
     
  45. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,733
    Can you send me an example project?
     
  46. chris54321

    chris54321

    Joined:
    Nov 5, 2013
    Posts:
    11
    I have some black triangles when I apply Microsplat to my own generated mesh in Triplanar mode. This seems to happen only in cases when my normal vector points into z direction (I have some vertical cliffs). When I check this code it seems it will produce null tangents when the world normal points into z direction:

    #if !_MICROMESH
    float4 tangent;
    tangent.xyz = cross(UnityObjectToWorldNormal( i.normal ), float3(0,0,1));
    tangent.w = -1;
    i.tangent = tangent;
    #endif

    Are vertical faces not supported in Triplanar mode?
     
  47. Gojira96

    Gojira96

    Joined:
    Jun 18, 2015
    Posts:
    31
    Hey, while I was packing an empty project to send you the files I figured out what happened.
    It seems that propdata wasn't unhooked but instead MicroSplatTerrain was making a connection to keywords and propdata generated before material name change. Applying propdata generated after name change solved the problem.

    btw. absolutely love the asset, amazing work!

    Screenshot 2019-04-04 21.05.28.png
     
  48. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,733
    Unity terrains don't have tangents, so they are generated mathmatically because the topology is known; in mesh mode, which is part of an unreleased module, they get read from the mesh. If you are using MicroSplat on meshes without the mesh module, then you're going to run into cases where the system assumes it's running on a terrain..
     
  49. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,733
    Yeah, I suggest not changing the names of things inside of the MicroSplatData directory- I had considered using a scriptable object to store this stuff so that people wouldn't be able to rename things and cause issues, but felt it better to leave the data exposed in case there was an actual issue that required editing it. That said, things look other things up in reference to known objects inside that directory, this is because often you don't want to store a reference to things which might not need to be in the build, etc. So the keywords might get looked up via the material name, etc. If those things aren't found, in many cases they are generated automatically.
     
  50. chris54321

    chris54321

    Joined:
    Nov 5, 2013
    Posts:
    11
    I see some code in the shader that seems not to be part of the released modules. I am very much interested in these modules. Let me contact you directly.