Skip to content
This repository has been archived by the owner on May 30, 2024. It is now read-only.

iFacialMocap support and some VRM fixes. #215

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@

# 3D models
**/*.glb
**/*.glb.import
**/*.vrm
**/*.vrm.import

4 changes: 2 additions & 2 deletions addons/renik/renik.gd
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ const DEFAULT_THRESHOLD: float = 0.0005
const DEFAULT_LOOP_LIMIT: int = 16

var spine_chain: renik_chain_class = renik_chain_class.new(Vector3(0, 15, -15), 0.5, 0.5, 1, 0)
var limb_arm_left: renik_limb_class = renik_limb_class.new(-0.27777*PI, -0.27777*PI, deg_to_rad(70.0), 0.5, 0.66666,
var limb_arm_left: renik_limb_class = renik_limb_class.new(-0.27777*PI, -0.27777*PI, deg_to_rad(-70.0), 0.5, 0.66666,
deg_to_rad(20.0), deg_to_rad(45.0), 0.33,
Vector3(deg_to_rad(15.0), 0, deg_to_rad(60.0)),
Vector3(2.0, -1.5, -1.0))
var limb_arm_right: renik_limb_class = renik_limb_class.new(0.27777*PI, 0.27777*PI, deg_to_rad(-70.0), 0.5, 0.66666,
var limb_arm_right: renik_limb_class = renik_limb_class.new(0.27777*PI, 0.27777*PI, deg_to_rad(70.0), 0.5, 0.66666,
deg_to_rad(-20.0), deg_to_rad(45.0), 0.33,
Vector3(deg_to_rad(15.0), 0, deg_to_rad(-60.0)),
Vector3(2.0, 1.5, 1.0))
Expand Down
1 change: 1 addition & 0 deletions gui/tracking/i_facial_mocap.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ text = "Connect Port"
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
text = "49983"

[node name="Start" type="Button" parent="."]
unique_name_in_owner = true
Expand Down
2 changes: 1 addition & 1 deletion screens/context.gd
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func _init(p_runner_data: RunnerData) -> void:

var gltf := GLTFDocument.new()
var state := GLTFState.new()
state.handle_binary_image = GLTFState.HANDLE_BINARY_EMBED_AS_BASISU
state.handle_binary_image = GLTFState.HANDLE_BINARY_EMBED_AS_UNCOMPRESSED

var err := gltf.append_from_file(model_path, state)
if err != OK:
Expand Down
38 changes: 26 additions & 12 deletions screens/runners/runner_3d.gd
Original file line number Diff line number Diff line change
Expand Up @@ -58,34 +58,48 @@ func _setup_vrm(model: VrmPuppet) -> Error:
add_child(armature_targets)

if ik_targets.head != null:
armature_targets.add_child(ik_targets.head)
var marker_offset = Marker3D.new()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

marker3ds aren't needed since all the needed ik targets are generated and managed by libvpuppr

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah it didn't help at all. I was experimenting with adding extra nodes so that the various IK points can be controlled manually in the inspector. I think this change isn't that helpful and so I might revert it. I'll split up these changes into separate PRs.

marker_offset.name = "HeadAdjust"
armature_targets.add_child(marker_offset)
marker_offset.add_child(ik_targets.head)
ren_ik.armature_head_target = ik_targets.head.get_path()
if ik_targets.left_hand != null:
var target := ik_targets.left_hand
armature_targets.add_child(target)
target.position.y = 0
target.rotation_degrees.x = 164

ik_targets.left_hand_starting_transform = target.transform

ren_ik.armature_left_hand_target = ik_targets.left_hand.get_path()
var marker_offset = Marker3D.new()
marker_offset.name = "LeftHandAdjust"
armature_targets.add_child(marker_offset)
marker_offset.add_child(target)
ren_ik.armature_left_hand_target = target.get_path()
if ik_targets.right_hand != null:
var target := ik_targets.right_hand
armature_targets.add_child(ik_targets.right_hand)
target.position.y = 0
target.rotation_degrees.x = 164

ik_targets.right_hand_starting_transform = target.transform

ren_ik.armature_right_hand_target = ik_targets.right_hand.get_path()
var marker_offset = Marker3D.new()
marker_offset.name = "RightHandAdjust"
armature_targets.add_child(marker_offset)
marker_offset.add_child(target)
ren_ik.armature_right_hand_target = target.get_path()
if ik_targets.hips != null:
armature_targets.add_child(ik_targets.hips)
var marker_offset = Marker3D.new()
marker_offset.name = "HipsAdjust"
armature_targets.add_child(marker_offset)
marker_offset.add_child(ik_targets.hips)
ren_ik.armature_hip_target = ik_targets.hips.get_path()
if ik_targets.left_foot != null:
armature_targets.add_child(ik_targets.left_foot)
var marker_offset = Marker3D.new()
marker_offset.name = "LeftFootAdjust"
armature_targets.add_child(marker_offset)
marker_offset.add_child(ik_targets.left_foot)
ren_ik.armature_left_foot_target = ik_targets.left_foot.get_path()
if ik_targets.right_foot != null:
armature_targets.add_child(ik_targets.right_foot)
var marker_offset = Marker3D.new()
marker_offset.name = "RightFootAdjust"
armature_targets.add_child(marker_offset)
marker_offset.add_child(ik_targets.right_foot)
ren_ik.armature_right_foot_target = ik_targets.right_foot.get_path()

add_child(ren_ik)
Expand Down
12 changes: 7 additions & 5 deletions screens/splash.gd
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,14 @@ func _ready() -> void:
if AM.metadata.scan("user://") != OK:
_logger.error("Failed to complete scanning of user data directory")

# true argument is required to ensure extensions run before the
# built-in GLTFDocumentExtensionConvertImporterMesh extension used at runtime.
GLTFDocument.register_gltf_document_extension(preload("res://addons/vrm/vrm_extension.gd").new(), true)
GLTFDocument.register_gltf_document_extension(preload("res://addons/vrm/1.0/VRMC_materials_hdr_emissiveMultiplier.gd").new())
GLTFDocument.register_gltf_document_extension(preload("res://addons/vrm/1.0/VRMC_materials_mtoon.gd").new())
GLTFDocument.register_gltf_document_extension(preload("res://addons/vrm/1.0/VRMC_node_constraint.gd").new())
GLTFDocument.register_gltf_document_extension(preload("res://addons/vrm/1.0/VRMC_springBone.gd").new())
GLTFDocument.register_gltf_document_extension(preload("res://addons/vrm/1.0/VRMC_vrm.gd").new())
GLTFDocument.register_gltf_document_extension(preload("res://addons/vrm/1.0/VRMC_materials_mtoon.gd").new(), true)
GLTFDocument.register_gltf_document_extension(preload("res://addons/vrm/1.0/VRMC_materials_hdr_emissiveMultiplier.gd").new(), true)
GLTFDocument.register_gltf_document_extension(preload("res://addons/vrm/1.0/VRMC_node_constraint.gd").new(), true)
GLTFDocument.register_gltf_document_extension(preload("res://addons/vrm/1.0/VRMC_springBone.gd").new(), true)
GLTFDocument.register_gltf_document_extension(preload("res://addons/vrm/1.0/VRMC_vrm.gd").new(), true)
)

_logger.debug("Splash ready!")
Expand Down
4 changes: 4 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ echo "Updating git submodules"
git submodule update --init --recursive --remote

echo "Building rust lib"
mv libvpuppr/target/debug/deps/libvpuppr.dll libvpuppr/target/debug/deps/libvpuppr.dll.bak || true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the backup files don't appear to be restored on error, so I think it would be better to just let the script error out.

In general, I think just letting the script throw an error is more optimal during development

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used a bad filename. it's not really bak as in backup, but rather trash or deleteme.

Actually, maybe we should simply delete the old files instead of renaming. I'll see if that works.

mv libvpuppr/target/debug/libvpuppr.dll libvpuppr/target/debug/libvpuppr.dll.bak || true
python libvpuppr/build.py --debug
rm -f libvpuppr/target/debug/deps/libvpuppr.dll.bak || true
rm -f libvpuppr/target/debug/libvpuppr.dll.bak || true

echo "Copying gdextension files"
cp libvpuppr/libvpuppr.gdextension .
Expand Down