🎮Unreal4/Basic

[UE4] Component 상속구조 정리

공대 컴린이 2023. 5. 22. 20:22
728x90

📚 Component 상속구조

Component 상속구조

상속 구조에서 UObjectBase, UObjectBaseUtility는 언리얼 엔진의 저수준 구현에 속하는 기초 코드로 게임 코드에서 직접 사용하지 않으므로 자세히 보지 않고, UObject는 Unreal4 오브젝트의 기본 클래스이기 때문에 자세히 보지 않는다.

📙 UActorComponent

- Component가 될 수 있는 최소한의 기능을 가지고 있다.

- UActorComponent에서 변환이 있으면 SceneComponent이고, 렌더링할 수 있다면 PrimitiveComponent이다.

📓 USceneComponent

- Transform 정보가 추가되어 SceneComponent부터 실질적인 배치가 가능하다.

- 그러나 렌더링이나 충돌 기능은 지원하지 않는다.

- USceneComponent는 계층 구조에서 다른 구성요소를 포괄하는 "dummy" 구성 요소로 유용하다.

📕 UPrimitiveComponent

- Primitive는 원시적인이라는 뜻의 단어인데, 이때 원시적이라는 것은 모델을 렌더링할 때 구성되는 삼각형을 의미한다.

- 따라서 Primitive 컴포넌트에는 모델을 그릴 최소한의 정점 정보(정점버퍼, 인덱스버퍼, Primitive 토폴로지)들을 저장하고 있다.

- 즉, UPrimitiveComponent는 Render 기능이 추가된 최초의 컴포넌트이며 PrimitiveComponent의 자식은 전부 그려지기 위한 Component들(Shape(충돌기능), Brush, FXSystem(Effect, Particle), Landscape 등등..)이 존재한다.

📗 UMeshComponent

- 저장된 프리미티브 컴포넌트의 정보를 정형화하여 불러와서, 모델을 그릴 수 있도록 도와준다.

- 다시말해, UPrimitiveComponent는 그려지는 Vertex Buffer, Index Buffer의 정보들을 가지고있다면 UMeshComponent는 본격적으로 Render 되기 위해 정형화된 그물망 구조의 데이터가 들어가는 것이다.

- 정형화된 모델들을 그리는 기능이 모두 Mesh 컴포넌트에 저장돼어 있기 때문에 자식 검포넌트가 매우 많다.

Inheritance Hierarchy
UObjectBase
UObjectBaseUtility
  UObject
   UActorComponent
    USceneComponent
     UPrimitiveComponent
      UMeshComponent
       PAPER2UPaperFlipbookComponent
       PAPER2UPaperGroupedSpriteComponent
       PAPER2UPaperSpriteComponent
       PAPER2UPaperTileMapComponent
       UBaseDynamicMeshComponent
       UCableComponent
       UCustomMeshComponent
       UGeometryCacheComponent
       UGeometryCollectionComponent
       UGroomComponent
       ULidarPointCloudComponent
       UOverlayComponent
       UPointCloudComponent
       UPointSetComponent
       UProceduralMeshComponent
       USkinnedMeshComponent 
       UStaticMeshComponent
       UWidgetComponent
       UWireframeMeshComponent

📙 UProceduralMeshComponent

- Static Mesh와 Skinned Mesh는 언리얼에서 임의의 데이터를 불러와서 모델을 만들어오기 때문에 수정할 수 없고, 임의대로 정점버퍼를 넣어서 값을 만들어 그릴 수 없다.
- 따라서 지면같은 모델을 커스터마이징 할 때는 임의대로 값을 넣어서 모양을 만들 수 있는 Procedural Mesh Component를 사용한다.

📓 UStaticMeshComponent

- UStaticMeshComponent는 정형화 된 데이터 중에 모델 데이터를 그린다.
- 즉, UMeshComponent에서 정적인 그물망 구조를 가지고 있다면 UStaticMesh이고, 그물망 구조가 일정 규칙을 위해 움직일 수 있는 가상 Mesh 구조를 가지고 있다면 USkinnedMesh 이다.

