이 페이지에서

Qt Quick 3D - 원칙 기반 소재 예시

원리 기반 머티리얼의 사용법을 보여줍니다.

제어판 및 속성 슬라이더가 포함된 소재 미리보기

이 예제는 PrincipledMaterial 의 사용법에 대한 대화형 문서 역할을 합니다. PrincipledMaterial 의 각 속성에는 사용 방법에 대한 설명과 함께 각 속성을 조정해 볼 수 있는 방법이 제공됩니다.

사용법

이 예제는 왼쪽의 대화형 설명서 및 제어 영역과 오른쪽의 3D 뷰어로 나뉘어 있습니다. 3D 뷰어는 상호작용이 가능하여 카메라를 대상 모델 주위로 회전시킬 수 있습니다. 특정 모델에 초점을 다시 맞추려면 초점을 맞추고 싶은 모델을 터치하거나 클릭하기만 하면 됩니다. 두 뷰 사이의 분할 영역은 뷰 사이의 막대를 드래그하여 크기를 조절할 수 있습니다.

이 예제는 ‘ PrincipledMaterial ’의 다양한 기능을 관리하기 쉬운 단위로 묶은 여러 섹션으로 나뉘어 있습니다. 각 섹션은 설명 영역 상단의 탭을 클릭하여 접근할 수 있습니다.

SpecularGlossyMaterial

PrincipledMaterial 에서 제공하는 Metalness/Roughness PBR 워크플로우를 시연하는 것 외에도, SpecularGlossyMaterial 를 사용하는 Specular/Glossy 워크플로우로 전환할 수 있습니다. 이는 ‘Basics’ 섹션의 스위치를 통해 설정할 수 있습니다.

리소스 로더

이 예제의 복잡한 특성 덕분에 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`의 표시 여부와 관계없이 해당 리소스는 유지됩니다.

"Special" 탭 아래의 점 및 선 메시에서 볼 수 있듯이, ResourceLoaded는 리소스를 미리 로드하는 데에도 사용할 수 있습니다.

ResourceLoader {
    meshSources: [
        "meshes/logo_lines.mesh",
        "meshes/logo_points.mesh"
    ]
}

여기서는 메쉬 파일의 ` QUrl`가 직접 나열되어 있습니다. 리소스는 ` ResourceLoader`에서 사용하기 위해 반드시 `Model`과 연결되어 있을 필요는 없습니다.

예제 프로젝트 @ code.qt.io

© 2026 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.