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. Gruguir

    Gruguir

    Joined:
    Nov 30, 2010
    Posts:
    296
    I wonder how to handle waving grass mesh (/env/props..) to simulate a wind effect efficientely. I'd really like to see an example. Also i didn't see a scripting api doc. I have to study the demo scripts, i'm a little lost at start. I hope there is some way to batch/optimize (anyway happy customer here).
     
  2. Gruguir

    Gruguir

    Joined:
    Nov 30, 2010
    Posts:
    296
    Got some first results :

    Code (CSharp):
    1.     void LateUpdate ()
    2.     {
    3.         for (int i = 0; i < myVertexMotion.m_VertExmotionSensors.Count; ++i)
    4.         {
    5.             myVertexMotion.m_VertExmotionSensors[i].m_params.translation.worldOffset = target.position;
    6.         }
    7.  
    8.     }
    where target translation is 'wind' behavior.
     
    Last edited: May 30, 2018
  3. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    Yes, you have to create your own wind function.:)
    Here a sample with the windzone gameobject.

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. namespace Kalagaan
    5. {
    6.     public class VertExmotionWindZone : MonoBehaviour {
    7.  
    8.         public WindZone m_windZone;
    9.         public VertExmotionSensor m_sensor;
    10.         [Range(0, 1)]
    11.         public float m_windIntensity = 1f;
    12.         public float m_maxRange = 1f;
    13.  
    14.         void Update()
    15.         {
    16.             if (m_windZone == null || m_sensor == null)
    17.                 return;
    18.  
    19.             Vector3 wind = m_windZone.transform.forward;
    20.             wind = wind.normalized * m_windZone.windMain * .4f;
    21.             wind += wind.normalized * m_windZone.windPulseMagnitude *
    22.                 Mathf.Sin(m_windZone.windPulseFrequency * Time.time * 10f) *
    23.                 Mathf.Cos(m_windZone.windPulseFrequency * Time.time * 2f) *
    24.                 .6f;
    25.  
    26.             wind += m_windZone.transform.up * .01f *
    27.                 Mathf.Sin(m_windZone.windTurbulence * Time.time * 10f) *
    28.                 Mathf.Cos(m_windZone.windTurbulence * Time.time * 2f);
    29.  
    30.             wind = Vector3.ClampMagnitude(wind, m_maxRange);
    31.  
    32.             m_sensor.m_params.translation.worldOffset = wind* m_windIntensity;
    33.         }
    34.     }
    35. }
     
    Gruguir likes this.
  4. wbstafford

    wbstafford

    Joined:
    Oct 5, 2017
    Posts:
    3
    Hi Kalagaan. I'm excited about your product. I just bought and imported it, and I'm getting a few errors, even if I import it into a fresh, blank scene. I am using Unity 2018.1.6f1. I get three errors with three shaders unable to compile. It is the "Standard", "Standard Specular" and the "ShaderForge/test1". I have included screenshots of the errors I get on loading, and then when I go to choose the "vertExmotion" shaders, those three show up in another dropdown for "Failed to compile".

    Can't wait to use the product, but need to see if these issues can be resolved. The errors appear to point to a very specific subscript on a specific line of the shader code.

    Thanks in advance for your help, and let me know if you need any info from me.

    vert1.jpg
    vert2.jpg

    vert3.jpg
     
  5. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    Hi, you have to reimport the "VertExmotion/Shaders" folder to fix the issue ;)
     
  6. wbstafford

    wbstafford

    Joined:
    Oct 5, 2017
    Posts:
    3
    Thanks for your quick reply. That did solve the issue. However, we have run into another problem. It seems that if you are using the Post Processing Stack, and ambient occlusion (which we are in our entire project), there is a problem. You end up seeing the original mesh ghosted below the wobbly mesh. The ambient occlusion effect is stuck to the original mesh, and the vertex motion is bouncing around on top of it. Is there a fix for this?

    You can see it in your own demos, if you import the post processing stack and add it to your camera and turn on ambient occlusion, it shows up. The image below is from your demo. It's a bit hard to see in the still shot, but is much more visible and apparent when things are moving around.

    I'm hoping there is a fix, because we love what vertexmotion does.

    Thanks!

    vert4.jpg
     
  7. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    423
    Hey Kalagaan.

    Can I use Vertexmotion with custom shaders I made with Shader Forge? And will the deformations effect the mesh normals?
     
  8. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    It looks like the AO post process works only in deferred mode, I'll check if I can fix that ;)
     
  9. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    Yes, you can use it with shader forge



    There's a parameter on the VertExmotion component for the normal correction.
     
  10. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    423
    awesome thanks :)
     
  11. wbstafford

    wbstafford

    Joined:
    Oct 5, 2017
    Posts:
    3
    Hey Kalagaan, have you had a chance to look into a fix for this AO situation? We are at the end of our project and this is one of the "finishing touches" we wanted to put on. If it's not going to work, that's fine, but we would just like to know if you think you will be able to make it happen or not.

    Thanks again!
     
  12. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    It looks like Depth map that is required for AO is generated by the camera before rendering the models, so it won't work with any shader with a vertex position modification :(.
    In deffered mode the AO is generated later so it works.
    So there's no solution for now :confused:
     
    hopeful likes this.
  13. superlol

    superlol

    Joined:
    Dec 6, 2010
    Posts:
    10
    Hi there!
    Just bought your plugin but I noticed later that it works only with vertexmotion shaders, I'm using unity 2018.2 with HD render pipeline (Lit shaders), any ETA for an update?
    Thx.
     
  14. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    I'm working on an update of the Amplify Shader Editor node for the lightweight SRP.
    When ASE will be compatible with HDRP I'll work on it ;)
     
    superlol likes this.
  15. TheivingBullet

    TheivingBullet

    Joined:
    Oct 29, 2015
    Posts:
    2
    Hey Kalagaan,

    I bought the pro version and am really happy with the results/GUI/performance of the plugin.

    I have a question about the sensors.

    Currently having trouble setting up the sensors to mimic materials that take time to reset into their shapes.

    For example the memory foam in the video:


    I've tried adjusting the Dampening/Bouncing on the sensors with no luck mimicking the material.

    Is there a general pattern you recommend to achieve this effect.
     
  16. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    Hi, you can create a custom script and add a custom offset to the sensor (world or local), so you could control the speed of the deformation. Have a look to the interaction demo.
    Maybe you should also use the VertExmotion.SetTimeScale() fonction, there's a sample in the TimeScale demo.
    With a very small value, the deformation will come back slowly to the original shape. :)
     
  17. TheivingBullet

    TheivingBullet

    Joined:
    Oct 29, 2015
    Posts:
    2
    Thanks for the quick response! I'll be sure to give this a try!
     
  18. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,292
    Just want to let you know that shader for this asset doesn't work on PS4. I have fixed the issue, so pm me for the fix. It works on Switch.
     
    kalagaan likes this.
  19. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,292
    Hi. @kalagaan

    Is there way for me to simulate the motion with Time.scale to zero. I use this for pausing the game, but the model still needs to be updated with motion for the objects that i show in the pause menu. Do I manually call UpdateShaders() ?
     
  20. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    The sensors compute motion according to the time scale, if you need to animate the vertices with a Time scale to zero, you could try this :

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using Kalagaan;
    5.  
    6. public class PauseGame : MonoBehaviour {
    7.  
    8.     public VertExmotion m_vtm;
    9.     bool _pause = false;
    10.  
    11.     void Update () {
    12.      
    13.         if(Input.GetKeyDown("space"))
    14.         {
    15.             _pause = !_pause;
    16.             Time.timeScale = _pause ? 0.00001f:1f;
    17.             m_vtm.SetTimeScale(_pause ? 10000f : 1f);
    18.         }
    19.  
    20.     }
    21. }
    but the game is not really in pause :confused:

    You can create a custom script to animate the sensors :
    Code (CSharp):
    1. m_vtm.m_VertExmotionSensors[0].m_params.translation.worldOffset.y = Mathf.Sin(Time.unscaledTime);
    I'll add an option for using the unscaled time in the main process.;)
     
    Last edited: Jul 29, 2018
  21. StimpyPurrpurr

    StimpyPurrpurr

    Joined:
    Jan 12, 2016
    Posts:
    3
    I'm kind of stupid with code, I use playmaker for everything. Could you walk me through making it a lateupdate for IK script compatibility? I saw the code snipit you posted a few pages back but no idea where to put it. You did mention adding a bool in the script to enable that but I don't know what script or where that is within it.

    Also.. I've figured out how to use this with shaderforge shaders. But I have no idea where to put the code in a premade shader' script. (EDIT: Solved the shader issue. Took me some time but the instructions in the manual were more clear that the forum post. :3 Worked like a charm!)

    To further explain what I'm trying to do. I have a dinosaur that turns to fallow an empty with IK. The IK breaks Vertexmotion as it's motion sensor doesn't move with the bone. Breaking the tail wiggle and collision effect I got working on it without the IK script.

    Please help a scriptard, Thanks. :(
     
    Last edited: Aug 22, 2018
  22. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    The script is activated on LateUpdate by default ;)

    you have to edit the script order in the editor settings, the VertExmotion script must be executed after the IK.
    So you have to go to the menu :
    Edit->Project Settings->Script Execution Order
    Then after the default Time, you can add the scripts Kalagaan.VertExmotionSensor and Kalagaan.VertExmotion.

    It should work ;)
     
  23. StimpyPurrpurr

    StimpyPurrpurr

    Joined:
    Jan 12, 2016
    Posts:
    3
    You're the best, Thanks! I've literally never noticed that script menu before. I think anything with the "S" word my eyes stray away from.
     
  24. Adam_Starcaster

    Adam_Starcaster

    Joined:
    Dec 7, 2012
    Posts:
    35
    Any Chance to support HDRP? Bought this and using HDRP for a main project, would really like to use some of the features.
     
    superlol likes this.
  25. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    I'm working on a node HD SRP for Amplify Shader Editor ;)

    https://twitter.com/kalagaan/status/1035847813127651328

    It should be available next week. :D
     
    Last edited: Sep 4, 2018
  26. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    229
    Hello,

    Since VertexMototion changes the shader to VM standard I am wondering how it's possible to use the Alloy skin shader and still have the VM effects?
     
  27. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    There's an official support of VertExmotion in the Alloy shader ;)

    - Open the file 'Alloy/Shaders/Config.cginc'
    - Uncomment :

    #define A_USE_VERTEX_MOTION
    #include "Assets/VertExmotion/Shaders/VertExmotion.cginc"

    - Reimport the 'Alloy/Shaders' folder
     
    Adam_Starcaster and skinwalker like this.
  28. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    VertExmotion 1.7.0 has been submitted to the asset store. :)
    It should be available soon.

    It includes the HD & LW nodes for Amplify Shader Editor.
    I've also added a way to use unscaled time for the sensors.
     
    hopeful likes this.
  29. Rave-TZ

    Rave-TZ

    Joined:
    Jul 21, 2013
    Posts:
    45
    I've noticed that VertExMotion occasionally stops working to the point I have to remake sensor. The sensor settings are all the same and I can add gravity, but the motion no longer functions.

    If I had to pinpoint the source of the issue, it would be editing the parameters while in play mode, then copying the component and pasting the values in edit mode.

    Any way I can get around this?
     
  30. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    What are the version of VertExmotion and Unity?
    Is there any messages in the console?

    Could you send me a sample scene, or a video of the problem?
    ( contact@kalagaan.com )
    I could check what's going on ;)
     
  31. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    Ok, I think that I got it!
    It looks like an initialization problem.
    When the sensor's data are paste, the sensor freeze at the begining and restart to work later.
    I'll fix it asap.
    Thank you for the feedback ;)
     
  32. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    Here a fix, ;)

    open the file VertExmotion/Core/VertExmotionSensor.cs
    and add this function :


    Code (CSharp):
    1. public class VertExmotionSensor : VertExmotionSensorBase {
    2.  
    3.         public new void Start()
    4.         {
    5.             if (m_motionReference == null)
    6.                 m_lastPosition = transform.position;
    7.             else
    8.                 m_lastPosition = m_motionReference.InverseTransformPoint(transform.position);
    9.  
    10.             m_sensorDirection = Vector3.zero;
    11.             m_motionDirection = Vector3.zero;
    12.  
    13.             ResetMotion();
    14.         }
    15.     }
     
  33. Rave-TZ

    Rave-TZ

    Joined:
    Jul 21, 2013
    Posts:
    45
    Worked like a charm! Kickass :D

    I was using Unity3d V 2017.3.0.p3
    VertExmotion 1.69
     
    Last edited: Sep 7, 2018
  34. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    I've made a node for the Unity Shader Graph :D
    Coming soon to the assetstore ;) (v 1.7.1)

     
    Last edited: Sep 18, 2018
    hopeful likes this.
  35. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    4,459
    I don't recall, but do you have a hookup for the Amplify Shader Editor already?
     
  36. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    Yes, Amplify nodes are already available :D
    version 1.7.0 includes ASE nodes for HDRP and LWRP
    VertExmotion is also in the official documentation of ASE.
     
    hopeful likes this.
  37. Splosions

    Splosions

    Joined:
    Apr 29, 2017
    Posts:
    16
    Having some issues with Vertexmotion pro. Main issue is the camera is not resetting when I close the editor. It is stuck in some sort of pseudo orthographic view. Even when I close and re-open unity
     
  38. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    Thank you for your feedback, I'll have a look to it.
    You can change the camera mode (persp/Iso) by clicking on the middle of the axis icons. ;)

     
  39. Gruguir

    Gruguir

    Joined:
    Nov 30, 2010
    Posts:
    296
    hey @kalagaan i wanted to use VertExmotion for a project but vertex colors are already used for painting my models (they don't have textures)... do you have any possible solution in mind maybe just in case - I guess i'll have no other choices than UV map them to free the vertex color map ?
     
  40. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    Yes, you can add your own input to the VertExmotion function.
    If you're using a tool like amplify Shader Editor, you can easily change the input.
    If you are using a custom shader, you can change the function, have a look to VertExmotion.cginc.
    If you have issues with the shader, please send me an email (contact@kalagaan.com) and I'll help you ;)
    You can also add a white color to the VertExmotion function, and only rely on the sensor's range.
     
    Last edited: Sep 29, 2018
    Gruguir likes this.
  41. Gruguir

    Gruguir

    Joined:
    Nov 30, 2010
    Posts:
    296
    That sounds great, i didn't expected that feature :)
    On a side note, i noticed that vertexmotion take over the color map edited in my modeler (i found it easier to paint vertex in the modeler). I'd like an 'update colors from model' paint option.
     
  42. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    This feature is already available, I have to add the checkBox in the UI :p
    You can enable it in debug mode :
    - Right click on the Inspector tab -> Debug mode
    - In the VertExmotion component, Params->Use Paint Data From Mesh Colors
    - Restore the inspector tab to Normal mode

    This feature is enabled when the mesh reference is saved, but if you want to use the original colors from the mesh without saving a new mesh reference, it must be activated.

    I'll add the checkbox in the next version. ;)
     
    Last edited: Sep 29, 2018
  43. Gruguir

    Gruguir

    Joined:
    Nov 30, 2010
    Posts:
    296
    @kalagaan sweet :)
    sorry to bother again but when trying to update my ASE shader with VertExmotion node i get that error :
    Shader error in 'ToonyVertexDetail': undeclared identifier 'VertExmotionAdvancedASE' at line 84 (on d3d11)
    Maybe something i have to setup in ASE output node ?
     
  44. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    Did you add the cginc file?
    Here the documentation for VertExmotion integration

    If it still doesn't work, could you send me the shader?
    It would be easier to check what's going on ;)
     
  45. Gruguir

    Gruguir

    Joined:
    Nov 30, 2010
    Posts:
    296
    Oops no...
    It looks like you are on my skype contacts and we are from the same country, so i messaged you there and will stop to spam here. Thanks again.
     
  46. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    I don't use skype :p
    You can send me a PM on the forum, or an email ;) (contact@kalagaan.com)
     
  47. YakkyCat

    YakkyCat

    Joined:
    Apr 22, 2015
    Posts:
    2
    Hi, @kalagaan
    First of all thanks for making a wonderful asset, and apologize for my English being a Google translation.
    I want to change the shape of the sensor from sphere to capsule, is it possible?
    It is in the form of "SpherePush" sensor in "Demos / Interactions / TouchScene".
    Look at this foolish attempt.:oops:
    wtest5.png wtest6.png
    I would like to make a capsule shaped sensor that can change size,
    Because I want to dent a slime-like soft object with a club.
    And can not it be a Pro version?(For source code custom)
    I only have VertExmotion normal version.
    I tried reading this forum with my poor English ability, but I am sorry if I asked the same question.:(
     
  48. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    737
    Unfortunatly there's no way to create a capsule shape for the sensors with the current version. :(
    I'll work on a way to link sensors, but I don't know yet when it will be available.
    Maybe you could use the vertex color of the mesh for generating the shape, and use only a few sensors.
     
    Last edited: Oct 24, 2018
  49. YakkyCat

    YakkyCat

    Joined:
    Apr 22, 2015
    Posts:
    2
    Thanks for your quick reply.
    Indeed, it is difficult.:confused:
    Anyway try out different ways, and
    I expect you to succeed in your work while waiting.
    Thanks for the hint!;)
     
  50. Slowbud

    Slowbud

    Joined:
    Jul 19, 2015
    Posts:
    53
    Hello @kalagaan, somehow I can't paint. I'm now using VertExmotion with interuption for quite long time and it worked well. But now on new figures and props painting doesn't work. Once for a short period it worked suddenly, afte leaving paint mode and going in again, not. Fill and clear layers works fine. Any hints where to look?