feat(hair): hair cards as their own skinned mesh, attached as a second component
Follows the character-artist skill on two points it is explicit about: hair for a game character is a card system, and swappable parts stay separate meshes. - Tools/character_hair_build.py builds SM_Char_Hair: a scalp cap plus 18 cards in three rings, quads only, every vertex weighted 1.0 to the head bone, UV-mapped for the strand sheet from Tools/generate_character_textures.py. 321 verts / 404 tris. - Tools/ue_character_hair_import.py imports it as its own skeletal mesh, which is the point: joined into the body, Unreal collapses the second material slot and the hair renders with the skin material. - The pawn carries it as a second USkeletalMeshComponent on SetLeaderPoseComponent, so it follows the head bone with no second rig and hides with the body in first person. Still wrong and recorded: the cards point outward, so the silhouette reads as a spiked crown rather than a short cut. The next pass orients them tangentially along the skull with a second overlapping row. Tools/ue_character_materials.py also segfaults in the headless commandlet when editing a material graph, so the generated textures are not wired yet and the hair keeps its Blender base colour.
This commit is contained in:
1 parent
72d00bdfbd
commit
39f07b0f5f
46 files changed
+519
-47
No files matched your search
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -90,6 +90,22 @@ AGigLineCharacter::AGigLineCharacter()
|
||||
GetMesh()->SetCollisionEnabled(ECollisionEnabled::NoCollision);
|
||||
GetMesh()->SetHiddenInGame(true);
|
||||
|
||||
// Hair: a separate component that copies the body's pose, so it follows the head
|
||||
// bone without a second rig or a second animation. Hidden with the body.
|
||||
HairMesh = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("HairMesh"));
|
||||
HairMesh->SetupAttachment(GetCapsuleComponent());
|
||||
HairMesh->SetCollisionEnabled(ECollisionEnabled::NoCollision);
|
||||
HairMesh->SetHiddenInGame(true);
|
||||
static ConstructorHelpers::FObjectFinder<USkeletalMesh> HairFinder(
|
||||
TEXT("/Game/Test/Character/CharacterHair.CharacterHair"));
|
||||
if (HairFinder.Succeeded())
|
||||
{
|
||||
HairMesh->SetSkeletalMesh(HairFinder.Object);
|
||||
HairMesh->SetRelativeLocation(FVector(0.0f, 0.0f, -87.5f));
|
||||
HairMesh->SetRelativeRotation(FRotator(0.0f, -90.0f, 0.0f));
|
||||
HairMesh->SetLeaderPoseComponent(GetMesh());
|
||||
}
|
||||
|
||||
// Third-person boom. bDoCollisionTest is the camera-collision feature: the arm
|
||||
// shortens when something is between the pivot and the desired camera position.
|
||||
ThirdPersonArm = CreateDefaultSubobject<USpringArmComponent>(TEXT("ThirdPersonArm"));
|
||||
@@ -795,6 +811,10 @@ void AGigLineCharacter::ToggleCamera()
|
||||
FirstPersonCamera->SetActive(!bThirdPerson);
|
||||
ThirdPersonCamera->SetActive(bThirdPerson);
|
||||
GetMesh()->SetHiddenInGame(!bThirdPerson);
|
||||
if (HairMesh)
|
||||
{
|
||||
HairMesh->SetHiddenInGame(!bThirdPerson);
|
||||
}
|
||||
if (bThirdPerson)
|
||||
{
|
||||
UpdateBodyAnimation();
|
||||
|
||||
@@ -155,6 +155,17 @@ protected:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Camera")
|
||||
float ThirdPersonBoomLength = 340.0f;
|
||||
|
||||
/**
|
||||
* Hair, as its own skeletal mesh following the body's pose.
|
||||
*
|
||||
* A second component rather than geometry joined into the body: Unreal collapses
|
||||
* the second material slot on a skeletal-mesh import, so joined hair rendered with
|
||||
* the skin material. The character-artist skill calls for hair cards to be their
|
||||
* own mesh for the same reason it calls for swappable parts to be separate.
|
||||
*/
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Body")
|
||||
TObjectPtr<USkeletalMeshComponent> HairMesh;
|
||||
|
||||
UPROPERTY()
|
||||
TObjectPtr<UAnimSequence> IdleAnimation;
|
||||
|
||||
|
||||
Reference in new issue
Block a user