Loading [MathJax]/extensions/tex2jax.js
Open3D (C++ API)  0.16.0
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
MaterialRecord.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // The MIT License (MIT)
5 //
6 // Copyright (c) 2018-2021 www.open3d.org
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to deal
10 // in the Software without restriction, including without limitation the rights
11 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 // copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be included in
16 // all copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 // IN THE SOFTWARE.
25 // ----------------------------------------------------------------------------
26 
27 #pragma once
28 
29 #include <Eigen/Core>
30 #include <string>
31 #include <unordered_map>
32 
33 #include "open3d/geometry/Image.h"
36 
37 namespace open3d {
38 namespace visualization {
39 namespace rendering {
40 
42  std::string name;
43 
44  // Rendering attributes
45  bool has_alpha = false;
46 
47  // PBR Material properties and maps
48  Eigen::Vector4f base_color = Eigen::Vector4f(1.f, 1.f, 1.f, 1.f);
49  float base_metallic = 0.f;
50  float base_roughness = 1.f;
51  float base_reflectance = 0.5f;
52  float base_clearcoat = 0.f;
54  float base_anisotropy = 0.f;
55  Eigen::Vector4f emissive_color = Eigen::Vector4f(0.f, 0.f, 0.f, 1.f);
56 
57  // PBR material properties for refractive materials
58  float thickness = 1.f;
59  float transmission = 1.f;
60  Eigen::Vector3f absorption_color =
61  Eigen::Vector3f(1.f, 1.f, 1.f); // linear color
62  float absorption_distance = 1.f;
63 
64  float point_size = 3.f;
65  float line_width = 1.f; // only used with shader = "unlitLine"
66 
67  std::shared_ptr<geometry::Image> albedo_img;
68  std::shared_ptr<geometry::Image> normal_img;
69  std::shared_ptr<geometry::Image> ao_img;
70  std::shared_ptr<geometry::Image> metallic_img;
71  std::shared_ptr<geometry::Image> roughness_img;
72  std::shared_ptr<geometry::Image> reflectance_img;
73  std::shared_ptr<geometry::Image> clearcoat_img;
74  std::shared_ptr<geometry::Image> clearcoat_roughness_img;
75  std::shared_ptr<geometry::Image> anisotropy_img;
76 
77  // Combined images
78  std::shared_ptr<geometry::Image> ao_rough_metal_img;
79 
80  // Colormap (incompatible with other settings except point_size)
81  // Values for 'value' must be in [0, 1] and the vector must be sorted
82  // by increasing value. 'shader' must be "unlitGradient".
83  std::shared_ptr<Gradient> gradient;
84  float scalar_min = 0.0f;
85  float scalar_max = 1.0f;
86 
87  // Colors are assumed to be sRGB and tone-mapped accordingly.
88  // If tone-mapping is disabled, then colors would be in linear RGB space,
89  // in which case this should be set to false. If necessary, colors will be
90  // linearized on the CPU.
91  bool sRGB_color = false;
92 
93  // Unlike the material property sRGB_color which is used to indicate that
94  // source colors are in sRGB colorspace, sRGB_vertex_color indicates that
95  // per-vertex colors are in sRGB space and should be passed to the GPU as
96  // sRGB color.
97  bool sRGB_vertex_color = false;
98 
99  // Background image (shader = "unlitBackground")
100  float aspect_ratio = 0.0f; // 0: uses base_color; >0: uses albedo_img
101 
102  // Infinite ground plane
103  float ground_plane_axis = 0.f; // 0: XZ; >0: XY; <0: YZ
104 
105  // Generic material properties
106  std::unordered_map<std::string, Eigen::Vector4f> generic_params;
107  std::unordered_map<std::string, geometry::Image> generic_imgs;
108 
109  std::string shader = "defaultUnlit";
110 };
111 
112 } // namespace rendering
113 } // namespace visualization
114 } // namespace open3d
std::string name
Definition: MaterialRecord.h:42
std::unordered_map< std::string, geometry::Image > generic_imgs
Definition: MaterialRecord.h:107
std::shared_ptr< Gradient > gradient
Definition: MaterialRecord.h:83
float point_size
Definition: MaterialRecord.h:64
std::shared_ptr< geometry::Image > metallic_img
Definition: MaterialRecord.h:70
std::shared_ptr< geometry::Image > reflectance_img
Definition: MaterialRecord.h:72
std::shared_ptr< geometry::Image > ao_img
Definition: MaterialRecord.h:69
float line_width
Definition: MaterialRecord.h:65
float scalar_max
Definition: MaterialRecord.h:85
float ground_plane_axis
Definition: MaterialRecord.h:103
float base_clearcoat_roughness
Definition: MaterialRecord.h:53
Eigen::Vector4f base_color
Definition: MaterialRecord.h:48
float transmission
Definition: MaterialRecord.h:59
float thickness
Definition: MaterialRecord.h:58
float base_roughness
Definition: MaterialRecord.h:50
std::shared_ptr< geometry::Image > normal_img
Definition: MaterialRecord.h:68
bool sRGB_vertex_color
Definition: MaterialRecord.h:97
std::shared_ptr< geometry::Image > albedo_img
Definition: MaterialRecord.h:67
float absorption_distance
Definition: MaterialRecord.h:62
float aspect_ratio
Definition: MaterialRecord.h:100
std::unordered_map< std::string, Eigen::Vector4f > generic_params
Definition: MaterialRecord.h:106
std::shared_ptr< geometry::Image > clearcoat_roughness_img
Definition: MaterialRecord.h:74
float scalar_min
Definition: MaterialRecord.h:84
Eigen::Vector3f absorption_color
Definition: MaterialRecord.h:60
Definition: PinholeCameraIntrinsic.cpp:35
std::shared_ptr< geometry::Image > clearcoat_img
Definition: MaterialRecord.h:73
bool sRGB_color
Definition: MaterialRecord.h:91
Eigen::Vector4f emissive_color
Definition: MaterialRecord.h:55
bool has_alpha
Definition: MaterialRecord.h:45
std::shared_ptr< geometry::Image > ao_rough_metal_img
Definition: MaterialRecord.h:78
float base_metallic
Definition: MaterialRecord.h:49
std::shared_ptr< geometry::Image > roughness_img
Definition: MaterialRecord.h:71
float base_clearcoat
Definition: MaterialRecord.h:52
float base_reflectance
Definition: MaterialRecord.h:51
std::string shader
Definition: MaterialRecord.h:109
float base_anisotropy
Definition: MaterialRecord.h:54
std::shared_ptr< geometry::Image > anisotropy_img
Definition: MaterialRecord.h:75