Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  4. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  5. Nominations have been announced for this years Unity Awards. Celebrate the wonderful projects made by your peers this year and get voting! Vote here!
    Dismiss Notice
  6. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  7. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

VertExmotion [Released]

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

  1. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    I've never had this kind of issue :confused:
    What is your version of unity?
    Does it happen on a specific mesh or on any mesh?
     
  2. Slowbud

    Slowbud

    Joined:
    Jul 19, 2015
    Posts:
    53
    It's Unity 2018.2.9 f1
    It's confusing. No matter if Skinned or normal Mesh renderer. But found out, I cant paint this one NPC and all meshes in the hierarchy below. If I duplicate an object, and pull it out of the hierarchy, I can paint.
    But something else, the NPC has different materials on one mesh. I just changed the parts I want to be affected by VertExmotion to VertExmotion compatible shaders. Which works, but maybe painting not?
     
  3. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    Could you send me an email (contact@kalagaan.com) with a sample scene?
     
  4. kcfos

    kcfos

    Joined:
    May 20, 2018
    Posts:
    3
    Hello, I'm having trouble getting an outline shader (QuickOutline from the asset store) to work with vertExmotion. The outline follows the object but doesn't keep an even line around it. If anyone knows how to fix this or knows an outline shader that does work I'd greatly appreciate it.

    Code (CSharp):
    1. //
    2. //  OutlineFill.shader
    3. //  QuickOutline
    4. //
    5. //  Created by Chris Nolet on 2/21/18.
    6. //  Copyright © 2018 Chris Nolet. All rights reserved.
    7. //
    8.  
    9. Shader "VertExmotion/Outline Fill" {
    10.   Properties {
    11.     [Enum(UnityEngine.Rendering.CompareFunction)] _ZTest("ZTest", Float) = 0
    12.  
    13.     _OutlineColor("Outline Color", Color) = (1, 1, 1, 1)
    14.     _OutlineWidth("Outline Width", Range(0, 10)) = 2
    15.   }
    16.  
    17.   SubShader {
    18.     Tags {
    19.       "Queue" = "Transparent+110"
    20.       "RenderType" = "Transparent"
    21.       "DisableBatching" = "True"
    22.     }
    23.  
    24.     Pass {
    25.       Name "Fill"
    26.       Cull Off
    27.       ZTest [_ZTest]
    28.       ZWrite Off
    29.       Blend SrcAlpha OneMinusSrcAlpha
    30.       ColorMask RGB
    31.  
    32.       Stencil {
    33.         Ref 1
    34.         Comp NotEqual
    35.       }
    36.  
    37.       CGPROGRAM
    38.       #include "UnityCG.cginc"
    39.       #pragma vertex vert
    40.       #pragma fragment frag
    41.  
    42.       struct appdata {
    43.         float4 vertex : POSITION;
    44.         float3 normal : NORMAL;
    45.         float3 smoothNormal : TEXCOORD3;
    46.         UNITY_VERTEX_INPUT_INSTANCE_ID
    47.       };
    48.  
    49.       struct v2f {
    50.         float4 position : SV_POSITION;
    51.         fixed4 color : COLOR;
    52.         UNITY_VERTEX_OUTPUT_STEREO
    53.       };
    54.  
    55.       uniform fixed4 _OutlineColor;
    56.       uniform float _OutlineWidth;
    57.       #include "Assets/VertExmotion/Shaders/VertExmotion.cginc"
    58.       v2f vert(appdata input) {
    59.           input.vertex = VertExmotion(input.vertex, _OutlineColor);
    60.         v2f output;
    61.  
    62.         UNITY_SETUP_INSTANCE_ID(input);
    63.         UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
    64.      
    65.  
    66.         float3 normal = any(input.smoothNormal) ? input.smoothNormal : input.normal;
    67.         float3 viewPosition = UnityObjectToViewPos(input.vertex);
    68.         float3 viewNormal = normalize(mul((float3x3)UNITY_MATRIX_IT_MV, normal));
    69.  
    70.         output.position = UnityViewToClipPos(viewPosition + viewNormal * -viewPosition.z * _OutlineWidth / 1000.0);
    71.         output.color = _OutlineColor;
    72.  
    73.         return output;
    74.       }
    75.  
    76.  
    77.  
    78.       fixed4 frag(v2f input) : SV_Target {
    79.         return input.color;
    80.       }
    81.       ENDCG
    82.     }
    83.   }
    84. }
    85.  
     
    hopeful likes this.
  5. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    Hello,
    The color required for vertexmotion is the vertex color, not the outline color.
    You have to add it to the appdata structure.

    Code (CSharp):
    1. struct appdata {
    2.         float4 vertex : POSITION;
    3.         float4 color : COLOR;
    4.         float3 normal : NORMAL;
    5.         float3 smoothNormal : TEXCOORD3;
    6.         UNITY_VERTEX_INPUT_INSTANCE_ID
    7.       };
    then you have to update the vertex position :

    Code (CSharp):
    1. v2f vert(appdata input) {
    2.         v2f output;
    3.         input.vertex = VertExmotion(input.vertex, input.color);
    4.  
    5.         UNITY_SETUP_INSTANCE_ID(input);
    6.         UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);

    The mask shader needs a conversion too. :p

    Code (CSharp):
    1. //
    2. //  OutlineMask.shader
    3. //  QuickOutline
    4. //
    5. //  Created by Chris Nolet on 2/21/18.
    6. //  Copyright © 2018 Chris Nolet. All rights reserved.
    7. //
    8.  
    9. Shader "VertExmotion/Outline Mask" {
    10.   Properties {
    11.     [Enum(UnityEngine.Rendering.CompareFunction)] _ZTest("ZTest", Float) = 0
    12.   }
    13.  
    14.   SubShader {
    15.     Tags {
    16.       "Queue" = "Transparent+100"
    17.       "RenderType" = "Transparent"
    18.     }
    19.  
    20.     Pass {
    21.       Name "Mask"
    22.       Cull Off
    23.       ZTest [_ZTest]
    24.       ZWrite Off
    25.       ColorMask 0
    26.  
    27.       Stencil {
    28.         Ref 1
    29.         Pass Replace
    30.       }
    31.       CGPROGRAM
    32.  
    33.  
    34.  
    35.     #pragma vertex vert
    36.     #pragma fragment frag
    37.     #include "Assets/VertExmotion/Shaders/VertExmotion.cginc"
    38.  
    39.       struct v2f
    40.       {
    41.           float4 vertex : POSITION;
    42.           float4 color : COLOR;
    43.       };
    44.  
    45.       v2f vert ( appdata_full v)
    46.       {
    47.           v2f o;
    48.           o.vertex = UnityObjectToClipPos(VertExmotion(v.vertex, v.color));    
    49.           return o;
    50.       }
    51.  
    52.  
    53.       fixed4 frag(v2f i) : SV_Target
    54.       {
    55.           return fixed4(1,1,1,1);
    56.       }
    57.  
    58.     ENDCG
    59.     }
    60.   }
    61. }
    62.  
    You have to set the VertExmotion shaders to the materials :
    Assets/QuickOutline/Resources/Materials/OutlineFill
    Assets/QuickOutline/Resources/Materials/OutlineMask

    ;)
     
    Last edited: Nov 1, 2018
    kcfos and hopeful like this.
  6. kcfos

    kcfos

    Joined:
    May 20, 2018
    Posts:
    3
    Thanks, it works well up until I try increasing the stretch variable under fx, which the outline shader doesn't seem to adjust to. I can work around it by playing with the max distance and stretch variables, but let me know if there's something better I can try.
     
  7. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    You have to set the shader target to 3.0 in the outline shaders (Fill & Mask) ;)

    Code (CSharp):
    1.       #pragma target 3.0
    2.       #pragma vertex vert
    3.       #pragma fragment frag
     
    Last edited: Nov 2, 2018
    hopeful and kcfos like this.
  8. kcfos

    kcfos

    Joined:
    May 20, 2018
    Posts:
    3
    Works perfect, thanks!
     
    kalagaan likes this.
  9. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    I'm working on the linked sensors ;)



    The vertice modifications are computed according to the settings of the 2 sensors and the distance.:D
     
    hopeful likes this.
  10. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    Now I can link all the sensors :D

     
    hopeful likes this.
  11. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    The UI is ready :D
    A simple click on the small icon for linking 2 sensors.

     
    hopeful likes this.
  12. Slowbud

    Slowbud

    Joined:
    Jul 19, 2015
    Posts:
    53
    Could you give me a hint how to do that? If I save the character as a prefab, and export it as unity package its just 65 kb what can't be. If I try to export it with dependencies, it wants wants to write gigabyte of data to disk.
     
  13. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    you could save the scene and move the necessary files (fbx and prefab) into the same folder, and export the folder as a package (without dependencies), it should work ;)
    You can also send me the fbx only, I'll apply VertExmotion on it.
     
  14. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    With the linked sensors the selection is much easier. :p

     
  15. Bobbysolo100

    Bobbysolo100

    Joined:
    Apr 7, 2017
    Posts:
    34
    Will this work on a linux executable?
     
  16. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    I didn't test it on a linux platform,
    It works on mobile, so I guess that it shoud work on Linux ;)
     
  17. Slowbud

    Slowbud

    Joined:
    Jul 19, 2015
    Posts:
    53
    If I have time I will try that. It isn't as easy as it looks. Well, last time I did it we found a bug in VertExmotion ;-)

    Now hanging at another problem. How do I get access to the "Amplitute multiplier"?
    rThighSensor.m_params.damping = 100f; for damping works, but can't find the correct variable name for the Amplitute.

    To be honest, VertExmotion is a great product, but working with it can be annoying due to lack of documentation.
    When will we get an API description? , I saw you avoided already answering this question by another person.

    Is it possible to update to Pro version, it would be a work around?
     
  18. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    You can find it here : m_params.translation.amplitudeMultiplier
    Here a link to the API ;)

    You can upgrade to the PRO if you need more infos about the source code.
    The upgrade is easy, you just have to delete the DLL files of the basic version. :p
     
    Last edited: Nov 14, 2018
  19. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    229
    Hello,

    I posted this thread and after the post I started undoing everything I've done today to see what caused the scene to increase the size. When I removed the VM and the sensors component from my character, the scene bounced back to 68mbs. Then I deleted VM and the sensors from my second character in the scene and it went back to 5mbs (note that the first character had VM for months in the same scene but the scene size only got affected today when I added VM to another character in the same scene. In source tree I also saw the eyelash material changed after removing VM (not sure if it could be helpful).

     
  20. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    Thank you for the feedback,
    I've found that some edition data should not be serialized in the scene,
    when VertExmotion is applied on a SkinnedMeshRender.:confused:
    The data increase with the polycount.:(

    I'll push a new version on the asset store (1.8.1).
    Please send me an email with your invoice number, and I'll send you a fix. ;)
     
    Last edited: Nov 20, 2018
  21. michelhabib

    michelhabib

    Joined:
    Mar 12, 2012
    Posts:
    11
    Hello, i am considering VertexMotion,
    I have a couple of questions to assess my selection:
    1- is it suitable for mobile AR/VR apps in terms of processing? any known common limitations?
    2- What are the possible use cases i would need the source code pro version?
    3- Is it possible to upgrade to pro after buying standard version?
     
  22. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    Hello,
    1. yes, vertExmotion is fast and works on mobile AR/VR. The limits are defined by the maximum number of sensors that can de applied on one mesh renderer (20 sensors for shader model 3.0 or more and 4 sensors for shader model 2.0 )
    2. The basic and pro version include the same features. I f you want to understand how it work, you can get the pro version. You could also change some parts of the source code if you need.
    3. Yes, you can upgrade to the pro version later ;)
     
    michelhabib likes this.
  23. aburian

    aburian

    Joined:
    Nov 29, 2018
    Posts:
    7
    Hello,

    Can I used this with figures? For example, to simulate a punch? Or is it only for geometric objects?

    -ab
     
  24. michelhabib

    michelhabib

    Joined:
    Mar 12, 2012
    Posts:
    11
    Many Thanks, i got the PRO version, the samples are fantastic, and can't wait to start using it on my new project :)
     
    kalagaan likes this.
  25. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    Hello,
    you can use it with MeshRenderer and SkinnedMeshRender, so you can simulate a punch on a character ;)
     
  26. aburian

    aburian

    Joined:
    Nov 29, 2018
    Posts:
    7
    Ah - so scripting would be required. Which is not my strength. :(

    Thank you!
     
  27. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    Scripting is not required, but sometime it's better for creating a custom FX, I could help if you need ;)
    You can add a collision zone on your character, it doesn't require a custom script.
    Here a sample included in the package.
     
  28. aburian

    aburian

    Joined:
    Nov 29, 2018
    Posts:
    7
    Ok - you sold me. I'll buy it. :)
     
  29. aburian

    aburian

    Joined:
    Nov 29, 2018
    Posts:
    7
    So this is actually pretty cool, and works on figures!
     
    kalagaan likes this.
  30. aburian

    aburian

    Joined:
    Nov 29, 2018
    Posts:
    7
    Ok - just one question. This is an awesome asset, but is it possible to make it work on ragdolls that are being affected by a configurable joint? (i.e. something that pulls a ragdoll and triggers motion does not seem to trigger this plugin)

    Thank you!
     
  31. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    Yes, it works with ragdolls :)
    you have to link the sensor to a bone (in the sensor settings),
    and it will follow any kind of motion, including ragdoll. ;)

     
  32. aburian

    aburian

    Joined:
    Nov 29, 2018
    Posts:
    7
    Wow! Definitely going to try it!

    [Update] SONOFAGUN THAT WORKED! This is an amazing asset!
     
    Last edited: Dec 4, 2018
    hopeful likes this.
  33. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    I'm working on a new demo,
    it will show how to use the linked sensors.



     
    punk, mensch-mueller, ftejada and 3 others like this.
  34. songjiekun

    songjiekun

    Joined:
    Jan 21, 2017
    Posts:
    5
    great asset. before i buy , i maybe have some questions.
    1.is it possible to deform a skinnedmesh based upon physics collision . for example, if i punched an monster(has colliders on different body parts ) , the punched point at that skinned mesh be deformed at realtime with pre-defined degree. is that possible.
    2. how is the performance if i deform a skinned mesh at runtime ?
    3.is that possible to fracture part of the mesh if deformation is very big.
     
  35. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    1. yes, you can do it, there's 2 ways :
    - Add a collision some collision zones on the monster, each impact will be sent to the sensor.
    Here the demo included in the package
    - Create a custom script that generate a sensor for deforming the mesh at runtime according to the impact hit position.

    2. the performance are really good, you won't noticed the impact on FPS ;)

    3. I think that it's possible to fracture a mesh, but the vertices must not be welded in the mesh.
    So if the mesh is pre-defined for fracture in the 3D software, it should work.
    Basicaly the mesh part fors fracture should be welded into fragments, and have a different vertex color (red, green, blue), so each sensor would modify the position of its own layer (red, green, blue).
    I'll do some tests ;)
     
  36. songjiekun

    songjiekun

    Joined:
    Jan 21, 2017
    Posts:
    5
    thank you for your quick reply.
    two more questions.
    1.if a player punched a monster, and softbody script generates a "big dent" on the surface of a body part of this monster. will the collider or collider zone of the body part be updated dynamically to reflect this "dent"
    2. i seen the demo. the deformation in demo is kind of "jelly ". is it possible to build more solid deformation like "play dough" kind of deformation?
     
  37. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    1. Yes you can add a custom deformation vector (local/world) to the sensor, you can also twist and inflate vertices.
    2. you can change the settings of the deformation animation (damping, bouncing...)
     
  38. adamz

    adamz

    Joined:
    Jul 18, 2007
    Posts:
    859
    Hi, so Im running 2018.3 with Amplify Shader Editor. Your doc says to Open the ASE window, and set the Vertex Output to "Relative" in the general section. It also says to add VertExmotion include file in the "Additional Includes" section. I dont know where either of those two go if I'm using HD PBR.

    I also can't get it to work within Unity's Shader Graph. I create Create > Shader > HD Lit Graph, add the VertExmotion to Position (setup like in your docs), Save, and my shader is Pink.

    I'm running:
    Unity 2018.3.0b12
    HD RP 4.6.0
    Shader Graph 4.6.0

    Thoughts? Thanks.
     
    Last edited: Dec 14, 2018 at 6:43 PM
  39. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    Thank you for the feedback,

    The UI of the HDRP nodes in ASE is different
    - the vertex output is already set to 'Relative' by default (there's no option for changing it)
    - you can add the include file in this section :


    The latest version of HDRP supported by ASE is 4.2.0


    The Shader Graph 4.x includes a bug that prevent VertExmotion to compile.
    It should be fixed in 5.0.0
    Edit : I did a fix for 4.6.0, but it require to add some nodes for fixing a weird bug in Shader Graph.So I'll wait for a fix of ShaderGraph.

    There's also a bug with the VertExmotion UI in Unity 2018.3,
    I have fixed it, the version 1.8.2 will be available next week.
     
    Last edited: Dec 16, 2018 at 10:19 PM
    nexoriumVR likes this.