Open3D (C++ API)  0.18.0+252c867
MaterialRecord.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2023 www.open3d.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <Eigen/Core>
11 #include <string>
12 #include <unordered_map>
13 
14 #include "open3d/geometry/Image.h"
17 
18 namespace open3d {
19 namespace visualization {
20 namespace rendering {
21 
23  std::string name;
24 
25  // Rendering attributes
26  bool has_alpha = false;
27 
28  // PBR Material properties and maps
29  Eigen::Vector4f base_color = Eigen::Vector4f(1.f, 1.f, 1.f, 1.f);
30  float base_metallic = 0.f;
31  float base_roughness = 1.f;
32  float base_reflectance = 0.5f;
33  float base_clearcoat = 0.f;
35  float base_anisotropy = 0.f;
36  Eigen::Vector4f emissive_color = Eigen::Vector4f(0.f, 0.f, 0.f, 1.f);
37 
38  // PBR material properties for refractive materials
39  float thickness = 1.f;
40  float transmission = 1.f;
41  Eigen::Vector3f absorption_color =
42  Eigen::Vector3f(1.f, 1.f, 1.f); // linear color
43  float absorption_distance = 1.f;
44 
45  float point_size = 3.f;
46  float line_width = 1.f; // only used with shader = "unlitLine"
47 
48  std::shared_ptr<geometry::Image> albedo_img;
49  std::shared_ptr<geometry::Image> normal_img;
50  std::shared_ptr<geometry::Image> ao_img;
51  std::shared_ptr<geometry::Image> metallic_img;
52  std::shared_ptr<geometry::Image> roughness_img;
53  std::shared_ptr<geometry::Image> reflectance_img;
54  std::shared_ptr<geometry::Image> clearcoat_img;
55  std::shared_ptr<geometry::Image> clearcoat_roughness_img;
56  std::shared_ptr<geometry::Image> anisotropy_img;
57 
58  // Combined images
59  std::shared_ptr<geometry::Image> ao_rough_metal_img;
60 
61  // Colormap (incompatible with other settings except point_size)
62  // Values for 'value' must be in [0, 1] and the vector must be sorted
63  // by increasing value. 'shader' must be "unlitGradient".
64  std::shared_ptr<Gradient> gradient;
65  float scalar_min = 0.0f;
66  float scalar_max = 1.0f;
67 
68  // Colors are assumed to be sRGB and tone-mapped accordingly.
69  // If tone-mapping is disabled, then colors would be in linear RGB space,
70  // in which case this should be set to false. If necessary, colors will be
71  // linearized on the CPU.
72  bool sRGB_color = false;
73 
74  // Unlike the material property sRGB_color which is used to indicate that
75  // source colors are in sRGB colorspace, sRGB_vertex_color indicates that
76  // per-vertex colors are in sRGB space and should be passed to the GPU as
77  // sRGB color.
78  bool sRGB_vertex_color = false;
79 
80  // Background image (shader = "unlitBackground")
81  float aspect_ratio = 0.0f; // 0: uses base_color; >0: uses albedo_img
82 
83  // Infinite ground plane
84  float ground_plane_axis = 0.f; // 0: XZ; >0: XY; <0: YZ
85 
86  // Generic material properties
87  std::unordered_map<std::string, Eigen::Vector4f> generic_params;
88  std::unordered_map<std::string, geometry::Image> generic_imgs;
89 
90  std::string shader = "defaultUnlit";
91 };
92 
93 } // namespace rendering
94 } // namespace visualization
95 } // namespace open3d
Definition: PinholeCameraIntrinsic.cpp:16
float base_anisotropy
Definition: MaterialRecord.h:35
Eigen::Vector3f absorption_color
Definition: MaterialRecord.h:41
std::shared_ptr< geometry::Image > ao_img
Definition: MaterialRecord.h:50
bool has_alpha
Definition: MaterialRecord.h:26
std::shared_ptr< geometry::Image > metallic_img
Definition: MaterialRecord.h:51
std::shared_ptr< geometry::Image > albedo_img
Definition: MaterialRecord.h:48
float transmission
Definition: MaterialRecord.h:40
float scalar_max
Definition: MaterialRecord.h:66
std::shared_ptr< geometry::Image > ao_rough_metal_img
Definition: MaterialRecord.h:59
Eigen::Vector4f base_color
Definition: MaterialRecord.h:29
std::string name
Definition: MaterialRecord.h:23
std::shared_ptr< Gradient > gradient
Definition: MaterialRecord.h:64
std::shared_ptr< geometry::Image > reflectance_img
Definition: MaterialRecord.h:53
bool sRGB_color
Definition: MaterialRecord.h:72
std::shared_ptr< geometry::Image > roughness_img
Definition: MaterialRecord.h:52
std::unordered_map< std::string, Eigen::Vector4f > generic_params
Definition: MaterialRecord.h:87
float line_width
Definition: MaterialRecord.h:46
std::shared_ptr< geometry::Image > clearcoat_roughness_img
Definition: MaterialRecord.h:55
std::shared_ptr< geometry::Image > anisotropy_img
Definition: MaterialRecord.h:56
float aspect_ratio
Definition: MaterialRecord.h:81
float absorption_distance
Definition: MaterialRecord.h:43
float thickness
Definition: MaterialRecord.h:39
float base_metallic
Definition: MaterialRecord.h:30
float ground_plane_axis
Definition: MaterialRecord.h:84
float point_size
Definition: MaterialRecord.h:45
float base_reflectance
Definition: MaterialRecord.h:32
float base_clearcoat
Definition: MaterialRecord.h:33
bool sRGB_vertex_color
Definition: MaterialRecord.h:78
std::unordered_map< std::string, geometry::Image > generic_imgs
Definition: MaterialRecord.h:88
float scalar_min
Definition: MaterialRecord.h:65
float base_clearcoat_roughness
Definition: MaterialRecord.h:34
std::shared_ptr< geometry::Image > clearcoat_img
Definition: MaterialRecord.h:54
Eigen::Vector4f emissive_color
Definition: MaterialRecord.h:36
float base_roughness
Definition: MaterialRecord.h:31
std::string shader
Definition: MaterialRecord.h:90
std::shared_ptr< geometry::Image > normal_img
Definition: MaterialRecord.h:49