Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

GPU Cloth Tools

Discussion in 'Assets and Asset Store' started by andrii-shpak, Jan 4, 2017.

  1. nirvanajie

    nirvanajie

    Joined:
    Jan 7, 2016
    Posts:
    42
    Any progress on opengl support right now?
     
  2. andrii-shpak

    andrii-shpak

    Joined:
    Nov 27, 2014
    Posts:
    315
    Just started working on this now. Will have more info up to the end of this week
     
  3. cgarossi

    cgarossi

    Joined:
    Jun 23, 2013
    Posts:
    70
    I've sent some questions to your support email. I am very interested in this but I'd like to know how the Cloth shader handles transparency (if it's possible) and how it handles skinned mesh renderers with more than one material slot.
     
  4. trilobyteme

    trilobyteme

    Joined:
    Nov 18, 2016
    Posts:
    306
    OpenGL support would be nice.... but I think Metal and Vulkan look like the way forward. Metal (and the Metal2 2nd-gen API release coming in the fall) run circles around OpenGL for performance, and based on the VR/AR kit support Unity's been doing in betas it appears that they will be sooner rather than later for Metal2. I think Vulkan will be the API of choice for newer Android devices.
     
  5. andrii-shpak

    andrii-shpak

    Joined:
    Nov 27, 2014
    Posts:
    315
    Never version support submeshes (multiple materials) Now is waiting for approve,
    Same for transparent shader It is in new build.
    You can write me to may support mail and I'll send you it dirrecty.
     
  6. cgarossi

    cgarossi

    Joined:
    Jun 23, 2013
    Posts:
    70
    Great thanks!
     
  7. may10086

    may10086

    Joined:
    Jun 19, 2017
    Posts:
    2
    When the plug-in can support self-collision? I need your tool to solve my problem.
     
  8. mrbdrm

    mrbdrm

    Joined:
    Mar 22, 2009
    Posts:
    510
    i am having troubles with a mesh that have shell modifier from 3ds max.(overlapping)
    is there self collision? or do you have a suggestion to fix this issue?
    my character have a coat that i want to apply cloth physics on it.
     
  9. andrii-shpak

    andrii-shpak

    Joined:
    Nov 27, 2014
    Posts:
    315
    Not yet, but in plans
     
  10. andrii-shpak

    andrii-shpak

    Joined:
    Nov 27, 2014
    Posts:
    315
    Could you show a screenshot? You can send me it to my mail
     
  11. GrailLinV

    GrailLinV

    Joined:
    Jul 25, 2017
    Posts:
    3
    excuse me, I noticed that you made a custom engine based on Verlet integration. I'm wondering if you use mass spring system as simulation model for cloth. Thanks!!!
     
  12. andrii-shpak

    andrii-shpak

    Joined:
    Nov 27, 2014
    Posts:
    315
    Yes, It is mass - spring system
     
  13. snowgundam

    snowgundam

    Joined:
    Apr 17, 2013
    Posts:
    7
    hello,andrii-shpak,I bought the GPU Cloth Tool,and I use it for a skinnedMeshRender skirt, but it turned out that the nomal directions of some vertices are 180 degree reversed。 I will show some images of this。
    Maybe there are some wrong steps in my cloth setting operations,do you know how to fix this problem?
    Thanks very much.
     

    Attached Files:

  14. mrbdrm

    mrbdrm

    Joined:
    Mar 22, 2009
    Posts:
    510
    i am having issues with brush painting.
    when i press P nothing is drawn on the mesh. i tried playing around with the settings but nothing work
    the only thing working is the button 'apply value for all'
     

    Attached Files:

  15. snowgundam

    snowgundam

    Joined:
    Apr 17, 2013
    Posts:
    7
    You need to enable the meshColider of the cloth.
     
  16. mrbdrm

    mrbdrm

    Joined:
    Mar 22, 2009
    Posts:
    510
    it's enabled and there is no errors in the log too
    Pre compute log
    Vertices Num: 9351
    Physics Vertices Num: 8390
    Mesh Vertex To Neibor Num: 93510
    Joints Num: 25176
     
  17. snowgundam

    snowgundam

    Joined:
    Apr 17, 2013
    Posts:
    7
    Make sure the cloth is in the edit status,and the surface of cloth is black,
    then, check you radius of the brush setting,make it bigger than 0.
     
  18. mrbdrm

    mrbdrm

    Joined:
    Mar 22, 2009
    Posts:
    510
    there is nothing wrong with the settings
    for some reason it doesn't work with mesh that have shell modifier applied from 3dsmax
    if i try the same mesh but single sided (removed shell modifier in max before export)
    painting works.
    double sided mesh is a must to make realistic clothing.
    can the author help with this? i can send the mesh for testing.
     
  19. may10086

    may10086

    Joined:
    Jun 19, 2017
    Posts:
    2
    I find a problem in your hair tool.The coiled effect will be affected by the object coordinates.Are you fixed it?
     
  20. andrii-shpak

    andrii-shpak

    Joined:
    Nov 27, 2014
    Posts:
    315
  21. andrii-shpak

    andrii-shpak

    Joined:
    Nov 27, 2014
    Posts:
    315
    Could you send me file to my support mail?
     
  22. andrii-shpak

    andrii-shpak

    Joined:
    Nov 27, 2014
    Posts:
    315
    Are you sure it's normal dirrections? it looks like you use doubesided mesh with "Cull Off" material. Could you send me mesh
     
  23. mrbdrm

    mrbdrm

    Joined:
    Mar 22, 2009
    Posts:
    510
    i have fixed the issue (layer problem)
    my issue is the need for self collisions now.
    double sided mesh need self collision or some way to stop the back side passing through front side (move them together as one perhaps?)
    PS: cant find your support email in the documentation and can't copy from the asset page in unity.
     
  24. andrii-shpak

    andrii-shpak

    Joined:
    Nov 27, 2014
    Posts:
    315
    (Double sided mesh need self collision) Unfortunatelly it is very bad idea because of performance. Just dont use doubled meshes.
    I plan to add self collision. It is more like a chalenge for me, because it is very complicated.
    But there not any reasons to use cloth with self collisions in games.[

    [PS: cant find your support email in the documentation and can't copy from the asset page in unity.]
    you can click on it.
     
  25. mrbdrm

    mrbdrm

    Joined:
    Mar 22, 2009
    Posts:
    510
    you are correct about the double sided mesh physics but for some meshes you need to have it like this.
    how about having a one sided mesh drive the two sided mesh? that will fix issues with coats and pockets.
     
  26. snowgundam

    snowgundam

    Joined:
    Apr 17, 2013
    Posts:
    7
    I tried a singlesided mesh and it worked!Thanks very much!
     
  27. GrailLinV

    GrailLinV

    Joined:
    Jul 25, 2017
    Posts:
    3
    Hello,
    Excuse me.

    I'm trying to create line-sphere colliders with your script "Bone Collider Placer".
    I wondered how to construct the breasts in that tutorial (during 5:50-5:53).

    Should I create the spheres manually?

    thank you.
     
  28. andrii-shpak

    andrii-shpak

    Joined:
    Nov 27, 2014
    Posts:
    315
    Yes, it supports line-sphere and spheres. You can combine them
     
  29. Olander

    Olander

    Joined:
    Sep 13, 2014
    Posts:
    400
    Well....this is an addition to my review of this with some pictures to help explain.
    This is an awesome cloth simulation....and very fast. It has numerous issues though and need to be solved. I am posting some information here so that others can 'See' through the smoke and mirrors to see what is really going on here. This is an expensive asset ($60) for as unpolished as it is.

    This GPU Cloth Tool is very fast and makes use of Unity Shader Material(s) to take care of business on the rendering calls. Much like VertExmotion does but in a different way.....much easier to make cloth behave like....well....cloth and leather and any other fabric.

    This tool gets it done with a custom surface shader that is NOT EASY to adapt your own custom shaders.....and don't even think of trying to make this work in the Unity Standard/Specular Source Shaders since it is just a guessing game where to place the GPU Cloth Tool shader code. No Include files and no library.....just a strange method to do shader code.

    The shaders provided with GPU Cloth Tool are Surface Shaders and have bad rendering issues (see pics).

    This tool only supports Spheres and Line Spheres.....not....not...Capsule Colliders (most often used....and highly used in various humanoid setups for various gameplay collisions).

    The vertex painter needs a lot of polish and help with the raycasting method being used.....basically anything in the 'Setup Scene' needs to be set as IgnoreRaycast for it to work...including the camera.

    So....besides the above complaints this cloth simulation is easy to use, very fast, and excellent cloth/vertex simulation/motion. I was easily able to fully simulate 15 32k Poly Sheets falling on Spheres (like shown in the pics below). If the shaders and tool can be polished up this will be the best cloth simulation to be found.

    Pics....
    1st Pic is showing the Above View on a 32k Poly Silk Sheet. You can see the rendering issue.
    GPU Tools Shader Issue A.png

    You can see here how nice the cloth simulation is. The wrinkles and folding is simply awesome and only took 30 seconds to set up. Notice the rendering issue with the shader.
    GPU Tools Shader Issue B.png

    This last pic is a Amplify Shader Editor Specular Opaque shader (basically the same as Unity Standard Specular). No simulation on this.
    GPU Tools Shader Issue C.png
     
    Last edited: Oct 28, 2017
    one_one likes this.
  30. andrii-shpak

    andrii-shpak

    Joined:
    Nov 27, 2014
    Posts:
    315
    [just a strange method to do shader code.]
    Actualy they are customizable just you need to know (shader model 5) hlst syntax. I'll try to make it more ease for the next update. But it needs vertexid which is not included in any standart structures by unity. So you definitely will need to add more code then vertex motion
    [Capsule Colliders]
    I have it in my feature list(box and mesh as well). LineSphere is just much better then capsule to describe human body.
    [The vertex painter needs a lot of polish and help with the raycasting method]
    It is the biggest problem for now. It is not ease to make paiter able to work very with detailed meshes. May be the best solution is to remove this feature. And leave just texture support.
    [The shaders provided with GPU Cloth Tool are Surface Shaders and have bad rendering issues (see pics)]
    It looks like you are using depth texture. Here is a tutorial how to add normal depth texture support.
     
    Last edited: Nov 13, 2017
  31. Olander

    Olander

    Joined:
    Sep 13, 2014
    Posts:
    400
    Disagree completely. In fact the Line Sphere and Capsule are almost the same 'Physically'. The main issue with Line Sphere is you cannot make them from Prototype Objects. Capsules comes standard with Unity, UE4....and whatever....even making Capsules in Blender or Maya LT and exporting them work as well. None of these can Make Line Spheres....and yes I Know how to Make Line Spheres in Unity (you also show this in one of your videos).

    Vertex ID:
    I use vertex motion for plants and trees in my own custom shaders for those. So I am familiar with this. Kalagan's VertExmotion does something similar to you and gives the following to Insert into a shader for that system to function with the brushed painting it requires and saves in a data array. Cool system and works beautifully for jiggly things....I think it 'could' have cloth simulation but the math behind the scenes is not set up for it. You have done it with excellent math but your shader code is far from easy to 'patch' into existing shaders.

    How VertExmotion professionally integrates into a shader. They use an Include File with all their code and access their vert data array in this fashion. This is how I recommend you do yours as well.

    Code (CSharp):
    1. For surface shader you have to modify these lines in your shader :
    2. #pragma surface surf Lambert alpha vertex:vert addshadow
    3. #include "Assets/VertExmotion/Shaders/VertExmotion.cginc"
    4. void vert (inout appdata_full v) {VertExmotion( v );}
    5. If your shader has already a vertex function, add theses lines :
    6. #include "Assets/VertExmotion/Shaders/VertExmotion.cginc"
    7. void vert (inout appdata_full v) {
    8. VertExmotion( v );
    9. //original shader code
    10. }
    11. If the vertex function don't use appdata_full add theses lines :
    12. #include "Assets/VertExmotion/Shaders/VertExmotion.cginc"
    13. void vert (inout appdata v) {
    14. v.vertex = VertExmotion( v.vertex, v.color );
    15. //original shader code
    16. }

    Lastly....about custom shaders. In a Real Game....the Unity Standard shaders are only used on perhaps 5-10% of all the models in game. I know that I do try to use them but when you want that additional Diffuse and Normal Map Layer(s) that get lerp'd to get a final finish you have to dig in and make a shader....and another....and another....want 2 Sided?.....edit Unity's or just shrug and make another....use ASE or SF to make them if you want....whatever....now....we need a Cloth Simulation on this item.....copy and then simply Uncomment the GPU Cloth Tool include and function code and save. Configure with a recipe.....Done. Next! Need to add Frost and Snow to it? Add the code and move along. No need to check to see if adding it will break your simulation. It just works because your code is stand alone. Done.

    And That is my point. Not just a really awesome Vertex Shader Math Example....but something that can simply be integrated without having to reverse engineer what you have going on under the hood.

    Apologies for the ramble.
    Cheers
    O
     
  32. andrii-shpak

    andrii-shpak

    Joined:
    Nov 27, 2014
    Posts:
    315
    Does VertMotion support skinned mesh renderer?
    For static mesh is possible to bake vertex id in position.z or color.a. But for skinned mesh you can only modify sharedMesh (Which is common for full project). So I have no Idea how to get vertex id without modifing input structure. Actualy I improved this point for verssion 1.0.2 I usualy add all user request in my feature list. So if I find a way how to do it better I'll do it. Now it looks like that.
    #pragma multi_compile __ VERTEX_FROM_BUFFER

    void vert(inout appdata_full_cloth io)
    {
    #ifdef VERTEX_FROM_BUFFER
    Cloth(io);
    #endif
    }
    would be nice if somebody knows how to call #pragma multi_compile for external function
    Also I improved brush painting. It needs no physics anymore.

    Still Disagree completely with you about Line Sphere. Render is a major point here (not physics). In this case capsules can describe no one of human body parts (waybe fingers).
     
  33. andrii-shpak

    andrii-shpak

    Joined:
    Nov 27, 2014
    Posts:
    315
  34. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,191
    Yes.
     
  35. Olander

    Olander

    Joined:
    Sep 13, 2014
    Posts:
    400
    @hopeful Thanks. Yes indeed.

    Nothing to do with Physics at all. In fact the colliders are entirely script based. I'll explain.

    So in a character game....the designer (usually a character designer in the game engine) makes Capsule Colliders for the different parts of the body that they want the Scripts and Events to interact with. Basically what happens is each of these Capsules has a Script that detects if it has been Triggered By (collided) and By What.....then this information is transferred to the Character Controller for appropriate things....like swapping textures....chopping arms off.....adding the transparent texture to hide the flying arm.....these sorts of things. Lots of games have this in place.

    Capsules have to designed from a Prototype/Primitive type of model. Capsules are super efficient and are easy to scale, rotate, and snap to a bone. You can easily make them just a little thicker than the clothing....and even can scale them at runtime for dynamic thickness. This is ALL usually done in prior to coming into 'Game Engine'.....but Unity is quite simple to do this as well...so helps not have to do this in the modelling software. Think of these body colliders as 'Attachments' to a model....like a weapon and shield (which also have rectangle and/or capsule colliders...same technique). The method Unity uses to make Line Spheres is pretty cool actually but there is so little control over shape and positioning and they can only be applied to very specific things as far as I know.

    I am not here to argue with you. I already stated you have a really fantastic cloth simulation....fantastic. I am really happy with my purchase and am glad to support your efforts here. This is really needed...and good to see this. I am not going to give you a free pass though....this is Not game ready for integration with a proper framework. With some adjustments it can be very quickly as long as you are not stubborn and willing to work to get it solved. You are more than welcome to PM me and I will do whatever it takes to help you get this tool solved. Really. I mean it. I would love to use this tool in my framework. And I do indeed have the proper framework to make certain this integrates well.

    I sincerely appreciate the dialogue. It shows this is a real attempt at a great product.

    Cheers
    O
     
    Last edited: Nov 17, 2017
    nirvanajie likes this.
  36. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    880
    This cloth simulation looks spectacular, but I'm concerned with integration with my custom shaders.

    Actually, the biggest problem with assetstore libraries is integration with each other and custom shaders.
    I understand this is an inherent issue of using third party libraries, but it's the reason I refrain from buying some systems.
    I just write to let you know this and state how important it is for the buyer to be able to integrate your system easily.

    We all have bought impressive systems in the asset store only to be unable to use them in production because of incompatibilities or integrating it requiring too much work.
    So plenty of people now just wait for an asset to be 100% reliable and easy to customize before buying.
    This can make the sales stall and the author drop the product entirely, thinking it will not sell well enough.

    Right now I'm waiting for your system to be mature enough to buy it.
    It's not that much a price issue than an integration issue for me and, I suppose, for others.
    Other systems are sold on the asset store for a higher price and they sell well enough as long as they are fully polished and easy to integrate. (I'm thinking of RootMotion's Final IK and PuppetMaster in example. I bought both and I'm very happy with the purchase.)

    So I will be more than happy to pay more money as long as integration with custom shaders is made easy and any other issue is resolved.
    Just my two cents. :)
     
    Olander likes this.
  37. andrii-shpak

    andrii-shpak

    Joined:
    Nov 27, 2014
    Posts:
    315
    As I’ve already mentioned. I’ve improved integration part. Also I’ve added OS X support. And completely rewritten weight painter. New update is already uploaded to assetstore and is waiting for approve. If someone need it faster just write me to my support mail.
     
  38. andrii-shpak

    andrii-shpak

    Joined:
    Nov 27, 2014
    Posts:
    315
    v1.0.2
    • OSX
    • New weight painter
    • Added continuos physics
    • Improved custom shader integration
     
    Last edited: Nov 28, 2017
    nirvanajie and ScoobyNooby like this.
  39. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    880
    Could you explain the improvements in detail, please?
    I have checked the docs but can't find anything about continuous physics and custom shader integration.
    I'm in a point in development were supporting a new system could break the other integrated ones.
    Thanks.
     
  40. andrii-shpak

    andrii-shpak

    Joined:
    Nov 27, 2014
    Posts:
    315
    Sorry, I've forgot to update docs liks.
    Now It is updated.
    Continuos collision detection is constantly enable. It handles cloth collision with physX colliders only. So in case char make very fast movements. Cloth will not move through boby parts as it was in previous version.
     
  41. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    880
    Thank you!
    Now it is much clearier how to implement it on custom shaders.
    I just bought your GPU Cloth system. :)

    However I'm still a bit confused: does it need it's own propietary colliders or does it use Unity's PhysX colliders?
    I mean: unity doesn't have "linear spheres".
    In your docs there is no information on "Continuous collision" and collider types.
     
  42. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    880
    Another important thing:
    Your shaders are not compatible with GLcore or Vulkan, meaning this will only work on Windows.
    I'm concerned about PS4 compatibility. I don't know if it will be compatible.

    this is the error at each shader:

    undeclared identifier 'THREADS' at kernel
     
  43. MrG

    MrG

    Joined:
    Oct 6, 2012
    Posts:
    335
    Your videos don't have audio?

    Please carefully document how to integrate CPU cloth and your Hair tool with UMA 2. At some distance, both need to switch to static clothing and hair. Thanks.
     
  44. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    880
    I'm afraid this is beyond the scope of this asset.
    You can easily do it yourself using Unity's LOD groups and switching the cloth objects for static ones at a distance.
     
  45. MrG

    MrG

    Joined:
    Oct 6, 2012
    Posts:
    335
    Fine for the switching, but I still need to understand how to use the Cloth and Hair with UMA.
     
  46. andrii-shpak

    andrii-shpak

    Joined:
    Nov 27, 2014
    Posts:
    315
    Physics is calcuated on GPU. PhysX works on CPU. So plugin creates copy of physics colliders. Also I've added one own collider (which don't work with PhysX) LineSphere is just recomended in some litereture as good and fast way to describe human body.
    Continuos collisions just prevent simulation bags in case when character move fast. It is alawys enabled.
     
  47. andrii-shpak

    andrii-shpak

    Joined:
    Nov 27, 2014
    Posts:
    315
    For now it works only with dx11 and metal. GLcore and Vulkan compute shaders does not work in editor. So cant add it's support yet
     
  48. andrii-shpak

    andrii-shpak

    Joined:
    Nov 27, 2014
    Posts:
    315
    UMA 2 is not officialy supported. I've never try to run Hair Tool and Cloth tool with UMA 2. But I have it in my feature list.

    [both need to switch to static clothing and hair] Good point, I'll try to add it in next update for both. For now it works only when char is out of camera frustrum
     
    MrG likes this.
  49. ohouha

    ohouha

    Joined:
    Jul 1, 2015
    Posts:
    3
    Hi,
    Really need your help for submeshes (multiple materials), can you send me some documentation about how to make submeshes work? I already download your newest version, does the version 1.0.2 contains ways handle submeshes?
     
  50. ohouha

    ohouha

    Joined:
    Jul 1, 2015
    Posts:
    3
    Did you know how to solve this problem right now? really need help, please help me, I met the same issue.
     
unityunity