Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    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:
    5,445
    Well, I really wish I knew what the cause was, but I'll take it..
     
  2. Mark_T

    Mark_T

    Joined:
    Apr 25, 2011
    Posts:
    303
    I can email you a few crash reports (crash.dmp and error.log files) if that helps.
     
  3. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,445
    Yeah, that would be great! I know it seems to be fixed, but knowing the cause would help me test for it or avoid it coming back.
     
  4. Mark_T

    Mark_T

    Joined:
    Apr 25, 2011
    Posts:
    303
    email sent
     
  5. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    579
    @jbooth really loving the asset! I haven't tried the texture mixing/clusters yet. I know you were wondering how that might look.. I'm amazed that I can paint with tessellation with so many textures, Substance painter hasn't even achieved this yet!

     
    ftejada and recon0303 like this.
  6. auhfel

    auhfel

    Joined:
    Jul 5, 2015
    Posts:
    92
    Sweet stuff. I like the no norm/specular option, using it with a noise texture to great effect on mobile.
    I do have a couple problems though. I went to the Terrain painter and tried to export only an albedo map, but it kept giving me an ao and emissive texture. I ended up getting the albedo texutre by exporting all, which correctly exported them all.

    My second problem is that I accidentally deleted the splat texture while I was playing with the terrain painter.. Now the terrain painter won't select a terrain anymore. Whenever I select a terrain, it just doesn't do anything.

    I'm attempting to re-import now to see if it'll make the terrain painter behave again.
     
    Last edited: Feb 1, 2017
  7. auhfel

    auhfel

    Joined:
    Jul 5, 2015
    Posts:
    92
    Yup, my terrain painter is broken. It will not select a terrain anymore.
     
  8. TacticalDan

    TacticalDan

    Joined:
    Jan 1, 2013
    Posts:
    35
    Tesselation: Figured out that if you select the Distance option with Detail Noise Texture checked, it crashes on my GTX 770. As long as I don't have Detail Noise, it works fine. Edge tesselation crashes my editor though.
     
  9. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,445
    This is in 0.97? I wonder if there's just some point where it's like "too much, giving up". Ironically, detail noise is very cheap, and doesn't even happen in the tessellation stage..
     
  10. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,445
    So repro is to delete the splat texture from out under it? Did you try closing the window and re-opening it, as that should reset and state..
     
  11. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,445
    That's all voxel's right? If it has normal UVs, you could use Alpha Layer mode to give it a traditional texture, which might be nice just for stuff like normals and general flow lines. Texture clusters are really amazing if you have lots of areas greater than your tiling size.
     
  12. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634

    nice I'm using Mega Splat with mobile as well, are you working with IOS or Android??? also when you get a chance love to see screenshots.
     
  13. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634

    I see Terrain Engine, and Mega Splats are working together now, which is awesome.
     
  14. auhfel

    auhfel

    Joined:
    Jul 5, 2015
    Posts:
    92
    That's the best repro I can give, that's most I can remember. I'll have to start a new project to try to repro it, I still have not gotten it back yet.

    I've re-opened the window many times, even restarted Unity a couple times. Attached image showing that terrain is selected but terrain painter window is not updating.
     

    Attached Files:

  15. auhfel

    auhfel

    Joined:
    Jul 5, 2015
    Posts:
    92
    I'm working on Android, on a relatively weak device ($100 smartphone).

    @jbooth I'm working on setting up a new project for repro. importing takes forever lol.
     

    Attached Files:

  16. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634

    nice, well Unity shaders and even some custom ones had issues with tiling, and blurry terrains in most Android games I seen on the Google Play Store...I notice in your screens and in my games, with MEGA Splats the issue is gone.. SO that is good..
     
  17. auhfel

    auhfel

    Joined:
    Jul 5, 2015
    Posts:
    92
    I really had not had much time to play with it before the terrain painter broke, lol. The noise detail thing is really good though.

    @jbooth I dunno if it's not-efficient or anything, but the one time I made a splat shader I eliminated tiling by simply re-sampling the same texture at a different tiling. Basically, just blending in a texture into itself at a lower scale.. and that effectively eliminated tiling. (although there still isn't a ton of diversity, but the seams are not really visible anymore) Would that be able to be done performantly? This video is where I got the idea, and you can take a quick look at the vid to see how it looks.
     
  18. auhfel

    auhfel

    Joined:
    Jul 5, 2015
    Posts:
    92
    @jbooth I reproduced it. Deleting the splat map texture breaks the Terrain Painter. I found that I can get it back though if I assign any 'ol texture back to the Splat Control in the material..

    I tried then to create a new terrain and also a new megasplat shader, but the new megasplat shader doesn't have a _SplatControl texture and everytime I select the terrain with the painter open, it throws an error "Material doesn't have a texture property '_SplatControl'. I feel like I shouldn't have deleted that texture at all, even though this was on accident and this is just a repro, lol.

    I also tested the texture exports again. It seems like the indices might be messed up-- for the most part, selecting the texture I wanted gave me the texture or textures before it.
     
  19. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    579
    Actually it's a mesh.. I started paint a mixture of single textures to get a feel for the overall coloring.. it gave me hard edges which is great for bricks/stones popping out but then later I hoped I could somehow blend one texture over another so I checked out your videos again.. when I switched to alpha everything turned white so I'm not sure what happened there.. so the next thing I experimented is just switching from top and bottom layers. The bottom layer is the single textures with hard edges then i switched to the top layer and continued painting.. it may not be the correct way but it's still turning out pretty amazing.

    After I'm finished painting this one I need to figure out how to bake/export the individual Diffuse, AO, Normal, Smooth etc because I need to use the model with the crack free tessellation shader from the asset store. I'll be using CaronteFX to process the mesh into a destructible object and the crack free shader is needed to keep all the little fragments from cracking at the Verts/faces. I know you probably wouldn't have the time to make your tessellation shader crack free for meshes and I wouldn't ask.
     
  20. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,445
    Yeah, this is a common technique, but compared to Texture Clusters, is pretty lame. Here's why:

    - Resampling doubles the number of samples needed. That can easily add 10-20 extra samples per pixel.
    - It's temporally unstable as it cross fades between the macro and micro textures
    - It adds noise to your texture patterns

    Texture Clusters, on the other hand:

    - Cost no extra samples. None. The MegaSplat technique is already doing this, so it's nearly free.
    - Allow you to use smaller texture variants (3 1024 instead of 1 2048) while increasing quality. Less memory, better quality.
    - Has no noticeable artifacts on organic surfaces

    I'll bang on this tomorrow and see if I can find a good way to handle it cleanly. Ideally, it would just offer to create another texture.

    Yep, in the Render Baker, right? Should be an easy fix. For now, just render bake them all and delete the ones you don't need..
     
  21. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,445
    If you use AlphaLayer, you put the regular textures in the Macro slots, then use the splat map top layer to blend in splats.

    Hmm, I can't remember if I do this automatically or not, but you might have to switch the shader to not have tessellation to get the correct render baking out of it. Only thing is, for render baking to work, you need a non-overlapping UV set, otherwise bits will render over other bits.

    The few crack free tessellation techniques I've seen require DX11, and I prefer to keep the shader generic at least for now. Perhaps in the future, post 1.0, when I'm not slamming out features at the rate I am now..
     
  22. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    579
    @jbooth About the baking, not sure what the problem would be with overlapped UVs -bits rendering over other bits..
    since all i'd need is the exact texture blended paint job.. merge all diffuse textures painted over each other, merge all normals painted over each other etc.

    I just had a goof up on my paint job.. in my tired state the bridge i was working on I pressed "fill" on the top layer and when I went to the unity and selected undo but it didn't undo at all.. did I just loose all my paint job? If I did, that fill button needs a lock! it's dangerous!
     
  23. auhfel

    auhfel

    Joined:
    Jul 5, 2015
    Posts:
    92
    I figured you would already have known about it, but I was itching to know lol. Thanks for the explanation.

    I think this is necessary. Actually, I don't think I even have any option at all to create another splatmap. I dug around looking for one, but it seems to be a once-per-terrain thing.

    That's right.
     
  24. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,445
    I mean if you have overlapping UVs or UVs outside of the 0-1 range; the last one rendered would win.

    Fills should be undoable.
     
  25. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,445
    You can just create a blank png texture in photoshop; nothing special about it.
     
  26. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    579
    @jbooth undo doesn't undo any painting but it does undo other changes such as adding a macro diffuse texture to the slot. Update: I've just updated megasplat and tried undoing it.. worked...whew!

    About winning with the rendering.. suppose each UV channel can be rendered separately then take those textures and merge the layers in photoshop? is that doable?

    And thanks for the fix in the update! I can now see the single textures!
     
    Last edited: Feb 1, 2017
  27. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,445
    All the render caster does is take your model and recreate it using the UV coordinates as the vertex positions. For a more complete solution, you'd have to use something like Simplygon. I outline the way we do generic render baking with Simplygon in my Unite 2015 talk; basically, render every triangle on a model's lighting inputs (diffuse, normal, etc) to a texture sheet, then rebuild the model using those textures, send the whole thing to Simplygon, and let it spit out an optimized model with one set of textures.

    You could do the same thing with MegaSplat, since it already has a lot of it done for you (mainly, the debug modes let you render out the results of the splat mapping).
     
    Ascensi likes this.
  28. gn0ll

    gn0ll

    Joined:
    Sep 29, 2016
    Posts:
    16
    As someone that is coming from the Unity terrain painting tools, I am having a hard time achieving certain results without the use of the "opacity" slider when painting materials. I can easily blend together materials based on noise, etc, which looks awesome, but its difficult to have 2 materials sitting ontop of each other with some uniform blending between them. Tried a million different combinations of flow/falloff but I can't quite get what im looking for.

    This might be out of the scope of this thread, but just wondering if anyone has any advice / tips / tricks to help me figure out this new style of painting terrain,

    Thanks!
     
    StevenP94 likes this.
  29. zmaxz

    zmaxz

    Joined:
    Sep 26, 2012
    Posts:
    143
    1."Puddles" doesn't work(paint and nothing happened).

    2. Press Puddles ->" Fill " get error(
    NullReferenceException: Object reference not set to an instance of an object
    JBooth.TerrainPainter.TerrainPainterWindow.FillTerrain (JBooth.TerrainPainter.TerrainJob t, Int32).

    3.Does "Puddles" work with mesh terrain (or any plans)?

    Windows10_Unity5.5.0f3_MegaSplat0.97

    MSerror.jpg
     
  30. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,445
    There's a "Brush Target" property just below that which clamps the maximum strength of the brush, I think that's what your looking for.
     
  31. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,445
    Thanks- repro'd this. If you paint on the terrain first, then the fill button will work. Basically an initialization case I missed.

    Puddles work for meshes or terrains, but remember that you need to turn the feature on in the shader generator on your material first. Puddles are painted into UV3.y on meshes. I also happened to find a case this morning where standard puddles (not flow puddles) does not compile correctly, though I'm not sure if I introduced that bug after I shipped 0.97 or not, but if anyone runs into it I can send over a patch..
     
  32. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,013
    Are you still planning integration with TerraFirma? I know they will be releasing soon and I'm curious if MegaSplat integration will be available when they publish.
     
  33. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,445
    There are a few different people doing integrations with MegaSplat right now, but I have no idea when they will ship..
     
    magique likes this.
  34. StevenP94

    StevenP94

    Joined:
    Jun 3, 2013
    Posts:
    143
    @jbooth I have problems with 0.97 and puddles, puddles with flow works instead.
    Another thing: Adding tessellation on an already painted mesh cause disappears of what I painted before. Removing tessellation the painting appears again. Is this by design ?
     
  35. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,445
    Yep, have this fixed already. Use PuddleFlow for now and it'll be fixed in the next patch.

    I switch between tessellated and non-tessellated shaders all the time and have never seen it affect the paint job (the two actually have no knowledge of each other in the code). In fact, the mesh itself doesn't even know it's going to be tessellated by the shader; it's the same mesh. Is there something more to the repro?
     
  36. ncho

    ncho

    Joined:
    Feb 1, 2014
    Posts:
    96
    Hi, this is the devs response, I asked in the ProBuilder thread

    Maybe the two of you could get in touch and work on a solution - considering how widespread ProBuilder is, marketing mutual compatibility would surely be beneficial for both assets.
     
  37. Mark_T

    Mark_T

    Joined:
    Apr 25, 2011
    Posts:
    303
    I used an older version of ASE and I was able to replicate the shader based on the screenshot from megasplat.com, but I get this error. Did I made a mistake somewhere? ASE-MEGASPLAT_error_002.png

    I posted yesterday in ASE thread seeing you check that thread too. There are more people there used and willing to help with ASE specific problems. Megasplat nodes/shaders wise, where should I post?
     
  38. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,445
    It looks about right - I'm going to look into this bug tonight and see what broke. If it's megasplat specific, post here - hell, post here if you think it might be megasplat specific, more info is always good.
     
  39. gn0ll

    gn0ll

    Joined:
    Sep 29, 2016
    Posts:
    16
    Cool. I don't remember seeing that in the terrain paint tools, nor is there any reference in the documentation but I will mess around tonight and see if I can figure it out.

    Thanks again for the quick answers, really appreciate it.
     
  40. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,445
    Sigh.. So many features that need more documentation.. So little time..
     
  41. jococo

    jococo

    Joined:
    Dec 15, 2012
    Posts:
    232
    Thanks jbooth. I used your texture array and it works well.

    I put in my own images and it also works.

    One issue I'm having is scale of my textures. The grass for example appears to big for the terrain.

    Is there a way to tile or adjust the size of the textures or do I have to adjust my texture sizes in Photoshop to be higher density and recreate atlas? Ie make them have a higher density of grass so the scale is correct?
     
    Last edited: Feb 1, 2017
  42. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,445
    You can use per-texture properties (it's in the flow mode property, which isn't very intuitive right now) to enable a per-texture scale. It gives you a min/max scale, and a value per texture which you can set for the scale between min/max value. This works well for small tweaks to texture size, but if you want really large tweaks, I'd suggest recreating your texture in photoshop for better results..
     
  43. Ali-Nagori

    Ali-Nagori

    Joined:
    Apr 9, 2010
    Posts:
    151
    hi jbooth is there is any way for me to access the Splat Data of certain mesh ?
    ..... just like a regular Terrain Data Has ....'terrainData.splatPrototypes'.
     
  44. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,445
    There are several examples of this. If you look at the camera in the examples, it has a component on it that queries the meshes for what texture your standing on and puts this onto the screen. This requires you to export your texture list for runtime (on the Texture Array Config) and add some components to your meshes/terrains.

    Second, there are spheres that roll down the hills and modify the terrain at runtime. That example shows you how to quickly find/edit vertex data on the mesh. The runtime painting example contains lots of comments explaining the optimizations in there that make it roughly 10x as fast as the naive implementation would be.

    These examples/components work on both meshes and terrains.

    There's also a lot of video in the dev logs about this stuff on YouTube..
     
    Ali-Nagori likes this.
  45. Ali-Nagori

    Ali-Nagori

    Joined:
    Apr 9, 2010
    Posts:
    151
    this exactly what initially i wanted to know , before getting it.

    thanks for the quick reply
     
  46. ikefrc

    ikefrc

    Joined:
    Jul 3, 2012
    Posts:
    81
    Hey jbooth, just wanted to let you know that my tessellation crash is gone in 0.97 as far as I can tell. I'm running GTX 680 & 5.4.1f1. Great job, I've also edited my review, which was 5 stars but had the notice about the issue.
     
  47. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,445
    Thanks! Unfortunately I don't know why the crash went away, which I find really unfortunate, but hopefully it's gone forever.
     
  48. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,445
    So, in the last update, one combination of Puddles didn't compile correctly. This is because shaders use a lot of #ifdef's, which only get compiled when certain features are on, so they aren't caught until you dial up that set of features with the editor. I've been doing this by hand for a while now - add a feature, test it on meshes and terrains, with tessellation on and off, with any options I think might affect it on/off, etc. It's pretty easy to miss something. Besides being time consuming, it's error prone, and as 1.0 approaches I'd like a better way to test this stuff.

    So tonight I wrote a test suite that creates and compiles every possible combination of shaders that can be produced by MegaSplat. Well, not quite every one- I still have a few more cases to add, but all the major pathways get compiled and checked for errors.

    It's over 100,000 shaders, and my rough estimation is it'll take Unity about a day to compile them all.

    So to remedy this, I run the combinatoric explosion through the stripper I already have for the UI. It basically takes a list of features and packs it into the data structure the UI uses, and then unpacks it from the UI structure for the compiler. When it does this, it does some validation to remove keywords your not using- stuff like "Hey, if you're in tessellation mode, then you shouldn't bother with parallax mapping, so remove that keyword".

    This reduces the total shader counts to only 25k. That means it possible to create 25k uniquely different shaders with MegaSplat right now. This number will only grow over time as well. Note that this doesn't test for visual errors, just compile errors - so there's still a ton of manual testing that needs to be done.

    But for now, this is something I can run overnight and get results back from. I've already found and fixed a few errors using it - but I'll have to figure out a good balance between test coverage and processing time in the future.
     
  49. jococo

    jococo

    Joined:
    Dec 15, 2012
    Posts:
    232
    I couldn't find the per-texture properties nor the flow property. Is it in a shader or some code section?

    My terrain is very large (hence the need to tile) and I'm surprised there isn't an easy way to tile textures for a terrain painter.

    Is tiling in general a bad idea in your opinion?
     
  50. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,445
    It's in the top most section of the material settings:


    When set to anything but none, you'll see the following show up in the material editor:



    There you can set values for each texture's scale (0->1 from scale range min to max).

    The reason I don't personally scale textures much this way is I prefer consistent texel density.
     
    jococo likes this.