📘 USkinnedMeshComponent

USkinnedMeshComponent 상속구조

- USkinnedMeshComponent는 그물망 구조와 일정 규칙을 위해 움직이는 가상 Mesh의 구조를 가지고 있다.

- USkinnedMeshComponent는 애니메이션을 그릴 때 Skinning 기능을 사용하여 그린다.

- 캐릭터 모델을 출력할 때 팔을 안으로 굽히면 팔 안쪽 Mesh들을 뭉쳐지고, 팔 뒤쪽 Mesh들은 벌려져서 Mesh가 비어있게 된다. 이때 뭉쳐진 부분의 정점들은 벌려주고, 비어있는 부분의 정점들은 메꿔주며 자연스러운 애니메이션의 피부 출력을 돕는다.

- 이러한 피부를 관할하여 Mesh를 그리는 기능때문에 Skinned Mesh라는 이름이 붙었다.

- USkinnedMeshComponent는 SkeletalMeshComponent와 UPoseableMeshComponent, UDestructibleComponent 까지 총 세가지의 자식 컴포넌트가 존재한다.

📕 SkeletalMeshComponent

- 이미 계산이 완료된 뼈대를 움직여준다. 즉, Bone 정보를 가지고있는 Component이다.
- 애니메이션의 변화되는 타이밍(시점)과 변화량을 매트릭스로 기록하고, 해당 시점 사이 사이를 보간하여 자연스러운 동작을 구현한다.
- 이러한 특정 시점을 키프레임이라고 하고, 안에서 실행되는 변화요소를 키라고 하여 키프레임 애니메이션이라고 한다.
- 이와같이 계산된 것들이 변하지 않는 것이 Skeletal이다.

📗 UPoseableMeshComponent

- 매 프레임마다 애니메이션의 변화된 모습을 캡쳐(복사)해서, 키 정보(bone에 대한 정보)를 임의로 수정할 수 있다.
- 즉, Bone 데이터의 한 순간을 캡처해서 출력하기 때문에 메시(Bone)의 변경이 가능한 것이다.
- 정보를 수정하기 때문에 속도는 느리다.

📙 UDestructibleComponent 

- Destructible은 파괴 가능한 이라는 뜻으로, 파괴할 수 있는 Mesh를 말한다.
- 예를 들어, 벽이 부숴지거나 상자가 파괴되는 Mesh들을 설정할 수 있다.
- PoseableMeshComponent와 동일하게 메시(Bone)의 변경이 가능하다.


참조

https://docs.unrealengine.com/4.27/en-US/API/Runtime/Engine/Components/UActorComponent/

 

UActorComponent

ActorComponent is the base class for components that define reusable behavior that can be added to different types of Actors.

docs.unrealengine.com

https://docs.unrealengine.com/4.26/en-US/API/Runtime/Engine/Components/UMeshComponent/

 

UMeshComponent

MeshComponent is an abstract base for any component that is an instance of a renderable collection of triangles.

docs.unrealengine.com

https://docs.unrealengine.com/4.26/en-US/API/Runtime/Engine/Components/USkinnedMeshComponent/

 

USkinnedMeshComponent

Skinned mesh component that supports bone skinned mesh rendering.

docs.unrealengine.com

https://docs.unrealengine.com/4.27/en-US/API/Runtime/Engine/Components/USkeletalMeshComponent/

 

USkeletalMeshComponent

SkeletalMeshComponent is used to create an instance of an animated SkeletalMesh asset.

docs.unrealengine.com

https://docs.unrealengine.com/4.27/en-US/API/Runtime/Engine/Components/USceneComponent/

 

USceneComponent

A SceneComponent has a transform and supports attachment, but has no rendering or collision capabilities.

docs.unrealengine.com

728x90