Open3D (C++ API)  0.15.1
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
36
37namespace open3d {
38namespace visualization {
39namespace 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
56 // PBR material properties for refractive materials
57 float thickness = 1.f;
58 float transmission = 1.f;
59 Eigen::Vector3f absorption_color =
60 Eigen::Vector3f(1.f, 1.f, 1.f); // linear color
62
63 float point_size = 3.f;
64 float line_width = 1.f; // only used with shader = "unlitLine"
65
66 std::shared_ptr<geometry::Image> albedo_img;
67 std::shared_ptr<geometry::Image> normal_img;
68 std::shared_ptr<geometry::Image> ao_img;
69 std::shared_ptr<geometry::Image> metallic_img;
70 std::shared_ptr<geometry::Image> roughness_img;
71 std::shared_ptr<geometry::Image> reflectance_img;
72 std::shared_ptr<geometry::Image> clearcoat_img;
73 std::shared_ptr<geometry::Image> clearcoat_roughness_img;
74 std::shared_ptr<geometry::Image> anisotropy_img;
75
76 // Combined images
77 std::shared_ptr<geometry::Image> ao_rough_metal_img;
78
79 // Colormap (incompatible with other settings except point_size)
80 // Values for 'value' must be in [0, 1] and the vector must be sorted
81 // by increasing value. 'shader' must be "unlitGradient".
82 std::shared_ptr<Gradient> gradient;
83 float scalar_min = 0.0f;
84 float scalar_max = 1.0f;
85
86 // Colors are assumed to be sRGB and tone-mapped accordingly.
87 // If tone-mapping is disabled, then colors would be in linear RGB space,
88 // in which case this should be set to false. If necessary, colors will be
89 // linearized on the CPU.
90 bool sRGB_color = false;
91
92 // Unlike the material property sRGB_color which is used to indicate that
93 // source colors are in sRGB colorspace, sRGB_vertex_color indicates that
94 // per-vertex colors are in sRGB space and should be passed to the GPU as
95 // sRGB color.
96 bool sRGB_vertex_color = false;
97
98 // Background image (shader = "unlitBackground")
99 float aspect_ratio = 0.0f; // 0: uses base_color; >0: uses albedo_img
100
101 // Infinite ground plane
102 float ground_plane_axis = 0.f; // 0: XZ; >0: XY; <0: YZ
103
104 // Generic material properties
105 std::unordered_map<std::string, Eigen::Vector4f> generic_params;
106 std::unordered_map<std::string, geometry::Image> generic_imgs;
107
108 std::string shader = "defaultUnlit";
109};
110
111} // namespace rendering
112} // namespace visualization
113} // namespace open3d
Definition: PinholeCameraIntrinsic.cpp:35
float base_anisotropy
Definition: MaterialRecord.h:54
Eigen::Vector3f absorption_color
Definition: MaterialRecord.h:59
std::shared_ptr< geometry::Image > ao_img
Definition: MaterialRecord.h:68
bool has_alpha
Definition: MaterialRecord.h:45
std::shared_ptr< geometry::Image > metallic_img
Definition: MaterialRecord.h:69
std::shared_ptr< geometry::Image > albedo_img
Definition: MaterialRecord.h:66
float transmission
Definition: MaterialRecord.h:58
float scalar_max
Definition: MaterialRecord.h:84
std::shared_ptr< geometry::Image > ao_rough_metal_img
Definition: MaterialRecord.h:77
Eigen::Vector4f base_color
Definition: MaterialRecord.h:48
std::string name
Definition: MaterialRecord.h:42
std::shared_ptr< Gradient > gradient
Definition: MaterialRecord.h:82
std::shared_ptr< geometry::Image > reflectance_img
Definition: MaterialRecord.h:71
bool sRGB_color
Definition: MaterialRecord.h:90
std::shared_ptr< geometry::Image > roughness_img
Definition: MaterialRecord.h:70
std::unordered_map< std::string, Eigen::Vector4f > generic_params
Definition: MaterialRecord.h:105
float line_width
Definition: MaterialRecord.h:64
std::shared_ptr< geometry::Image > clearcoat_roughness_img
Definition: MaterialRecord.h:73
std::shared_ptr< geometry::Image > anisotropy_img
Definition: MaterialRecord.h:74
float aspect_ratio
Definition: MaterialRecord.h:99
float absorption_distance
Definition: MaterialRecord.h:61
float thickness
Definition: MaterialRecord.h:57
float base_metallic
Definition: MaterialRecord.h:49
float ground_plane_axis
Definition: MaterialRecord.h:102
float point_size
Definition: MaterialRecord.h:63
float base_reflectance
Definition: MaterialRecord.h:51
float base_clearcoat
Definition: MaterialRecord.h:52
bool sRGB_vertex_color
Definition: MaterialRecord.h:96
std::unordered_map< std::string, geometry::Image > generic_imgs
Definition: MaterialRecord.h:106
float scalar_min
Definition: MaterialRecord.h:83
float base_clearcoat_roughness
Definition: MaterialRecord.h:53
std::shared_ptr< geometry::Image > clearcoat_img
Definition: MaterialRecord.h:72
float base_roughness
Definition: MaterialRecord.h:50
std::string shader
Definition: MaterialRecord.h:108
std::shared_ptr< geometry::Image > normal_img
Definition: MaterialRecord.h:67