Search Unity

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

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

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

  1. Mark_T

    Mark_T

    Joined:
    Apr 25, 2011
    Posts:
    303
    I was trying to use the Splat from ColorMap and I got this error:
    error_002.jpg

    I was using Unoty 5.4.4p4. On Unity 5.8.0b4 I got a crush(freeze), without closing the Unity window. It was a weird one. I was using a 512 pixels image size in .png file format. I managed to transfer the macrotexture to the vertex color using texture baker. I had 16 submeshes in a .fbx file, all of them LOD0. basically, 16 tiles.

    Question: How can I use the vertex colors (after using the texture baking) to paint/transfer textures on the mesh based on the vertex colors?
    Thanks!
     
    Last edited: Jan 31, 2017
  2. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    What is the end goal? You've projected the texture from the macro texture onto the vertices, are you trying to have it render those as colors, or something else?
     
  3. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    So, if anyone is trying to use lightmaps with the tessellated shaders, there's a bug in the current release and the one pending. However, I've fixed it, and now have it working in all 3 light mapping modes (directionless, directional, and directional specular). After digging through miles and miles of macros, I've also managed to enter into Unity's lighting pipeline a little earlier, which hopefully means I'll be more resilient to low level changes.

    There is one issue I have left to deal with, and that's that in one of these modes the flow maps use the same UV's as enlighten. To fix this, I'm going to move the current flowmap UVs on meshes from UV2.xy to UV2.zw instead. I can make this optional if anyone has spent a lot of time and painted flow directions and wants to preserve them, but I somehow doubt that's going to be worth it.

    If anyone is blocked by this, send me your invoice and I can send you an early patch.
     
    recon0303 likes this.
  4. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Sounds like an utter nightmare only offset by selling thousands of copies at 500 quid each.
     
  5. Half_Res

    Half_Res

    Joined:
    Apr 16, 2013
    Posts:
    12
    Hi Jason,

    I'm having Unity crashes every time I try and open the example scenes - especially the terrain with tessellation. The project causes my GPU driver to panic and restart. I'm on a reasonably high spec card - a Nvidea 780Ti with up to date drivers (re-installed today to test this).

    Interesting the first crash always happens during the mega splat package import right before unity 5.5.1f1 gives me the warning 'that the project contains scripts / or assemblies that use obsolete APIs'.

    The crash normally takes out most of the editor windows. Have tested importing mega splat into an empty 5.5.1f1 project and still get the crashes, including the initial one during import.

    Have checked that my project is Dx11, with no graphic emulation and DX9 is manually switched off.

    Any thoughts?
     
  6. ncho

    ncho

    Joined:
    Feb 1, 2014
    Posts:
    99
    So I have also noticed that if I take a mesh, put it through the converter, and then try to convert it for use with ProBuilder, this breaks the mesh. If I first convert it for ProBuilder, Megasplat will not convert the resulting mesh.

    Anyone have any workarounds?
     
  7. PiAnkh

    PiAnkh

    Joined:
    Apr 20, 2013
    Posts:
    126
    Jason,

    you recommend using polygons for the road surface, but what if I use a mesh on top of a terrain. How would you recommend blending in the edge of the road geometry with the terrain? Is there some way to do geometry blending in this case?

     
  8. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Any idea what ProBuilder does to meshes?
     
  9. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I was saying to cut off the road at the white lines, then paint gravel under that with MegaSplat, such that you don't need to do any geometry blending. That said, if you do need geometry blending, you can use AlphaLayer mode to make a shader that blends MegaSplat over a regularly textured object.
     
    PiAnkh likes this.
  10. StevenP94

    StevenP94

    Joined:
    Jun 3, 2013
    Posts:
    143
    You can get the free version to check what it does, imho :)
     
  11. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    Error messages I get in unity 5.5.1f1

    MegaSplat unity 5.5 console errors.JPG
     
  12. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    FYI

    In terrain paint tab under Utility, the buttons are almost unreadable with the Unity personal skin, white on light grey.

    In the manual where discussing terrain converter there is a image that shows the unity textures on the left, and the MegaSplat on the right, but the discussion below the image states that the unity terrain is on the right. Is this a simple typeo?
     
    Teila likes this.
  13. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Let the auto-updater run and it'll fix it.. I code for 5.4, then fix anything in 5.5 that the auto-updater won't fix, as that keeps the code a lot easier to work with.

    Fixed in the pending release, which will hopefully go through in the next day or two.

    Fixed as well in the pending release, or in the online docs..
     
    wood333 and Teila like this.
  14. ncho

    ncho

    Joined:
    Feb 1, 2014
    Posts:
    99
    No clue but I guess something must be clashing about the way both assets modify vertices. The broken mesh looks like this after ProBuilderizing it:
     
  15. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Crazy- Does probuilder export to standard meshes at some point? Because I would expect that to go through the MegaSplat converter fine if so.
     
  16. ncho

    ncho

    Joined:
    Feb 1, 2014
    Posts:
    99
    Yeah it does, and I have not tried it yet and it might well be that the resulting mesh is fine, but it would be too bad if this convenient workflow of working with Probuilder and Megasplat at the same time is not possible.
     
  17. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    If probuilding is generating meshes, then they would have to be in MegaSplat format for it to work with the shader. This might be something that could be integrated into ProBuilder by the author, so you might want to ask him if he's up for it. Another option would be to located whatever function he generates a mesh with and daisy chain the converter on the end of it so that the final mesh is converted after each edit - not sure how fast that would be though.
     
  18. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    I've got a very similar issue on a laptop with a 770M. There was one other user who I think has a 680 that ran into something like that too. @jbooth had me verify that tessellation was even working on that machine. I tried a different tessellated shader which did work. Then I tried creating a new MegaSplat shader and started ramping up the features. Tessellation did work up to a certain point, but eventually I got it to crash:
    https://forum.unity3d.com/threads/r...at-mapping-system.441329/page-10#post-2911726

    I'm not clear on if the upcoming fix with tessellation and lightmaps is related at all, but I'm looking forward to trying it.

    The issue should be of concern to anyone wanting to deploy a game that uses MegaSplat tessellation, since any player who happens to have the wrong GPU could end up with a black screen. I say that since I tried doing a build from another machine that doesn't have any issues with MegaSplat, and when running on the 770M machine, that's what happened.
     
  19. Mark_T

    Mark_T

    Joined:
    Apr 25, 2011
    Posts:
    303
    Well, no goal. Yet. :)
    After getting the error with the Color2Splat attempt I tried to color the vertices, and to my surprise it worked. I've got a few times the error reported before and I suppose it was because I messed up the ColorToSplatConfig.
    I'm not sure yet what I am doing, but it would be nice to have some warnings in case some incompatibilities are triggered by noobs like me.
    Anyway, seeing the colors transferred on vertices I said in my mind that it would be great to import a mesh with vertex color maps and no need to use a bitmap, just assign the shader. Is it possible to do that?
    I don't know why, but I always thought that vertices are being colored when painting a texture cluster in Megasplat. Checking in Vertex Painter to "Show Vertex Data" I was expecting to see some painting I've done, but to my surprise, the same RGB colors but somehow the initial order was messed up. So, I made the suposition that the vertices are not colored but an index is assigned to each painted vertex, corresponding to the texture in the texture array.

    Checking the ColorToSplatConfig I noticed it was set to SplatTexture. When trying to add more keys to assign more textures it was not possible, even though the "+" button was there. Is this a bug, or this is a 4 keys limit in case the ColorToSplat is set to SplatTexture. Reading the docs there are no mentions about the Color and Index settings.
     
  20. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I've been working with Unity support on this; they managed to run on a PC with a 680 that looks as if it's the same video card as one of the ones causing the issue without having any problems. They are currently running a full QA pass on it, testing it on various video cards, and so far have not been able to reproduce it on any of them. But it's definitely an issue that a few users have run into, so not something that can be choked up to a bad video card. Most likely it's some kind of driver issue, but really tracking it down to something that we can verify has been problematic.

    Maybe, just maybe, the upcoming patch will fix it- sometimes jiggling the handle works, and enough code has been re-written that who knows.
     
  21. Mark_T

    Mark_T

    Joined:
    Apr 25, 2011
    Posts:
    303
    I'm on Win7, nVidia Titan (the first one), updated to the latest drivers and I get a 100% crash when I import Megasplat into a new project. I tested all megasplat versions and 0.9, 0.9.1.1, 0.9.2, 0.9.3 are importing fine, no errors, no crash. With versions 0.9.5 and 0.9.6 I get a 100% crash and video drivers are crashing too every time. I started to import only parts of the package and the troublemaker is located in Megasplat/Examples/Materials. I do have an empty project with only Megasplat imported and I clone the project folder avery time I need it. Right now, for testing and learning it's fine.
     
  22. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    The vertex layout is described in the documents. In short, it's color.a for the bottom layer texture index, UV3.w for the top layer's texture index, and UV3.x for the blends. If you have a 3d program that can output 4 UV channels of float4 data, and Unity imports that data correctly, then you could do the painting in that program instead. But I don't know of one that will do that.

    There are 4 max because a splat texture has 3 values representing the weight of each texture (with the 4th always being 1). Color2Splat is really about taking control maps from external programs and loosely mapping them to clusters. However, if you want a more accurate conversion and happen to be using Unity Terrains, then the terrain converter will support as many textures as Unity supports, and does a better job mapping the data..

    I'll update the docs about the index and splat modes..
     
  23. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    Wow, interesting. Sounds like a tricky one for sure.

    Here's hoping. :D
     
  24. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yeah, it's the tessellation shaders that are in there.

    So, I don't know if you tried this, but the user who's machine I remoted onto found that if they created a new shader, turned on tessellation, but then set the tessellation factors really low (say, 4), it would work fine. But as soon as they ramped up above 6 or so it would crash the GPU on them. Would be interesting to know if you experience the same behavior.
     
  25. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,240
    Just to clarify: this does work with Unity terrains now? I saw a number of posts in the first few pages of this thread stating that it didn't, and it wouldn't be possible to make it worth with Unity terrains, but it seems you figured out how to do that?

    And has anyone done any kind of in-depth comparison with RTP?
     
  26. Mark_T

    Mark_T

    Joined:
    Apr 25, 2011
    Posts:
    303
    I created a new material and a new shader but every time I hit "Play" the old material is coming back. I'm able to push all the settings all the way to maximum, but I wasn't able to assign the new material during play time. Weird. Why is that? tesselation.png
     
  27. ferlodeveloper

    ferlodeveloper

    Joined:
    Jan 21, 2013
    Posts:
    15
    Hi,
    Congratulation for megasplat package.
    I generate my .asset with houdini so i have total control over vertex color values but when i use in vertex painter i have this problem(see below).
    I dont undestand the part that say "each face has exactly one red one green and one blue value"
    Q: The textures are being interpolated across the face - I see like 20 textures on one triangle.

    A: You need to preprocess your mesh with the converter into the format used by MegaSplat. If you are procedurally generating geometry, then you will need to correctly mark the vertex colors so that each face has exactly one red, one green, and one blue value. If you are using the meshes, it’s also possible you accidently painted into the color channels- MegaSplat uses data in the color channels of the vertices to filter texture choices, so if that data gets accidentally changed, it can cause this problem.

    Thanks so much
     
  28. Mark_T

    Mark_T

    Joined:
    Apr 25, 2011
    Posts:
    303
    Well, that is very unfortunate. The ColorToSplat is a very misleading name. It suggests that I am able to convert the colors from a texture into a mask, each color being a mask for one texture or texture cluster. In fact it is converting 4 chosen colors from a rgb image map into a classic splatmap.
    Why limit to 4 colors only? My meshes have nothing to do with a Unity terrain and it's limitations. Why noy choose as many colors I want? Than, it will be a true cColorToSplatConfig.
     
  29. Half_Res

    Half_Res

    Joined:
    Apr 16, 2013
    Posts:
    12
    Thanks Steve-tack that makes sense, it definitely pays to be careful with tessellation. However, also used other tessellation shaders on our dev machines here in the past with the 780ti and they have worked too - both the RTP shader and others. Atter all the card that benchmarks equal to GTX 970 in most tests. All have a limit as Tessellation is heavy, but I'm curious why the package crashes first on install everytime... this is bringing down the GPU before I even run the tessellation scene?!

    I'm going to run Mega Splats on my 1060 card at home tonight to for a fair test.

    EDIT: Just finished the install at home, and MS runs fine on my 10 series card....

    Will look in detail at the posts from Jason, Mark_T and SteveTack on the tessellation / example scene install in the studio tomorrow and see if we can work round this thing with series 7 GTX cards. I really want to use MS if we can as it seems to be the best-in-class solution, and has great support.
     
    Last edited: Jan 31, 2017
  30. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yeah, it works on terrains now, and the patch that's currently waiting in the asset store line has full support for every feature on terrains and on meshes.
     
    magique likes this.
  31. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Wait, so simply making a new shader fixes it and everything just works?

    There are three modes:

    color mode is "Given a color in an image, find the texture cluster with the closest color to this color and assign it". You could, for instance, say green is grass, and purple is rock, etc. It finds the closest match and assigns it. You can have as many color->cluster mappings as you want.

    index mode is "Color.r will tell me which index to use- a value of 0 means the first texture, a value of 1 means the second texture, etc).

    Splat mode is "Given a traditional splat map, where the R/G/B represent the weights of each texture (and the last one is assumed to be one), choose the highest weighted texture". That's why it's limited to four textures, because the original source is assumed to have the same limit.
     
  32. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    The converter will take your meshes and set this up for you. But if you *want* to do this yourself, then you need to make sure each triangle has a red/blue/green vertex. You cannot, for instance, have a triangle with two red vertices and a green one. The main reason people want to do this themselves is if they are generating geometry at runtime- if you're generating it with Houdini, you can just use the mesh converter and it will do the markings for you.
     
  33. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    I'm guessing it's not appropriate to discuss a directly competing product in this thread (unless @jbooth is cool with it). But I own RTP also, so if you have any specific questions, we can start a new thread or do it via PM.
     
  34. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,240
    Sure, that's only polite. I've PM'd you.
     
  35. Mark_T

    Mark_T

    Joined:
    Apr 25, 2011
    Posts:
    303
    No. As I mentioned I replaced the old material and shader with a new one but when the Play button was pressed the old material and shader were jumping bac like they were not replaced at all. I had to delete the material and shader from the project folder and assign the new material and shader. Ad you can see below, it doesn't look right. It looks like the paintong information is gone, especially after rebeuilding the shader a few times nd playing with the settings. In the beginning it had an attempt to displace but was looking pretty bad and thing were getting from bad to worse. ASE-MEGASPLAT_error_003_.png
    I was expecting the painting information to stay with the object. I have to mention that I deactivated and activated the Vertex Instance Stream script a few times.
     
  36. jococo

    jococo

    Joined:
    Dec 15, 2012
    Posts:
    232
    Awesome product!

    I'm running Unity 5.4.0 non-pro on PC.

    I'm trying to start out repainting my Gaia terrain and tried this 1st step:

    "To create a new MegaSplat shader, right click in your project view and select Create->MegaSplat->MegaSplat Mesh Shader or MegaSplat Terrain Shader, depending on which workflow you are using. "

    However, there is only 1 option after Create->MegaSplat-> and that's only "MegaSplat Shader" there is no option to select mesh or terrain.

    I chose the only option and then:

    "Next create a material and assign the shader which was created." but the shader I created isn't showing.

    Am I missing something, here?

    Thanks
     
  37. Mark_T

    Mark_T

    Joined:
    Apr 25, 2011
    Posts:
    303
    I think we need tutorials and full documentation.
     
  38. Mark_T

    Mark_T

    Joined:
    Apr 25, 2011
    Posts:
    303
    Is the converter unwelding all the triangles?
     
  39. ncho

    ncho

    Joined:
    Feb 1, 2014
    Posts:
    99
    The doc seems to be outdated, you now choose directly in the shader properties if it is for a Terrain or a mesh (at the top).

    Not sure about the second one, it shows up fine for me.

     
  40. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Looks like ncho beat me to it, but I'll update that popup to say the correct thing. Yeah, you just change the type of "Terrain" at the top. Then assign the material to the terrain's custom material and switch back to the Terrain painter. It will likely prompt you to create a splat map texture, etc.
     
  41. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    No, it's unwelding the minimum number needed to make sure the markings are correct. On my 32k mesh pieces, this ends up adding about 120 vertices. But it can vary wildly based on the geometry.
     
  42. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    There's a devlog on it from a while back, but I'll update the documentation on my next pass..
     
  43. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    0.97 has apparently been approved!
     
    magique likes this.
  44. Mark_T

    Mark_T

    Joined:
    Apr 25, 2011
    Posts:
    303
    I have a 512x512 pixels image and after setting up ColorToSplatConfig in Color mode and using Splat from ColorMap I get the error:
    "ArgumentOutOfRangeException: Argument is out of range. Parameter name: index"
    Is it my fault or the baker? I had 5 colors in my setup. I didn't made any changes in the other 2 modes.
     
  45. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    Just pulled down 0.97 and it does seem to have fixed my tessellation issues!

    After importing the package, I did not get a Unity crash or any weirdness at all.

    I was able to open both tessellation example scenes no problem. Everything appears to be rendering perfectly.
     
  46. Mark_T

    Mark_T

    Joined:
    Apr 25, 2011
    Posts:
    303
    downloading now.

    Fingers crossed.
     
  47. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Awesome, but frightening at the same time...


    Definitely something I need to look into.
     
  48. jococo

    jococo

    Joined:
    Dec 15, 2012
    Posts:
    232
    I was able to create a shader and material.

    I currently have a textured Gaia terrain which I want to convert and paint better.




    Following the steps in the manual I can't seem to paint and I am wondering if it is because of the warning shown in the image attached.

    Also my terrain is completely white. I think I set up the texture atlas properly but any advice is appreciated.

    Thanks
     
  49. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461

    Did you assign the texture arrays you created (or mine) to the material? Also, painting is done in the Terrain painter, not the vertex painter. That warning is fine; I don't actually use tangents in the terrain shader, but I think the vertex structure might be defining them.
     
    jococo likes this.
  50. Mark_T

    Mark_T

    Joined:
    Apr 25, 2011
    Posts:
    303
    Unity 5.4.4p1, no crash during import. Everything looks fine. On my workstation and on my laptop (integrated AMD which was able to render around 30fps in the MeshTesselation scene)

    Thanks!