Search Unity

VertExmotion [Released]

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

  1. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,502
    You can add the VertExmotion node after the Vertex displacement in shadergraph.
    You'll have to set the material property block of the VertExmotion component to your own renderer.
    In HDRP the function need the 'absolute world position' for the input position.

    The sensors have to be set as children of the bones, so it should work like a regular skinned mesh.
    So I think that it should work like this :
    - Apply the VertExmotion component on the SkinnedMeshRenderer
    - Create the sensors with the editor
    - Add the VertExmotion node to your shader
    - Create a script for applying the VertExmotion material property block to your own renderer.
     
  2. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    868
    Thanks,I just purchased it. However; I still have some questions:
    - Getting lots of errors when I go to paint panel, and panel disappears; however, did not add the shader nodes yet because of:
    - I unpacked Addon/VertExemotion_ShaderGraph_6.9 (I am using shadergraph 7.5.1). There seems to be no suitable node to add as subgraph in Shaders/ShaderGraph
     
  3. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,502
    What is your version of Unity?
    Could you send me an email with the errors? (contact@kalagaan.com)

    You can use the custom function node like this :


     
  4. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    868
    Using 2019.4.15 LTS, will send error messages by mail.
     
  5. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    868
    Just want to thank you @kalagaan for the incredible fast help, everything works as expected (besides the normals correction, hoping for the update:)
     
    kalagaan likes this.
  6. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    868
    @kalagaan Have another question related to my custom pipeline; do you think it's feasible to somehow pass my vertex displacements into your "hacked" Lit.shader ? Right now, I am doing displacements with shader graph, using textures for the positions/normals and UVs for the vertex IDs, right before I pass the position into the custom function from VertExmotion. would like to replicate the same with lit.shader, main reason is I want to use tessellation.
     
  7. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,502
    I think that it could be difficult to add additionnal data to the LitShader, and the current version is not compatible with the normal correction. I think that you should try Amplify Shader Editor, there's more options than ShaderGraph.

    There's another way to use the original tessellation shader, you could include the VertExmotion function in your compute shader. So the VertExmotion effects will be performed while the skinning computation, and you won't need compatible shaders anymore.

    I use a compute shader for baking the mesh with the vertex & normals deformations.
    Have a look to the Bake mesh demo and the compute shader file : "VertExmotion/Saders/Resources/VertExmotionBakeMesh.compute"
     
  8. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    868
    I had a look at the BakeMesh demo; the interesting part probably is hidden, as I have the non Pro version ;) I guess you are still copying the vertex info to CPU, right? This would be too slow for my use case, also the bake mesh demo is running at relatively low framerate.
     
  9. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,502
    For the bakeMesh function the buffers are read from GPU for generating the new mesh, this is a tool that should not be executed every frame, but in your case, you could store the final result into the textures you use for the skinning.
    I'll send you the source code for this part ;)
     
    Qleenie likes this.
  10. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    868
    Thanks, I guess this would work, but probably I still cannot use the default shaders without baking, as I cannot pass the position textures I am generating afaik. This is a bit of a shame that we are not able directly into the mesh buffers in Unity.

    PS: This is of course not a shortcoming of the great VertExmotion plugin, but of Unity.
     
  11. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,502
    That's why VertExmotion works in the vertex program :p
    You should try to use ASE, but I think that it's not yet compatible with the latest HDRP version for unity 2020.
    There's a package including the VertExmotion nodes for ASE in the addon folder ;)
     
  12. minad2017

    minad2017

    Joined:
    Dec 1, 2016
    Posts:
    50
    hi
    I want to make Vert Exmotion Interaction work in Capsel shape. Is there a good way?
    To achieve this, I tried connecting Spheres into a rod shape, but the mesh deformation became jagged.
     
  13. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,502
    Did you try to link the sensors?
    Could you send me more informations about the effect you try to achieve?
    Please send me some references, or screenshots (email : contact@kalagaan.com), I'll help you ;)
     
  14. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    868
    Hi @kalagaan , have another question: I need to deactivate sensors during runtime; right now, I am doing it by just setting the game object of the sensor "inactive"; but this leaves the affected vertices somehow in the state they were before I do the switch. Is this a bug? Is there a way to "gracefully" switch off a sensor, so that all vertices go back to their "neutral" position?
     
  15. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    868
    actually I found a way to do so with ResetMotion(). But what is a bit strange is / was that before, the vertices seemed to be shifted in world space, not in local space. So when the skinnedmesh turned around, the vertices were shifted always into negative X direction.
     
  16. johningame

    johningame

    Joined:
    Dec 12, 2016
    Posts:
    2
    Hello Kalagaan - Ran into the Pink material as well - I'm getting errors after importing the URP Shader package. . any help would be appreciated.

    using Unity 2020.1.9f1 personal & URP
    Assigned a VertExmotion material to a mesh (turned pink)
    imported Universal render pipeline package

    After importing, Unity delivered the following errors: (Error details are in the text file)

    Shader error in 'VertExmotion/Universal Render Pipeline/Unlit': failed to open source file: '../VertExmotion.cginc' at line 56 (on d3d11)

    Shader error in 'VertExmotion/Universal Render Pipeline/Unlit': failed to open source file: '../VertExmotion.cginc' at Assets/VertExmotion/Shaders/URP/DepthOnlyPass.hlsl(7) (on d3d11

    Shader error in 'VertExmotion/Universal Render Pipeline/Unlit': failed to open source file: '../VertExmotion.cginc' at Assets/VertExmotion/Shaders/URP/UnlitMetaPass.hlsl(7) (on d3d11)

    Shader error in 'VertExmotion/Universal Render Pipeline/Lit': failed to open source file: '../VertExmotion.cginc' at Assets/VertExmotion/Shaders/URP/DepthOnlyPass.hlsl(7) (on d3d11)

    Shader error in 'VertExmotion/Universal Render Pipeline/Lit': failed to open source file: 'Assets/VertExmotion/Shaders/VertExmotion.cginc' at Assets/VertExmotion/Shaders/URP/LitForwardPass.hlsl(7) (on d3d11)

    Shader error in 'VertExmotion/Universal Render Pipeline/Lit': failed to open source file: '../VertExmotion.cginc' at Assets/VertExmotion/Shaders/URP/LitMetaPass.hlsl(7) (on d3d11)

    Shader error in 'VertExmotion/Universal Render Pipeline/Lit': failed to open source file: '../VertExmotion.cginc' at Assets/VertExmotion/Shaders/URP/ShadowCasterPass.hlsl(8) (on d3d11)

    Shader error in 'VertExmotion/Universal Render Pipeline/Simple Lit': failed to open source file: '../VertExmotion.cginc' at Assets/VertExmotion/Shaders/URP/DepthOnlyPass.hlsl(7) (on d3d11)

    Shader error in 'VertExmotion/Universal Render Pipeline/Simple Lit': failed to open source file: '../VertExmotion.cginc' at Assets/VertExmotion/Shaders/URP/ShadowCasterPass.hlsl(8) (on d3d11)

    Shader error in 'VertExmotion/Universal Render Pipeline/Simple Lit': failed to open source file: '../VertExmotion.cginc' at Assets/VertExmotion/Shaders/URP/SimpleLitForwardPass.hlsl(7) (on d3d11)

    Shader error in 'VertExmotion/Universal Render Pipeline/Simple Lit': failed to open source file: '../VertExmotion.cginc' at Assets/VertExmotion/Shaders/URP/SimpleLitMetaPass.hlsl(7) (on d3d11)
     

    Attached Files:

  17. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,502
    Maybe you should ignore a frame after the reset motion, because the animation system check the position of the sensor in the previous frame.
     
  18. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,502
    It looks like the file 'Assets/VertExmotion/Shaders/VertExmotion.cginc' is missing.
    Did you move some files in the folder hierarchy?
     
    johningame likes this.
  19. johningame

    johningame

    Joined:
    Dec 12, 2016
    Posts:
    2
    Yes, Yes I did. keeping it in it's original space sovled the issue. Thank you! Happy Holidays!
     
    kalagaan likes this.
  20. Dobalina

    Dobalina

    Joined:
    Sep 6, 2013
    Posts:
    105
    Hello! I have a couple basic questions I've been meaning to ask for a while. Is VertExmotion handled completely on the GPU? If so, is there any option to move any of the calculations to the CPU? I ask because my project is starting to drift into gpu bound territory and I'm looking for anything I can do to lighten the GPU load :)
     
  21. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,502
    VertExmotion modifications are made in the vertex function of the shader, so it not bottleneck for the GPU ;)
    Doing the job on the CPU will modify the mesh itself, and it will slow down the process...
     
  22. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    868
    Hey @kalagaan Another question:
    I have painted the weights and placed sensors, so everything is working fine. But sometimes I see vertices being affected by sensors, even if they are not being painted at all in the paint menu. How to avoid that these vertices are being affected by the sensors? BTW I set the "Gradient" to 1, is this the problem? How should it be set so that unpainted vertices are never affected?
     
  23. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,502
    The gradient is just a way to visualize the paint data, it doesn't change the weight.
    If the weight is set to 0 ( blue ) the vertices won't move.
    If you used the smooth brush, some weights could be near 0, and could move.

    Do you use some layers or not?

    EDIT: I've added a darker color to the gradient for the weight 0 ;)
     
    Last edited: Dec 16, 2020
  24. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    868
    Thanks, I found the issue; I am switching between two different meshes, a low and a high poly one; I painted the weights on the low poly one. Seems that if I switch to the high poly one, it seems to put everything to "max" weight, as I did not define a separate weight map. Is there a way to "share" the weights somehow ? Both meshes share same textures. What would be best setup of VertExmotion in this case?
     
  25. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,502
    You can use the export mesh function in paint mode (enable 'use mesh reference')
    If you do it for both meshes (low and high) you'll be able to switch them at runtime.
    Both mesh will be saved as new assets your project.
     
    Last edited: Dec 21, 2020
  26. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    868
    Thanks, this works great!
     
    kalagaan likes this.
  27. Slashbot64

    Slashbot64

    Joined:
    Jun 15, 2020
    Posts:
    322
    Any ideas? additional directives has the VertExmotion...
    just checking an old project with latest amplify/vertexmotion on 2021... so no idea didn't have this before though..
     
  28. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,502
    Thank you for the feedback,
    I'm not sure that ASE supports the latest beta version.
    I'll do some tests!

    What is your render pipeline?
     
  29. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,502
    I've tested with this version :
    - Unity 2021.1.0b3
    - ASE 1.8.8
    - VertExmotion 1.9.7
    - Built-in render pipeline

    The shader works as expected.

    What I've done for the test :
    - Install the VertExmotion addon for ASE
    - Add the additionnal directive : "Include" VertExmotion.cginc (link to the file)
    - Add the VertExmotion node
     
  30. banksysan_unity

    banksysan_unity

    Joined:
    Feb 4, 2020
    Posts:
    16
    Hi.

    Painting isn't happening. I've got the correct shader, I'm using the VertExmotion URP Lit shader.



    What am I missing?
     
  31. banksysan_unity

    banksysan_unity

    Joined:
    Feb 4, 2020
    Posts:
    16

    Solved it
    I'd deleted the collider.
     
    kalagaan likes this.
  32. banksysan_unity

    banksysan_unity

    Joined:
    Feb 4, 2020
    Posts:
    16
    Actually, take that back. It seems to be something to do with editing prefabs.



    Painting in the main scene view works, painting in the prefab view doesn't.
     
  33. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,502
    Thank you for the feedback,
    it looks like the collision system doesn't work properly in prefab mode.
    I'll find a way to fix that.

    Here an easy method for applying the paint data :
    - Edit the weights in the sceneview
    - In the inspector : disable & enable the vertExmotion component (for enabling that something changed)
    - RightClick on the name of the VertExmotion component : "Modified component->Apply to prefab"

    the paint data will be saved in the prefab.


    EDIT : I found a way to fix it.
    In the next version you'll be able to paint in prefab mode
    ;)
     
    Last edited: Jan 24, 2021
    C_p_H, hopeful and banksysan_unity like this.
  34. banksysan_unity

    banksysan_unity

    Joined:
    Feb 4, 2020
    Posts:
    16
    Thanks.
     
  35. YukkuriMikan

    YukkuriMikan

    Joined:
    May 17, 2017
    Posts:
    8
    When I add VertExmotionSensor from AddComponent, the settings in the inspector are broken and I get an error.

    Is this going to be fixed in the next version? スクリーンショット 2021-02-13 004053.png
     
  36. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,502
    Yes, it will be fixed in the next version (1.9.8), I'll push it asap.
    You can add a parent gameObject for fixing the inspector.
     
  37. YukkuriMikan

    YukkuriMikan

    Joined:
    May 17, 2017
    Posts:
    8
    I understand.
    Thank you very much.
     
  38. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,502
    The version 1.9.8 is now available on the assetstore ;)
     
  39. YukkuriMikan

    YukkuriMikan

    Joined:
    May 17, 2017
    Posts:
    8
    Thanks for the update.
    The sensor bug has been fixed.

    I wish I had noticed it before the update, but there was some strange behavior.
    When I connect the VertexNormal of the VertExmotion node with the Amplify Shader, the shadow disappears.

    upload_2021-2-24_23-5-38.png
    Vertex Normal is not connected and is drawn correctly.

    upload_2021-2-24_23-7-44.png
    When Vertex Normal is connected, the shadow disappears.
     
  40. GSanLob

    GSanLob

    Joined:
    Oct 11, 2017
    Posts:
    14
    Hi @kalagaan, thanks for creating this awesome asset. I was wondering if it's possible to get VertXMotion working in the editor, without going to play mode? I 'm using your asset to deform a character and am using timeline to control the animation. In a nutshell, I would love to preview VertXMotion in editor while using timeline. If I get the VertXMotion pro version with the source code, is it as simple as adding [ExecuteInEditMode], or do you foresee any issues that might come up?

    Also, if I bough the regular VertXMotion version, is it possible to upgrade to Pro, or would I need to pay the full price for Pro?

    Thank you!
     
  41. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,502
    That's weird,
    I'll check what's going on, could you please give me more informations about your project settings ?
    - Unity version
    - Render Pipeline
    - ASE version
     
  42. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,502
    This is not possible with the current version.
    There's some mesh initializations at runtime that can't be done in edit mode without more data control.
    The system is also using the Time class, so the animation system won't work in editor.
    Adding the [ExecuteInEdtiMode] property won't fix it.

    I'll think about a way to include this feature. ;)

    You can upgrade to the pro version in the assetstore, the current price will be set to the upgrade price when you log in with an account that has already the basic version.
     
  43. GSanLob

    GSanLob

    Joined:
    Oct 11, 2017
    Posts:
    14
    Gotcha, thank you for explaining. I figured it might be a bit more complex than adding [ExecuteInEdtiMode] lol.
    Thank you for looking into including this feature. That would be amazing!
     
  44. YukkuriMikan

    YukkuriMikan

    Joined:
    May 17, 2017
    Posts:
    8
    Sorry, I forgot to write down the version information.

    Unity 2020.2.5f1
    HDRP 10.3.1
    AmplifyShader 1.8.8
     
    Last edited: Feb 26, 2021
  45. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,502
    I did some tests, you have to uses these nodes ;)
     
  46. YukkuriMikan

    YukkuriMikan

    Joined:
    May 17, 2017
    Posts:
    8
    Thanks for the reply.

    But I've tried it and it's still a little strange.
    The shadows are showing, but there is a clear difference in the shading with and without the Vertex Normal connected.
    Also, there seems to be an anomaly when applying SSAO in HDRP.
    I think there are still some anomalies in the calculated normals.

    無題.png
    When connected to Vertex Normal

    スクリーンショット 2021-03-01 104049.png
    When not connected to Vertex Normal

    スクリーンショット 2021-03-01 104233.png
    Difference in shading (top: without Vertex Normal, bottom: with Vertex Normal)
     
  47. Creiz

    Creiz

    Joined:
    Jun 6, 2017
    Posts:
    130
    @kalagaan, is it possible to import the "VertExMotion" textures at runtime for procedurally generated characters?
     
  48. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,502
    Here a way to fix it
    I think that the 'bug' is about the HDRP camera offset (changed in 2020), I'll update the documentation.

    Vertex Position mode : 'relative'



    Vertex Position mode : 'Absolute'
     
    Last edited: Mar 1, 2021
  49. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,502
    The weight data are stored in the vertex color, so you can generate it in the new procedural mesh.
     
    Creiz likes this.
  50. Creiz

    Creiz

    Joined:
    Jun 6, 2017
    Posts:
    130
    Yes, but that mesh is generated at runtime from different parts "glued together". It's an UMA in case you heard about it. With a custom character.

    I tried to directly colorize the mesh in Blender (with Vertex Paint), I tried to make a instance mesh and switch it at runtime directly on the mesh renderer but neither worked.

    When the character generates, it's all white. The whole thing. the sensors make the whole character bounce.

    I was wondering if it was possible to just export the whole UV texture when you paint it in Edit mode, then at runtime just re-import it back when the character generated and then enable the sensors.