Physically Based Rendering
基于物理的渲染
Introduction
介绍
Physically Based Rendering (PBR) is a rendering technique that aims to accurately simulate the physical properties of materials and lights in a scene. It is based on the principles of physics, and uses algorithms to accurately model the way light interacts with different materials.
基于物理的渲染(PBR)是一种渲染技术,旨在准确模拟场景中材质和灯光的物理特性。它基于物理学原理,并使用算法准确地模拟光与不同材料相互作用的方式。
Physically Based Rendering takes into account the way light is absorbed, reflected, and scattered by various surfaces, such as metal, glass, and plastic. This allows for more realistic and accurate rendering of materials, as well as more accurate lighting effects such as reflections, refractions, and shadows.
基于物理的渲染会考虑光被各种表面(如金属、玻璃和塑料)吸收、反射和散射的方式。这允许对材质进行更逼真、更准确的渲染,以及更准确的照明效果,如反射、折射和阴影。
Aside from looking better, it also simplifies the workflow of artist since materials are based on physical parameters, which are more intuitive to use and tweak. Another benefit is that using PBR materials makes the look of imported assets more consistent with how they were designed.
除了看起来更好之外,它还简化了艺术家的工作流程,因为材料是基于物理参数的,使用和调整更直观。另一个好处是,使用PBR材料可以使导入资产的外观与设计方式更加一致。
For more details on the theory behind PBR, see: LearnOpenGL - Theory and Adobe Creative Cloud | Sign in for an in-depth explanation.
有关PBR背后的理论的更多详细信息,请参阅:LearnOpenGL-theory and Adobe Creative Cloud |登录以获得深入解释。
Materials and Workflows
材质和工作流
To take advantage of Physically Based Rendering, Qt Quick 3D offers three built-in materials: PrincipledMaterial, SpecularGlossyMaterial, and CustomMaterial. Each of these materials provides a different workflow for defining material properties. The choice of which workflow and material to use will depend on the type of material you want to create or the workflow defined by the tool you are using to create the material.
为了利用基于物理的渲染,Qt Quick 3D提供了三种内置材质:Principled Material、SpecularGlossyMaterial和CustomMaterial。这些材质中的每一种都为定义材质属性提供了不同的工作流。要使用的工作流和材质的选择将取决于要创建的材质类型或用于创建材质的工具定义的工作流。
Metallic Roughness Workflow
金属粗糙度工作流
The Metallic Roughness workflow is a method for implementing Physically Based Rendering that uses two main parameters to represent the appearance of a material: metallic reflectance and surface roughness. The metallic reflectance is a value ranging from 0 (non-metallic) to 1 (fully metallic) that determines how much of the incoming light is reflected by the material and how much is absorbed. The surface roughness is a value ranging from 0 (smooth) to 1 (rough) that determines how rough or smooth the surface of the material appears. The appearance of a material in the Metallic/Roughness workflow is determined by its base color, metallic reflectance, and surface roughness values, which can be stored as textures or constant values.
“金属粗糙度”工作流是一种实现基于物理的渲染的方法,它使用两个主要参数来表示材质的外观:金属反射率和表面粗糙度。金属反射率是一个范围从0(非金属)到1(全金属)的值,它决定了有多少入射光被材料反射以及有多少被吸收。表面粗糙度是一个范围从0(平滑)到1(粗糙)的值,用于确定材质表面的粗糙度或平滑度。“金属/粗糙度”工作流中材质的外观由其基本颜色、金属反射率和表面粗糙度值决定,这些值可以存储为纹理或常数值。
The base color of the material for the Metallic Roughness workflow contains both the reflected color for non-metals (dielectrics) and the reflectance value for metals.
“金属粗糙度”工作流的材质的基本颜色包含非金属(电介质)的反射颜色和金属的反射值。
PrincipledMaterial
原理材质
The PrincipledMaterial is the primary material that enables the Metallic Roughness workflow in Qt Quick 3D. An example of how to use the PrincipledMaterial is shown below:
PrincipledMaterial是启用Qt Quick 3D中金属粗糙度工作流的主要材质。以下是如何使用Principled Material的示例:
import QtQuick
import QtQuick3D
import QtQuick3D.Helpers
Window {
visible: true
width: 640
height: 480
title: qsTr("PrincipledMaterial")
View3D {
anchors.fill: parent
environment.backgroundMode: SceneEnvironment.SkyBox
environment.lightProbe: Texture {
textureData: ProceduralSkyTextureData {}
}
PerspectiveCamera {
z: 150
y: 40
eulerRotation.x: -15
}
Model {
x: -50
source: "#Sphere"
materials: [
PrincipledMaterial {
baseColor: "red"
metalness: 0.0
roughness: 0.1
}
]
}
Model {
x: 50
source: "#Sphere"
materials: [
PrincipledMaterial {
baseColor: "red"
metalness: 1.0
roughness: 0.1
}
]
}
}
}
This example shows two spheres, one with a non-metallic material and one with a metallic material and shows the different meanings that base color has depending on the metalness amount.
该示例显示了两个球体,一个具有非金属材料,另一个具有金属材料,并显示了基础颜色根据金属量的不同含义。

