Qt Quick 3D - 원칙적 자료 예시
원칙이 적용된 머티리얼의 사용법을 보여줍니다.
이 예제는 PrincipledMaterial 의 사용법에 대한 대화형 문서 역할을 합니다. PrincipledMaterial 의 각 프로퍼티는 사용 방법에 대한 설명과 함께 각 프로퍼티를 조정하는 실험 방법을 제공합니다.
사용법
이 예제는 왼쪽의 대화형 문서와 컨트롤, 오른쪽의 3D 뷰어라는 두 가지 보기로 나뉩니다. 3D 뷰어는 대화형이므로 카메라가 대상 모델을 중심으로 궤도를 돌 수 있습니다. 특정 모델에 초점을 재설정하려면 초점을 맞출 모델을 터치하거나 클릭하기만 하면 됩니다. 두 뷰 사이의 분할은 뷰 사이의 막대를 드래그하여 크기를 조정할 수 있습니다.
이 예는 PrincipledMaterial 의 다양한 기능을 관리하기 쉬운 청크로 그룹화하는 여러 섹션으로 분리되어 있습니다. 각 섹션은 설명 영역 상단의 탭을 클릭하여 액세스할 수 있습니다.
스페큘러 글로시 머티리얼
PrincipledMaterial 에서 제공하는 메탈니스/거칠기 PBR 워크플로우를 시연하는 것 외에도 SpecularGlossyMaterial 을 사용하는 스페큘러/글로시 워크플로우로 전환할 수 있습니다. 이 작업은 기본 섹션에서 전환을 통해 수행할 수 있습니다.
리소스 로더
이 예제의 더 복잡한 특성은 ResourceLoader 컴포넌트의 사용법을 보여줄 수 있는 기회이기도 합니다. 모델이 더 이상 장면에 표시되지 않으면 모델과 관련된 모든 리소스는 Qt Quick 3D (장면의 다른 모델에서 리소스를 사용하지 않는다고 가정)에 의해 해제됩니다. 이 예제에서는 커튼 모델을 숨길 수 있으며, 이렇게 하면 2개의 메쉬와 2개의 텍스처가 GPU 메모리에서 해제될 수 있습니다. 하지만 다음에 커튼을 표시할 때는 이러한 리소스를 GPU에 다시 업로드해야 합니다. 일부 하드웨어에서는 이 업로드가 프레임 속도를 일시적으로 떨어뜨릴 수 있으므로 이를 완화하기 위해 BackgroundCurtain 컴포넌트 내부에 ResourceLoader 컴포넌트가 사용됩니다.
ResourceLoader { meshSources: [ frame.source, curtain.source ] textures: [ tilePatternTexture, curtainNormalTexture ] } Model { id: frame z: -1.95 source: "meshes/frame.mesh" PrincipledMaterial { id: frame_material baseColor: "#ffcccccc" metalness: 1 roughness: 0.259091 alphaMode: PrincipledMaterial.Opaque } materials: [ frame_material ] } Model { id: curtain y: 3.02413 z: 2.04922 source: "meshes/curtain.mesh" PrincipledMaterial { id: curtain_material baseColorMap: Texture { id: tilePatternTexture source: "maps/tilepattern.png" generateMipmaps: true mipFilter: Texture.Linear } opacityChannel: Material.A roughness: 0.5 normalMap: Texture { id: curtainNormalTexture source: "maps/curtain_normal.jpg" generateMipmaps: true mipFilter: Texture.Linear } cullMode: Material.NoCulling alphaMode: PrincipledMaterial.Opaque } materials: [ curtain_material ] }
여기서 메시 파일과 텍스처는 모두 ResourceLoader 에 등록됩니다. ResourceLoader 은 등록된 모든 리소스가 항상 GPU 메모리에서 사용할 수 있도록 보장하므로 이제 BackgroundCurtain의 가시성과 관계없이 리소스가 보존됩니다.
'특수' 탭 아래의 점 및 선 메시에서 볼 수 있듯이 ResouceLoaded를 사용하여 리소스를 미리 로드할 수도 있습니다.
ResourceLoader { meshSources: [ "meshes/logo_lines.mesh", "meshes/logo_points.mesh" ] }
여기에는 메시 파일의 QUrl 가 직접 나열됩니다. 리소스는 ResourceLoader 에서 사용하기 위해 모델에 연결할 필요가 없습니다.
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.