Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[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
    Try deleting the LDRenderLoopAdapter script as it shouldn't be in there, unless you are using the LDRenderLoop module.

    2018.1.2f1 isn't available to the public, only 2018.1f1, so no way I can test what your seeing.
     
  2. Olander

    Olander

    Joined:
    Sep 13, 2014
    Posts:
    405
    Indeed. Exactly what I was thinking (saw that in your video as well). Wetness will be interesting but it appears I can get this done. I will play with the globals over the last of the week and post some screen pics of the results.
    Thank you for the tips.
    Cheers
    O
     
  3. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    860
    Hello Jason,

    Thanks for the prompt response. You are really one of the best in the asset store. I removed the script and the errors disappeared. Also the terrain textures appeared back after. The only problem I have now is with the object blending with terrain module. I get this error and the blending appears in white when I use the module. I have some rocks that use this module and when I press play the rocks are white. This is the error:

    tex2D: no matching 3 parameter intrinsic function; Possible intrinsic functions are: tex2D(sampler2D, float2|half2|min10float2|min16float2) tex2D(sampler2D, float2|half2|min10float2|min16float2) tex2D(sampler2D, float2|half2|min10float2|min16float2) d3d11 945

    Any idea about this?

    Regards,
    Carlos
     
  4. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    [Edit] someone pointed out that they are now putting these versions on the download page instead of the patch page. Can you post a screenshot of your shader settings so I can try to reproduce (the top section)
     
    Last edited: May 31, 2018
  5. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    393
    @jbooth Jason, thanks for what you do
    I hope unity buys it for big bucks, because your contribution to the engine is invaluable

    own a copy of Megasplat and downloaded Microsplat just today since need a closer workflow to unity terrain + mobile device performance. Really enjoying the workflow
     
    Last edited: May 31, 2018
  6. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    393
    Hey Jason, is there a terrain shader variant which doesn't use reflection probes?

    I tried using the Simplified version from the material's gui, but such a shader doesn't work with soft particles.
    The Standard shader both has reflections and won't support soft particles

    I need something lightweight for iOS iPhone - literally like
    • Albedo
    • softParticles
    • no reflections
    • splat blending via alpha chanel
    • Lightmapable
    Is there an extension I could buy, just for these specs?

    I tried experimenting to remove reflections and add soft particles, by doing the following:

    1) Went into SurfaceShaderRenderLoopAdapter.cs and changed "\Geometry+100" to "\Geometry-100", planning to allow the terrain to store itself into zbuffer if that was the issue. However it didn't cooperate, so my approach must be incorrect

    2) Tried disabling reflection probes in the hierarchy - the reflective glare has disappeared from the terrain, but I now don't have reflections on my main character (the Knight).

    Currently the only version that works with soft particles is Automatic, but it has reflections :(

    To make it more evident I've placed a big usual unity terrain under my main terrain - the latter uses MicroSplat, have a look:
    reflect.JPG
     
    Last edited: Jun 2, 2018
  7. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    There's not an intrinsic to remove light probe support from a surface shader, at least as far as I'm aware, and can't find one in the shader docs. So the only way to do this would be to write your own render loop that rendered everything as a vertex/fragment shader and did all your own lighting. The other option is to use the layer based culling on the render probe to not have it affect anything on the terrain's layer.

    Is the main thing your after speed, or trying to go for a specific look?
     
  8. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    393
    Yep, need for the look mostly, but also don't require normal maps - hopefully it would improve performance too.

    Here are a few places I found in the past year about terrain:
    https://forum.unity.com/threads/terrain-shader-with-multiple-splat-textures.476187/

    in my first post, I paste the "Adjusted Shader" spoiler.
    I am a noob in unity shaders, but this one was a surface shader and had:
    - Supports soft particles
    - Doesn't have reflection probes, good

    However I failed to make it work with 8 splats, couldn't figure out how to make them blendable (could only make 4 blendable), so abandoned it
     
    Last edited: Jun 2, 2018
  9. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    393
    Please note, I am hoping to get rid of reflection probes, not light probes :)
     
  10. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yes, this uses the Unity4 lighting model, which is a non-PBR based model (Lambert in this case). It wouldn't be that hard to modify MicroSplat to use this model; you'd basically need to change the #pragma's around in the base feature module, and remap the core functions to use SurfaceOutput instead of SurfaceOutputStandard.

    Skipping normals maps won't save much vs. making your normal maps very small, but you could hack them out as well. Might help reduce register pressure a bit.
     
  11. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    393
    Could you make such a shader as an extension? I would buy it even if it costs 100 bucks + 5 stars from me on unity store
     
  12. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I'll see if it can be easily integrated using the lighting modes feature..
     
    IgorAherne likes this.
  13. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Ok, added.

    So since the Unity4 Lambert model is not a PBR shading model, the data is remapped such that

    Roughness is mapped to the gloss value
    Ambient Occlusion is mapped to the specular power

    It'll be a bit before I can release this, as the next update will likely be version locked (though technically I don't need to version lock it until the new module I'm working on is ready, so maybe I'll release it sooner.)
     
    IgorAherne likes this.
  14. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    393
    Thank you!! :D
     
  15. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    393
    Will it allow to exclude normal maps to just have bare bones alpha-mixed albedo?
     
  16. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    No, that would be a much bigger change, and I'm not sure if the savings would actually be worth the code complexity since using a very small texture would likely be very similar in speed.
     
    IgorAherne likes this.
  17. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    393
    Ok! Thanks man, you are awesome
     
  18. Crzylegs1138

    Crzylegs1138

    Joined:
    May 7, 2018
    Posts:
    1
    Hi jbooth. I recently purchased the Lightweight render pipeline add-on for Microsplat. After loading your included demo scene, the terrain texture appears to be working fine. However, moving the camera causes the terrain to go all pink and throw the following error message:

    Shader error in 'Hidden/MicroSplat/Terrain_Base-1893489554': undeclared identifier '_MainTex_ST' at /Users/mpier/AppData/Local/Unity/cache/packages/packages.unity.com/com.unity.render-pipelines.lightweight@1.1.4-preview/LWRP/ShaderLibrary/LightweightPassShadow.hlsl(53) (on d3d11)

    Compiling Vertex program with UNITY_PASS_SHADOWCASTER
    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

    I get this error for LightweightPassShadow.hlsl, LightweightPassDepthOnly.hsls, and LightweightPassShadow.hsls. Additionally I get 6 "macro redefinition" errors pointing towards "SAMPLE_DEPTH_TEXTURE" and "SAMPLE_DEPTH_TEXTURE_LOD".

    Tested on both 2018.1.1f1 and 2018.1.2f1. Same issue.

    Love your work and look forward to hearing from you soon.
     
  19. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yes, the latest release of the LWRP has some bugs in it (You'll note, _MainTex_ST is not present anywhere in my code, and the errors are being thrown from the LWRP itself). This is exactly the kind of thing I feared would happen when they discontinued surface shaders, though to be fair LWRP is still technically in preview. Anyway, I'll be figuring out what to do about this this week when I hear back from Unity. I believe some of these are their bugs, and they've likely changed some other things which require changes on my end..
     
  20. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,200
    I bought all of the MicroSplat modules. Now I've seen there's a new one for the LWRP for which you have to pay. So am I correct that in order for the purchased modules to work with the LWRP I have to buy yet another module?
     
  21. beatelove

    beatelove

    Joined:
    Aug 30, 2014
    Posts:
    18
    I had tha same issue.i purchased them upload_2018-6-4_16-7-26.png and imported all.what happened?
     
  22. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    So, each SRP requires a pretty significant re-write of the internal shader code. Unity decided not to provide a common abstraction between SRP's and discontinue surface shaders, so for every SRP you have to write a ton of wrapper code. And if you read above, in Unity's first update since this module was released they changed a bunch of this code and broke my shaders, which is one of the main issues I have with them pushing SRP for indi developers- it's much more fragile than surface shaders were, so supporting each SRP is going to be a lot of support. So that's why I'm charging for it (but wait a week if you want LW support so I can patch it up when I figure out what they broke).

    For some reason the asset store seems to get confused and install several megasplat/microsplat files over one another (IE: it thinks a class in MegaSplat is the one from MicroSplat and overwrites it instead of installing it in the proper place). I would suggest downloading MicroSplat into one project, and MegaSplat into the other, and then copying the files into the project if you want to use them together.
     
  23. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,200
    Ok, thanks for the clarification. I'll wait then.
     
  24. Pascal-

    Pascal-

    Joined:
    Mar 23, 2013
    Posts:
    32
    Dear All,

    I have an issue after painting the terrain. I got some lines artifacts.
    Do you know where it's from and how to get ride of them?

    Thanks a lot in advance for your help!
     

    Attached Files:

    • line.jpg
      line.jpg
      File size:
      306.4 KB
      Views:
      745
  25. beatelove

    beatelove

    Joined:
    Aug 30, 2014
    Posts:
    18
    thanks,i resolved it.by the way,i want to pait my terrain with megasplat and blending gameobject with TerrainBlending,but TerrainBlending needs MicroSplatTerrain,how do i do it?
     
  26. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Read in the documentation about Per-Texture UV scale.

    MicroSplat modules work with MicroSplat, MegaSplat is a different product.
     
  27. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    393
    Jason, how to override the texture array's compression?
    I would like to go "ETC 8 bits" because it's more compact, not PVRTC. Is there a benefit for me to stay with PVRTC though? I am targeting iPhone 6 and above

    Also, how to I remove these artifacts from my texture, - after changing size on TexureArrayConfig to 1024k they get smaller, but the size increases to several MB. Is there a way to get rid of them completely? It seems to be unrelated to bilinear/point filtering pixels.JPG

    This is the normal texture I am using a flat blue 4x4 px texture


    Edit: - actually, just changed format inside TextureArrayConfigEditor.GetTextureFormat(). The artifacts went away as well, so no further help is needed
     
    Last edited: Jun 5, 2018
  28. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    393
    I've just completed creating the hightmaps for my textures (storing in alpha channel as usual), but realized the blending doesn't seem to occurs via hightmap, but via the normal map?
    If I use "flat normal" texture, I get no blending between the textures

    Is it possible to blend by the alpha channel? I can't use normals because of artistic look, but need blending

    with no normals (flat 4x4px blue texture) - notice "Disable Highmap blending" is not ticked in material:
    with flat normals.JPG

    with Microsplat's auto-generated normals I do get blending:
    with normals.JPG
     
    Last edited: Jun 6, 2018
  29. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Normals have no effect on the blending, only the height map. Make sure you have the height maps source channel set correctly.
     
  30. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Note, you should probably use PBR mode. PBR mode is actually no different than basic mode, it generates all the missing textures either way, it’s just there to be a more familiar interface for people not used to PBR. In VBR mode, you will get a heat map slot, which you can put your texts are in and set the channel to Alpha. The packer generates any missing textures, and packs them into a special format, so it doesn’t really care which channel is your source textures came from.
     
    IgorAherne likes this.
  31. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I’m using voice dictation on my phone, so sorry for the typos.
     
    IgorAherne likes this.
  32. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    393
    Thanks man!
    Does smoothness + AO take performance hit on mobile devices? You mentioned there is no way to prevent normal map from being used, but what about Smooth + AO? Will it be always used for mobile phones regarless?

    With the lambert model (you said will be added in next update) you mentioned smooth + AO is still included, if I understood correctly
     
  33. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Smoothness and AO are packed in with the normal, and always computed in a PBR lighting model, so there's no real cost there. (The texture packer always generates this data).

    With lambert, smoothness and AO are replaced by specularity and spec power (gloss) respectively, because that is a non-PBR lighting model.
     
    IgorAherne likes this.
  34. trilobyteme

    trilobyteme

    Joined:
    Nov 18, 2016
    Posts:
    309
    It's worth noting that I recently switched to using the new App Store beta within Unity and decided to bite the bullet (I find the layout of the my download pages to be more awkward and clunky than the previous version)... it may be awkward, but it sure seems to work. Each asset updated to today's release with no troubles... that is, as long as I don't install the streams module (if I do that, it immediately throws hard stop errors against megasplat).
     
  35. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    @jbooth I upgrade Microsplat today and the terrain blending module is causing a compiler error:

    Assets/MicroSplat/TerrainBlending/MicroSplatBlendableObject.cs(109,45): error CS0246: The type or namespace name `MicroSplatMesh' could not be found. Are you missing an assembly reference?

    Is there a fix for this?
     
  36. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Awe crap, forgot to #ifdef around that..

    You can delete the block of code there for now - I'm submitting a patch right now..
     
  37. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Thanks
     
  38. mmaclaurin

    mmaclaurin

    Joined:
    Dec 18, 2016
    Posts:
    244
    Hello; I had a broken build because of a version mismatch. Wasn't working so I decided to remove the Microsplat directory and get a clean install. Installed Microsplat and got an error about "can't find data xx" - the error hasn't repeated but now my terrains all render in cloudy white. My MicroSplatData directory is still there, so not sure what it is that can't be found or what module is looking for it.

    Any suggestions for what to check? I'm still on the last 2017 build. Not getting any error messages now, just white terrain.

    - M
     
  39. kepesh

    kepesh

    Joined:
    Dec 29, 2017
    Posts:
    92
    Hi,

    Is it possible to make the microsplat shader to work with the postprocessing stack screen space reflection effect?
     
  40. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Should just work- SSR happens after the scene is drawn, so what shader you use should have no effect..
     
  41. kepesh

    kepesh

    Joined:
    Dec 29, 2017
    Posts:
    92
    It doesn't work though. I use the standard shader model in microsplat. It works on other meshes in the scene but not the terrain which uses microsplat.
     
  42. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Look in the frame debugger and make sure the terrain is rendering before the SSR happens.
     
  43. NinjaMonkeyTom

    NinjaMonkeyTom

    Joined:
    Apr 28, 2015
    Posts:
    6
    Hi I hope this issue hasn't been brought up before but I couldn't find an answer. I'm an artist using the triplanar module for microsplat and it all works really well except I've noticed some problems with normal map lighting directions.

    Basically the Y or G channel appears to be flipped on half the terrain. I've come across this issue using different triplanar terrain shaders in the past and as far as I know its a very complex problem. Its hard to notice with a lot of organic textures and materials but I have some cliff surfaces where it is quite an obvious problem. Hopefully the screenshot below will help illustrate the problem. There is no ambient lighting and only a single directional light pointing straight down.

    Is there something I need to do with the terrain's setup or is this a bug?

    Thanks for your time.

    normal map bumps.JPG normal map bumps 2.JPG
     
  44. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461

    Likely a bug, mind sending me that test scene?
     
  45. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    In the future, send this kind of stuff in private- you've just effective allowed anyone to pirate these modules. @hippocoder can you remove this post?
     
    hippocoder likes this.
  46. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Please don't post stuff that contains paid copyright assets, everyone :)
     
  47. NinjaMonkeyTom

    NinjaMonkeyTom

    Joined:
    Apr 28, 2015
    Posts:
    6
    aghhh I'm so sorry! That was really stupid of me. I completely forgot what I was doing and how assets worked. Thanks for clearing that up.
     
    jbooth and hippocoder like this.
  48. franky_li

    franky_li

    Joined:
    Aug 8, 2016
    Posts:
    163
    Hi,
    The latest update of the blend module is missing a curly brace at the end of the file.
     
  49. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Really? Which file? I'm not getting a compile error..
     
  50. jmpedros

    jmpedros

    Joined:
    Jun 19, 2017
    Posts:
    11
    Hi!
    I'm using microsplat on my terrain and when I blend my textures using height maps appears some kind of seam around the limits. Any idea of what it is?
    Thanks in advance!

    upload_2018-6-12_17-5-41.png
     
Thread Status:
Not open for further replies.