Study/.NET (C#, WPF, Unity)

[C#] Helix-toolkit 연구중 (WPF.SharpDX 기준)

BlueBright 2021. 1. 27. 16:23

github.com/helix-toolkit/helix-toolkit : MIT

 

<개발 환경>

  • 권장 사항은 VS2019
    • Solution file : HelixToolkit.SharpDx.sln
    • VS2017에서 Dotnet을 4.8로 맞추어서 편집은 가능함.
      다만, 일부 패키지 종속성, 호환 문제 때문에 2.11.0 버전으로 설치함
  • 프로젝트 명칭이 많이 헷갈린다 -_-
  • GitHub에서 제공되는 예제코드 중에서 WPF 프로젝트는 MVVM(Model View ViewModel) 패턴으로 설계되어 있다.
  • WPF.SharDX는 DirectX 11을 베이스로 설계된 프로젝트이다

<이슈 (v2.11.0)>

 

<라이브러리 관계도>

  • HelixToolkit
    • .NET WPF
      • HelixToolkit.WPF
    • SharpDX DX11 Engine
      • .NET WPF
        • HelixToolkit.WPF.SharpDX
      • UWP
        • Helixtoolkit.UWP
      • .NET CORE
        • HelixToolkit.SharpDX.Core
          • HelixToolkit.SharpDX.Core.Wpf
      • HelixToolkit.Assimp

 

<지원 되는 3D 파일 확장자>

64개의 확장자 (내부 함수의 출력 결과를 확인 해본 것. 실제로 테스트 해보지는 않음)

 

".3d" ".3ds" ".3mf" ".ac" ".ac3d" ".acc" ".amf" ".ase" ".ask" ".assbin" ".b3d" ".blend" ".bvh" ".cob" ".csm" ".dae" ".dxf" ".enff" ".fbx" ".glb" ".gltf" ".hmp" ".ifc" ".ifczip" ".irr" ".irrmesh" ".lwo" ".lws" ".lxo" ".md2" ".md3" ".md5anim" ".md5camera" ".md5mesh" ".mdc" ".mdl" ".mesh" ".mesh.xml" ".mot" ".ms3d" ".ndo" ".nff" ".obj" ".off" ".ogex" ".pk3" ".ply" ".pmx" ".prj" ".q3o" ".q3s" ".raw" ".scn" ".sib" ".smd" ".stl" ".stp" ".ter" ".uc" ".vta" ".x" ".x3d" ".x3db" ".xgl" ".xml" ".zgl"

 

<단순 사전 정의>

  • Geometry : 기하학(공간의 성질과 공간 안의 물체에 대한 성질을 연구하는 수학의 한 분야)
  • Mesh : 그물
  • Material : 재질, 물질
  • Transform : 바꾸다, 전환하다

 

<설계 원리>

HelixToolkit.Wpf.SharpDX.Viewport3DX 클래스가 주 객체 이다.

Viewport3DX 클래스 내부 변수들의 값을 설정하고, Items에 3D 관련 클래스를 Add하는 구조.

 

  • Camera (Camera) : 
  • EffectsManager (IEffectsManager) : 
  • Items { ObservableElement3DCollection, ViewPort3DX의 ContentProperty }
    <아래는 Items 내부에 포함하는 것을 권장하는 요소들>
    • InputBindings : Windows 계열이지만 ViewPort를 조작하려면 추가하는 것을 권장
    • Light3D 계열 : 조명이 없으면 모델의 텍스쳐가 없는 것처럼 (검은색) 나온다.
    •  

 

예제 FileLoadDemo의 MainWindow.xaml 일부분

 

 

예제 BoneSkinDemo의 MainWindow.xaml 일부분

 

 

 

 

 

 

 

<EffectsManager>

  • Effectsmanager를 사용할 경우, 사용하는 스레드 각각 하나씩 만들 것
    (하나의 EffectsManager를 여러 개의 스레드가 공유하지 않도록 할 것)
  • 단, ViewPort가 여러개 있는 경우, EffectsManager를 하나만 만들어서 사용하기

 

 

<Element3D OR SceneNode> 결론 : 호환성과 퍼포먼스가 좋은 SceneNode로 사용하자. 상황에 따라 적절히 사용할 것

  • SceneNode
    • HelixToolkit.WPF.SharpDX.Model.Scene 또는 HelixToolkit.UWP.Model.Scene의 네임스페이스를 가짐 (Cross platform compatibility)
    • Scene의 동적인 부분에 사용
    • Assimp Importer / Exporter는 이 클래스만 지원한다.
    • SceneNode 클래스 내부 Tag가 있다. (데이터 타입은 object). Tag 속성을 이용하여 ViewModel을 링크할 수 있다.
    • WPF/UWP MVVM 모델 또는 XAML 대신에, SceneNodeGroupModel3D 클래스와 함께 사용할 수 있다.
    • SceneNode는 INotifyPropertyChanged를 implement 하지 않는다.
    • SceneNode.Items는 ReadOnlyObservableCollection이고, TreeView에 바인딩 될 수 있다.
    • 프로젝트를 멀티 플랫폼에서 실행해야할 경우, 이 녀석을 활용해야한다.
    • (퍼포먼스 관점에서) 가벼움
  • Element3D
    • SceneNode 위에 DependencyObject wrapper로 구현된다. (XAML 바인딩 가능)
    • DependencyProperty 레이어의 메모리 및 성능 비용과 함께 제공됨 (렌더링이 아닌 속성 업데이트에만 영향)
    • Element3D.SceneNode를 이용하여 SceneNode를 가져올 수 있다.
      (Element3D 내부에 DependencyProperty가 존해하며, 상위 (추상)클래스인 Element3DCore 내부에 SceneNode가 존재한다.)
    • Scene의 정적인 부분에 사용
    • (퍼포먼스 관점에서) 무거움

 

<Performance>

  • Material과 Material Texture는 가능한 공유할 것

 

 

<Manipulator>

 

Translate, Rotation이 활성화된 Manipulator

 

 

Scaling이 활성화된 Manipulator

 

 

<같이 볼만한 링크>

 

docs.microsoft.com/en-us/dotnet/desktop/wpf/graphics-multimedia/3-d-graphics-overview?redirectedfrom=MSDN&view=netframeworkdesktop-4.8

 

3D Graphics Overview - WPF .NET Framework

Get acquainted with 3D graphics in Windows Presentation Foundation (WPF) to draw, transform, and animate 3D graphics in both markup and procedural code.

docs.microsoft.com

 

all3dp.com/3d-file-format-3d-files-3d-printer-3d-cad-vrml-stl-obj/

 

The Most Common 3D File Formats | All3DP

Which 3D file formats are there? How do they compare? We simply explain the most common 3D file formats used today: STL, OBJ, FBX, COLLADA, 3DS, IGES; STEP, and VRML/X3D.

all3dp.com

www.marxentlabs.com/3d-file-formats/

 

Essential Guide to 3D File Formats | Marxent

See a complete list of 3D file formats, pros and cons of open vs. proprietary formats, and how to pick the right format.

www.marxentlabs.com

 

 

'Study > .NET (C#, WPF, Unity)' 카테고리의 다른 글

[Unity] Windows Magic Leap 초기 설정  (0) 2020.12.08
[C#] 배열 연구  (0) 2020.01.07
[C#] 디렉토리 (폴더) 삭제에 관하여  (0) 2019.08.23
[C#] 문법 공부중입니다  (0) 2018.05.17