Search Unity

[Released] MegaSplat, a 256 texture splat mapping system..

Discussion in 'Assets and Asset Store' started by jbooth, Nov 16, 2016.

  1. XenaWarriorPrincessX

    XenaWarriorPrincessX

    Joined:
    Jul 30, 2014
    Posts:
    8
    Al right sounds nice, thanks for the fast reply, won't need the distance noise texture just yet :)
     
  2. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Ok, figured this one out- it's cute. So Unity has two options for saving textures built in; Jpeg and PNG. So you edit some data, save the texture and everything seems good. But the displacement dampening is stored in the textures alpha channel. When Unity loads a png with an alpha channel that is entirely the value 1, it goes "Great, no alpha, make this a 24 bit texture with no alpha channel". And from that point, you don't have an alpha channel to store data..

    So I'm forcing them to be RGBA32 textures on all platforms, as that should prevent it from loading it in and stripping the alpha channel.
     
    XenaWarriorPrincessX likes this.
  3. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Adding the script helped with the black terrain, thanx! Maybe you should consider adding this script when you press the setup button to make it easier for new ppl? : p

    Here are some screens from the Texture Graph issues:
    Texture Graph:
    https://dl.dropboxusercontent.com/s/czccncs8leldmtv/shot_170603_125825.jpg

    Result:
    https://dl.dropboxusercontent.com/s/z8wpcgk99n4gl3b/shot_170603_125856.jpg

    Shader setup:
    https://dl.dropboxusercontent.com/s/96ig46if8wkr157/shot_170603_125929.jpg

    Texture painting works just fine, so the shader is setup and working on the terrain.
     
  4. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461

    You haven't provided a blend between the two textures. Try this; create a noise node, and plug the output into the blend. This will vary between the two textures based on the blend value.

    I highly recommend watching the dev logs and quick start on the texture graph if you haven't already (on YouTube). They should get you moving pretty quickly..
     
  5. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Sorry to say this but you are actually wrong in this case : D
    If you actually look at the images you will see that the texture thats showing is not the one applied in the editor. I know that without a blend only one texture will show in this setup, but the problem is that its the wrong texture thats showing.

    To show this again a added a blend and the blend is kind of working but the textures is all wrong, not at all the ones i input in the node editor : /

    https://dl.dropboxusercontent.com/s/ad5fh2sdqiil42n/shot_170603_141310.jpg
    https://dl.dropboxusercontent.com/s/olgr4663fyxggul/shot_170603_141406.jpg

    Edit: Ok, seem to be some update issue with the terrain. After pressing compile i have to change some value in the graph for the terrain to actually update. If i do this everything is working as expected it seems.
     
  6. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Interesting- must be some kind of refresh issue on the first compile. I'll see if I can repro when I get back tomorrow night.
     
  7. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    At least it's working now, thanx! Btw, using 5.6p2
     
  8. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Finally had the chance to convert my game terrain over to Megasplat. I'm super impressed. The process was easy to do and the results are stunning. This is without even getting into the mesh blending, which I know is really going to improve it even more.

    Just one comment so far and one question.

    First, for adding the global snow it wasn't clear from the documentation what I should select for the Diffuse/Height and Snow NormalSAO textures. I searched by the keyword snow and eventually found ice_snow_03_diff and ice_snow_03_normsao and some other versions. I think those are what I needed, but not sure.

    Second, I'm not quite sure I understand the Height Range parameters. They seem to work for 20, 30, but what they represent I am not sure. They don't relate to terrain height so what exactly do they mean?

    [EDIT]
    Oh, and this blows RTP out of the water on every level. Fantastic work, @jbooth
     
    Last edited: Jun 3, 2017
    Dwight_Everhart likes this.
  9. trilobyteme

    trilobyteme

    Joined:
    Nov 18, 2016
    Posts:
    309
    I thought Apple added tessellation support in Metal for MacOS with OSX_GPUFamily1_v2? This page and this one suggest as much, though maybe they are out of date?
     
  10. MonkeyPuzzle

    MonkeyPuzzle

    Joined:
    Jan 17, 2016
    Posts:
    119
    [SOLVED] Update Unity as per docs.

    Hey, Great tool - really offers impressive results. I am having a ferw issues in editor - and I think some of those are covered here, my main problem though is that the texturtes on showing properly when I play my game. Here is a shot in editor:


    But when I build and play the executable, with fantastic quality only the base texture is showing.


    I have tried both building as x86 and x86_64, but getting the same results.:

    I looked through the docs, but didn't see an answer. Running on a 2016 Macbook Pro:

    Hardware Overview:
    Model Name: MacBook Pro
    Model Identifier: MacBookPro13,1
    Processor Name: Intel Core i5
    Processor Speed: 2 GHz
    Number of Processors: 1
    Total Number of Cores: 2
    L2 Cache (per Core): 256 KB
    L3 Cache: 4 MB
    Memory: 16 GB
    Boot ROM Version: MBP131.0205.B20
    SMC Version (system): 2.36f97
    Serial Number (system): XXXXXXXXXXXX
    Hardware UUID: XXXXXXXXXXXXXX

    Any thoughts on how to rresolve? It is weird that it works running in the editor, but not the publsihed game.

    I am using the texture graph and generarting textures from clustrers procdeurally on a standard Unity terrain.
     
    Last edited: Jun 4, 2017
  11. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I'm trying to do the mesh blending tutorial video here:



    But when is says to select the Megasplat_MacroLayered shader, there isn't any such shader in the list. Is there a more up to date video on how to do mesh blending?
     
  12. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    There is for sure some bug with the Texture Graph, now again when i start Unity i get this:
    https://dl.dropboxusercontent.com/s/tgh32jjl9ka3eqz/shot_170603_225843.jpg

    And because the area below the "Prepare Selection" button is empty, i assume i have to press that but then i just keep getting error in the console:

    NullReferenceException: Object reference not set to an instance of an object
    JBooth.MegaSplat.NodeEditorFramework.NodeMegaSplatOutput+Job.Init (UnityEngine.Terrain t, JBooth.MegaSplat.NodeEditorFramework.NodeMegaSplatOutput masterNode) (at Assets/MegaSplat/Scripts/Editor/TextureGraph/Nodes/NodeMegaSplatOutput.cs:215)

    Also, is it possible to fix so you can use arrows in the input fields? Its slightly annoying that its not working : p
     
  13. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Upgrade to the patch released yesterday; Unity broke texture arrays in builds for about 2 months there.
     
  14. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    You can use whatever texture you want for snow, as long as it's in normalSAO packing format.

    Height range is the range that snow appears on in world space. Basically it ramps now from 0 to 100% based on height (not that other parameters may affect this as well).
     
  15. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    That's a very outdated video; I think I cover blending a bit in a more recent one, but I really need to find the time to shoot a video on it. Also, the tooling could use some additional work.
     
  16. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I'll look into this when I'm back home tomorrow night; the graph stuff is pretty new and hasn't had the workout that the rest of the package has. I'm excited that people are starting to use it though! Not sure why the arrows aren't working, but I'll also look into that.
     
  17. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Well, arrows are working, but it moves the node instead of the cursor : )
    Now suddenly everything started to work again, seems like there are some trigger needed but no idea what it is, just messed around with unity in general : D
    Also im sure you are aware of this already, but might as well post it while im at it:
    https://dl.dropboxusercontent.com/s/i58lnq6vh9945ia/shot_170604_001717.jpg

    Btw, is it possible to change the color of the gray lines? They are hard to see with the grey background : D

    The node editor is great, love it!!
     
  18. MonkeyPuzzle

    MonkeyPuzzle

    Joined:
    Jan 17, 2016
    Posts:
    119
    Thanks - Saw that in the docs - Works like a charm! Great work.
     
  19. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
  20. MarkusGod

    MarkusGod

    Joined:
    Jan 10, 2017
    Posts:
    168
    Hello @jbooth, I know that you collaborate with Denis for MapMagick integration, but can MegaSpalt work with Voxeland?
     
  21. ZoneOfTanks

    ZoneOfTanks

    Joined:
    Aug 10, 2014
    Posts:
    128
    I hope that now the activity with this awesome asset shall be concentrated on optimization for Unity 5.6 :)
    In our tests Unity 5.6 performs much faster with terrains than 5.5 and it also has Vulcan support.
    So we plan to switch to it as soon as possible.
     
    Last edited: Jun 4, 2017
  22. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yeah; maybe I should make them blue and red instead? The node editor framework is an open source node editor by Sentri, so the graph inherited a bunch of choices like that. I think for me though, that arrows moving the nodes is not important, so I'll remove that..

    Are you running an old version of MegaSplat? There was a bug where height was incorrectly computed for terrains a version or two ago.

    I'm happy to help with this if Denis wants to do it, he's pretty aware of how MegaSplat works now, so I don't imagine it would be hard for him to do it.
     
    MarkusGod likes this.
  23. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    I just bought it like 3 days ago or something, did you release something since then?
     
  24. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    They did, but Unity hasn't. It's a very different pipeline from OpenGL/DX11, as it goes through compute shader, so it'll be interesting to see what they end up with. Most likely, tessellation shaders already written won't 'just work' without the authors adding new things to them..
     
  25. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    About 3 days ago 1.08 shipped. You can look in a compiled shader and see what version you have. Though my notes say that bug was fixed in 1.07, and I just tested your graph layout and it seems to work fine..
     
  26. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I'm trying to setup to use the MegaSplatCollisionInfo script and the documentation states the following:

    Finally, you will need to turn on ‘Keep Runtime Data’ on the Vertex Instance Stream.This will ensure that the mesh data is kept on the CPU during gameplay.

    I don't know where to turn on this "Keep Runtime Data' thing. I don't know what a Vertex Instance Stream is in Unity.

    [EDIT]
    Maybe I don't need this. I added the DisplayTextureName script to my camera and it seems to find the texture names just fine without any additional work. It does seem to prefer some textures over others though. I have an area with a blend between 2 textures and it never seems to get one of them, always preferring the other. Not sure if anything can be done about that.
     
  27. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    This is only needed on meshes, not Unity terrains. (With meshes, you need to keep the vertex data around).

    So, the GetTextureName command performs an extremely simple version of the blending- just looking at which weight is greater at the given point. This doesn't take the actual heights in the texture into account.

    GetPhysicsOffset does take all of this data into account, so it would be possible to write a version of the GetTextureName function which performed the full blending and got the exact surface for a given point- but it is significantly more expensive to do all of this blending.

    At some point, I really want to unify this system to fill out a struct with all the data about the hit, including things like puddle information, which currently is not handled. I suppose I should have an "approximate" and "accurate" versions, so the user can decide how much time they want to spend for the lookup..
     
    ftejada and magique like this.
  28. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    1.09 patch release notes, submitted to the asset store a few minutes ago:

    Features:
    • Custom functions can now be written to be included at the end of the shader so that you may extend a MegaSplat shader with custom code without being forced to work with the underlying code structure. (covered in DevLog 20)
    • Removed albedo modulate from the puddles system; it was causing issues on linear lighting mode, and doesn’t look that great now that foam/refraction is available
    • Terrain Converter can now save/load scriptable objects which store the terrain settings
    • Terrain Converter now supports secondary textures for each terrain mapping, which allows you to blend more textures in with noise for each original unity terrain
    • Update amplify node to 1.0 version API
    • Fix terrain distance component automatically added to terrains using the AutoSetup routine.
    • Switch float connection type to cyan in the texture graph
    • Arrows in the texture graph no longer move nodes, as that was interfering with using them in the input fields.
    • Ability to manually override the feature level of the shader. This is useful because if you may need to bump the shader model for your custom code (need more texture samplers, etc).
    Fixes:
    • Fixed shader compile bug when using Distance Noise and Detail Noise together
    • Fixed issue with terrain control textures getting imported as RGB24 when they should always be ARGB32.
    • Fixed issue with the Texture Graph when splat control texture size and alpha map size don't match..
    I'll be shooting dev log 21 shortly, which will go over the new terrain conversion features..
     
    Last edited: Jun 5, 2017
    nxrighthere, ftejada and ZoneOfTanks like this.
  29. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Yay, seems like some nice fixes in there : )
    Unity says i have the latest version, but let me come back after the this patch, just to make sure.
    Otherwise maybe i can send the terrain to you in a pm.
     
  30. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    This sounds like a great idea. I'm interested.
     
  31. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Feel free to send over a repro now, as it looks like the issue that was fixed in 1.07.
     
  32. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Dev Log 21:

     
    Tethys, one_one, antoripa and 2 others like this.
  33. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Does the new Secondary Cluster only work in 2 layer mode?
     
  34. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yes, it uses the two layer blending to blend in the second cluster value. That allows you to get partially blended results, which generally makes things look much better. With one layer, you could vary which texture gets used- but you can already do that by designing Texture Clusters with those extra textures in them..
     
    Last edited: Jun 5, 2017
  35. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    OK, thanks. That makes sense.
     
  36. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    So, I baked all my 270 diffuse terrain textures with 2 additional randomized textures in over 3500 texture maps. Then I used the ChannelPacker and created the [BaseColor RGB + Height A] and [Normal R + Normal G + Glossy B + Ambient A] .

    It seems to be that the Glossy value is to high, that was calculated by B2M 3.

    bandicam 2017-06-05 15-33-52-913.jpg

    Does it make sense to use glossiness value for normal terrain textures, e.g. sand, grass and even for mud? Because to find a correct glossy value is nearly impossible. Is there a possibility to change the smoothness in NSAO texture format? If not, then the glossiness makes no sense in my opinion.

    The only one thing that I can do is, to do not add the glossy map at baking the NSAO, then I get the following result (1 cluster with 5 sand textures filled on terrain, nothing else):

    bandicam 2017-06-05 16-04-26-600.jpg
    Now I have 2 options:
    - NSAO: disable Smoothness (AO available, but smoothing not controlable, so disabled)
    - No Spec. Text: (No AO but adjustable global smoothing).

    However, both looks good (AO has hardly impact for my type of game), but the baked about 3500 textures should be stable for the future, the work behind creating them is madness for a programmer weighted all-around indie game developer :), 2 days clicking around, due to the missing batch mode in B2M...
     
    Last edited: Jun 5, 2017
  37. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Smoothness is an very important parameter in PBR surfaces, and if you look at the maps included with MegaSplat, they actually have a lot of smoothness information included. The types of surfaces you are talking about actually have reasonably high smoothness values. You can find various charts on the internet about the smoothness (or roughness) values of various surfaces:

    http://blog.teamtreehouse.com/beginners-guide-physically-based-rendering-unity
    https://seblagarde.wordpress.com/2011/08/17/feeding-a-physical-based-lighting-mode/

    Note that 'glossiness' is usually term used for the older, labert style models of lighting, which are not physically correct. I would be wary of software producing a 'glossiness' value, as it might be totally incorrect for a PBR surface.

    In your case, it may be that it's not really important if you're going for a more diffuse/cartoony look. In that case, and if AO is not really important for you, I'd recommend using NoSpecTex with the normal maps done as traditional normal maps instead of NormalSAO maps. This will give you higher quality normals than using NSAO, and save some memory as well. I'd also recommend starting with a subset of textures first, because that's a ton of textures..

    Doh.. Well, at least it'll be easier in the future.
     
    mkgame and antoripa like this.
  38. Tethys

    Tethys

    Joined:
    Jul 2, 2012
    Posts:
    672
    Hey @jbooth I still think there is something wrong with TriPlanar and how normal maps are working. I cannot turn my normal strength down without turning the texture almost black. Set at 1 the normal map looks smooth, as you turn down the normal map it actually makes the normal map MORE noticeable... until you get to 0.1 where it starts getting ugly, and at 0.0 it turns the textures blackish. This doesn't seem like standard shader behavior for how normal maps work so I'm assuming either something is bugged or I'm doing something wrong. Will you please confirm? Im trying to reduce ground texture noise a bit but it seems impossible to tweak the normal map strength to get it just right. Thanks!
     
    Last edited: Jun 5, 2017
    dyox likes this.
  39. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I'll check this tonight- it's quite possible the normal map strength code isn't taking triplanar into account correctly.. Thanks for the repro!
     
    dyox likes this.
  40. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Found and fixed. I'm re-uploading this to Unity under the 1.09 patch, but as usual, email an invoice if you need it sooner..
     
    ZoneOfTanks, dyox and Tethys like this.
  41. strich

    strich

    Joined:
    Aug 14, 2012
    Posts:
    374
    I'm getting close to needing to actually author my own realistic terrains - Jbooth can you recommend any particular framework that works well with MegaSplat?
     
  42. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    Does 1.08 fix the problems I'm having in linear space? Were you able to reproduce those jbooth? I only use MapMagic, so I'm not sure if it's confined to that or not. Seems to break the texture array in Linear color though, grass and a lot of other textures all turn into stone, as someone else mentioned running into. I found it works fine in gamma then breaks again when I go back to linear. Would prefer to be in linear though for Enviro, though I don't fully understand why ;p
     
  43. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I have not been able to reproduce this, and I have enviro installed in my MegaSplat development branch. If you can send me a project that exhibits this behaviour, I'm happy to take a look.

    The only official integrated terrain generator right now is MapMagic, but one for Gaia2 is on the way as soon as @AdamGoodrich is ready to finish it. I'm not sure when he plans to release Gaia2 yet, but it's looking like it's going to be pretty slick. The two have very different workflows, so it's really about what type of workflow you want to use, and what type of results you need.
     
    dyox and malkere like this.
  44. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    MapMagic 1.8.1 release notes say "MegaSplat output fix for linear color space" so =o I guess it was MapMagic? Downloading the upgrade now to try out.

    Working now =D
     
    Last edited: Jun 6, 2017
    Dwight_Everhart likes this.
  45. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    Thanks for motivation, now I'am using glossiness/smoothness. I wrote a bat file and dropped the glossiness/smoothness intensity. But however, I cannot use the same values for top down view. I had as highest value 0.5, not far away from 0.4.

    Default values for:
    Desert sand 0.40
    New concrete 0.55

    If someone has the same issue, use this script (Windows) for lowering the intensity for the glossy map (defined so in B2M). It recursively adapt the glossiness texture intensity. Change the filter if needed (*Glossiness.jpg) and the intensity (intensity-0.3). Create a .bat file and drop the lines in it, then start it in the directory where you have your glossy maps. ImageMagick must be installed and the folder must be set to the environment path variable. BACKUP YOUR TEXTURES before you run this script.

    Code (CSharp):
    1. setlocal ENABLEDELAYEDEXPANSION
    2. FOR /R %%X IN (*Glossiness.jpg) DO (
    3.     magick "%%X" -fx intensity-0.3 "%%X"
    4. )
    5. endlocal
    6. pause
     
  46. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    As soon as i change scene all of my textures on the terrain are gone, how can i make it so when i reopen the scene the textures are still there?
     
  47. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Press the large button that says "Save" on the terrain painter..
     
  48. tomraegan

    tomraegan

    Joined:
    Mar 28, 2016
    Posts:
    137
    I wanted to thank jbooth for this asset. After a few days of experimentation, Megasplat is now becoming this mind-blowingly necessary tool. I finally feel like I can settle on this; a modern and efficient texture workflow. I don't know much, but this asset lets me feel like the little I do know I can leverage to the max. In my experience, that is the essence of good tool.

    I've settled on my preferred packing method and am happy tweaking. It's remarkable to think that in one material I can use all of my 116 textures. Anyway, when things feel good you want to talk about it, and that's my 2 bob.
     
    Tethys, magique, jbooth and 2 others like this.
  49. ZoneOfTanks

    ZoneOfTanks

    Joined:
    Aug 10, 2014
    Posts:
    128
    MegaSplat is MegaCool! :)
    I think Unity guys will buy it and integrate into core as TextMesh Pro.
    What I don't like at the moment - warnings in Unity 5.6
    I hope author will make a Unity 5.6 optimization soon.
     
  50. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    579
    @jbooth I made a post on the Voxeland website showing that Megasplat can work with tessellated displacement when Megasplat is set to Terrain mode rather than mesh. My question though - does one mode provide more features than the other? also is one mode better on performance than the other? -it's for Voxels rather than Unity terrain.

    So although I was able to show Megasplat to potentially work on Voxeland in Terrain mode.. the mesh mode currently makes the terrain black.
     
    Last edited: Jun 7, 2017
    Tethys likes this.