Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

[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:
    4,190
    Ok, good chance this bug has been in there forever- without the texture packer, update took about a second, so it wasn't really an issue. I'll check it out..
     
  2. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,190
    Can you send me an example scene? Easiest way to track it down.
     
  3. NKdefiance

    NKdefiance

    Joined:
    Jan 4, 2017
    Posts:
    15
    Sure thing: https://www.dropbox.com/s/nsdf39dpd0dz01c/sample.unitypackage?dl=0

    Importing that into blank project shows the issue for me. My graphics card is Radeon 280X, Unity in DX11 mode. Windows 10, recent drivers, etc.

    EDIT: Same issue on Intel Integrated Graphics, just tested.

    Its not a big deal to be fixed right away, just wanted to let you know of the bug thats all.
     
  4. tomhamilton

    tomhamilton

    Joined:
    Aug 31, 2013
    Posts:
    9
    Hi Jason,

    It looks like there is an issue with the glossiness in the latest version. It works correctly with a directional light. However, with a skybox, it seems to be inverted. I.e. It's almost like i'm plugging in a roughness map (completely the opposite of glossiness). This is a major issue in my project as i'm using both a skybox and a directional light. I've attached an image to explain. Notice that on the strip that reads 'Rough' is a glossiness value of 0.1ish, and on 'Glossy' is a value of 0.9ish.

    I'm using Unity 5.5.0f3, DX11, Linear.

    If you could help shed any light on the issue it would be very much appreciated,

    Cheers,

    Tom
     

    Attached Files:

  5. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,190
    If this is an un-tessellated shader, then it is a surface shader and there is no code dealing with the difference between light probes/sky boxes/etc. Did this same test work fine in an older version? Can you send me this test scene to look at?
     
  6. tomhamilton

    tomhamilton

    Joined:
    Aug 31, 2013
    Posts:
    9
    Hi Jason, sorry, forgot to mention that it is indeed a tessellation shader. If i untick tessellation, it's absolutely fine. But i do need tessellation. I'm not sure about previous versions as I never got to the stage where I was testing out to make sure that all the maps were behaving correctly. Let me know if that info helps, otherwise I can prepare a scene later on for you. Thanks for the quick reply.
     
  7. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,190
    Yeah, unfortunately the tessellation shaders have to call into all of Unity's lighting system, which has no documentation, and changes often. If you provide a repro scene I can dig into it, but unfortunately I end up having to do this through multiple versions of Unity since they keep changing the lighting system around- so if I'm not careful I end up fixing it in one version and breaking it in another. Hopefully there's just a 1 - that needs to happen somewhere on the roughness/smoothness component.
     
  8. tomhamilton

    tomhamilton

    Joined:
    Aug 31, 2013
    Posts:
    9
    Thanks Jason, understood. Yes, a 2 character fix would be the ideal scenario i'm sure ;) Let me prepare scene and send it over to you.
     
    jbooth likes this.
  9. Danua

    Danua

    Joined:
    Feb 20, 2015
    Posts:
    195
    Hello it's looks like lightprobes can't sampling color from megasplat and they using color from original terrain instead. How to fix this bug?
     
  10. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,190
    Stop using an old, pirated version?
     
  11. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,190
    MicroSplat uses the same workflow as standard unity terrains, so it should work with any terrain system that also works with the standard unity terrain format. I have a few users who are using TC2, but am not familiar with the workflow myself.
     
  12. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,190
    I imported this into Unity 5.5 - there were no scenes, but I found the rocks and shaders generated by MegaSplat, turned on the fog in my lighting window, and everything seemed to work. Which version of Unity are you using? It would be best if you could zip up the data instead- the Unity Package thing usually misses/breaks half the needed stuff, and there's no way to know which Unity version it was created in, so it's a bit harder for me to reproduce things in many cases.
     
  13. NKdefiance

    NKdefiance

    Joined:
    Jan 4, 2017
    Posts:
    15
    Im on 2017.2.0b10, the scene wont be backwards compatible with your version of unity.

    Regardless, its just some rocks in the scene, some with the tesselation shader and some without, and really strong fog. If you cant see the problem in 5.5, its probably only a bug in later versions of unity.

    My project is too large to try to make a zip, would be a pita.
     
  14. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,190
    I'll give it a test in 2017.2 when it's out of beta- too much breakage across released unity versions to delve into their betas.
     
  15. Danua

    Danua

    Joined:
    Feb 20, 2015
    Posts:
    195
    any discount can be?
     
  16. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    284
    @jbooth -- just upgraded to the recent version, the new texture packer is awesome. Took a bit of time to pull everything across as I was using a different packing, but everything just worked... much easier to manage now.. :)

    My texture packing before had no smoothness, so that was disabled on the shader setting (Texture Packing). The whole terrain went very dark in this case. So then when I switched it to the default setting with smoothness, things worked correctly. This is expected behavior? I should disable smoothness another way now?
     
  17. superkratos

    superkratos

    Joined:
    Sep 4, 2017
    Posts:
    86
    Got your point, Mr Booth. I changed the wrong thing~ So I change the material property to RGBA 32 bit and things worke out! Original one was RGBA Compressed DXT5 and I don't know why. Thanks anyway !
     
  18. gaiastellar

    gaiastellar

    Joined:
    Nov 8, 2013
    Posts:
    47
    hi,
    i need to procedurally texture spherical planets (icospheres) based on vertex height, normals etc - is this possible with megasplat?

    thanks

    paul uk
     
  19. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,190
    There's still a packing mode for "NoSpecTex" and "NoSpecNormal" which will disable smoothness/ao or normal/smooth/ao chanels. This actually disabled both the calculation and texture lookups (in NoSpecNormal mode).
     
  20. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,190
    Depends what your trying to do. There's a runtime procedural projection mode, which lets you splat 3 textures from 3 projections on 2 layers, blended with noise - so 18 textures in total. It's basically an amped up version of the classic triplanar projection technique. You can also do procedural texturing with the texture graph at design time. But neither of these are specifically designed for doing planets. You can also write your own routines to texture the planets based on whatever you want, and just write the resulting choices into the vertices for MegaSplat to use.

    You could also reference my talk from Unite 2015 on planet rendering for some additional ideas:

     
    trilobyteme likes this.
  21. NKdefiance

    NKdefiance

    Joined:
    Jan 4, 2017
    Posts:
    15
    EDIT: This was my own fault. Make sure any objects with vertex streamers are not marked static. They need to be baked first to enable static batching.

    Getting this error sometimes, the "Combined Mesh" are all .asset files created by using the "MegaSplat Mesh Convertor". Since they are .asset files there are no import settings.

    Also, I did not use any combined mesh tool, these are simply gameobjects with singular mesh renderers converted using the "MegaSplat Mesh Convertor" to allow vertex painting.

    When this error occurs, at runtime the settings from Vertex Streamer do not get applied. This affects builds as well.

     
    Last edited: Sep 29, 2017
  22. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    284
    This is probably because you've used the vertex painter on meshes that are not read / write enabled .. or they are marked as static. Sometimes when using the tools you can accidentally affect other meshes... I've done this often too. You can use a debug loop to dump out / check all instances.

    Code (CSharp):
    1. Object[] vertexInstanceObjects = GameObject.FindObjectsOfType(typeof(VertexInstanceStream));
    2. if (vertexInstanceObjects != null && vertexInstanceObjects.Length > 0)
    3. {
    4.     foreach (var v in vertexInstanceObjects)
    5.     {
    6.         Debug.Log("VertexInstanceStream: '" + v.name + "'");
    7.     }
    8. }
     
    NKdefiance likes this.
  23. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    284
    @jbooth -- I've been working in a branch for the MegaSplat upgrade, to use the new texture array packing and got things working last night. Today I've just noticed something weird, I can now see the edge / vertex on the terrain when running the game, it's quite noticeable. I just switched back to master and verified that it's working just fine before the upgrade.

    Any idea what could be happening?

    I'm running Unity 5.6.3p4 (64-bit), screenshot attached for reference.

    GB-IMG-Mega-Splat-Vertext-Edge-Issue-30-Sept-2017-1.png
     
  24. NKdefiance

    NKdefiance

    Joined:
    Jan 4, 2017
    Posts:
    15
    Thats it, static issue. I forgot that when using static meshes they need to be baked down.

    Thanks!
     
    WildStyle69 likes this.
  25. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,190
    Looks like a seem at the edge of the texture; are you sure the edges tile on all of the components correctly? That border mip maps didn't get checked on the source texture? Also, can you let me know if per-texture UV scale is being used and if this is a seem between two texture variants within a cluster?
     
  26. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    284
    Thanks man -- to answer your questions:
    • Textures are decent and do tile correctly.
    • Border mip maps are not enabled.
    • Per-texture UV scale is enabled.
    • Yes -- seems likely (possible) that it's happening between texture variants within a cluster.

    Edit: I'm seeing it all over.. but I do have a lot of blending going on. It's more noticeable in areas like road / asphalt or stones... grass kind of hides it a bit.
     
  27. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    284
    Also noticed a difference on the blending of textures.I have a road area that switches to an area of hard-standing.. after upgrading the texture arrays, the blend had moved and no longer lined up. I have a drain on top of the blend to make it look more natural and the texture join had moved by nearly 0.5 meter in-game dimensions.

    GB-IMG-Mega-Splat-Texture-Align-Issue-30-Sept-2017-1.png
     
  28. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,190
    Try turning off Per-Texture UVs and let me know if it goes away. I think I know where this is coming from, as I have a similar bug in MicroSplat with per-texture UVs..
     
  29. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    284
    Yes -- turning off Per-Texture UVs fixes the issue, so it's the same issue as you suspected. Do you think it's difficult to fix?
     
  30. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,190
    Well, there's is an easy fix, but it removes a major optimization I made to both shaders. On MegaSplat, it took my stress test frame rate from 33fps to 47fps, which is a huge improvement. So I'm hesitant to remove that without spending some time looking into the issue to see if it can be avoided in some manner.

    Basically, GPUs operate in pixel quads (2x2 pixels) and when nothing diverges between the quads, texture samples can be shared between them. I believe what is happening is that when uv's are being scaled on a per-texture basis, the derivatives used in the samplers of each quad are getting slightly different results and creating a small discontinuity in the shading. I'm not exactly sure why yet, but that's my theory on what is happening. To fix this, you can compute the derivatives yourself and pass them into the sampler, but when you do that, information can no longer be shared between the pixels in the quad, so your shader runs much, much slower. In essence, each pixel needs to take it's own sample of the texture, instead of being able to share one sample. This can slow shading down by up to a factor of 4. I could obviously put in some kind of switch for this so it doesn't do that extra work when per-texture UVs are not enabled, but it would suck to have per-texture UVs have such a drastic cost. (thought it would be the same speed as before, but still)
     
    Last edited: Sep 29, 2017
    WildStyle69 likes this.
  31. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,190
    Ok, I have a fix for this- one which doesn't require me to use the gradient samplers, and therefor has little effect on shader speed. I've implemented this into MicroSplat, and will switch over to MegaSplat when it's all tested and do it there. I'm going to be at Unite all next week, but will try to get these builds submitted before then.
     
    WildStyle69 likes this.
  32. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,190
    antoripa and WildStyle69 like this.
  33. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    284
  34. tomhamilton

    tomhamilton

    Joined:
    Aug 31, 2013
    Posts:
    9
    Hello there,

    I seem to have another issue this morning. When using tesselation, if i enable per tex displacement, and try to adjust the displacement scale or up bias in the texture settings editor, I get the following errors:

    5 of these in a row:
    Unsupported texture format - needs to be ARGB32, RGBA32, RGB24, Alpha8 or one of float formats
    UnityEngine.Texture2D:SetPixel(Int32, Int32, Color)
    SplatArrayShaderGUI:DrawTextureEditor(MaterialEditor, MaterialProperty[], Material, FeatureData) (at Assets/MegaSplat/Scripts/Editor/SplatArrayShaderGUI.cs:404)
    SplatArrayShaderGUI:OnGUI(MaterialEditor, MaterialProperty[]) (at Assets/MegaSplat/Scripts/Editor/SplatArrayShaderGUI.cs:968)
    UnityEditor.DockArea:OnGUI()

    and 1 of these:
    NullReferenceException: Object reference not set to an instance of an object
    System.IO.File.WriteAllBytes (System.String path, System.Byte[] bytes) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/File.cs:595)
    SplatArrayShaderGUI.DrawTextureEditor (UnityEditor.MaterialEditor materialEditor, UnityEditor.MaterialProperty[] props, UnityEngine.Material targetMat, .FeatureData fData) (at Assets/MegaSplat/Scripts/Editor/SplatArrayShaderGUI.cs:415)
    SplatArrayShaderGUI.OnGUI (UnityEditor.MaterialEditor materialEditor, UnityEditor.MaterialProperty[] props) (at Assets/MegaSplat/Scripts/Editor/SplatArrayShaderGUI.cs:968)
    UnityEditor.MaterialEditor.PropertiesGUI () (at C:/buildslave/unity/build/Editor/Mono/Inspector/MaterialEditor.cs:1292)
    UnityEditor.DockArea:OnGUI()

    Also, i'm looking to understand what the MegaSplatTerrainManager script does exactly, and what sync / sync all does. Can you point me in the direction for any documentation for this?

    Cheers!
     
  35. tomhamilton

    tomhamilton

    Joined:
    Aug 31, 2013
    Posts:
    9
    Sorry, i forgot to add that i'm getting the same error with Per tex scale too.
     
  36. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,190
    Select the properties texture next to the material and set the format to RGBA32
     
    Danirey likes this.
  37. tomhamilton

    tomhamilton

    Joined:
    Aug 31, 2013
    Posts:
    9
    It works, thank you. However, now that I have this feature, i've noticed that the displacement scale per texture seems to scale from 0 (black), even when 'Displace from center' is ticked. I need to be able to change the displacement where 0.5 (Grey) = no displacement, 1 (White) = high, 0 (Black) = low. Lowering 'displacement scale' to 0 should take it back to it's midpoint, i.e. grey, 0.5 if 'Displace from center' is ticked. Currently, lowering it to 0 is the equivalent of giving it a pure black texture.
     
  38. gaiastellar

    gaiastellar

    Joined:
    Nov 8, 2013
    Posts:
    47
    Hi,
    I want to texture spherical mesh terrain ( planet) procedurally at runtime. Can this be done?
    If it can, how would it work?
    Do I need to create a splat map?
    Or can it be done based on vertex Colors, or height, or normal?

    Vertex Colors would ideal as I can procedurally encode the terrain for biomes with different colors before the vertex Colors are sent to megasplat.

    Or is there another way of doing this?

    Thanks Paul uk
     
  39. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,190
    Yes, you can do it by setting data on your the vertices, the format is described in the documentation.

    I can look into adding this soon; I’m at Unite this week, but it should be simple to fix this.
     
  40. strich

    strich

    Joined:
    Aug 14, 2012
    Posts:
    288
    Hey Jason, just wondering if you could help me with a specific feature I believe you support:

    I have a requirement where I need to place down small high-resolution mesh patches on the terrain at runtime. I will be deforming these patches. I had planned to use the Alpha Hole feature to cut a hole in the terrain and have the mesh patch replace it. However I cannot seem to work out how to make the mesh patch use the same material as the terrain so it can seamlessly blend in.

    Thoughts?
     
  41. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    462
    Jason,

    I just got MegaSplat and I am hopeful for great results as I learn how to use it better.

    I am having some problems with the distant terrain. The trees and plants are showing but the terrain is not. I have set everything to max culling distance and was wondering if the "FixTerrainDistance" component that you spoke of in previous posts would help ? Does it help on showing distance better in Unity or something else?

    I cannot find where this is located so I can't try it to find out.

    Thanks,

    David
     
  42. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,190
    It’s integrated into the MegaSplatTerrainManager now, do it should be automatic.

    Anything different about your terrains?
     
  43. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,190
    If you want it to seem up perfectly, then you need to make sure the UVs, normals, tangents, and textures all line up perfectly. For instance, one way to get the UVs to line up is to texture your terrain and mesh using a world projection or triplanar projection, and that both materials (the terrain and the mesh one) have the exact same settings in regards to UV scale, etc.
     
  44. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    462
    I'm using TC2 to create a chain of islands. But the islands trees and grass were only show up when further away, and distant ones don't show up at all.

    I saw on one of your videos a multi terrain that was huge and didn't clip out the far terrains. So I was hoping MegaSplat could fix this.

    I removed the distant islands before I loaded in MegaSplat, since they didn't show up, so I can't test right now. I'll run some more tests to see if it's still happening. If it does I'll get you a screenshot.

    Being an artist I'm not real familiar with coding, so I'm learning my way into Unity. I came over from Vue and I am now trying a different medium for my work using Unity. I am trying for a realistic landscape and your MegaSplat looks like it can bring me there, I just have to learn all the ins and outs of it. :)
     
    Last edited: Oct 3, 2017
  45. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    462
    Another question:
    I made an error last night in packing my textures (about 250 of them). I had just finished packing all my textures one by one and realized that I had missed yours. So, I ran batch importer to add your folder. And I lost everything that I have been doing for the last 2 days as it replaced everything I did with yours. :(
    • Is there a way to use the batch more than once, to add one folder at a time?
    • Will batch import import subfolders? Such as can I add the asset folder to cover everything or do I need to put everything into one folder?
    • Can I add more naming conventions to the converter? I have purchased different textures that have different naming conventions. Can I use something like "_diff, _diffuse" etc., separating each with a coma or something so that it will search for the different names and add them or do I have to rename everything so it is the same?
    So now I'm moving all of my textures to one folder and beginning to manually rename everything so that it matches yours, so that I can run the batch importer and get everything.
     
  46. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,190
    No, it just works on one folder with one set of naming conventions. I would suggest using a batch renaming utility (many are available for windows/osx) rather than doing it all by hand if you have a ton of textures.
     
  47. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    462
    Thanks, I'll do that.

    I appreciate your quick responses!
     
  48. Nijiem_Arhi

    Nijiem_Arhi

    Joined:
    Oct 4, 2017
    Posts:
    17
    Hey, great looking plug-in!

    I've purchased, and have imported it, but can't seem to get the example scenes to work. The mesh/terrains appear grey (except for a small patch of water) and I can't paint on or fill them. I've followed the exact steps outlined in the documentation for both the Mesh and MeshTesselation scenes to no avail.

    I'm on 2017.1.1.p2 and have tried running in DX11, OPenGL ES 3.1 AEP, and DX9 (terrain is black).
     
  49. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,190

    Can you try in a fresh project and make sure nothing is interfering? Also, what API does it report on the top bar of the Unity window?
     
  50. Nijiem_Arhi

    Nijiem_Arhi

    Joined:
    Oct 4, 2017
    Posts:
    17
    upload_2017-10-3_17-49-57.png

    Started a fresh project with only MegaSplat and got the same results. The API is displaying DX11 (this is the same thing I was seeing with OpenGL ES 3.1 AEP)
     
unityunity