Search Unity

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

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

  1. mig91

    mig91

    Joined:
    May 14, 2013
    Posts:
    6
    i dont quite understand :D this is megasplat shader im using. right?

    first everything is going fine without lowpoly look turned on. lighting is correct (see 1.png). then i set lowpoly look on and ambient light is gone (see 2.png)
     

    Attached Files:

    • 1.png
      1.png
      File size:
      2.2 MB
      Views:
      360
    • 2.png
      2.png
      File size:
      2 MB
      Views:
      344
  2. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Ahh - I forgot there’s a low poly look feature in MegaSplat. Hmm, I’ll have to check the code and see which pathway it uses..
     
  3. corjn

    corjn

    Joined:
    Feb 6, 2014
    Posts:
    168
    Hey @jbooth,

    Sorry i'm posting here again about your Stochastic Node for amplify :

    It's a bit borken in the latest version of Amplify. Repro :
    Create a new Unity project (tested with 2019.3.15 and 2019.4.3). Install the latests Amplify shader (1.8.2 rev 00) and Stochastic node.
    Open "StochasticExample" shader with Amplify. The stochastic node will be gone, throwing this error "AmplifyShaderEditor.AmplifyStochasticNode is not a valid ASE node".

    You can re add the node though, and compile, it will work. But the node will disappear everytime you close amplify window (which is annoying)

    Thanks for your time :)

    Edit : I fixed it by putting "AmplifyStochasticNode.cs" in the folder Assets/AmplifySahderEditor/Plugins/Nodes
     
    Last edited: Jul 12, 2020
  4. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I wonder if they changed something about how they register nodes- I'll see if I can repro.
     
    corjn likes this.
  5. mig91

    mig91

    Joined:
    May 14, 2013
    Posts:
    6
    ok i tested it and looks like its working on forward rendering path. is there a way to get it working on deferred?
     
  6. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Odd, I would have expected the opposite- as in deferred you just fill out the various inputs to the lighting equation.
     
  7. mig91

    mig91

    Joined:
    May 14, 2013
    Posts:
    6
    is there hdrp support in megasplat? i tried ultimate terrains with megasplat but terrain is pink
     
  8. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Nope..
     
  9. viceca

    viceca

    Joined:
    Nov 10, 2016
    Posts:
    14
    More mobile issues: currently I'm getting these black splotches when rendering Meshes with vertex instance streams, but only on my final device, not in editor.
    Any idea on what could be the issue?
    upload_2020-7-17_15-28-5.png
     
  10. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    No idea, not much information given to go on.
     
  11. viceca

    viceca

    Joined:
    Nov 10, 2016
    Posts:
    14
    This is roughly the same view, but in editor upload_2020-7-17_16-0-10.png

    and this is my material setup upload_2020-7-17_16-1-7.png
    I'm renderdoc'ing through trying to understand what's going on, but still no clues
     
  12. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    whats the target device? Kinda looks texture related, as it's not following polygon edges or anything like that. You might try clearing the library and making sure everything is freshly cached..
     
  13. viceca

    viceca

    Joined:
    Nov 10, 2016
    Posts:
    14
    It's an oculus quest, I might try to clear the library, but I've just found that by increasing the _Contrast value a bit it apparently resolved the issue, regardless, this is a LINK for a Renderdoc capture in case you want to have a look
     
  14. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I could imagine that if contrast got low enough (like 0.001 or something) and the shader decided to treat something as lower precision (often on mobile GPUs), it might end up with a divide by 0 on certain pixels with a low height value..
     
  15. viceca

    viceca

    Joined:
    Nov 10, 2016
    Posts:
    14
    Yeah, the issue was the low precision on the device, I just did a minor change on the method ComputeWeights to have a bit bigger epsilon value and have a clamp on the transition value so it wouldn't be 0 and got it fixed!
     
    jbooth likes this.
  16. Bzuco

    Bzuco

    Joined:
    Sep 6, 2015
    Posts:
    56
    @corjn @jbooth

    They added AssemblyDefinition file in 1.8.1xx ver. which is causing that error message for stochastic and megasplat nodes. I deleted that file from ASE folder, but I am also curious how to use correctly assembly definition files in my project...it seems to be quite useful organize C# scripts to several Assembly dll files for final build and easier patching when necessary...

    v1.8.1 rev 01:
    * Improvements:
    * Added AssemblyDefinition file and made it so nodes can be found in the main editor assembly besides ASE assembly
    * If you which to extend ASE with your own node and you already use your own assembly file you need to add ASE as a dependency
     
  17. Zeven001

    Zeven001

    Joined:
    Sep 11, 2017
    Posts:
    10
    Hi I have a Problem whit megasplat and map magic everytime i generate my terrain whit mapmagic i cant use terrain painter anymore its says control texture not readable and fix it button dont work either can you pls help my to fix this because i cant get it to work
     
  18. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    You'd have to check with the author of map magic- I'm guessing, but I suspect it's changing the control map to one which is in memory, and not one that is on disk. Thus the fix button cannot change the read/write status of the texture via the importer.
     
  19. ZaCkOX

    ZaCkOX

    Joined:
    Oct 14, 2017
    Posts:
    17
    I have a terrain with a mega splat component, and I need to copy textures properly after cutting the map up into chunks. The terrain is in chunks because I created a system for deforming (creating holes basically in the terrain at runtime). Everything is working properly except getting the terrain to match the default textures it starts with. I have tried a lot of things but ultimately stuck with leaving the mega splat component attached and having a strange offset issue.

    What can I do? I believe the main problem is I need to open two assets files and change their dimensions, but I don't know how to do that yet.

    Alpha maps are working properly, chunks are working too:
    upload_2020-8-12_6-6-9.png

    Height map is perfect, you can see one piece I moved down, 0 index. If I zoom in, you'll see at the edge of this piece, along it, the texture is not painted perfectly.

    After moving the piece back up:
    upload_2020-8-12_6-9-49.png

    The map is 512 / 4 = 128... I am painting the texture with 128 dimension but it seems to not paint the entire 0 index chunk correctly, like missing a dimension of 1 or something. Clearly in index 1, it starts over and looks fine. But at every seam, this problem occurs. The splat texture is already split up into chunks and I moved it into photoshop to confirm perfectly 16 pieces, even zoomed in.

    This is a top view with only index 0 and index 1 displayed as an example:
    upload_2020-8-12_6-16-21.png
    The red area appears to be painted correctly. But you can see the seam edges are not getting painted correctly.

    upload_2020-8-12_6-19-41.png

    Two of my friends and I checked this line of code. It does do 0, 0 for offset index 0 then 128, 0 for index 1... and the x and y dimension are 128 always.

    This is the material of a chunk (index 0):
    upload_2020-8-12_6-22-52.png
    Green I was able to edit with code and seems to be proper. They were 200, 220. = 50, 55 when divided by 4. I wasn't able to edit the albedo or normal textures as they are asset files. They seem to have full 1024x1024 textures inside. Is this a problem? Or anything else in red? Or anything I need to do? Because just need to split any terrain into a chunk of 16, so the texture / 4 should work.

    Thank you in advance,
    Zacko
     
  20. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I mean, it all seems fine- you wouldn't need to edit your albedo/normal textures. However, realize that your UV scales are changing if each chunk has UVs from 0-1, and that your new subdivided textures need to be set to clamp, otherwise they may blend with textures from the other edge..
     
  21. ZaCkOX

    ZaCkOX

    Joined:
    Oct 14, 2017
    Posts:
    17
    Tried this with my friends as well, everything seemed correct with the uv scale, the original splat texture is 512x512. So after more experimenting, I found out when I take that original texture and cut it into 16 pieces, 128x128 and then put it back on the terrain chunks I get this:

    upload_2020-8-13_6-48-3.png
    So i tried going crazy and instead making one of the chunk textures into a 130x130 by hand and it did scale the entire space. I tried 129x129 then and it also seemed to scale the entire chunk. But 128x128 will not. I checked the terrain many times, the chunks seem to be perfect size other than the texture. If I reduce a size of the chunk, the pieces will have gaps between each chunk. Again everything seems perfect except for the textures being painted on top.
     
  22. ZaCkOX

    ZaCkOX

    Joined:
    Oct 14, 2017
    Posts:
    17
    Is there a way to extract the Mega Splat terrain paint into terrain layers or textures that I can easily paint myself? Like after the terrain is all beautifully painted, extract to separate files that I can also use with Complete Terrain Shader? I feel like the problem here is somewhere in the shader being used but also because my issue is somewhat complex. Chunking the terrain into pieces might be problematic when painting back onto the terrain. If I can apply separate texture files to each chunk, I should be able to have a perfect looking terrain even if chunked.
     
  23. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    you’ve got some issue in your chunking- no reason it can’t be chunked, if you painted it already split it would be fine. That said, MegaSplat format is non-standard, so nothing else can read that format (other terrain shaders use one backing texture for every 4 textures on the terrain, which can’t scale to 256 textures)
     
  24. ZaCkOX

    ZaCkOX

    Joined:
    Oct 14, 2017
    Posts:
    17
    Actually even without the chunking I still see the problem in the entire map, chunking just made it more obvious.

    Changing texture to clamp:

    upload_2020-8-17_21-7-40.png

    Changing texture to repeat:

    upload_2020-8-17_21-7-56.png

    If it was painting 1 to 1 ratio, wouldn't the top/right edge not show these problems?

    Now here is a picture when chunked and I spread them apart so you can see top/right is still same result as the above with entire map without chunking:

    upload_2020-8-17_21-8-46.png

    I spent time in the shader code, trying to figure out where this issue is, but I don't know a lot about this but it seems like an error to me with 1 pixel off. I have had at least 2 other friends confirm with me that is related somewhere else and not chunking code.
     
  25. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461

    Hmm, it's possible that this is due to the change Unity made to terrain UVs a while back. If you look at their internal terrain shaders, as of about Unity 2019.3 or so, they modify the UVs with a half pixel reduction over the scale of the map, like so

    controlUV = (controlUV * (_Custom0_TexelSize.zw - 1.0f) + 0.5f) * _Custom0_TexelSize.xy;

    Where controlUV's are the input UV coordinates, and _Custom0 is the control map and it's texel size parameters.
     
  26. Testmobile

    Testmobile

    Joined:
    Jul 3, 2012
    Posts:
    113
    Hello, im kinda new to MegaSplat and i was trying to use it with MapMagic but i can't get it to work.
    Im almost 90% confident it's my fault because it worked once but i can't get it right anymore, whenever i try to add the MegaSplat component thru the terrain paint window or thru MapMagic editor, the terrain mesh turns transparent and i get a lot of black mesh flashing on the screen.
    If i try to add a layer thru MapMagic i get a null error, any ideas of what could be wrong?!
     

    Attached Files:

  27. Duende

    Duende

    Joined:
    Oct 11, 2014
    Posts:
    200
    Hello, your asset (or assets) interest me, but I don't know if it would be compatible with my project since I don't use the Unity terrain, I create a custom mesh in runtime. All procedural.

    The terrain is made up of cubes, although I added slopes, as you can see here: https://twitter.com/MistRealms/status/1251602384377307136
    (There are more videos on my twitter in case you want to see how it is built).

    Each cube has its vertices that it doesn't share with the neighboring cubes, and the textures are added to each face of the cube by choosing the UVs from a texture atlas that has the different terrains. I don't know if I explain myself.

    With this information, do you think I could use your Micro or Macrosplat and their addons?
     
  28. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    You could use either, but the approach would be different:

    MegaSplat - You'd have to stamp one red, green and blue vertex on each triangle- in your case you have a quad, so it's easy- you'd need two red vertices on the opposite corners, with blue and green on the remaining two. Then you could write a texture choice into the color's A channel as (textureIndex/255). A second index and blend weight are available in the two color mode. You'd be able to have 256 textures.

    MicroSplat - Using the Mesh Workflow module, you could have up to 28 textures to choose from, and would store weights for each texture in the vertex colors and UVs. They are packed 4 to a component (so first four in color.r, next in color.g, etc). You might want to write your own component to manage the material handling..

    Usually I recommend MicroSplat for pretty much everything- it's got a ton more features, works in all 3 render pipelines, etc- but in your case MegaSplat might be an easier fit, in that it supports more textures..
     
    Duende likes this.
  29. Duende

    Duende

    Joined:
    Oct 11, 2014
    Posts:
    200
    Thank you very much for your answer. Although since I don't know very well how your asset works, it's hard for me to understand them a bit. :oops:

    So the texture limit in my game with MacroSplat would be 256 and with MicroSplat 28?

    Another question, in my custom terrain I could use things from your asset like autotilling or blend textures? I would need full control of the textures, for example placing a grass texture in one cube face and a dirt one in another neighboring cube face, and then blend them.

    As you say, although MacroSplat seems would be easier, MicroSplat has more addons and also URP support, which I don't need yet but it is possible in the future (As long as the texture limit isn't 28, even 256 might fall short). Is there any tutorial or documentation on how I should integrate MicroSplat and Mesh Workflow module? Something similar to what I would have to do.
     
  30. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Limit is 256 with MegaSplat, 28 with the vertex workflow in MicroSplat. Your use case is pretty custom, so there's no real guide on how to do something like that. MegaSplat's vertex format is explained in the documentation, and has been integrated into a lot of voxel engines, so it should be reasonably straight forward. If by auto tiling you mean triplanar texturing, it's available for both packages. For blending, you don't place textures on faces- you place them on vertices, and the blending happens across faces. So in your example as long as the edges of both have the same texture, and texturing is world space triplanar, they would appear seamless across the edge and blend to whatever textures are specified on the other vertices across the face.
     
    Duende likes this.
  31. Duende

    Duende

    Joined:
    Oct 11, 2014
    Posts:
    200
    Ok, I understand. :)
    In case of buying the Mesh Workflow module, could you help me integrate it?

    And let me insist to understand the limit of textures. So in MicroSplat (with the Mesh Workflow module) if I need more than 28 textures, what should I do?
     
    Last edited: Sep 15, 2020
  32. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Well I can point you in the right direction, but I'm not writing the code for you. With MicroSplat you couldn't get past the 28 texture limit - the way it works with texture weights prevents it, and you'd need to do something like what MegaSplat does, which is pretty different and would require a lot of shader knowledge to do.
     
    Duende likes this.
  33. Duende

    Duende

    Joined:
    Oct 11, 2014
    Posts:
    200
    Of course, of course. That's exactly what I mean by helping me.

    Well, the asset is pretty good and it would be great to use it, but the limit of 256 textures in Macrosplat or 28 in the other assets makes it impossible for me to use it because I would need more. (In the early versions of my game that limit is sufficient, but in the long run I need more.)

    Is it possible that you will be able to remove the 28 and/or 256 textures limit in the future? If so, I would try to integrate your asset for sure.

    Thank you very much for your attention. :)
     
  34. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I have no such plans.
     
    Duende likes this.
  35. rohmer

    rohmer

    Joined:
    Mar 24, 2014
    Posts:
    23
    Seems with a unity update mega has started erroring.

    I am running Unity 2020.1.7f1

    When I open terrain paint I dont get the textures (Either on my Texture Array Config or the Megasplat example)

    I just get the attached over and over.
     

    Attached Files:

  36. rohmer

    rohmer

    Joined:
    Mar 24, 2014
    Posts:
    23
    Similar issue when I attempt to click Auto Generate Clusters

    Seems the creation of the PreviewRenderUtility is failing.
     
  37. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I just opened in 2020.1.7 and didn't see any of these issues. Can you try in a new project?
     
  38. rohmer

    rohmer

    Joined:
    Mar 24, 2014
    Posts:
    23
    Sure, could be a bad project upgrade..
     
  39. hmoorev_h539w

    hmoorev_h539w

    Joined:
    Oct 10, 2020
    Posts:
    10
    not work for me !!! i use unity personal and standard bullet-in project

    please see this video :



    when is choose "meshes" in Mesh Scene in Examples and check Active in "Vertex Paint" Tab , nothing happened and i cant see the Brush Visualization!!!

    how can fix that ! i cant paint nothing !!! i follow tutorial videos in assets store :
     
    Last edited: Oct 11, 2020
  40. hmoorev_h539w

    hmoorev_h539w

    Joined:
    Oct 10, 2020
    Posts:
    10
  41. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Well first you should follow the written tutorial and select the custom brush - your on the vertex color painting tab, not using the MegaSplat custom brush. Second, you should try in a new project to make sure it's not something in your project causing an issue.
     
  42. hmoorev_h539w

    hmoorev_h539w

    Joined:
    Oct 10, 2020
    Posts:
    10
    i try in a new project and not working.

    "Well first you should follow the written tutorial and select the custom brush - your on the vertex color painting tab, not using the MegaSplat custom brush" how can do that ?
     
  43. hmoorev_h539w

    hmoorev_h539w

    Joined:
    Oct 10, 2020
    Posts:
    10
    in URP project is fine and i see the brush but all materials in the scene are purple !!! how can fix that ?
     
  44. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    MegaSplat does not support URP..
     
  45. hmoorev_h539w

    hmoorev_h539w

    Joined:
    Oct 10, 2020
    Posts:
    10
    so why brush show in urp project and not show in standard project ?



    see the pointer. i see the brush in URP project ! :eek:
     
  46. hmoorev_h539w

    hmoorev_h539w

    Joined:
    Oct 10, 2020
    Posts:
    10
    can you show me the one tutorial for config megasplat in standard project from zero to hero ? just show me the config brush and nothing else.
     
  47. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    There's 70+ pages of documentation, including a step by step tutorial that walks you through setting up a mesh or terrain. There's about 30 Youtube videos, though they may be made with older versions. I'm not going to record a custom tutorial for every new user, no.
     
    Lorrak likes this.
  48. hmoorev_h539w

    hmoorev_h539w

    Joined:
    Oct 10, 2020
    Posts:
    10
    thanks for your support
     
  49. ixikos

    ixikos

    Joined:
    Jun 21, 2013
    Posts:
    26
    Hey, quick question - I searched the thread and online a bit without too much luck. I am attempting a build on an Oculus Quest and getting this error - Shader error in 'Hidden/MicroSplat/MicroSplat_Base1028754267': undeclared identifier 'geomNormal' at line 4515 (on gles3) . Would you have any pointers on how to go about fixing this one? Or anyu specific information that may be helpful to solve this?
     
  50. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Line numbers aren't really useful in MicroSplat because it generates unique shaders based on the settings, but geomNormal is part of the function in microsplat_terrain_surface_fragment.txt. I'd open up the shader and see which #if block it's happening in, perhaps there's some combination of defines which is causing it to be used but not declared, but looking at it I don't see a clear way that could happen - but it's a lot of conditional compiling, so...