add install instructions

This commit is contained in:
Lee-Orr
2024-02-12 16:22:27 -05:00
parent 84f4e79cf4
commit 4737804ab3
4 changed files with 18 additions and 13 deletions
+1 -1
View File
@@ -14,5 +14,5 @@ serde_json = "1"
itertools = "0.12" itertools = "0.12"
[dev-dependencies] [dev-dependencies]
bevy = { version = "0.12", default-features = true } bevy = { version = "0.12", default-features = true, features = ["file_watcher"]}
bevy-inspector-egui = "0.22" bevy-inspector-egui = "0.22"
+15
View File
@@ -2,6 +2,20 @@
This is a project build for storyteller.ai, to provide support for importing ARKit data into bevy, and using it to drive shape keys. This is a project build for storyteller.ai, to provide support for importing ARKit data into bevy, and using it to drive shape keys.
## Install
Add this to your dependencies alongside bevy:
```toml
bevy = "0.12"
bevy-facial-mocap = { git = "https://github.com/caladluin/bevy-facial-mocap" } #TODO - once ownership of the repo transfers, set this to the correct repository
```
If you add the `file_watcher` feature to bevy, this also supports hot reloading:
```toml
bevy = { version = "0.12", default-features = true, features = ["file_watcher"]}
```
## Use ## Use
Import the asset loader: Import the asset loader:
@@ -19,6 +33,7 @@ let mut player = AnimationPlayer::default();
player.play(handle.clone()).repeat(); player.play(handle.clone()).repeat();
``` ```
## Asset Preparation ## Asset Preparation
To load a recording, you need 3 files: To load a recording, you need 3 files:
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"csv": "./20240205_shapekey_BevyImplementationFaceCap_5/shapekey_BevyImplementationFaceCap_5_ScottiPhone_cal.morph_anim.csv", "csv": "./20240205_shapekey_BevyImplementationFaceCap_5/shapekey_BevyImplementationFaceCap_5_ScottiPhone_cal.morph_anim.csv",
"root_name": "pascal_Head", "root_name": "pascal_Head",
"fps": 60, "fps": 120,
"mapping": "example_mapping.json" "mapping": "example_mapping.json"
} }
+1 -11
View File
@@ -275,7 +275,6 @@ impl CSVAnimation {
let mut transform = let mut transform =
Transform::from_rotation(Quat::from_euler(bevy::math::EulerRot::XYZ, 0., 0., 0.)); Transform::from_rotation(Quat::from_euler(bevy::math::EulerRot::XYZ, 0., 0., 0.));
println!("TIME: {time}");
for (mapping, csv_key) in mappings.iter() { for (mapping, csv_key) in mappings.iter() {
let result = csv_morph_order let result = csv_morph_order
.get(csv_key.as_str()) .get(csv_key.as_str())
@@ -283,7 +282,6 @@ impl CSVAnimation {
.and_then(|i| data.morphs.get(i)) .and_then(|i| data.morphs.get(i))
.copied() .copied()
.unwrap_or(0f32); .unwrap_or(0f32);
println!("Mapping {csv_key} - {mapping:?} -> {result}");
let axis = match mapping.axis { let axis = match mapping.axis {
Axis::X => Vec3::X, Axis::X => Vec3::X,
@@ -297,10 +295,7 @@ impl CSVAnimation {
let result = result * 180f32.to_radians() * scale + offset; let result = result * 180f32.to_radians() * scale + offset;
println!("Rotating {axis:?} by {result:?}");
println!("From {}", transform.rotation.xyz());
transform.rotate_axis(axis, result); transform.rotate_axis(axis, result);
println!("To {}", transform.rotation.xyz());
} }
keyframes.push(transform.rotation) keyframes.push(transform.rotation)
@@ -751,7 +746,6 @@ mod tests {
] ]
.iter() .iter()
.map(|(key, value)| { .map(|(key, value)| {
println!("Attempting to convert {key}");
(serde_json::from_str(key).unwrap(), value.to_string()) (serde_json::from_str(key).unwrap(), value.to_string())
}) })
.collect(), .collect(),
@@ -805,11 +799,7 @@ mod tests {
}; };
assert_eq!(keyframes.len(), 5); assert_eq!(keyframes.len(), 5);
println!(
"Rotations: {:?}",
keyframes.iter().map(|v| v.xyz()).collect::<Vec<_>>()
);
assert!((keyframes[0].xyz() - Vec3::new(0., 0., 0.)).length() < 0.0001); assert!((keyframes[0].xyz() - Vec3::new(0., 0., 0.)).length() < 0.0001);
assert!((keyframes[1].xyz() - Vec3::new(0.5, 0.5, -0.5)).length() < 0.01); assert!((keyframes[1].xyz() - Vec3::new(0.5, 0.5, -0.5)).length() < 0.01);
} }