Open3D (C++ API)  0.11.0
Material.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // The MIT License (MIT)
5 //
6 // Copyright (c) 2020 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"
35 
36 namespace open3d {
37 namespace visualization {
38 namespace rendering {
39 
40 struct Material {
41  std::string name;
42 
43  // Rendering attributes
44  bool has_alpha = false;
45 
46  // PBR Material properties and maps
47  Eigen::Vector4f base_color = Eigen::Vector4f(1.f, 1.f, 1.f, 1.f);
48  float base_metallic = 0.f;
49  float base_roughness = 1.f;
50  float base_reflectance = 0.5f;
51  float base_clearcoat = 0.f;
53  float base_anisotropy = 0.f;
54 
55  float point_size = 3.f;
56 
57  std::shared_ptr<geometry::Image> albedo_img;
58  std::shared_ptr<geometry::Image> normal_img;
59  std::shared_ptr<geometry::Image> ao_img;
60  std::shared_ptr<geometry::Image> metallic_img;
61  std::shared_ptr<geometry::Image> roughness_img;
62  std::shared_ptr<geometry::Image> reflectance_img;
63  std::shared_ptr<geometry::Image> clearcoat_img;
64  std::shared_ptr<geometry::Image> clearcoat_roughness_img;
65  std::shared_ptr<geometry::Image> anisotropy_img;
66 
67  // Combined images
68  std::shared_ptr<geometry::Image> ao_rough_metal_img;
69 
70  // Colormap (incompatible with other settings except point_size)
71  // Values for 'value' must be in [0, 1] and the vector must be sorted
72  // by increasing value. 'shader' must be "unlitGradient".
73  std::shared_ptr<Gradient> gradient;
74  float scalar_min = 0.0f;
75  float scalar_max = 1.0f;
76 
77  // Generic material properties
78  std::unordered_map<std::string, Eigen::Vector4f> generic_params;
79  std::unordered_map<std::string, geometry::Image> generic_imgs;
80 
81  std::string shader;
82 };
83 
84 } // namespace rendering
85 } // namespace visualization
86 } // namespace open3d
std::shared_ptr< geometry::Image > anisotropy_img
Definition: Material.h:65
std::shared_ptr< geometry::Image > clearcoat_roughness_img
Definition: Material.h:64
std::shared_ptr< geometry::Image > normal_img
Definition: Material.h:58
bool has_alpha
Definition: Material.h:44
std::unordered_map< std::string, Eigen::Vector4f > generic_params
Definition: Material.h:78
std::shared_ptr< Gradient > gradient
Definition: Material.h:73
std::shared_ptr< geometry::Image > ao_img
Definition: Material.h:59
float point_size
Definition: Material.h:55
float base_clearcoat
Definition: Material.h:51
float scalar_min
Definition: Material.h:74
std::unordered_map< std::string, geometry::Image > generic_imgs
Definition: Material.h:79
std::shared_ptr< geometry::Image > roughness_img
Definition: Material.h:61
float base_roughness
Definition: Material.h:49
float base_reflectance
Definition: Material.h:50
std::shared_ptr< geometry::Image > albedo_img
Definition: Material.h:57
std::string shader
Definition: Material.h:81
float scalar_max
Definition: Material.h:75
Definition: PinholeCameraIntrinsic.cpp:35
float base_anisotropy
Definition: Material.h:53
std::shared_ptr< geometry::Image > reflectance_img
Definition: Material.h:62
std::shared_ptr< geometry::Image > metallic_img
Definition: Material.h:60
std::shared_ptr< geometry::Image > clearcoat_img
Definition: Material.h:63
float base_clearcoat_roughness
Definition: Material.h:52
std::shared_ptr< geometry::Image > ao_rough_metal_img
Definition: Material.h:68
Eigen::Vector4f base_color
Definition: Material.h:47
float base_metallic
Definition: Material.h:48
std::string name
Definition: Material.h:41