Vertex Animation Texture utilities tools used at BonjourLab
npm install com.bonjour-lab.vatutils
{
"name": "Bonjour-lab",
"url": "https://registry.npmjs.com",
"scopes": [
"com.bonjour-lab"
]
}
`
To the dependencies section:
`
"com.bonjour-lab.vatutils": "0.0.8",
`
After changes, the manifest file should look like below:
`
{
"scopedRegistries": [
{
"name": "Bonjour-lab",
"url": "https://registry.npmjs.com",
"scopes": [
"com.bonjour-lab"
]
}
],
"dependencies": {
"com.bonjour-lab.vatutils": "0.0.7",
...
`
How to use this package
First, create and export your VAT file using the VAT 3.0 format for Unity from SideFX Labs.
See more on the SideFX forum FAQ and Links to learn more about VAT and how to export them for Unity.
Duplicate one VAT shader template from the `Editor/Shader` folder. Choose the one adapted to your VAT file.
Apply this shader to your VAT material and update its design (Albedo, normal map... anything you want) using shader graph.
Apply all the VAT texture to the material. This is important as the script will read the material to grab all the data and bind it to your VFX Graph
Using this you can check if your VAT works fine before creating your VFX Graph.
!img
Duplicate one of the VFXGrap templates from the VFX Template folder.
Choose the one adapted to your VAT and create your own VFX simulation.
Replace the Shadergraph asset from the `Output Particle Lit Mesh` with your own shader and link the new uniform variable if you have created some (like Color, Albedo, Normal map...)
Add your VFX Graph to the scene and add the corresponding binding script. There is one script per VAT type
* `BindVATDynamicRemeshingToVFX.cs`
* `BindVATParticleSpritesToVFX.cs`
* `BindVATRigidBodyToVFX.cs`
* `BindVATSoftBodyToVFX.cs`
Add your VAT mesh and material to the `VAT Mesh Reference` and `VAT Material Reference` variables.
Click on Bind VAT Params to VFX to bind your VAT data to your VFX Graph
!img
Extend the Bind VAT Params script
If you want you, can extend any `BindVAT...ToVFX` script to add more variable to bind to your VFX graph.
You can simply create a new script which will inherit from the target type and override the `BindCustomDataToVFX` function.
`
protected virtual void BindCustomDataToVFX(ref VisualEffect vfx){
//Extend this function to bind your own custom data to the VFX Graph (eg: Albedo, Roughness, Metallic...)
}
`
This repository includes an example of extended system where a VFX graph output two mesh (a flower and its pistil) using two VAT meshes and shaders.
See the `VFXxVAT_SoftBody_Multiple` graph for the VFX parts and the `BindVATMultiSoftBodyToVFX.cs`` script for extending the binding script.