Search Unity

Blend Machine - Blending tool using height maps and mesh contact!

Discussion in 'Shaders' started by Blobinet, Apr 3, 2018.

  1. Blobinet

    Blobinet

    Joined:
    May 4, 2015
    Posts:
    20
    Hello !
    I have finished my blending tool, capable of blending a large amount of PBR materials on a single mesh using height maps for better transitions (sand filling in the cracks of a cobblestone path for example).
    It is also capable of blending objects together based on proximity, designed to hide seams where meshes intersect.
    You can get it for free here !

    Please try it out and tell me what you think !



     
    Last edited: Apr 3, 2018
  2. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,391
    I'm surprised nobody talking about this, might want to create a new thread in MWU or WIP forum.
    I'll check it out :)
     
  3. Blobinet

    Blobinet

    Joined:
    May 4, 2015
    Posts:
    20
    I made another thread in MWU ! Please send any feedback you might have once you try it !
     
    Reanimate_L likes this.
  4. GameDevCouple_I

    GameDevCouple_I

    Joined:
    Oct 5, 2013
    Posts:
    2,219
    looks nice but doesnt polybrush already do this for free in unity?

    EDIT: saw it also blends heightmaps which is cool
     
  5. Blobinet

    Blobinet

    Joined:
    May 4, 2015
    Posts:
    20
    Yes, it uses height maps for better blending + is has a contact blending shader which is designed to hide seams where meshes intersect !
     
    GameDevCouple_I likes this.
  6. tcourbet

    tcourbet

    Joined:
    Oct 5, 2017
    Posts:
    46
    It looks great, especially for a free asset! :)
    I haven't tried it yet (I will soon!) but I assume the Contact Blending is just between 2 meshes and won't work on terrains?
     
  7. Adam-Bailey

    Adam-Bailey

    Joined:
    Feb 17, 2015
    Posts:
    230
    Awesome of you to release this for free. Obviously the functionality can be achieved with polybrush but just from the video I can see situations where this tool would be easier to use.
     
  8. Blobinet

    Blobinet

    Joined:
    May 4, 2015
    Posts:
    20
    There are two types of contact blending, one works between any two meshes (it needs a mesh collider for baking, haven't tried with a terrain collider yet), but the texture that appears at the intersection is defined on the material (it could be something completely different from the texture on the terrain if you wish !)
    As for the other type, it only works between a mesh and a floor using my blending shader, but allows for multiple textures to blend onto the object based on distance
     
  9. Blobinet

    Blobinet

    Joined:
    May 4, 2015
    Posts:
    20
    I don't think polybrush can do height blending out of the box can it ? I also believe it only supports 4 textures max per mesh ? My tool does height blending and has potentially no limit on the amount of (pbr!) materials usable per mesh (the limit would be GPU memory)
     
  10. Adam-Bailey

    Adam-Bailey

    Joined:
    Feb 17, 2015
    Posts:
    230
    If you get fancy and use the new Shadergraph then it can be done, but certainly not as easily as this (plus that doesn't work with legacy pipeline like yours does).
     
  11. tcourbet

    tcourbet

    Joined:
    Oct 5, 2017
    Posts:
    46
    Thanks for the answer!
    Sorry if I'm misunderstanding, but I assumed that the transition texture would have to come from a mesh with a BlendMachineSurface material applied. In the case of a terrain, that would mean replacing the default terrain shader with a custom one, right? I don't think that would work to just swap it with a BlendMachineSurface?
    But I might be missing something! :confused:

    Edit: works really well between 2 meshes though!
     
  12. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,391
    @Blobinet Oh btw when i select a texture array asset your editor script that showed the content ,it make the editor to slow down, like a lot
     
  13. Blobinet

    Blobinet

    Joined:
    May 4, 2015
    Posts:
    20
    @tcourbet If you want to use it with a unity terrain, you can use the simple contact blending, but that means only one texture will be blended onto your object

    @Reanimate_L Are you using the latest version ? Initially I showed the textures, but that made the editor way too slow with large arrays/textures so I only show the paths to the original textures now, which should not lag (if it does, please tell me the texture count and dimensions, or even send me the array if you can)
     
  14. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,391
    Oh there's an update? i'll try the latest
     
  15. Milanis

    Milanis

    Joined:
    Apr 6, 2018
    Posts:
    53
    Holy cow! Blobinet! If this is becoming something strong like this: http://polycount.com/discussion/174377/witcher-3-blood-and-wine-architectural-material then you should think about releasing a pro package. Thank you for the free shader, you got money. <3

    Atm, we're looking for an solution like seen on the blood-and-wine architectural material, supporting these numbers of PBR with a lot of options for coloring, blending and adding additional dust/rust/dirt layers on top. I'm going to test your shader and will response with a little review after. Thank you, Sir.
     
  16. Blobinet

    Blobinet

    Joined:
    May 4, 2015
    Posts:
    20
    Please do ! And tell me if you have any suggestions !
     
  17. BKprod

    BKprod

    Joined:
    Sep 19, 2014
    Posts:
    14
    Hello Blobinet !

    I've just purchased your plugin. I have looked for something that blends multiple materials with height for years now.

    The thing is, everything works as intended except the painting part !
    I've done everything you show on the video, the array is built, textures are showing on my mesh, I can even fill texture or wetness. Only the painting part won't seems to work for me.

    Maybe I am missing something ?
    I'm using Unity 2018.1.0f2
     
  18. Blobinet

    Blobinet

    Joined:
    May 4, 2015
    Posts:
    20
    Hey, that's weird ! Can I get some more info ?
    Once you enable paint mode, do you have any errors ? Does the gizmo show up on the mesh but clicking does nothing ? Have you enabled the texture paint checkbox and set the intensity to more than 0 ?
    I have not tested my tool on your version of unity, but if you are using the legacy pipeline there should be no problems
     
  19. BKprod

    BKprod

    Joined:
    Sep 19, 2014
    Posts:
    14
    Yep exactly as you say, painting is enabled, the gizmo shows up, I haven't any errors in the console, but clicking does nothing. I'm not using HDRP or Lightweight.
    Curiously I also tested with 2017.4.2f2 and the same problem appears.
     
  20. Blobinet

    Blobinet

    Joined:
    May 4, 2015
    Posts:
    20
    Mhh, does this also happen in the demo scene ? What is your current build target ?
    If you can fill different textures onto your mesh my best guess would be an issue with the settings...
    I could take a look at it tomorrow if you can send me the files
     
  21. BKprod

    BKprod

    Joined:
    Sep 19, 2014
    Posts:
    14
    Well I was just testing that, and it works perfectly whith the demo package on any other new project.
    Same settings, same plugins, same Unity version... (it's a VR project with some plugins targetting Windows.)
    Very curious.

    I've done everything I could with various versions, the painting just won't work on this specific project.
    At least it works now. Thanks for the awesome plugin !
     
  22. Blobinet

    Blobinet

    Joined:
    May 4, 2015
    Posts:
    20
    Glad you managed to resolve it !
    (Might have been an issue with gamma/linear space ...)
     
  23. sjm-tech

    sjm-tech

    Joined:
    Sep 23, 2010
    Posts:
    695
    It looks interesting!
    Any plan to release it on asset store?
     
  24. Blobinet

    Blobinet

    Joined:
    May 4, 2015
    Posts:
    20
    Eventually yes, I need to implement some improvements I've been thinking about and polish polish polish even more first
     
    sjm-tech likes this.
  25. danielrugu

    danielrugu

    Joined:
    Jul 24, 2016
    Posts:
    14
    This is one of the best finds in this forum. Great work
     
  26. Deleted User

    Deleted User

    Guest

  27. Quast

    Quast

    Joined:
    Jul 5, 2015
    Posts:
    488
    Thank you for sharing this tool. I tried to use it in my project using unity 2018.3.0f2 PipeLine.
    I'm trying to blend house with ground. I't didn't work !!!
    First it doesn't work. It's give me pink material all the time !! I tried to update this mate to LRP but not updated !!?
    Second, I think what you showing in this video is old version. From first second till 1:03 all steps is good but the house is still pink !!
    Could help me with this issue ?
    Thank you.
     
  28. Blobinet

    Blobinet

    Joined:
    May 4, 2015
    Posts:
    20
    @Quast It only works with the legacy rendering pipeline for now. I will eventually port it to the HDRP
     
    Wietrzyk and Quast like this.
  29. Quast

    Quast

    Joined:
    Jul 5, 2015
    Posts:
    488
    Great. I hope you will do that soon. Thank you.
     
  30. d12duke

    d12duke

    Joined:
    Mar 22, 2016
    Posts:
    37
    This is absolutely Phenomenal!!
     
  31. Jeremy-Borton

    Jeremy-Borton

    Joined:
    Oct 21, 2015
    Posts:
    52
    Thank you so much, this is amazing!!!
     
  32. Myging

    Myging

    Joined:
    Oct 23, 2014
    Posts:
    2
    When I apply the Contact Blending Baker Script, it sais that the "SourceMesh is not readable !" and the blend does not work at all. Nor does the painting.


    Update: Sourcemesh could be made readable in the import settings of the mesh by enabling Read/write. The issue is that the blend between two meshes does not work at all. There is a harsh line.
     
    Last edited: Jun 17, 2019
  33. andreiagmu

    andreiagmu

    Joined:
    Feb 20, 2014
    Posts:
    25
    I downloaded Blend Machine today, is there a version number anywhere? It would help to identify if some user is using an outdated version of the asset.

    In my tests, the BlendMachine Surface shader, the texture painter and the Advanced Contact Blending shader are working nicely! :)
    But the Simple Contact Blending shader doesn't seem to be working... :(

    I'm using Unity 2019.1.2f1. I tested the Simple Contact shader in the demo scene (using the included test objects), and in another scene where I created other objects and added the necessary components (following the pdf guide's instructions).
    In both cases, I click the Bake button and nothing seems to happen.
     
  34. Blobinet

    Blobinet

    Joined:
    May 4, 2015
    Posts:
    20
    I haven't updated it in almost a year, the last tested unity versions was 2018.x, but as long as you are using the legacy pipeline, it should work, as I don't remember seeing breaking changes since then.
     
  35. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    899

    It would be really nice if this were updated to work in HDRP/LWRP and on 2019.2+

    I've not seen a tool like this before. I'm pretty certain it'd be ridiculously popular! -- Are there still plans to update it?
     
    pachermann likes this.
  36. Blobinet

    Blobinet

    Joined:
    May 4, 2015
    Posts:
    20
    I do plan on updating it ! I was waiting on the HDRP to properly release before adapting it. I had no plans for LWRP initially since it was supposed to be for mobile platforms, but with the updated goals I intend to start working on a version soon actually :)
     
    awesomedata, MaDDoX and Milanis like this.
  37. Milanis

    Milanis

    Joined:
    Apr 6, 2018
    Posts:
    53
    This is awesome news! Thank you for doing this since we would really love to use it on our HDRP pipeline. You're awesome.
     
  38. MCYCShadow

    MCYCShadow

    Joined:
    Jan 1, 2018
    Posts:
    6
    It is such a neat tool, but i cant seem to use it anymore since some parts of the scripts need to be updated. Its simply the panter cursor who seems to not be working anymore on the 2019.2 version.


    Edit: i should have attached some more infos.


    Those are the warnings i get.

    Edit2:
    It seems that it is the same problem like BKProd had. If i add the tool to a different project it just works fine.
     
    Last edited: Oct 7, 2019
  39. pachermann

    pachermann

    Joined:
    Dec 18, 2013
    Posts:
    63
    @Blobinet hey, how the progress of the HDRP port? can't wait to buy it!
    thanks :)
     
  40. Blobinet

    Blobinet

    Joined:
    May 4, 2015
    Posts:
    20
    I'm trying to implement it into shader graph for a more modular approach, but right now shader graph is still a bit limited for what I want to do with it, I'll post updates once I'm happy with it :)
     
    awesomedata and Quast like this.
  41. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    899
    I'm curious about what limitations you're facing -- I'm actually surprised at how robust shader graph has become, but I've been looking into doing what you're doing for quite some time with different solutions and I've had no real luck in getting it to be flexible across multiple non-terrain mesh objects (which is what I'm aiming for).
     
  42. Immu

    Immu

    Joined:
    Jun 18, 2013
    Posts:
    155
    Ahr yes, we would be in a dear need of shadergraph support, with LWRP compatibility :3
    Nontheless, impressive work. Will definitely pay for such an asset like that :)
     
  43. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    484
    love it. thanks
     
  44. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    484
    OOH.
    Do you think it is possible to get the bakin right.
    Here my result in 2019.3.0f1.
    I lowered the samples so that the non baked areas (no dots) are better visible.

    BAKE.JPG
     
    pachermann likes this.
  45. Blobinet

    Blobinet

    Joined:
    May 4, 2015
    Posts:
    20
    @Immu @awesomedata
    I've started working on an HDRP-compatible version (and LWRP too I suppose, nothing is really specific to a pipeline since I'm making it graph-compatible). My focus is on the painting/blending part for now as I'm not sure how to modify the tangents of the mesh in shader graph for the contact blending at this moment.
    Here is a WIP gif, showing shape brushes :)
    I also want to make the blending tool more versatile, and the paint tool now paints the control map in a generic way, you can then use this data however you want in shadergraph for all your blending needs.
     

    Attached Files:

    Immu, awesomedata and Quast like this.
  46. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    899

    Seems like this node might give you some access to the mesh tangents you need? -- I'm not sure, but I'm thinking creatively here, that you may be able to do some of your special processing stuff in a "SubGraph" (which seems to be the way Unity is wanting us to do it).

    As you may already be aware, ShaderGraph has all the basic "stages" of rendering, and as such, maybe this is helpful for understanding how to customize that portion. Honestly, a SubGraph step seems like a good idea to make it more modular anyhow.


    I think a triplanar world space texture could be a good start, then a detail texture overlaid onto the World Space texture to make it blend more easily. There was a Star Wars game that had a world-space blended shader like this actually. They could control the blur between the contact positions this way without having to get into the grit too deeply. Maybe they too modified the tangents, but I don't remember. There's a nice video on the net about this if you haven't seen it already. It might give you some ideas.


    Great job with the texture blending though! -- Looks really nice so far! Hopefully this works with meshes as terrain too.
     
    Blobinet likes this.
  47. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    484
    check this out. couldb helpful.
    https://blogs.unity3d.com/2019/11/2...e-surface-gradient-framework-in-shader-graph/

    I also baked your demo scene in Bakery(Directional Dominant direction and shadowmask) . The result is much better than Progressive but the blending areas normals are not correct. They seem rotated.
     
    Last edited: Dec 20, 2019
    Blobinet likes this.
  48. talharing

    talharing

    Joined:
    Oct 27, 2013
    Posts:
    9
    Hello!

    I am using the regular 3D rendering path, 2019.2.11f, but when trying to use the Contact Blending Shaders I get different results between scene mode and game mode...

    scene:


    game:


    Do you have any idea why?

    Thank you for everything! Great tool!

    Also, I was wondering if there is any way to use this tool to also paint decals?

    Thx again,

    T.H
     
  49. MCYCShadow

    MCYCShadow

    Joined:
    Jan 1, 2018
    Posts:
    6
    Hey Hey, strange things happening currenty to my project i am working on.
    Overall the tool works fine, besides some pixelated fragments if i use more then 4 materials on the same spot over time.

    I am stuck now with the problem that i want to create a new control map for the next big part of my level and when i click once to start painting, it just turns the control map all black and nothing happens, i cant paint anymore, tried it with different meshes.

    Only then once who already have a working control map are still fine and paintable. :(
    What i try now, is to manually create new controll maps in another project to then import these into the main project and see if they work again

    Edit:
    It doesnt work, but seems to be mesh related. On some meshes this bug happenes, i cant seems to find a fix, besides creating a simple plane and using this as the texture plane to paint on and then use the control map of the plane


    Edit2: i added the file i am having problems with. anyone can try if this problem occurs at their place as well.

    Edit3: I have been able to fix the issue by recentering the pivot to the individual parts of my cave system, freezing the position and deleting the objects history. After that it worked fine again.
     

    Attached Files:

    Last edited: Dec 29, 2019
unityunity