Search Unity

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

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

  1. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    A couple of questions:

    1. Which scene is this on?
    2. Can you toggle an option on the shader (in the top section, ie: Toggle Detail Normal on and off) and see if it goes away? There's a chance that the actual shader that shipped in the last patch was slightly out of date and just needs to be regenerated.
     
  2. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Just added support for paintable puddles:


    These give you a lot more control over the interaction between the textured surface and the water, as well as not taking up one of your texture layers where the effect is happening. Currently only for meshes and bumps the shader model up to 4.0, but works with or without tessellation.

    Can be done with no texture samples, so it's really cheap, or you can use two texture samples and flow map a normal map over the water, which is still really cheap.

    You control the puddle by painting into UV3.y - a value of 0 is no puddle, a value of 1 is completely submerged.
     
  3. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    And the video dev log covering the coming changes.

    I did forget to talk about Per-texture contrast controls, which have been added as a new option.

     
    Ascensi, ChinChiaYeh and StevenPicard like this.
  4. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    579
    Does painting the puddle flow direction change all puddles/streams across the map? or can they each be independent?

    If they only flow in one direction it would be cool perhaps to have a radial flow map (or something like it) whereby all streams flow into the middle such as a lake or pond
     
    Last edited: Jan 17, 2017
  5. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    They are all independent.

    In the future, I may add options for things like global rain, etc..
     
    one_one likes this.
  6. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    I have a question. Let's say I have four biomes on four different tiled terrains. I use 8 textures for the entire terrain and overlap them on the biomes. So one might have grass and dirt, another dirt, sand, and rock, another mud and dirt, etc.

    Will this asset work across all of the tiles? I remember reading in this forum that it would repeat the textures on all the tiled terrains. Does this mean they would be identical or that they would simply repeat the textures.

    Could I have a swamp tile, a grasslands tile, a mountain tile, and a desert tile as long as I only use 8 textures?

    I love what you are doing here, but really need tiled terrains for our world. I realize that meshes might work better for this but losing the LOD's and the tree/grass optimizations would hurt, not to mention the ability to modify the terrain.
     
  7. StevenPicard

    StevenPicard

    Joined:
    Mar 7, 2016
    Posts:
    859
    I thought since this can use 256 textures that this wouldn't be a problem, anyways?
     
  8. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Each terrain can have it's own collection of 256 textures, or you can share the material across all of the terrains. No need to restrict yourself to some small number of textures anymore. Also, the painting toolset works freely across multiple terrains or meshes.
     
  9. Hofmann

    Hofmann

    Joined:
    Sep 30, 2015
    Posts:
    25
    jbooth:
    Could be possible to convert prepared unity terrain on the mesh without losing any layers of texturing and also to use grass and trees optimization as another unity terrain which will have hidden surface? This kind of combination of unity terrain grass and trees could have optimization of terrain but as a surface would be used the mesh.
     
  10. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    It's possible, but I don't have any Terrain->Mesh tools yet. If this is something people generally want I could add something to do this and retain the texturing information. Note, though, that since Unity Terrains use textures and there's no guarantee that the vertices will alight with the texture, it wouldn't be an exact conversion (Unless you enforce that one pixel == one vertex).
     
  11. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Just to let everyone know, I'm going to be out for about a week starting on Thursday. I will have very limited internet, or possibly none at all, during that time, but will attempt to answer support requests if I can.
     
    StevenP94 likes this.
  12. Hofmann

    Hofmann

    Joined:
    Sep 30, 2015
    Posts:
    25
    In vertex painter pro, when I use deform and in the field vertex mode I choose smooth, it makes holes in the mesh when I'm painting.
    Unity 5.5
     

    Attached Files:

  13. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Do you have the latest? I checked in a fix for that a while back, though come to think of it I don't remember testing the smoothing mode, so maybe I missed one? I'll have a look tonight..
     
  14. Hofmann

    Hofmann

    Joined:
    Sep 30, 2015
    Posts:
    25
    Yes i Version: 0.96. Otherwise, an error occurs if the paint and switching to it or Botton layer. It occurs only occasionally.
    error:
    MissingReferenceException: The object of type 'Material' has been destroyed but you are still trying to access it.
    Your script should either check if it is null or you should not destroy the object.
     
  15. Hofmann

    Hofmann

    Joined:
    Sep 30, 2015
    Posts:
    25
    I also noticed that Unity 5.5 does not show wireframe. Which is Bool in Vertex paint. The unity 5.43 works. personally tested.
     

    Attached Files:

    • wire.JPG
      wire.JPG
      File size:
      275.8 KB
      Views:
      859
  16. Hofmann

    Hofmann

    Joined:
    Sep 30, 2015
    Posts:
    25
    I do not see the option to increase or decrease the setting metalic. smootness and specular. For example, the RTP can set these properties for each layer.
    you could have added, in the next update?
     
  17. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    You can set them in the following ways:

    - By using a packing mode which contains Metallic and smoothness values (ie: NormalSM, MSEO or Standard) and supplying the texture arrays with per-pixel smoothness and metallic maps.
    - By setting flow mode to 'PerTextureProperties', which gives you a metallic and smoothness value for each texture in the array.
     
    Last edited: Jan 17, 2017
  18. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    Thanks, I think the above confused me. So all the textures you use in the tiled terrain must be present in the first tile? So if I have 256 textures, they must all be somehow painted on one tile, the first one that is seen by the asset. Is that correct?

    I would be more apt to put 8 on a tile just because it would be very messy to try it with 256. :)

    Hoping that this will eventually work with Gaia when it adds tiling.
     
  19. PiAnkh

    PiAnkh

    Joined:
    Apr 20, 2013
    Posts:
    126
    Wow, the new puddle feature looks great.
    Is there some way of using that from a control texture in the same way that the splats can be defined by importing a texture? Or can the puddles only be painted manually?

    One more question, any plans to introduce Parallax Occlusion Mapping, presuming it would be cheaper than tessellation?

    thanks
     
  20. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    They don't have to be painted on any particular tile. Basically, the material has slots for Texture Arrays instead of Texture2D objects. These are collections of textures that act as one texture on the GPU, but are actually many textures combined into one graphics resource. Most people just put everything into one texture array and paint whichever ones they want onto the terrains/meshes they are working with. If you only want to paint 8 of them, you can, but you can also use all of them on a single terrain if you want. There are no restrictions or managing texture counts, and the shader does the same amount of work if there are 60 textures or 2 used.

    Additionally, you don't have to work with individual textures. Instead, what a lot of people do, is use my Texture Cluster feature. If you name textures in a sequence (grass_01, grass_02, grass_03, then press the Auto Generate Clusters on the Texture Array Config object), then you can paint a grass texture cluster instead of painting individual textures. Clusters can use noise, height, or slope to choose which of the textures in the cluster are painted on each control point. This lets you break up tiling and save memory by using 2-3 small textures instead of one larger texture, with MegaSplat blending between those textures on every pixel. For instance, MegaSplat ships with 60 textures, but arranges these into about 25 clusters that you can paint with.

    Finally, you can use the blend brush with a 2 layer shader and paint a blend between two clusters using a noise function.

    The toolset of MegaSplat really tried to answer the question "What new techniques are possible with so many textures available?".


    You can convert a terrain exported with Gaia to MegaSplat right now. Really from any standard Unity terrain. However, if you're using some type of runtime generation, then it would have to be a deeper integration. Basically, you select your unity terrain, open the conversion utility, and map the textures used in the Unity terrain to texture clusters in MegaSplat and press convert.
     
  21. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Right now they are defined on the vertices (like all MegaSplat mesh data); however, I believe the Utilities panel has a generic "project textures onto mesh" utility where you might be able to project a mask onto the UV3.y channel that control the puddles.


    It would be significantly more expensive than tessellation. I did some research into it, but abandoned it after doing tessellation and seeing the quality/cost of POM style effects compared to tessellation. The main technique I was looking at was Quadratic Occlusion Mapping, which has significant advantages vs. POM when dealing with multiple texture layers, but it was still painfully slow.
     
    Last edited: Jan 17, 2017
  22. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    Yep, that is what I am going to do! Thanks. :)
     
  23. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    579
    @jbooth I will say up front I haven't completely read the doc -I've skimmed through as quickly as I could. I've set my texture properties almost exactly as yours but my textures don't displace. I'm using the same setting as well -tessellation enabled, Texture Packing = Normal/Smooth AO MegaSplat doesn't automatically take height information from albedo does it? or would I have to use some kind of third party Color & Height texture combiner tool? just wondering why the landscape isn't displacing.
     
  24. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Height data needs to be in the alpha channel of the albedo; it's used for resolving texture blending, parallax, and displacement. To use NormalSAO, you need to pack the normal map's RG channels in the RG, and put the smoothness in the B channel, and ambient occlusion in the alpha channel.
     
  25. StevenP94

    StevenP94

    Joined:
    Jun 3, 2013
    Posts:
    143
    So there is no way to change at design time the Metallic/Smoothness or the Normal intensity without using flow, should I prepare my texture arrays with packed values of them ?
    What about the macro texture Metallic/Smoothness or Normal sliders ?
    What software can I use as Color & Height texture combiner tool ?
     
    Ascensi likes this.
  26. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    579
    I've got hundreds of textures do you know of a tool that could batch process them? It would be decent if your arrays could be plugged into some batch combiner to have them mixed into a final array.
     
  27. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Unity does not support arrays of shader properties, so the only way to store those values is via a texture that gets sampled at runtime. PerTexProperties mode creates a 256x2 texture to store values for metallic/smooth, uv scale, and per texture displacement information, so it does all of this for you. The metallic/smoothness get swapped for flow parameters if you use one of the actual flow mapping modes. At some point, I'd like to make this system much more general, so you can choose what parameters you want for each texture and have it pack/manage the data accordingly.

    The macro texture Metallic/Smooth is controlled by the regular sliders when PerTexProperties is enabled.

    I use Photoshop, but Gimp would also work and is free. There might be something on the asset store to automate this, I've never looked.
     
    jason-fisher likes this.
  28. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    Okay, that is confusing. RG in the RG? :) Could you explain that a little better? I am used to packing channels but not sure how to do that. lol
     
  29. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    The Red and Green channels of your traditional normal map go into the Red/Green channels of the NormalSAO map. Basically, the blue channel's information is reconstructed at runtime, leaving the blue and alpha channels open for other data (in this case, smoothness and ambient occlusion).
     
  30. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    That would be nice, but isn't really possible since the textures need to be compressed into the final format before being copied to the texture arrays, and Unity doesn't really give you a great way to do that without writing the file on disk and letting it import it first. So any texture packing tool would just have to convert them into other .png files on disk first.
     
  31. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    Thanks, @jbooth

    I went to your asset store page and clicked on documentation. It is all very nicely explained there. :) I am still considering this asset but since it would distract me from my finishing what I am doing now, I am going to wait until I have a nice textured terrain ready for Megasplat. My biggest complaint about terrain is the tiling issues, and while many shaders have claimed to reduce the issue, none have eliminated it. It looks to me like your texture clusters may do just that.
     
  32. mk1978

    mk1978

    Joined:
    Dec 27, 2009
    Posts:
    276
    This is new to me. Is there any tutorials about this? I did a quick search with Google but maybe I didn't find correct words. I have Bitmap2Material so I would assume that I have the right tools to create textures for MegSplat. Or do you think that this Unity Asset Store texture tool would help with the case?

    https://www.assetstore.unity3d.com/en/#!/content/39216
     
  33. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I'm pretty sure Bitmap2Material will spit out the required data you need (ambient occlusion, normals, smoothness which might be called roughness and need inverting, etc). However, I would doubt that it's going to output the data in the correct channels. I suspect it'll output a whole separate texture for each of these, and what you'll want to do is load them into an image editing program and put the correct data into the correct channels. So paste the height map into the alpha channel of the diffuse texture, paste the smoothness data into the B channel of the Normal map, and the ambient occlusion into the alpha channel of the normal map.

    This is done for efficiency, since you can sample all of the data you need in 2 or 3 textures instead of 5 or 6..
     
  34. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    If you design your textures with multiple variations, you basically will never see it tile. I find that using 3 smaller textures vs. 1 larger texture looks better and saves memory. Sometimes you can get away with as little as 2 smaller textures. In some cases, I vary the textures a lot (from just grass -> some stones -> just stone), or just vary them a little (minor variations to break up tiling).
     
    Teila likes this.
  35. StevenP94

    StevenP94

    Joined:
    Jun 3, 2013
    Posts:
    143
    @jbooth
    I see, "Per Texture Properties" appears only for terrain shader and not in the mesh shader.
    I was unable to activate any additional sliders (smoothness) for 'Macro Texture' section.
    A 'Macro Normal' Slider would be useful too.
     
  36. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    It's under flow mode for the mesh shader. Yeah, that could be better named..
     
  37. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    579
    Well before I knew i had to mix the height with the alpha I had set all my diffuse textures with the identical size and other properties then added them to an array..but then thought if the height maps all had the same settings too and if no errors resulted after adding the color textures to a diffuse array and the height textures to it's own temporary array that it could be used as a batch list and processor - just an idea.. but if you mean to say that once textures are added to an array it compresses the textures and wont work then that's understandable.
     
  38. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    I've played with MegaSplat a bit, and the sample scenes included have *zero* tiling. The texture cluster thing really works.
     
    Teila and jbooth like this.
  39. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    A nice surprise this morning as MegaSplat is on the front of the Asset Store.

    Anyway, the next release is delayed a bit because I will be in the middle of the ocean for the next week and don't want it to drop with some bug while I'm out. That said, it's growing in size in terms of changes and features. So far:
    • Terrain Shader parity with the mesh shader (Flow maps, puddles, displacement dampening added to the shader and painting toolset)
    • Added PerTexture Contrast control option to PerTexProperties, allowing you to control the height map blending contrast per texture. Blending between layers is still handled via the main contrast control.
    • Preview sphere render re-written using BeginStaticPreview
    • Added support for Ramp lighting model, which uses a texture for diffuse response instead of computing lighting
    • Added support for a diffuse only lighting mode, removing the need to sample normal maps. Can be used with Ramp lighting for NPR rendering and extremely cheap rendering.
    • Only brush selection is encapsulated by scroll window in painters
    • Added hooks for third party tools to listen to paint strokes
    • Paintable Puddles, including puddles with flow map directions painted
    • Example added of painting terrain at runtime
    • Batch save of meshes to asset cache. You can insert this into your build pipeline and have it bake out all the meshes and mark them as static before each build, eliminating the need to do this manually.
    • Projected UVs (world or local)
    • Controls for displaying vertex normal/tangent now only show in brushing area. When working with large meshes, the old scheme was prohibitively slow
    • Optimized vertex painter brushing by roughly 2x
    • Added support for projected UVs in local or world space.
    So yeah, lots of changes, better to release it when I'm around ;)
     
  40. jason-fisher

    jason-fisher

    Joined:
    Mar 19, 2014
    Posts:
    133
  41. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    jason-fisher likes this.
  42. Jeremyp

    Jeremyp

    Joined:
    Apr 9, 2013
    Posts:
    3
    Hi Jason. I've just recently installed Megasplat, but I'm getting this error thrown up in the console:

    Assets/MegaSplat/Scripts/Editor/TextureArrayConfigEditor.cs(160,28): error CS0618: Warning as Error: `UnityEditor.TextureImporter.textureFormat' is obsolete: `textureFormat is not longer accessible at the TextureImporter level. For old 'simple' formats use the textureCompression property for the equivalent automatic choice (Uncompressed for TrueColor, Compressed and HQCommpressed for 16 bits). For platform specific formats use the [[PlatformTextureSettings]] API. Using this setter will setup various parameters to match the new automatic system as well possible. Getter will return the last value set.'​

    Any thoughts? I'm on Unity 5.5
     
  43. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    579
    I haven't had any issues working with tga and when importing your textures into an array make sure they are the same format/compressed/non compressed and dimensions/size etc
     
  44. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yes, when you installed, it likely asked you to upgrade the code and I believe you clicked no. You can run the updater from the menu in Unity though, and it should upgrade the code to the latest Unity changes. (They changed around the texture importer for 5.5)
     
    Last edited: Jan 20, 2017
  45. Obsurveyor

    Obsurveyor

    Joined:
    Nov 22, 2012
    Posts:
    277
    Finally digging into this asset but right off the bat, I'm seeing something weird. Windows 10, GeForce GTX 1080, Unity 5.4.4f1, DX11, MegaSplat 0.96 according to Asset Store(but docs says 0.95, maybe they weren't updated though) no errors on import into a new Project and everything looks good in the MeshTessellation and UnityTerrainTessellation example scenes but Mesh and UnityTerrainExample look like this when you get close while running in the editor:



    edit: Figured it out, followed your instructions to questsend to rebuild the shader and that fixes it. I'll leave this up for anyone else that runs into this.
     
    Last edited: Jan 20, 2017
    maxaud and jbooth like this.
  46. camel82106

    camel82106

    Joined:
    Jul 2, 2013
    Posts:
    304
    Hi,
    just researching mega splats at it's looking realy nice.

    I'm curious does physics tesselation "hack" work in tesselated Unity terrain too?

    Thanks
    Peter
     
  47. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yes..
     
    camel82106 likes this.
  48. maxaud

    maxaud

    Joined:
    Feb 12, 2016
    Posts:
    177
    Just picked up Megasplat. Having some fun with it.

    I noticed I had to rebuild the shader and for some reason the Macro texture fade distance inverted. I had to set the "Begin" setting to something like 200 and the "End" setting to something like 20. Otherwise stuff far away was showing the ground textures and stuff close was showing the macro texture. Did I do something wrong somewhere?

    Also, another question I have is if you are going to incorporate parallax using the normal or heightmap as an alternative to tesselation? I want to make my textures pop a bit more but don't like the increased vertex count.
     
  49. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    579
    @jbooth Here is a sample of using RTD (real displacement textures) I haven't touched texture mixing yet, I need to do more tutorials to customize things more, but so far this is awesome to be able to use so many of my displacement textures.. I currently have 21 setup, a lot more to go!
    upload_2017-1-21_2-51-32.png
     
    kerrmedia likes this.
  50. zwcloud

    zwcloud

    Joined:
    Mar 15, 2016
    Posts:
    377