Search Unity

[Released] Advanced Details - MicroSplat Module

Discussion in 'Assets and Asset Store' started by wmpunk, Jan 2, 2018.

  1. wmpunk

    wmpunk

    Joined:
    Sep 5, 2015
    Posts:
    71


    https://www.assetstore.unity3d.com/#!/content/108321
    Introduction sale at 7USD! Will Increase to 15 after next big update.

    What this module does is allows you to use up to 16 detail textures that are alpha mask blended over your existing terrain textures. This allows you to add small details to your terrain such as leaves, small rocks, moss, mud.ect or just add a aditional simple texture that you can't justify replaceing one of you're main 16 splat textures for. The Detail textures placement are stored is a control map inspired by megasplat and uses a similar approach. This limits you to only one detail texture per-pixel on the control map, but because of this approuch it is fast to sample and allows me to store additional data. Each pixel store's height and range restrictions allowing you to paint height and angle restrictions that blend with the alpha mask per-pixel. This lets you effectivly paint detail textures only within certain height or angle ranges of the base splatmap textures.











     
    Last edited: Jan 26, 2018
    ice2011, mgear, nirvanajie and 11 others like this.
  2. superkratos

    superkratos

    Joined:
    Sep 4, 2017
    Posts:
    86
    This could be awesome! Looking forward to your video~
     
    wmpunk likes this.
  3. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,019
    That looks great! Since I'm on a Mac, my big question is: Does it require another sampler?
     
    wmpunk likes this.
  4. coverpage

    coverpage

    Joined:
    Mar 3, 2016
    Posts:
    385
    Can it have normal, or is it albedo only. Great to see another developer building on top of microsplat.
     
    wmpunk likes this.
  5. antoripa

    antoripa

    Joined:
    Oct 19, 2015
    Posts:
    1,150
    excellent .. that is really amazing .
     
    wmpunk likes this.
  6. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,690
    Great!! Looking forward to this!! Love to see others making modules, not that Jason's are not great, but the more, the merrier. :)
     
    StevenPicard and wmpunk like this.
  7. Whippets

    Whippets

    Joined:
    Feb 28, 2013
    Posts:
    1,775
    Is there a tool for hand painting specific decals on the terrain, and is there decal blending?
     
    wmpunk likes this.
  8. blitzvb

    blitzvb

    Joined:
    Mar 20, 2015
    Posts:
    284
    Does it can be changed at runtime? I am thinking blood...
     
    wmpunk likes this.
  9. wmpunk

    wmpunk

    Joined:
    Sep 5, 2015
    Posts:
    71
    Unfortunate yes it does require one more sampler.

    Yes! There is a special painter that comes with the asset. Because the data is stored in an un-conventual manner compared to splats it is required to work with a special too to paint them. Currently everything has to manually painted. There are plans to release a basic procedural tool to help jump start the process for large terrains in the future.

    Technically there is no decals, I call them "details" to avoid confusion, but I sometimes catch myself referring to it as decals :)

    There is no current built in tool for run time modification. The data is stored in a texture so all you would need to do is modify the pixels at run time. I intent to through in a few methods to make run time painting simpler. This is super simple and if the asset gets released before that change is updated I can send you a quick fix for it.

    Blood is a really cool idea that I thought about but haven't tried with this yet. It may or may work well depending on how you intend to use it or how the textures are setup. If your intent to use it for smooth puddles with flow (like how dying light does their blood puddles) then this probably is not what you need. If you want blood that would be random splotches or make trails for injured characters then this could potentially work.

    Well developing this there are allot of features or blending methods I had to cut because although they worked well, it did not make sense have all the extra overhead in code for one feature that would only be used on one out of 16 textures (if the user even desired so). With that being said I'm willing to work with people who find they are in need of a special case for their project. As most of these I assume would end up mainly being related to blending which is simple to change. If it turns out that you desire blood and it turns out this doesn't quite work out then I'm more than willing to work with you to figure out what could be done to make it work for you. :)
     
    Last edited: Jan 2, 2018
    blitzvb and antoripa like this.
  10. wmpunk

    wmpunk

    Joined:
    Sep 5, 2015
    Posts:
    71
    Each texture has a normal slider than lets you set how much of the normals to blend in.
     
  11. blitzvb

    blitzvb

    Joined:
    Mar 20, 2015
    Posts:
    284
    simple enough.

    In the use cases of the blood, that stain the ground after an injury, will it be faster than a decal?
     
  12. wmpunk

    wmpunk

    Joined:
    Sep 5, 2015
    Posts:
    71

    I would say it would probably be easier and more feasible to go with decals by them selves or use a projector, unless you are thinking of having trails of blood that last very long periods for hunting...or you just want a blood bath of a game and want to soak all your enemy's and leave the stained reminders of you're battle for the duration of the play..then this could probably work. :rolleyes:

    But if that be the case you would have to either not use the details for the terrain because adding new blood would blend out terrain details, or we could add a second layer in. I can't say how the performance would be compared to doing it that way vs details or a projector would fair. If you're goal was to drench everything then I could safely assume it would probably be faster that using as many decals or projectors it would need to accomplish that.

    I would say when it is released, before you consider purchasing you should send me a PM and we can go over more specifics if you want to decide if this would work for you. I will gladly accept your money but there really is no need for you to purchase something if it is not gonna suit your needs. :)

    I will make sure to get a video up tommorow
     
    blitzvb likes this.
  13. blitzvb

    blitzvb

    Joined:
    Mar 20, 2015
    Posts:
    284
    Make sense. Nevertheless a great addition to microsplat.
     
  14. Whippets

    Whippets

    Joined:
    Feb 28, 2013
    Posts:
    1,775
    blood trails should be the same as footprints, car tyre trails, all that sort of thing.
    Wonder how to pass new data from server to all clients...
     
  15. StevenPicard

    StevenPicard

    Joined:
    Mar 7, 2016
    Posts:
    624
    Looks very interesting. Can't wait to see the video.
     
  16. wmpunk

    wmpunk

    Joined:
    Sep 5, 2015
    Posts:
    71
    I don't have any experience with networking in Unity. I would assume if you wanted to make run time changes to sync over a network then you would probably have the server send a event with a pixel coordinate and value change,and every client would have there own texture modified on there side from the server event.
     
  17. wmpunk

    wmpunk

    Joined:
    Sep 5, 2015
    Posts:
    71
    Video up!

     
  18. StevenPicard

    StevenPicard

    Joined:
    Mar 7, 2016
    Posts:
    624
    Will this conflict with any of the other Microsplat plugins? Can they all be used together?
     
  19. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,607
    No, works fine with everything else..
     
    ice2011 and StevenPicard like this.
  20. StevenPicard

    StevenPicard

    Joined:
    Mar 7, 2016
    Posts:
    624
    That's great to hear!
     
  21. superkratos

    superkratos

    Joined:
    Sep 4, 2017
    Posts:
    86
    Seems great! I think with these features, you could release the first version;)
     
  22. wmpunk

    wmpunk

    Joined:
    Sep 5, 2015
    Posts:
    71
    The asset has already been submited for review;)
     
  23. wmpunk

    wmpunk

    Joined:
    Sep 5, 2015
    Posts:
    71
    Mr booth has already answered this, but I would like to add that it blends nicely with other modules aswell. The Global Texturing module will work ontop of the detail textures, the per-pixel mask features will adjust to the Anti-Tiling and Clustets module.
     
    StevenPicard likes this.
  24. superkratos

    superkratos

    Joined:
    Sep 4, 2017
    Posts:
    86
    That's great! Can't wait to give it a try~
     
    ice2011 and wmpunk like this.
  25. suchoparek

    suchoparek

    Joined:
    Nov 10, 2014
    Posts:
    7
    Hi @wmpunk, sorry if I bother you, I need help about a little feature I'd like to port in MicroSplat. I know I should ask to Jason, but I've read about the runtime blood idea, it seems pretty near to what I have in mind.

    Before I downloaded MicroSplat, I've managed to create a tiny shader that read the depth of an ortho camera (positioned well below the terrain, looking up) and write the movement of the player in a renderTexture used as an input for a displacement shader.
    This is to let the player modify the terrain as he walks (ie: leaving a trace on snow or even sinking into it).

    Now, I'd like to use that renderTexture in the "Tessellation and Parallax" module, as an input of the "displacement" Per Texture Properties (whereas currently there is a slider that works globally and not on a per-pixel basis).
    I've tried to edit the module (microsplat_func_tess and microsplat_properties_tess) but I'm simply not skilled enough in shader coding to make this little change.

    If you could put me on the right track I'd be really grateful. Of course, if you can't it's not a problem. :)

    Anyway, your module is awesome, it would be even "awesomer" with a runtime painting feature (I know, I'm obsessed with runtime :) ).

    Thanks.
     
  26. antoripa

    antoripa

    Joined:
    Oct 19, 2015
    Posts:
    1,150
    Working on that plugin ..I will have ready in next few weeks ..
     
    wmpunk likes this.
  27. blitzvb

    blitzvb

    Joined:
    Mar 20, 2015
    Posts:
    284
    Blood or runtime ?
     
  28. wmpunk

    wmpunk

    Joined:
    Sep 5, 2015
    Posts:
    71

    Looks like antoripa has you covered!;)

    For education purposes..
    You have 3 options for adding custom shader code.
    1. Modify a already created microsplat shader (Not recommended: If you click any features or PerTex it will recompile and erase your changes).
    2. Modify core microsplat files (keep backups so core updates don't erase your files).
    3. Make a module.
    Pertex properties are a little more difficult to implement fluidly with out a custom module setup. You can easily modify the core micro splat code to force youre added features but at this point (pertex properties, GUI,ect) you are pretty much already writing close to the same amount of code that is needed to make a module. I would recommend taking a look at the FeatureDescriptor.cs class then MicroSplatTessellation.cs to get a idea of how things work. After that take a look MicroSplatPropData.cs to see how PerTex properties are stored.

    Shader side implementation should be pretty straight forward. If you already have a global version (per-pixel) working then all you need to do is add a pertex call (Assuming you follow microsplat pertex convention) and use its value to modify you global one. If you have a more specific question feel free to PM me. Hope that helps!


    Perhaps you could give us a few more specifics about what you need for blood? :)
     
    Last edited: Jan 20, 2018
    antoripa likes this.
  29. blitzvb

    blitzvb

    Joined:
    Mar 20, 2015
    Posts:
    284
  30. antoripa

    antoripa

    Joined:
    Oct 19, 2015
    Posts:
    1,150
  31. antoripa

    antoripa

    Joined:
    Oct 19, 2015
    Posts:
    1,150
    I think that you can use Advanced Detail for that .. need to paint locally to the char in playmode .. should be not a challenge .. better get @wmpunk opinion
     
  32. wmpunk

    wmpunk

    Joined:
    Sep 5, 2015
    Posts:
    71
    So I went and downloaded this pack
    https://www.assetstore.unity3d.com/en/#!/content/7518
    And did a test.

    First off all these are sprite textures which is not really what this system is intended to use, and they are not set up for pbr or any sort of alpha blending.
    I did the most basic setup



    and these are some of the results






    This is the most very basic/worst case setup you could use and not what I would recommend bothering with.
    Now if you had a seamless blood texture and a alpha map set with different layers then you could do some really cool splatter/layer/chunk blood painting, and I believe this would look completely awesome.

    I am including a utility for making seamless textures from sprites. It wont make it on the initial release but hopefully shortly after. What this will do is allow you to plug in sprites and give them some values and a count and it will automatically make a seamless texture with the sprites stamped around randomly and build a alpha mask. This would allow to download a blood pack and create a seamless texture like the one I described above.

    I would recommend moving forward with a classic decal implementation. Decals are pretty simple and you can find plenty of scripts on the asset store. Then later on if you decide to do it with the Advanced Details module you can just replace the code that spawns decals with one that paints to the control map. Either way you will need code that spawns or paints the blood so I would start there.

    Hopefully this helps!
     
    antoripa likes this.
  33. blitzvb

    blitzvb

    Joined:
    Mar 20, 2015
    Posts:
    284
    agreed! thanks for your help.
     
    wmpunk likes this.
  34. suchoparek

    suchoparek

    Joined:
    Nov 10, 2014
    Posts:
    7
    That's a piece of news. :)

    Thanks a lot @wmpunk, you are very kind, I'll definitely try your suggestions. :)
     
    antoripa and wmpunk like this.
  35. wmpunk

    wmpunk

    Joined:
    Sep 5, 2015
    Posts:
    71
    Still pending review..
    Here is a little demo of the prototype for the texture utility that will be included in the module (when completed).

     
    one_one, antoripa, suchoparek and 2 others like this.
  36. wmpunk

    wmpunk

    Joined:
    Sep 5, 2015
    Posts:
    71
    Good news! As of today Advanced Details is now up on the asset store!

    In related news, in my first time asset submission I misunderstood the process of updating a asset in pending and the asset shipped without the demo scene or textures..I got it figured out now and just submitted a version update and regressed the editor submission from 2017.3 to 5.6 and includes the demo scene and textures. Hopefully it will be live tomorrow. Once the version update is live I will change the thread to released.

    And in other news! The Splatter texture utility is getting close to complete. Unless there are any hot-fixes needed after the update is live expect the next version to include the splatter texture utility and possibly maybe 1 or 2 more textures.
     
    mons00n, antoripa, blitzvb and 2 others like this.
  37. blitzvb

    blitzvb

    Joined:
    Mar 20, 2015
    Posts:
    284
    Congrats!
     
  38. wmpunk

    wmpunk

    Joined:
    Sep 5, 2015
    Posts:
    71
    And patch is live, all good! Officially Released!
     
    blitzvb and antoripa like this.
  39. franky_li

    franky_li

    Joined:
    Aug 8, 2016
    Posts:
    129
    I've bought your asset and have a problem with UV scale for single textures, it's not working at all. No matter what value I enter, nothings changes, only the global UV scale is working. Is this a bug or did I missed something?
     
  40. franky_li

    franky_li

    Joined:
    Aug 8, 2016
    Posts:
    129
    Hi,
    is there any undo function or a way to delete strokes without having to clear everything?
     
  41. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,019
    Finally trying this...in the Example scene, the shader inspector lists three maps under Default Maps. I understood that was the list of samplers, so this suggests it uses three samplers...or is this not accurate in this case, and it really only uses one?

    They are:
    AdvDetailAlbedo
    AdvDetailNorma
    AdvDetailContro

    Also curious about the Undo question above.

    thanks
    Dave
     
  42. wmpunk

    wmpunk

    Joined:
    Sep 5, 2015
    Posts:
    71
    I just submited a patch to the asset store, it should be avaible in a day or two. To fix right now open up AdvancedDetail/Scripts/Editor/Fragments/microsplat_functions_AdvancedDetail.txt and change line 195 from
    "float indexScaler = 255.0/16.0;" to "float indexScaler = 255.0/32.0;"
     
  43. wmpunk

    wmpunk

    Joined:
    Sep 5, 2015
    Posts:
    71
    You can undo the last stroke with control-z, or if you just want to change a specific setting (texture,restriction,ect) there is the paint options setting right above the texture select in the painter. This will allow you to select wich options you want to paint, if you select weight only and put the target value to zero it essential acts as a eraser.
     
  44. wmpunk

    wmpunk

    Joined:
    Sep 5, 2015
    Posts:
    71
    Ah yes thank you for pointing this out, I will fix this in the next fix. Yes it uses 3 samplers as I believe texture array samplers cannot be shared. Currently the control uses its own sampler but I will probably change to to share a sampler with the splatmap so it will go down to 2 samplers.
     
  45. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,019
    Ah, darn it, I was counting on just a single sampler. Well, maybe I can squeeze it in still...
     
  46. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,607
    They can actually be shared; most languages post dx9 separate samplers and sampler states. The problem is that Unity has never wrapped the texture array access this way, so you’d have to define your own macros and figure out what the syntax is for each platform. This might be easy to do if you look at the new HD pipelines hlsl/Hall wrapper files, as they likely use texture arrays and separate samplers from states in that pipeline. This could also be used to make texture clusters share samplers with the main arrays as well.
     
  47. wmpunk

    wmpunk

    Joined:
    Sep 5, 2015
    Posts:
    71
    So currently there are some some breaking errors with the Advanced Detail module. I have already fixed these issues weeks ago but the update keeps getting rejected by the asset store without notification or reason for rejection. I'm in the process of getting a hold of Unity to figure this out. For anyone needing the update feel free to message me and I will send you the patch while I get this worked out.
     
    antoripa likes this.
  48. sylon

    sylon

    Joined:
    Mar 5, 2017
    Posts:
    242
    Hi.

    I am experimenting with your module. Works great :) Nice addition to MicroSplat.
    Was expecting to find the Splatter Utility as well.. also update problems?
     
  49. wmpunk

    wmpunk

    Joined:
    Sep 5, 2015
    Posts:
    71
    Hello! Update problems have been resolved and has gone though. The Splatter Utility is included. I need to do a update on the documentation and update the asset store. To use the Splatter Utility create a new Splatter texture asset from MicroSplat/AdvancedDetail/SplatterTexture in the Asset menu. You can blend up to 4 layers and export it in slandered or microsplat packing format.
     
  50. sylon

    sylon

    Joined:
    Mar 5, 2017
    Posts:
    242
    I was wondering why SplatterPrototype.cs was already included :)
    Updating the docs is a good idea i think ;)