Search Unity

[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. AnneDraaisma

    AnneDraaisma

    Joined:
    Jul 14, 2014
    Posts:
    14
    Hello, I'm battling the reflection of the terrain with the standard shader with deferred lighting (2017.2). When using the options you provide, the terrain is rendered in forward mode. As I use Vegetation studio, the terrain becomes semi transparent and shows the props poking through the ground. Is there a way to change the Unity lighting while keeping the terrain in deferred?

    What I've found so far is this topic: https://forum.unity.com/threads/standard-terrain-shader-smoothness-solved.297691/ But this applies to Unity 5. In 5.5 they removed the remapping of the roughness curve when they introduced GGX (https://docs.unity3d.com/Manual/UpgradeGuide55.html)

    Thanks in advance!
     
  2. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    When running in deferred lighting, lighting doesn't happen on a per-material basis as you draw the material, but is rather "deferred" until later, after everything is drawn. Unity allows you to change the deferred lighting shader in the render settings, but this will change the lighting of everything in your scene, as there can only be one lighting pathway for all deferred objects.
     
  3. knopkem

    knopkem

    Joined:
    Apr 16, 2016
    Posts:
    2
    Hi,
    disclaimer: quite a noob when it comes to unity graphic stuff, so forgive me if I miss something obvious.

    TL;DR: I converted my unity terrain to microsplat (all default), build (android), however performance was worse afterwards.

    So my game prototype currently uses a flat terrain with 8 textures painted on it (shader was diffuse mobile), so everything extremly basic. Since I'd like to optimize performance on mobile devices I gave microsplat a shot, but honestly I don't see the big performance improvement everyone is talking about, worse I actually had a drop in FPS from about 40 to 15 (same quality level). Obviously I must be doing something wrong or the shader is not meant to be faster for these basic setup. I could see the same performance issue using the unity profiler (running the scene in the editor). Any hints? Thanks.
     
  4. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Well, your comparing a shader using simple diffuse- non-PBR rendering, no normal maps, etc, to one doing full PBR with normal, smoothness, and AO maps. The main speed advantage MicroSplat offers is vs. shaders which also do full PBR. There are settings you could adjust to make things go faster, but it's not designed to be in competition with a simple diffuse map shader. For something like extreme low-end mobile, you could look to some of the techniques I outline in my Unity 2017 talk.
     
    Last edited: Jan 9, 2018
  5. knopkem

    knopkem

    Joined:
    Apr 16, 2016
    Posts:
    2
    Thanks for the quick response, this makes alot of sense now. I was under the impression that this is a complete replacement of the build-in terrain shader. Will have a look at your talks to improve my knowledge.
     
  6. acaton

    acaton

    Joined:
    May 27, 2013
    Posts:
    28
    Any chance you remember the name of the grass placement on tessellation tool from unity asset store or even have a link to it? I'm having some of the same issues and am hoping it might also help with foot placement issues as well.
     
  7. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,561
    I switched to Microsplat terrain in Nimian Legends BrightRidge 7.7 and it looks better and runs as fast, if not faster than the standard terrain material. Ive started with just the basic, but am going to experiment with some of the other Microsplat plugins i purchased. Thanks for you great work on this I really like it.
     
    Flurgle, Jaimi, StevenPicard and 3 others like this.
  8. nbac

    nbac

    Joined:
    Jul 7, 2015
    Posts:
    267
    microsplat madness ! can i only use ripples from the puddle module?
     
    blitzvb likes this.
  9. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    It ripples the puddles, so yeah...
     
  10. nbac

    nbac

    Joined:
    Jul 7, 2015
    Posts:
    267
    but i have my own puddles and just need the ripples ;D
     
  11. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Then you'll have to add that feature to whatever shader your using for puddles..
     
  12. nbac

    nbac

    Joined:
    Jul 7, 2015
    Posts:
    267
    it is microsplat. thats why i posted it in the first place. it is megascans + quixel mixer textures . so puddles are in the texture. i wanted to stick to the concept so i had to be very explicit regarding the puddles. i assume the ripples from your module are conected to the wetness/ puddles. thats why i asked if i can control them seperately
     
    Last edited: Jan 12, 2018
  13. nbac

    nbac

    Joined:
    Jul 7, 2015
    Posts:
    267
    in your streams and puddles video you dont show the rain drops at all!? but since i bought it now it seems it is tied to the puddles. could it at least be enabled for the wetness as well!? also wetness just shows up / can be painted on my last material/layer it does not show on the rest.
    do custom brightness/smoothness controls etc prevent the darkening etc from happening?
     
    Last edited: Jan 12, 2018
  14. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    When I shot that video I hadn't added the raindrops yet. I could allow them to appear on wet areas. Wetness shows up on all layers, but each layer can have it's own porosity setting (per-texture property), so might respond to the wetness differently. The per-texture properties for brightness/smoothness are all applied before wetness, so should work as if that was the value you had for those attributes in your texture.
     
  15. nbac

    nbac

    Joined:
    Jul 7, 2015
    Posts:
    267
    makes sense. anyway it is not in my case - all wetness effects do not show up on the layers except the last one. i checked porosity but it has only effect on the last layer even if i have it per material.
    if i finished neon challenge ill send you more info but i cant troubleshot it now. good thing is i can paint "invisible puddles" but with raindrops. the wetness from the puddles is also not visible on the other layers. so i have kind of the effect i need.
     
  16. Bitboys

    Bitboys

    Joined:
    Apr 22, 2015
    Posts:
    156
    Hello. I'm getting this error all the time while using Microsplat in 2017.3. I'm also using the tesseleation package.


    GetPixels32 failed: insufficent pixel buffer size (1), must be at least 4 x 4
    UnityEngine.TerrainData:set_baseMapResolution(Int32)
    MicroSplatTerrain:Sync() (at Assets/MicroSplat/Core/Scripts/MicroSplatTerrain.cs:200)
    MicroSplatTerrain:OnEnable() (at Assets/MicroSplat/Core/Scripts/MicroSplatTerrain.cs:70)
     
  17. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461

    What does basemap say it's set to in your settings (should be 16)? Are your terrain textures read/write (Unity requires that they are)?
     
  18. Bitboys

    Bitboys

    Joined:
    Apr 22, 2015
    Posts:
    156
    Yes, all my textures are set to read/write and i get the error in a new terrain. When i setup the terrain whit the "Micr Splat Terrain" script, it changes all the resolution and settings of the terrain and the errors starts showing. (sorry for my poor english)

    I have also tried to create a new terrain from 0 and I have added the script to the terrain, I have pressed convert to microsplat and when I paint in the terrain the errors appear again. The textures have a resolution of 4k. Can it have anything to do with it?
     
    Last edited: Jan 13, 2018
  19. Bitboys

    Bitboys

    Joined:
    Apr 22, 2015
    Posts:
    156
    Oh! Finally i got the error. I´m using crunch compression on the textures.
    I have removed the crunch compression and I no longer have the errors. But will not it be bad for performance?
     
    camta005 likes this.
  20. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    So, MicroSplat does not use the original textures assigned to the terrain at all; Unity uses them to generate a basemap, which MicroSplat doesn't actually use (that's why it sets the resolution to 16, so you're not generating some giant basemap for nothing). I'm guessing that this is a straight up Unity error then, in that when they go to generate the basemap and read the texture data, that they don't handle crunch compression correctly.

    In terms of performance, crunch just reduces download size of the textures- once on the GPU, they are just regular DXT textures. Also, since MicroSplat doesn't actually use those textures at all (it uses the ones in the texture array), it would make no difference anyway.
     
  21. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,561
    I'm wondering if its possible to give players an option to turn certain effects on and off on Mobile

    Like if they could turn Distance Noise or Anti-tiling something on and off to affect performance.

    Would that entail recompiling the shader at runtime? Is that possible or is there a more efficient way. Is it possible to have two shader/material variants and then i could swap those materials on the terrain?

    I don't know all the terminology exactly so i hope that makes sense. If it's not possible that is cool - like its been mentioned Microsplat already runs very very fast:)
     
  22. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    Yes, my plan is to have several sets of shader+material pre-generated and assign them based on quality level.
     
    protopop likes this.
  23. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,561
    Is this something you've managed to test successfully already? Im wondering the workflow to generate several textures, because i think it re compiles the same material.

    Is it as simple as compilig, and then copy/pasting a copy of that material, and then regenerating a new one...etc...
     
  24. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    You can just make another shader and swap it at runtime- Unity cannot compile shaders at runtime. The easiest workflow for this is to create a second microsplat shader and material in another directory, setup the settings, and let it generate the shader code (it will generate several shaders, the base and fallback, and object blending if you use that). At runtime, you can just set the shader on the template material on the MicroSplatTerrain component and call Sync or SyncAll() to update all the terrains.
     
    protopop likes this.
  25. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,561
    Thank you very much. That was a very thorough, simple, and helpful answer. No wonder Microsplat is so efficient:) I'm going to add this to the user options. I didn't know about runtime compilation and SyncAll() so i learned some more helpful tips in this too.
     
    blitzvb likes this.
  26. nbac

    nbac

    Joined:
    Jul 7, 2015
    Posts:
    267
  27. blitzvb

    blitzvb

    Joined:
    Mar 20, 2015
    Posts:
    284
    Any plan to have more weather effects for the ground? I was thinking fire that could burn the ground and leave ashes.
     
    Last edited: Jan 15, 2018
  28. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    The lava effect already does this. All the effects are drawn as part of the terrain itself, so drawing flames on it wouldn't look correct..
     
  29. blitzvb

    blitzvb

    Joined:
    Mar 20, 2015
    Posts:
    284
    Agreed.

    I was more thinking of ember with ashes that could work a little bit like the wind. It typically happens when a tree take fire. Lava will not work visually for that.
     
  30. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    So, I'm off for the next week traveling out of the country. I will have very limited internet on most days, if at all, but will try to check in when I can..
     
    antoripa, blitzvb and boysenberry like this.
  31. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    So the Snow module is really great...but I've belatedly realized that, now that I have some grasses on my terrain, that there's no depth to the snow. Is there any way to elevate the snow rendering to suggest deeper accumulation?
     
    antoripa likes this.
  32. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Tessellation will do that.
     
  33. Bitboys

    Bitboys

    Joined:
    Apr 22, 2015
    Posts:
    156
    Hello again jbooth.
    I have added the "Triplanar" package to my project and I am having some issue with it. I do not know if it's something normal or if it could be because I'm also using the tesselation package next to it. When I activate the triplanar option, this pattern of reliefs appears on my terrain. If I change the scale of the triplanar, the pattern becomes larger or smaller but does not disappear. I also use the anti-tiling package, in case it has something to do with it. Thanks for your time.

     
  34. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    It's kind of hard for me to see exactly what you're referring to- there are also two options for triplanar; triplanar, which just linearly blends the projections (the traditional technique), and triplanar height blend, which performs height based blending between the projections. In the traditional technique, a flattening of the normals may appear since they are effectively being averaged between the projections.

    I'll be out of the country for the next few days, so I might not be able to respond again for a bit.
     
  35. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    @jbooth I'm not sure if this is a known thing or not... Just updated to 2017.3.0p1 and am now seeing these errors in standalone build when run. Also seen in the build log. It does not stop it from running though. I know you are likely gone by now, but it is here for you to see when you are around again.

    Not allowed to access vertices on mesh 'Combined Mesh (root: scene) 6' (isReadable is false; Read/Write must be enabled in import settings)

    Not allowed to access triangles/indices on mesh 'Combined Mesh (root: scene) 6' (isReadable is false; Read/Write must be enabled in import settings)

    Update:
    This was coming from the megasplat Vertex Painter Pro tool I still had hanging around. I removed the tool and the error is gone.
     
    Last edited: Jan 18, 2018
  36. suchoparek

    suchoparek

    Joined:
    Nov 10, 2014
    Posts:
    11
    Hello @jbooth, first thing first: thank you for your work, so much quality (and so cheap) :)
    I have a question about texture input.

    Well before I knew of MicroSplat and his performance, I wanted to simulate the accumulation of the snow on the terrain and let the player leave a trace on snow, or even sink into it.
    I've managed to create a tiny shader that read the depth of an ortho camera (positioned well below the terrain, looking up) and write the movement of the player in a renderTexture used as an input for a displacement shader.

    When I discovered the MicroSplat core asset (and its wonderful performance) I bought the Tessellation and Parallax module. Sadly, I found out that there isn't any slot for a texture input, nor it is into the Snow module, as I saw in the demo video.

    Did I miss something or simply this feature is not available?

    Thank you.
     
    Last edited: Jan 18, 2018
    Flurgle likes this.
  37. Flurgle

    Flurgle

    Joined:
    May 16, 2016
    Posts:
    389
    Quick question. In Unity 2017.3.03f, if you set the per texture UV value, the tessellation does not scale with the UV. However, if you do some terrain height map painting using the unity terrain tool, the tessellation works. Is that a workaround thing, or a bug?
     
  38. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I’ve never had any kind of player interacting with the snow in any of my videos, but you could likely port your shader into a MicroSplat module to do this. The system is very easy to extend with new features.
     
  39. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    You mean it updated and works correctly once you paint? That would be odd since MicroSplat doesn’t use unity’s UV scale data, except on initial conversion.

    If you mean it doesn’t work at all, then perhaps I missed applying the pertex I’ve scale in the tessellated displacement lookups? I’ll check when I’m back in the country.
     
  40. danmarcarl

    danmarcarl

    Joined:
    Jan 20, 2018
    Posts:
    1
    I have a little problem here. I can not seem to find the substance options in pbr mode. Any idea of what is happening?

    Hope you can help me!
     

    Attached Files:

  41. blitzvb

    blitzvb

    Joined:
    Mar 20, 2015
    Posts:
    284
    Unity removed substance support in 2017.3 so all others assets dev are removing substance support little by little (CTS too). @jbooth removed it, in version 1.71 :

    - Removed support for substance in 2017.3+ as Unity no longer supports it natively

    For substance, what I read is that they will announce a plugin when 2018.1 is release so maybe it will come back in all other assets.
     
  42. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,300
    Really? That was a big plus for me in MicroSplat. Why remove it when it's still available and 2018.1 isn't out yet? Also, from what I read the feature will remain available, however as a separate plugin. That way Allegorithmic can adjust it better to their product line. At least that's what they say.
     
  43. blitzvb

    blitzvb

    Joined:
    Mar 20, 2015
    Posts:
    284
    My guess is : when the substance plugin will be avalaible, it could come back.
     
  44. KomatsuMTS

    KomatsuMTS

    Joined:
    Jul 18, 2016
    Posts:
    22
    Windows 10, Alienware. I just boiught this and Imported. I am following the documentation "Select existing terrain" "Add component" "Microsplat".. etc.. I see the addon in the Project Directory, it is installed. I created a blank project added terrain, imported from the website Asset Store and I am not seeing anything in the editor and inspector window for the terrain after selecting and trying to "Add Component". The console states "
    Could not create a custom UI for the shader 'MicroSplat/Example_Tessellation'. The shader has the following: 'CustomEditor = MicroSplatShaderGUI'. Does the custom editor specified include its namespace? And does the class either derive from ShaderGUI or MaterialEditor?
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)"


    I opened the enclosed scene example in the asset, and the console states the same:
    Could not create a custom UI for the shader 'MicroSplat/Example_Tessellation'. The shader has the following: 'CustomEditor = MicroSplatShaderGUI'. Does the custom editor specified include its namespace? And does the class either derive from ShaderGUI or MaterialEditor?
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr).

    Am I missing something here?
     
  45. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    They started throwing warnings for substance code in 2017.3, so I conditionally compile out that code in that version onward since Unity users will one star your asset if it throws warnings. You could comment out the #if block to reenable it, but this would break in 2018, obviously.
     
    Rowlan likes this.
  46. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Sounds like your missing the script files. Maybe redownload from the store into a fresh project?
     
  47. KomatsuMTS

    KomatsuMTS

    Joined:
    Jul 18, 2016
    Posts:
    22
    Thanks form quick reply. I re-installed Unity, no add-ons. Downloaded this from the Asset store again. and still the same. Is there a chance the asset store has a bad version?
     
  48. KomatsuMTS

    KomatsuMTS

    Joined:
    Jul 18, 2016
    Posts:
    22
    I tested this on another PC, though violating the Per seat License Agreement. Same result and errors.
     
  49. blitzvb

    blitzvb

    Joined:
    Mar 20, 2015
    Posts:
    284
    Strange it work for me. Tesselation + microsplat.

    What other modules you have?
     
  50. KomatsuMTS

    KomatsuMTS

    Joined:
    Jul 18, 2016
    Posts:
    22
    Trying to share images, but work is blocking some image sites. So, new Alienware 1 week old, $3200.00 dual SLI for animations. Blender installed just last week. unity reinstalled 14 minutes ago (x4), new project (environment package) Microsplat Tesselation downloaded again, installed looks to be complete has scripts, but I'm not seeing textures. Same output message in console as before. This time it added TerrainData is missing splat texture 0,1,2,3 etc.. UnityEngine.GUIUtility.ProcessEvent(int32, intPtr).
     
Thread Status:
Not open for further replies.