Search Unity

VertExmotion [Released]

Discussion in 'Assets and Asset Store' started by kalagaan, Oct 30, 2014.

  1. huxley

    huxley

    Joined:
    Apr 27, 2009
    Posts:
    334
    Hi Kalagaan, we are currently on VertExMotion v1.8.5. We have encountered an issue where our UV vertex weight paints occasionally get lost and the entire skinned mesh turns white. Then we must erase and repaint new UV weights.

    My first question is has this issue been fixed in the current version of VertExMotion.
    My second question is will we loose all the previous UV weight paints on other objects if we upgrade, as we have well over 100 meshes with unique VertExMotion paints already on them. Merci!
     
  2. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    I didn't fix that bug, because I didn't experiment it :confused:

    The weight are stored in the component, but if the mesh as changed (updated by an external tool) and if the vertex count is different, the vertex data will be reset.

    You can upgrade to the latest version, the weight system didn't changed.
    Here the modifications between 1.8.5 and 1.9.7

    Let me know if you still experiment this bug with the latest version.
     
  3. huxley

    huxley

    Joined:
    Apr 27, 2009
    Posts:
    334
    I think I may have discovered the issue.

    I have 2 object meshes with the same name, but they are different meshes with different vertex counts. Is it possible that this would cause a issue with weight paint getting corrupted on one of the meshes?
     
  4. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    The VertExmotion component uses the mesh of the renderer so the name is not a problem, it's a reference to the mesh.
    If you switch the mesh reference in the MeshRenderer (or skinnedMeshRenderer) the weight will be reset.
     
  5. huxley

    huxley

    Joined:
    Apr 27, 2009
    Posts:
    334
    Thanks for the explanation kalagaan. I discovered that issue was that the component was assigned under a prefab and the prefab kept reverting to the paintweight. Issue solved.
     
    kalagaan likes this.
  6. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Thank you for the feedback :)
     
  7. Kyrieru

    Kyrieru

    Joined:
    Mar 2, 2015
    Posts:
    42
    Is it possible to have things jiggle in response to deformation?
    With the push/pull/direction interaction script for example, the deformation will not "rebound" and jiggle when returning to it's initial state.
     
  8. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Yes, you can modify the force with a bouncing effect on release.
    There's a class that you can use to do that effect : BounceSystem_V3

    Here a modification of the demo scripts :

    Code (CSharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5.  
    6. namespace Kalagaan
    7. {
    8.  
    9.     [RequireComponent(typeof(VertExmotionSensor))]
    10.     public class VertExmotionInteraction : MonoBehaviour
    11.     {
    12.  
    13.  
    14.         public enum eInteractionType
    15.         {
    16.             DIRECTION,
    17.             PUSH,
    18.             PULL
    19.         }
    20.  
    21.         public VertExmotion m_target;
    22.         public float m_radius = .1f;
    23.         public eInteractionType m_interactionType;
    24.  
    25.         public bool m_isTouching = false;
    26.         public bool m_bounceOnRelease = true;
    27.  
    28.         public float m_damping = 1f;
    29.         public float m_boucing = 1f;
    30.  
    31.         VertExmotionSensor m_sensor;
    32.         BounceSystem_V3 m_bounceSystem = new BounceSystem_V3();
    33.        
    34.         // Use this for initialization
    35.         void Start()
    36.         {
    37.  
    38.             m_sensor = GetComponent<VertExmotionSensor>();
    39.             m_sensor.m_params.translation.motionFactor = 0;
    40.  
    41.             if (m_target != null)
    42.             {
    43.                 m_target.m_VertExmotionSensors.Add(m_sensor);
    44.             }
    45.             m_bounceSystem.Init();
    46.         }
    47.  
    48.         public void ChangeTarget(VertExmotion newtarget)
    49.         {
    50.             if (m_target != null)
    51.                 m_target.m_VertExmotionSensors.Remove(m_sensor);
    52.  
    53.             m_target = newtarget;
    54.  
    55.             if (m_target != null)
    56.                 m_target.m_VertExmotionSensors.Add(m_sensor);
    57.         }
    58.  
    59.  
    60.         // Update is called once per frame
    61.         void Update()
    62.         {
    63.  
    64.             float scale = (transform.localScale.x + transform.localScale.y + transform.localScale.z) / 3f;
    65.  
    66.             if (m_isTouching || !m_bounceOnRelease)
    67.             {
    68.                 switch (m_interactionType)
    69.                 {
    70.                     case eInteractionType.DIRECTION:
    71.                         m_sensor.m_params.translation.worldOffset = m_radius * scale * transform.forward;
    72.                         break;
    73.  
    74.                     case eInteractionType.PUSH:
    75.                         m_sensor.m_params.translation.worldOffset = m_radius * scale * (m_target.transform.position - transform.position).normalized;
    76.                         break;
    77.  
    78.                     case eInteractionType.PULL:
    79.                         m_sensor.m_params.translation.worldOffset = m_radius * scale * (transform.position - m_target.transform.position).normalized;
    80.                         break;
    81.                 }
    82.                
    83.                 m_bounceSystem.m_target = m_sensor.m_params.translation.worldOffset;
    84.                 m_bounceSystem.Init();
    85.             }
    86.             else
    87.             {              
    88.                 m_bounceSystem.damping = m_damping;
    89.                 m_bounceSystem.bouncing = m_boucing;
    90.                 m_bounceSystem.m_target = Vector3.zero;
    91.                 m_sensor.m_params.translation.worldOffset = m_bounceSystem.Compute(m_sensor.m_params.translation.worldOffset);
    92.             }
    93.             m_sensor.m_envelopRadius = m_radius;
    94.  
    95.         }
    96.     }
    97. }
    Code (CSharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5.  
    6. namespace Kalagaan
    7. {
    8.     public class VertExmotionTouchDemo : MonoBehaviour
    9.     {
    10.  
    11.         public float m_radius = 1;
    12.         public float m_radiusSpeedPush = 1f;
    13.         public float m_radiusSpeedRelease = .1f;
    14.         VertExmotionInteraction m_vmi;
    15.         MeshRenderer m_mr;
    16.  
    17.         void Start()
    18.         {
    19.             m_vmi = GetComponent<VertExmotionInteraction>();
    20.             m_mr = GetComponent<MeshRenderer>();
    21.             m_mr.enabled = false;
    22.         }
    23.  
    24.         void Update()
    25.         {
    26.  
    27.             if (Input.GetMouseButton(0))
    28.             {
    29.                 RaycastHit hitInfo;
    30.                 if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hitInfo))
    31.                 {
    32.                     m_vmi.m_radius += Time.deltaTime * m_radiusSpeedPush;
    33.                     m_vmi.transform.position = hitInfo.point;
    34.                     m_vmi.m_isTouching = true;
    35.                     //m_mr.enabled = true;
    36.                 }
    37.                 else
    38.                 {
    39.                     //m_vmi.m_radius -= Time.deltaTime;
    40.                     //m_mr.enabled = false;
    41.                 }
    42.  
    43.  
    44.             }
    45.             else
    46.             {
    47.                 m_vmi.m_radius -= Time.deltaTime * m_radiusSpeedRelease;
    48.                 //m_mr.enabled = false;
    49.                 m_vmi.m_isTouching = false;
    50.             }
    51.  
    52.             m_vmi.m_radius = Mathf.Clamp(m_vmi.m_radius, 0, m_radius);
    53.  
    54.  
    55.         }
    56.     }
    57. }
     
    Kyrieru likes this.
  9. raphaelsanguinete

    raphaelsanguinete

    Joined:
    Feb 3, 2018
    Posts:
    6
    Hi, @kalagaan

    It is possible to use VertExmotion to achieve procedural animation for 2D sprites?

    The main use for my project is to animate environment plants, trees and other elements in a light way, without abrupt moves (probably the more complex animations we will do by hand). So the use will be for simpler 2D animations.
     
  10. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Yes, you can apply the VertExmotion component to a SpriteRenderer, the shader will move the vertices of the sprite.
    The sensors will move all the vertices in their range according to the settings.

    There's a limitation, you can't paint the motion weights of the vertices, so each vertex in the sensor range will move accordingly to the sensor settings and the distance from the sensor center.

    There's a demo in the package. ;)
     
    raphaelsanguinete likes this.
  11. Alemneh

    Alemneh

    Joined:
    Jun 16, 2020
    Posts:
    3
    I have purchase this asset recently to apply softbody to my character. So can i apply the softbody to character while i touch it?
     
  12. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Yes, there's different samples in the package.
    If you want to touch it with the mouse, or in VR, you'll have to create a custom script and add some colliders to your character for the interactions.
    If you need helps, please send me a sample scene of your character setup (contact@kalagaan.com), I'll help you ;)
     
  13. Alemneh

    Alemneh

    Joined:
    Jun 16, 2020
    Posts:
    3
    Thank you kalagaan for your quick reply. Can you please take a look at the video that is attached in below link. I would like to generate same kind of output with my character. Is it possible?
    https://drive.google.com/file/d/1cMHGdvOehTpaQwXt-FtF8gnUQ8hXAoJO/view?usp=sharing

    Here is the character setup scene.
    https://drive.google.com/file/d/1oSgEPBFfXnL_E9_ol7erKqczKgxm4PX-/view?usp=sharing
     
    Last edited: Aug 13, 2020
  14. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    There's sample in the package for this kind of deformation : FaceDeform ;)
    Have a look to the demo scene, you have to use the scripts 'SkinnedMeshCollider' and 'VertExmotionDeformBrush'

     
    Alemneh likes this.
  15. Alemneh

    Alemneh

    Joined:
    Jun 16, 2020
    Posts:
    3
    Thank you , i have fixed it.
     
  16. Slowbud

    Slowbud

    Joined:
    Jul 19, 2015
    Posts:
    81
    @kalagaan Hello Kalagaan, working since years with VertExmotion with great success.
    I updated to Unity to 2020.1.0f1 and HDRP 8.2.0. VertExmotion 1.8.8
    Bevor installing a VertExmotion HDRP Lit AddOn, can you tell me if it will work. I just see addon up to 2019.3. If it works, could you give me instructions if there are additional steps needed, I'm more a generalist, not a big shader specialist.
     
  17. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    You can install the latest version (2019.3 HDRP 7.3.1)
    It's still compatible with unity 2020 & HDRP 8.2.0

    The only additionnal step is to set the 'Displacement Mode' to 'Vertex displacement' in the material settings.
     
    Last edited: Aug 26, 2020
  18. Slowbud

    Slowbud

    Joined:
    Jul 19, 2015
    Posts:
    81
    Thanks for super fast reply :)
     
    kalagaan likes this.
  19. davidgbarnes_inertialframes

    davidgbarnes_inertialframes

    Joined:
    Sep 15, 2017
    Posts:
    8
    For what it's worth, I appear to have the exact same problem. I can create a sphere, assign a material that is using a vertexmotion/HDRP/Lit shader, and then proceed to paint on the surface. But for my skinned character, I see the same colour pink and cannot paint. I do see the surface colour change in paint mode if I press fill/clear all layers, but the paint brush doesn't work :-(

    And indeed the pink colour can be be varied between white and red using the Gradient slider...
     
  20. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Could you check that the option 'read/write' is enabled in the fbx importer?
     
    Last edited: Sep 24, 2020
  21. ben_unity9

    ben_unity9

    Joined:
    Sep 21, 2017
    Posts:
    7
    Hi, the tool looks great! Would you have anything around mobile performances to share?
    I am working on mobile game that could benefit from your tool but performances are a concern.
    What are the minimum specs to run on mobile?
    thanks!
     
  22. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Performances on mobiles are really good, the deformation is made in the vertex shader, it's really fast on any device.
    There's a limitation for old GPU mobile ( shader model 2.0) : you can only use 4 sensors per mesh.
     
    Last edited: Sep 24, 2020
    ben_unity9 likes this.
  23. davidgbarnes_inertialframes

    davidgbarnes_inertialframes

    Joined:
    Sep 15, 2017
    Posts:
    8
    Ah good point and I'm sorry I missed that earlier in the forum. Yes that now allows me to paint. Thank you!

    But I am stuck further down the track getting no motion at all and also failing with a capsule. I'll explore more today with a basic example and see if I can get it going.
     
  24. ben_unity9

    ben_unity9

    Joined:
    Sep 21, 2017
    Posts:
    7
    Thank you for the clarifications, I'll be testing it out right now.
     
    kalagaan likes this.
  25. davidgbarnes_inertialframes

    davidgbarnes_inertialframes

    Joined:
    Sep 15, 2017
    Posts:
    8
    Ok the manual reminded me to set displacement mode for my VertexMotion/HDRP material. That helps :)
     
    kalagaan likes this.
  26. titoasty

    titoasty

    Joined:
    Dec 2, 2018
    Posts:
    25
    Hi,

    I'm trying to make a blob and can't figure out how.
    I thought just adding VertExmotion to a sphere, painting it, and messing with some parameters would simply work but it seems not at all.
    I looked at examples, like droplets, they have no sensors but a script that refers to no documentation at all.
    It seems it's more "visual" oriented than physics-oriented and I don't even know if it's possible to make a blob character.
    Could you help me please?
     
  27. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Hello,
    VertExmotion is not a physics based simulation, you need a script like in the droplet demo if you want to deform your object using a physics behavior. So you should create your own script based on the demo script.
    In this one, a sensor is generated at runtime when a collision is detected, and it deforms the mesh.
    If you need help, please send me an email (contact@kalagaan.com) with more info about the effect you want ;)
     
  28. ishlilith

    ishlilith

    Joined:
    Mar 16, 2012
    Posts:
    13
    Hello, I can't make the shader work with shadergraph. Can you look at the new daz3d to unity bridge www.daz3d.com/daz-to-unity-bridge and explain how to make them work?
    Thanks
     
  29. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    You have to install the shadergraph addon in the VertExmotion folder.
    If you still have issues with a shader, please send me an email (contact@kalagaan.com) with your invoice number, and I'll help you ;)

    It looks like the Github of the unity bridge is down :(
    https://github.com/daz3d/DazToUnity
    I'll have a look when it will be available ;)
     
  30. ishlilith

    ishlilith

    Joined:
    Mar 16, 2012
    Posts:
    13
    Yeah, I did, but they are for older versions of the shader graph?
    Your basic hdrp graphs work, but copy pasting the nodes to the daz shader doesn't work and there isn't a node to add in your latest addon.

    The GitHub page is https://github.com/daz3d/DazToRuntime/tree/unity

    I'll look again tomorrow to see if I missed something obvious and if I can't find anything I'll contact you. Thanks
     
  31. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    The name of the addon file is the minimum version compatible, so it should work also with the latest version of unity, until something change in the ShaderGraph API.
    Please send me the Graph and I'll check it ;)
     
  32. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    I found why the shader doesn't work properly with Unity 2020 HDRP.
    The shadergraph API changed, so the position node and the transform node space must be set to 'Absolute world' instead of 'world'. You don't need to add the camera position anymore.

    The VertExmotion nodes should look like this :
     
  33. ishlilith

    ishlilith

    Joined:
    Mar 16, 2012
    Posts:
    13
    Thank you, Sorry I forgot to reply, but I fixed it using your lit hdrp shader. And then went back to the standard pipeline.
     
  34. ChillX

    ChillX

    Joined:
    Jun 16, 2016
    Posts:
    145
    HDRP 7.3.1 - The Vertexmotion shader does nothing if DXR is enabled.
     
  35. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    What is your version of Unity?
    I've some hardware issues, I can't test DXR with unity 2019 :(
    You could try to update to HDRP 7.4.3

    I did some tests with unity 2020 and HDRP 8.2.0 and it works fine.:)

    If you are using the "VertExmotion/HDRP/Lit" shader, you have to set the displacement mode to 'Vertex displacement' in the material settings.
     
  36. Dobalina

    Dobalina

    Joined:
    Sep 6, 2013
    Posts:
    105
    Hello @kalagaan . I've run into an error I was hoping you can help me with. My apologies if this has already been addressed.

    I seem to getting this error at runtime when a prefab with a "vert exmotion base" component is created in the scene.
    upload_2020-11-7_14-47-25.png
    Mesh.colors is out of bounds. The supplied array needs to be the same size as the Mesh.vertices array.
    UnityEngine.Mesh:set_colors32(Color32[])
    Kalagaan.VertExmotionBase:ApplyMotionData()
    Kalagaan.VertExmotionBase:Awake()
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr, Boolean&)

    If I strip the component off the prefab, the error goes away.

    A quick and very easy way to repro this is by:
    -create a basic cube and assign a vert exmotion material and component (include a senor if you want)
    -turn it into the prefab and launch the scene
    -now drag your prefab into the scene, or spawn it in game via code (this is when the error pops up)
    -as extra step you can open the prefab mid game and remove the component and now notice the error is gone.

    Any thoughts on what this might be?
    I'm on Unity 2020.1.11f. I also tried it on 2018.4.23 and got the same errors.
     
  37. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Thank you for the feedback,
    I did some tests and I cannot reproduce that bug...:confused:
    I've created the cube prefab, and I've used a simple script
    Code (CSharp):
    1.  
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5.  
    6. public class Spawn : MonoBehaviour
    7. {
    8.     public GameObject m_prefab;
    9.     void Start()
    10.     {
    11.         GameObject.Instantiate(m_prefab);
    12.     }
    13. }
    It works witout errors...

    Do you use the latest version of VertExmotion?
    There's different versions of the VertExmotion package according to the version of unity, so you have to install it from the assetstore window (or the package manager) in the unity editor.

    Could send me a package including a sample scene ? (contact@kalagaan.com)
    It would be easier to check what's going on ;)
     
  38. Dobalina

    Dobalina

    Joined:
    Sep 6, 2013
    Posts:
    105



    Thanks for the quick reply and trying it out.
    I hope you don't mind that I attached the test scene here as it's tiny in size.

    Also on a side note.
    I suspect this might be shaderforge and vertexmotion related. It appeared that I was latest version of vertexmotion, though I deleted my local copy and imported the latest from the package manager just to be safe. Though now I got a buch of shader errors for all shaderforge shader that use vertexmotion upload_2020-11-7_16-8-26.png
     

    Attached Files:

    Last edited: Nov 8, 2020
  39. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Your version of VertExmotion is really old : 1.8.5
    please update to 1.9.7
     
  40. Dobalina

    Dobalina

    Joined:
    Sep 6, 2013
    Posts:
    105
    @kalagaan That's odd. If I go to import from the package manager, it literally shows just 3 materials were different. So this time I removed my local files, closed and restarted unity. Got the latest vertexemotion from the package manager.

    Some good news is time, there are no shaderforge errors.

    Though the original "Mesh.colors is out of bounds." issue I had mentioned is still occurring. I've re-saved the scene now seemingly on v1.9.7. Just a reminder that you can simply copy/paste the prefab in scene or drag the prefab into the scene while it's running to repro the issue i'm seeing
     

    Attached Files:

  41. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Could you recreate the prefab with the latest version please.
    The version number in the inspector must be 1.9.7.
     
  42. Dobalina

    Dobalina

    Joined:
    Sep 6, 2013
    Posts:
    105
    Opps, sorry. I tried it again with the component replaced and the error is gone! Thank you for your assistance!

    I did run into one other issue that's an easy fix. For some reason after the painting of a prefab, the material swapped to Hidden/VertExmotion_editor. I don't keep my custom shaders in the vertexmotion shader hierarchy, perhaps this is why? Anyways, I just have to swap the shader back to the one I wanted after I finish painting.

    upload_2020-11-7_18-0-18.png
     
  43. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    If the scripts are recompiled when the editor is in paint mode, it could happen.
    You can easily fix if by enable and disable the paint mode, the shader will be fixed in the material. ;)
     
    Dobalina likes this.
  44. aangmar

    aangmar

    Joined:
    Mar 17, 2020
    Posts:
    1
    Hi @kalagaan! First, thank you for you tool,I´m a new user using vertExmotion is helping me a lot in a project. But I have a question, is there a way to stop the movement of the object based on an action? For example I have a soft body cube its moving through collisions, but I want that movement to restart at the moment of performing a specific action, I have tried to do it, however I have not had any success.
    I hope you can support me in this question.

    Cheers
     
  45. MateAndor

    MateAndor

    Joined:
    Nov 5, 2014
    Posts:
    70
    Hello!

    I'm thinking to buy VertExmotion, but I have two questions:
    - Can I use in URP? With URP Lit shaders?
    - I use UMA Dynamic Character System. Can add VertExmotion in runtime?

    thanks, Andor
     
  46. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    You can use the ResetMotion() function of the VertExmotion component.
    If you still have issues, please send me anemail (contact@kalagaan.com), I'll hep you ;)
     
  47. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    - yes you can use the URP shaders, VertExmotion is compatible with shaderGraph & amplify shader editor.
    - You can add the VertExmotion component at runtime, and add some sensors by script.
    The only problem with UMA is that the weights of the vertices can't be painted with the tool.
    You have to generate them at runtime, there's a sample in the 'VertExmotionBubble' script.

    PS : I've answered to your email ;)
     
  48. Andresmonte

    Andresmonte

    Joined:
    Nov 22, 2014
    Posts:
    37
    Hi, are normal corrections working in hdrp? because when deforming the mesh, I don't see any difference in the lighting.
     
  49. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    You can use the normal correction with the amplify shader node, I'll add it to ShaderGraph in the next update ;)
     
    Last edited: Nov 19, 2020
    Andresmonte likes this.
  50. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    868
    Hi @kalagaan ,
    considering buying (again;) ), but one question:
    I don't use SkinnedMeshRenderer, but an own renderer, based on compute shaders, where I pass the result to shader graph and use vertex displacements via textures; the SkinnedMeshRenderer exists, but is not used, only to get the bones. Would it be possible to integrate VertExmotion in this pipeline?
    PS: Am using HDRP
     
    Last edited: Nov 22, 2020