Search Unity

  1. Unity 2018.1 has arrived! Read about it here
    Dismiss Notice
  2. Scriptable Render Pipeline improvements, Texture Mipmap Streaming, and more! Check out what we have in store for you in the 2018.2 Beta.
    Dismiss Notice
  3. If you couldn't join the live stream, take a peek at what you missed.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  5. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  6. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    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:
    2,743
    The terrain shader type expects to have control maps, but they are not in the Unity terrain format (format is described in the docs). It *should* work on a mesh just fine, since all that the Unity terrain ends up being in the end is a bunch of meshes anyway.

    What MegaSplat does on a Unity Terrain (which is also CLOD) is construct virtual triangles in the shader in which to perform the splat mapping on. This is because the triangle topology is always changing when you have a CLOD terrain, so if you had it on vertex data, like the mesh mode, textures would pop and change with the LOD.
     
  2. zoltanBorbas

    zoltanBorbas

    Joined:
    Nov 12, 2016
    Posts:
    23
    Hi there,
    I just updated MegaSplat as well as switched to 2018.1.3f1 and now when i am trying to update a texture array i get these errors which leads to my texture clusters are not showing on the painted terrain but only the ones comming with the tool.
    upload_2018-6-10_20-37-18.png
     
  3. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,743
    Yes, I submitted a patch for this on thursday but it hasn't been approved yet. I'll send you replacement shaders in a PM.
     
  4. zoltanBorbas

    zoltanBorbas

    Joined:
    Nov 12, 2016
    Posts:
    23
    Thank you! It worked! It is so nice when turns out i did not f***ed up something :)! It happens so rarely!
     
  5. zoltanBorbas

    zoltanBorbas

    Joined:
    Nov 12, 2016
    Posts:
    23
    Slight issue,

    I am using MegaSplat with MapMagic, which is now acting up. It paints the terrain as it did before but upon hitting play the texture clusters of my textures are replaced by the cliff texture at 0 index which is the first default texture that is coming with MegaSplat. The whole thing works fine in the editor as before the issue starts only upon starting the scene.
    :(

    Edit:
    Looks like some of my texture clusters not exactly replaced with the very same first cliff cluster of MegaSplats default textures but some has got the Grass of yours. So not all of them defaults back to the one at index 0.

    Never Mind it is fine now, although i am not sure which one of my actions fixed it.
     
    Last edited: Jun 11, 2018
  6. strich

    strich

    Joined:
    Aug 14, 2012
    Posts:
    238
    Yep I got it working - My procedural mesh had F***ed UVs. A derp on my end.

    One further question: Is it possible/easy to enable GPU instancing on the Megasplat shader? I have a bunch of terrain tiles that can be instanced.
     
    ftejada likes this.
  7. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,743
    Yeah, I'd have to add code to support that- MegaSplat was written before instancing and I've never been asked for it..
     
  8. strich

    strich

    Joined:
    Aug 14, 2012
    Posts:
    238
    Do you think it is something that could be easily added to certain modes? AFAIK there is no unique data per material instance so should be just a couple of lines?
     
  9. DrInternet

    DrInternet

    Joined:
    Apr 6, 2014
    Posts:
    49
    Actually you have been asked before, about a year and half ago.
    https://forum.unity.com/threads/rel...at-mapping-system.441329/page-12#post-2927816

    But that's not why I'm here. About week and half ago I sent you a project to reproduce texture bug in 2018. No reply so far. Any progress on that?
     
  10. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,743
    I have not had time to look at it yet; a lot of stuff going on in my personal life and I’m about to head on a 9 week trip, but will have a few days at home in early July to catch up on everything.
     
  11. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    410
    Hi @jbooth !!!
    One question ... do you know if MegaSplat shaders works for ps4?

    regards
     
  12. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,743
    The non-tessellated ones do (yay surface shader abstraction)- but apparently the tessellated ones do not, but without a ps4 dev kit or sdk I don't really have any way to know what the issue is.
     
    ftejada likes this.
  13. strich

    strich

    Joined:
    Aug 14, 2012
    Posts:
    238
    Oh that reminds me - I'm displacing the verts using your prevertex custom function and if I don't have tesselation enabled the shadows aren't offset correctly. Turning on tesselation fixes that. However I don't really want tesselation. Is this something that can be required?
     
  14. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,743
    Oh, I think there's a surface shader directive that forces it to generate a shadow pass. I might have to add that..
     
    Aniow and strich like this.
  15. unfungmz

    unfungmz

    Joined:
    Jul 29, 2017
    Posts:
    86
    I was using MegaSplat and it was working just fine, then something weird happened. My terrain textures suddenly look very washed out. Very low contrast and no noticeable normal mapping. Also, when I try to paint, it only paints a tiny little blob instead of full coverage. I was literally in the middle of a project and had no issues then all of a sudden it happened. I tried saving and reloading, but when it comes back the textures still look washed out and I can barely paint anything. Any idea what happened?
     
  16. unfungmz

    unfungmz

    Joined:
    Jul 29, 2017
    Posts:
    86
    Figured out my brush flow was causing the painting to get screwed up, so now the only issue is the very washed out looking textures
     
  17. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,743
    Check the shaders in the InternalShaders directory and make sure they are compiling- I submitted (and the UAS published) a fix for this recently, but maybe something is still off?
     
  18. unfungmz

    unfungmz

    Joined:
    Jul 29, 2017
    Posts:
    86
    For some reason they look correct now. Not sure what happened.

    I do have a question about the procedural shader. Under my Texture Projection Editor, I have orange boxes for each texture, and the farthest left boxes are the only ones that are working. It lets me go through each texture, but the preview image never updates. None of the other boxes will let me move the sliders (only the far left texture slider works).

    I'm assuming I missed a step somewhere. I selected my mesh, selected "MegaSplat_procedural" as the shader, set "Bottom Layer Texturing" to "Project 3 Way" - and I set up my Albedo/Normal under "Splats", and then I added the MegaSplat_Example (TextureArrayConfig) to the Vertex Painter.
     
  19. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,743
    All sounds fine- what Unity version? Sometimes the slider doesn't work if the window is too small (Unity bug).
     
  20. unfungmz

    unfungmz

    Joined:
    Jul 29, 2017
    Posts:
    86
    In Unity 2017.4.3f1
     
  21. Tomza

    Tomza

    Joined:
    Aug 27, 2013
    Posts:
    567
    Hi,
    Is Vulkan supported? Because CTS doesn't support the graphics API.
     
  22. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,743
    As far as I know it should be..
     
  23. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    2,940
    I had a challenge to buy this asset after solving by hand the barycentric blending, even though I don't need it now (character investment is first), but how the hell does that works? lol
    - I'm assuming that you need to reconstruct the index, in pixel shader, using the blending weight (that is the colors ratio), simplifying the problem to 2d yield infinite solution (clamp to 0-255 obviously) and i need slope as a tie breaker but don't know the specific of derivative in shader yet :( (met them once in skin shader to get the curvature, just copy pasted though). That's assuming there is no geometry shader used as the only shader 3 features announced was texture array.
    - I'm must say I'm tipping my hats off, because that's ingenious, the moment I learn about indexing 255 texture I had my mind blown, but then learning about the color coding had me floored, I knew it was about the barycenter, I thought I could try it lol.

    Well I guess I need to buy it to get the solution lol
     
  24. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,743
    It's so subtle, you'll be lucky if you can even find it in the code. I suggest stepping through the code with some example data if you want to figure it out.

    Yes, the basic idea is that you need to know the blend amounts and indexes of the three textures used on a given triangle, so that you can sample them and blend them. And by default, the indexes will get interpolated, so that is the main thing to solve.
     
    neoshaman likes this.
  25. lamwz

    lamwz

    Joined:
    Dec 28, 2013
    Posts:
    3
    Hello, can you tell me how MegaSplat supports VR.After using Mesh, FPS has dropped a lot. Is it wrong with my operation? Or other reasons.
     
  26. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,743
    Not enough specifics to tell- but MegaSplat is going to be heavier than something like the standard shader, especially as you turn on more options.
     
  27. lamwz

    lamwz

    Joined:
    Dec 28, 2013
    Posts:
    3
    What options should I pay attention to?
     
  28. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,743
    There's a texture sample counter in the debug section of the material properties which will tell you how many samples the shader takes, which you can check as you adjust features. This is a pretty good measure of texture bandwidth. There's not an easy way to tell ALU complexity, but MegaSplat was designed more for high end stuff than VR, which tends to want low complexity shaders.
     
  29. lamwz

    lamwz

    Joined:
    Dec 28, 2013
    Posts:
    3
    Thank you, I'll try
     
  30. Tomza

    Tomza

    Joined:
    Aug 27, 2013
    Posts:
    567
    Thank you!
     
  31. NightElfik

    NightElfik

    Joined:
    Oct 27, 2014
    Posts:
    5
    Hey, I had some troubles making the packed NSAO textures work. After some debugging and reading the MegaSplat.shader it turns out that the order in RGBA texture should be [S, Nx, AO, Ny], not [Nx, Ny, S, AO] as described in the documentation.

    Can you please confirm this? If true, can you also update the documentation? I am using the latest MegaSplat version.

    Thanks!
     
  32. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,743
    That is correct - but why are you making them by hand now? The Texture Array Config manages it all internally now, and I thought I had removed references to NSAO format in the docs, but maybe I missed a spot.
     
  33. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,743
    Oh, and it's:

    S, Ny, AO, Nx to closer match the Unity format.
     
  34. NightElfik

    NightElfik

    Joined:
    Oct 27, 2014
    Posts:
    5
    Thanks, but are you sure? For example in NormalSAOFromNormal.shader you do:

    Code (HLSL):
    1. half3 un = UnpackNormal(norm);
    2. un.xy = un.xy * 0.5 + 0.5;
    3. half4 nsao = 0;
    4. nsao.xy = un.xy;
    5. nsao.w = un.b * un.b;
    6. nsao.z = un.b * 0.07;
    7. return nsao.brag;
    The code above packs the values in [S, Nx, AO, Ny] order, right? Is that a bug? It would help to not mix .xyzw with .rgba.

    Also, please do not remove details like these from docs. Add more! :) Power users like me often need/use these details to our advantage. We are building the arrays maps manually because our game loads everything dynamically during run time (and it is way faster to iterate without rebuilding large arrays, and we do not need to check-in >100MB arrays to our versioning system, etc).

    I was also able to build dynamic tillable terrain mesh that has the RGB vertices correct for MegaSplat. Your documentation had enough info to make that possible. :)
     
  35. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,743

    No, it’s correct; notice the swizzle on the return.
     
  36. NightElfik

    NightElfik

    Joined:
    Oct 27, 2014
    Posts:
    5
    I might be missing something, but the nsao.xyzw variable holds [Nx, Ny, S, AO] which gets swizzled using .brag which is the same as .zxwy which gives me [S, Nx, AO, Ny], right? Not the [X, Ny, AO, Nx] as you suggested.

    One tiny note: The generated shader says "Compiled with MegaSplat 1.6" even though I think I have the 1.68 version. I was just not sure if the upgrade I did was correct or I got some older version.
     
  37. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,743
    Yup - your right- Unity uses YX in their encoding, so I thought I had followed suit. When sampled, it gets swizzled back into NSAO format again, so the majority of the shader code is unaware of the formulas. Yes, the version number is still 1.6- I don't always update it for small point releases..
     
  38. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,743
    Yup - your right- Unity uses YX in their encoding, so I thought I had followed suit. When sampled, it gets swizzled back into NSAO format again, so the majority of the shader code is unaware of the convertsion. Yes, the version number is still 1.6- I don't always update it for small point releases..
     
  39. k3D-Junkie

    k3D-Junkie

    Joined:
    Jun 14, 2011
    Posts:
    236
    Quick question-

    I just downloaded MicroSplat and purchased the Alpha Hole module for it. Works great!

    But, although I was able to paint regular Unity Terrain trees on it, I haven't been able to paint grasses or other Details. The description says it supports Vegetation Studio for grasses. Does this mean it doesn't support Unity Details (grass,meshes)? I'm using 2018.2.0b4 beta
     
  40. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,743
    No, MicroSpat has no interaction with the Unity grass system, so it should have no effect..
     
  41. Tinder-Red

    Tinder-Red

    Joined:
    Dec 2, 2017
    Posts:
    9
    Hello everybody. i have a problem when i draw cluster texture. i've got different scaling .
    What i do wrong?. And how can i reduce the scale of my sand texture
    Thx.
    Texture Scale.jpg
     
  42. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,743
    There’s an option for per-texture UV scaling.
     
  43. Tinder-Red

    Tinder-Red

    Joined:
    Dec 2, 2017
    Posts:
    9
    Where can i find this?
     
  44. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,743
    In the top section of the material there's an option for it- once you turn it on, you'll have a control that lets you select the texture you want to edit and scale it's UVs between a minimum and maximum scaling value.
     
  45. Tinder-Red

    Tinder-Red

    Joined:
    Dec 2, 2017
    Posts:
    9
    Thx I found it.