In the previous example all of the relevant properties of the Metallic Roughness workflow are defined via a constant value, but they can also be defined using textures. The following example shows how to use textures to define the base color, metallness, and roughness of a material:
在前面的示例中,“金属粗糙度”工作流的所有相关属性都是通过常数值定义的,但也可以使用纹理来定义。以下示例显示了如何使用纹理来定义材质的基本颜色、金属度和粗糙度:
import QtQuick
import QtQuick3D
import QtQuick3D.Helpers
Window {
visible: true
width: 640
height: 480
title: qsTr("PrincipledMaterial with Textures")
View3D {
anchors.fill: parent
environment.backgroundMode: SceneEnvironment.SkyBox
environment.lightProbe: Texture {
textureData: ProceduralSkyTextureData {
}
}
PerspectiveCamera {
z: 150
y: 40
eulerRotation.x: -15
}
Model {
source: "#Sphere"
materials: [
PrincipledMaterial {
baseColorMap: Texture {
source: "red.png"
}
metalnessMap: Texture {
source: "metalness.png"
}
roughnessMap: Texture {
source: "roughness.png"
}
}
]
}
}
}
CustomMaterial
自定义材质
While PrincipledMaterial is a very flexible way to create materials, somtimes you may need more control over the material properties. For this, Qt Quick 3D provides the CustomMaterial, which allows you to augment the values used in the Metallic Roughness workflow by adjusting the shader code used by the material.
虽然PrincipledMaterial是一种非常灵活的创建材质的方法,但有时可能需要对材质属性进行更多控制。为此,Qt Quick 3D提供了CustomMaterial,它允许通过调整材质使用的着色器代码来增加“金属粗糙度”工作流中使用的值。
See Programmable Materials, Effects, Geometry, and Texture data for an introduction to augmenting materials and the built-in PBR lighting system with custom shader code.
有关使用自定义着色器代码增强材质和内置PBR照明系统的介绍,请参见可编程材质、效果、几何体和纹理数据。
Specular and Glossiness Workflow
镜面反射和光泽度工作流
The Specular/Glossiness workflow is a method for implementing Physically Based Rendering that uses two main parameters to represent the appearance of a material: specular reflectance and glossiness. The specular reflectance is a color value that determines the color and intensity of the specular highlights on the surface of the material. The glossiness is a value ranging from 0 (rough) to 1 (smooth) that determines how rough or smooth the surface of the material appears. In the Specular/Glossiness workflow, the appearance of a material is determined by its albedo, specular reflectance, and glossiness values, which can be stored as textures or constant values. A material with a high specular reflectance and low glossiness will appear more metallic and will have sharp specular highlights, while a material with a low specular reflectance and high glossiness will appear more diffuse and will have soft specular highlights.
镜面反射/光泽度工作流是一种实现基于物理的渲染的方法,它使用两个主要参数来表示材质的外观:镜面反射和光泽度。镜面反射是一个颜色值,用于确定材质表面上镜面高光的颜色和强度。光泽度是一个范围从0(粗糙)到1(平滑)的值,用于确定材质表面的粗糙度或平滑度。在“高光/光泽度”工作流中,材质的外观由其反照率、高光反射率和光泽度值决定,这些值可以存储为纹理或常数值。具有高镜面反射率和低光泽度的材质将看起来更像金属,并具有尖锐的镜面高光,而具有低镜面反射率和高光泽度的材质则会看起来更漫反射,并具有柔和的镜面高光。
SpecularGlossyMaterial
The SpecularGlossyMaterial is the material that enables the Specular/Glossiness in Qt Quick 3D.
镜面反射光泽材质是在Qt Quick 3D中启用镜面反射/光泽的材质。
More examples
更多示例
For more examples, see Qt Quick 3D - Principled Material Example and Qt Quick 3D - Custom Materials Example.
有关更多示例,请参见Qt Quick 3D-原理材质示例和Qt Quick三维-自定义材质示例。
© 2024 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.

1778

被折叠的 条评论
为什么被折叠?



