File: material_pbr.cc

package info (click to toggle)
sdformat 9.3.0%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 5,708 kB
  • sloc: cpp: 42,166; python: 1,618; javascript: 704; ruby: 368; sh: 81; ansic: 37; makefile: 16
file content (545 lines) | stat: -rw-r--r-- 19,243 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
/*
 * Copyright 2019 Open Source Robotics Foundation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

#include <string>
#include <gtest/gtest.h>
#include "sdf/sdf.hh"
#include "sdf/Pbr.hh"

#include "test_config.h"

//////////////////////////////////////////////////
TEST(Material, PbrDOM)
{
  const std::string testFile =
    sdf::filesystem::append(PROJECT_SOURCE_PATH, "test", "sdf",
        "material_pbr.sdf");

  // Load the SDF file into DOM
  sdf::Root root;
  EXPECT_TRUE(root.Load(testFile).empty());

  // Get the first model
  const sdf::Model *model = root.ModelByIndex(0);
  ASSERT_NE(nullptr, model);

  // Get the first link
  const sdf::Link *link = model->LinkByIndex(0);
  ASSERT_NE(nullptr, link);
  EXPECT_EQ("link", link->Name());

  // checkt visual materials
  EXPECT_EQ(3u, link->VisualCount());

  // visual metal workflow
  {
    EXPECT_TRUE(link->VisualNameExists("visual_metal_workflow"));
    const sdf::Visual *visual = link->VisualByIndex(0);
    ASSERT_NE(nullptr, visual);
    EXPECT_EQ("visual_metal_workflow", visual->Name());

    // material
    const sdf::Material *material = visual->Material();
    ASSERT_NE(nullptr, material);

    // diffuse
    EXPECT_EQ(ignition::math::Color(0.2f, 0.5f, 0.1f, 1.0f),
        material->Diffuse());

    // pbr
    const sdf::Pbr *pbr = material->PbrMaterial();
    ASSERT_NE(nullptr, pbr);

    // metal
    const sdf::PbrWorkflow *workflow =
        pbr->Workflow(sdf::PbrWorkflowType::METAL);
    ASSERT_NE(nullptr, workflow);
    EXPECT_EQ(sdf::PbrWorkflowType::METAL, workflow->Type());
    EXPECT_EQ(nullptr, pbr->Workflow(sdf::PbrWorkflowType::SPECULAR));

    // albedo map
    EXPECT_EQ("albedo_map.png", workflow->AlbedoMap());

    // normal map
    EXPECT_EQ("normal_map.png", workflow->NormalMap());

    // metalness map
    EXPECT_EQ("metalness_map.png", workflow->MetalnessMap());

    // metalness
    EXPECT_DOUBLE_EQ(0.3, workflow->Metalness());

    // roughness map
    EXPECT_EQ("roughness_map.png", workflow->RoughnessMap());

    // roughness
    EXPECT_DOUBLE_EQ(0.4, workflow->Roughness());

    // environment map
    EXPECT_EQ("environment_map.png", workflow->EnvironmentMap());

    // ambient occlusion map
    EXPECT_EQ("ambient_occlusion_map.png", workflow->AmbientOcclusionMap());

    // emissive map
    EXPECT_EQ("emissive_map.png", workflow->EmissiveMap());
  }

  // visual specular workflow
  {
    EXPECT_TRUE(link->VisualNameExists("visual_specular_workflow"));
    const sdf::Visual *visual = link->VisualByIndex(1);
    ASSERT_NE(nullptr, visual);
    EXPECT_EQ("visual_specular_workflow", visual->Name());

    // material
    const sdf::Material *material = visual->Material();
    ASSERT_NE(nullptr, material);

    // diffuse
    EXPECT_EQ(ignition::math::Color(0.2f, 0.5f, 0.1f, 1.0f),
        material->Diffuse());

    // pbr
    const sdf::Pbr *pbr = material->PbrMaterial();
    ASSERT_NE(nullptr, pbr);

    // specular
    const sdf::PbrWorkflow *workflow =
        pbr->Workflow(sdf::PbrWorkflowType::SPECULAR);
    ASSERT_NE(nullptr, workflow);
    EXPECT_EQ(sdf::PbrWorkflowType::SPECULAR, workflow->Type());
    EXPECT_EQ(nullptr, pbr->Workflow(sdf::PbrWorkflowType::METAL));

    // albedo map
    EXPECT_EQ("albedo_map.png", workflow->AlbedoMap());

    // normal map
    EXPECT_EQ("normal_map.png", workflow->NormalMap());

    // metalness map
    EXPECT_EQ("glossiness_map.png", workflow->GlossinessMap());

    // glossiness
    EXPECT_DOUBLE_EQ(0.2, workflow->Glossiness());

    // specular map
    EXPECT_EQ("specular_map.png", workflow->SpecularMap());

    // environment map
    EXPECT_EQ("environment_map.png", workflow->EnvironmentMap());

    // ambient occlusion map
    EXPECT_EQ("ambient_occlusion_map.png", workflow->AmbientOcclusionMap());

    // emissive map
    EXPECT_EQ("emissive_map.png", workflow->EmissiveMap());
  }

  // visual all
  {
    EXPECT_TRUE(link->VisualNameExists("visual_all"));
    const sdf::Visual *visual = link->VisualByIndex(2);
    ASSERT_NE(nullptr, visual);
    EXPECT_EQ("visual_all", visual->Name());

    // material
    const sdf::Material *material = visual->Material();
    ASSERT_NE(nullptr, material);

    // diffuse
    EXPECT_EQ(ignition::math::Color(0.2f, 0.5f, 0.1f, 1.0f),
        material->Diffuse());

    // pbr
    const sdf::Pbr *pbr = material->PbrMaterial();
    ASSERT_NE(nullptr, pbr);

    // specular
    {
      // specular
      const sdf::PbrWorkflow *workflow =
          pbr->Workflow(sdf::PbrWorkflowType::SPECULAR);
      ASSERT_NE(nullptr, workflow);
      EXPECT_EQ(sdf::PbrWorkflowType::SPECULAR, workflow->Type());

      // specular
      EXPECT_EQ(sdf::PbrWorkflowType::SPECULAR, workflow->Type());

      // albedo map
      EXPECT_EQ("albedo_map.png", workflow->AlbedoMap());

      // normal map
      EXPECT_EQ("normal_map_tangent.png", workflow->NormalMap());

      // metalness map
      EXPECT_EQ("glossiness_map.png", workflow->GlossinessMap());

      // glossiness
      EXPECT_DOUBLE_EQ(0.2, workflow->Glossiness());

      // specular map
      EXPECT_EQ("specular_map.png", workflow->SpecularMap());

      // environment map
      EXPECT_EQ("environment_map.png", workflow->EnvironmentMap());

      // ambient occlusion map
      EXPECT_EQ("ambient_occlusion_map.png", workflow->AmbientOcclusionMap());

      // emissive map
      EXPECT_EQ("emissive_map.png", workflow->EmissiveMap());
    }
    // metal
    {
      const sdf::PbrWorkflow *workflow =
          pbr->Workflow(sdf::PbrWorkflowType::METAL);
      ASSERT_NE(nullptr, workflow);
      EXPECT_EQ(sdf::PbrWorkflowType::METAL, workflow->Type());

      // albedo map
      EXPECT_EQ("albedo_map.png", workflow->AlbedoMap());

      // normal map
      EXPECT_EQ("normal_map_object.png", workflow->NormalMap());

      // metalness map
      EXPECT_EQ("metalness_map.png", workflow->MetalnessMap());

      // metalness
      EXPECT_DOUBLE_EQ(0.3, workflow->Metalness());

      // roughness map
      EXPECT_EQ("roughness_map.png", workflow->RoughnessMap());

      // roughness
      EXPECT_DOUBLE_EQ(0.4, workflow->Roughness());

      // environment map
      EXPECT_EQ("environment_map.png", workflow->EnvironmentMap());

      // ambient occlusion map
      EXPECT_EQ("ambient_occlusion_map.png", workflow->AmbientOcclusionMap());

      // emissive map
      EXPECT_EQ("emissive_map.png", workflow->EmissiveMap());
    }
  }
}

//////////////////////////////////////////////////
TEST(Material, MaterialPBR)
{
  const std::string testFile =
    sdf::filesystem::append(PROJECT_SOURCE_PATH, "test", "sdf",
        "material_pbr.sdf");

  // load material pbr sdf file
  sdf::Errors errors;
  sdf::SDFPtr sdfParsed = sdf::readFile(testFile, errors);
  ASSERT_TRUE(errors.empty());
  ASSERT_NE(nullptr, sdfParsed);
  ASSERT_NE(nullptr, sdfParsed->Root());
  EXPECT_EQ(testFile, sdfParsed->FilePath());

  // model
  EXPECT_TRUE(sdfParsed->Root()->HasElement("model"));
  sdf::ElementPtr modelElem = sdfParsed->Root()->GetElement("model");
  EXPECT_TRUE(modelElem->HasAttribute("name"));
  EXPECT_EQ(modelElem->Get<std::string>("name"), "model");
  EXPECT_EQ(testFile, modelElem->FilePath());

  // link
  EXPECT_TRUE(modelElem->HasElement("link"));
  sdf::ElementPtr linkElem = modelElem->GetElement("link");
  EXPECT_TRUE(linkElem->HasAttribute("name"));
  EXPECT_EQ(linkElem->Get<std::string>("name"), "link");
  EXPECT_EQ(testFile, linkElem->FilePath());

  EXPECT_TRUE(linkElem->HasElement("visual"));
  sdf::ElementPtr visualElem = linkElem->GetElement("visual");

  // visual metal workflow
  {
    EXPECT_TRUE(visualElem->HasAttribute("name"));
    EXPECT_EQ("visual_metal_workflow", visualElem->Get<std::string>("name"));
    EXPECT_EQ(testFile, visualElem->FilePath());

    // material
    EXPECT_TRUE(visualElem->HasElement("material"));
    sdf::ElementPtr materialElem = visualElem->GetElement("material");

    // diffuse
    EXPECT_TRUE(materialElem->HasElement("diffuse"));
    sdf::ElementPtr diffuseElem = materialElem->GetElement("diffuse");
    EXPECT_EQ(ignition::math::Color(0.2f, 0.5f, 0.1f, 1.0f),
        diffuseElem->Get<ignition::math::Color>());

    // pbr
    EXPECT_TRUE(materialElem->HasElement("pbr"));
    sdf::ElementPtr pbrElem = materialElem->GetElement("pbr");

    // metal
    EXPECT_TRUE(pbrElem->HasElement("metal"));
    sdf::ElementPtr metalElem = pbrElem->GetElement("metal");

    // albedo map
    EXPECT_TRUE(metalElem->HasElement("albedo_map"));
    sdf::ElementPtr albedoMapElem = metalElem->GetElement("albedo_map");
    EXPECT_EQ("albedo_map.png", albedoMapElem->Get<std::string>());

    // normal map
    EXPECT_TRUE(metalElem->HasElement("normal_map"));
    sdf::ElementPtr normalMapElem = metalElem->GetElement("normal_map");
    EXPECT_TRUE(normalMapElem->HasAttribute("type"));
    EXPECT_EQ("tangent", normalMapElem->Get<std::string>("type"));
    EXPECT_EQ("normal_map.png", normalMapElem->Get<std::string>());

    // metalness map
    EXPECT_TRUE(metalElem->HasElement("metalness_map"));
    sdf::ElementPtr metalnessMapElem = metalElem->GetElement("metalness_map");
    EXPECT_EQ("metalness_map.png", metalnessMapElem->Get<std::string>());

    // metalness
    EXPECT_TRUE(metalElem->HasElement("metalness"));
    sdf::ElementPtr metalnessElem = metalElem->GetElement("metalness");
    EXPECT_DOUBLE_EQ(0.3, metalnessElem->Get<double>());

    // roughness map
    EXPECT_TRUE(metalElem->HasElement("roughness_map"));
    sdf::ElementPtr roughnessMapElem = metalElem->GetElement("roughness_map");
    EXPECT_EQ("roughness_map.png", roughnessMapElem->Get<std::string>());

    // roughness
    EXPECT_TRUE(metalElem->HasElement("roughness"));
    sdf::ElementPtr roughnessElem = metalElem->GetElement("roughness");
    EXPECT_DOUBLE_EQ(0.4, roughnessElem->Get<double>());

    // environment map
    EXPECT_TRUE(metalElem->HasElement("environment_map"));
    sdf::ElementPtr envMapElem = metalElem->GetElement("environment_map");
    EXPECT_EQ("environment_map.png", envMapElem->Get<std::string>());

    // ambient occlusion map
    EXPECT_TRUE(metalElem->HasElement("ambient_occlusion_map"));
    sdf::ElementPtr aoMapElem = metalElem->GetElement("ambient_occlusion_map");
    EXPECT_EQ("ambient_occlusion_map.png", aoMapElem->Get<std::string>());

    // emissive map
    EXPECT_TRUE(metalElem->HasElement("emissive_map"));
    sdf::ElementPtr emissiveMapElem = metalElem->GetElement("emissive_map");
    EXPECT_EQ("emissive_map.png", emissiveMapElem->Get<std::string>());
  }

  // visual specular workflow
  {
    visualElem = visualElem->GetNextElement("visual");
    EXPECT_TRUE(visualElem->HasAttribute("name"));
    EXPECT_EQ("visual_specular_workflow", visualElem->Get<std::string>("name"));

    // material
    EXPECT_TRUE(visualElem->HasElement("material"));
    sdf::ElementPtr materialElem = visualElem->GetElement("material");

    // diffuse
    EXPECT_TRUE(materialElem->HasElement("diffuse"));
    sdf::ElementPtr diffuseElem = materialElem->GetElement("diffuse");
    EXPECT_EQ(ignition::math::Color(0.2f, 0.5f, 0.1f, 1.0f),
        diffuseElem->Get<ignition::math::Color>());

    // pbr
    EXPECT_TRUE(materialElem->HasElement("pbr"));
    sdf::ElementPtr pbrElem = materialElem->GetElement("pbr");

    // specular
    EXPECT_TRUE(pbrElem->HasElement("specular"));
    sdf::ElementPtr specularElem = pbrElem->GetElement("specular");

    // albedo map
    EXPECT_TRUE(specularElem->HasElement("albedo_map"));
    sdf::ElementPtr albedoMapElem = specularElem->GetElement("albedo_map");
    EXPECT_EQ("albedo_map.png", albedoMapElem->Get<std::string>());

    // normal map
    EXPECT_TRUE(specularElem->HasElement("normal_map"));
    sdf::ElementPtr normalMapElem = specularElem->GetElement("normal_map");
    EXPECT_TRUE(normalMapElem->HasAttribute("type"));
    EXPECT_EQ("tangent", normalMapElem->Get<std::string>("type"));
    EXPECT_EQ("normal_map.png", normalMapElem->Get<std::string>());

    // specular map
    EXPECT_TRUE(specularElem->HasElement("specular_map"));
    sdf::ElementPtr specularMapElem = specularElem->GetElement("specular_map");
    EXPECT_EQ("specular_map.png", specularMapElem->Get<std::string>());

    // glossiness map
    EXPECT_TRUE(specularElem->HasElement("glossiness_map"));
    sdf::ElementPtr glossinessMapElem =
        specularElem->GetElement("glossiness_map");
    EXPECT_EQ("glossiness_map.png", glossinessMapElem->Get<std::string>());

    // glossiness
    EXPECT_TRUE(specularElem->HasElement("glossiness"));
    sdf::ElementPtr glossinessElem = specularElem->GetElement("glossiness");
    EXPECT_DOUBLE_EQ(0.2, glossinessElem->Get<double>());

    // environment map
    EXPECT_TRUE(specularElem->HasElement("environment_map"));
    sdf::ElementPtr envMapElem = specularElem->GetElement("environment_map");
    EXPECT_EQ("environment_map.png", envMapElem->Get<std::string>());

    // ambient occlusion map
    EXPECT_TRUE(specularElem->HasElement("ambient_occlusion_map"));
    sdf::ElementPtr aoMapElem =
        specularElem->GetElement("ambient_occlusion_map");
    EXPECT_EQ("ambient_occlusion_map.png", aoMapElem->Get<std::string>());

    // emissive map
    EXPECT_TRUE(specularElem->HasElement("emissive_map"));
    sdf::ElementPtr emissiveMapElem = specularElem->GetElement("emissive_map");
    EXPECT_EQ("emissive_map.png", emissiveMapElem->Get<std::string>());
  }

  // visual all
  {
    visualElem = visualElem->GetNextElement("visual");
    EXPECT_TRUE(visualElem->HasAttribute("name"));
    EXPECT_EQ("visual_all", visualElem->Get<std::string>("name"));

    // material
    EXPECT_TRUE(visualElem->HasElement("material"));
    sdf::ElementPtr materialElem = visualElem->GetElement("material");

    // diffuse
    EXPECT_TRUE(materialElem->HasElement("diffuse"));
    sdf::ElementPtr diffuseElem = materialElem->GetElement("diffuse");
    EXPECT_EQ(ignition::math::Color(0.2f, 0.5f, 0.1f, 1.0f),
        diffuseElem->Get<ignition::math::Color>());

    // pbr
    EXPECT_TRUE(materialElem->HasElement("pbr"));
    sdf::ElementPtr pbrElem = materialElem->GetElement("pbr");

    {
      // specular
      EXPECT_TRUE(pbrElem->HasElement("specular"));
      sdf::ElementPtr specularElem = pbrElem->GetElement("specular");

      // albedo map
      EXPECT_TRUE(specularElem->HasElement("albedo_map"));
      sdf::ElementPtr albedoMapElem = specularElem->GetElement("albedo_map");
      EXPECT_EQ("albedo_map.png", albedoMapElem->Get<std::string>());

      // normal map
      EXPECT_TRUE(specularElem->HasElement("normal_map"));
      sdf::ElementPtr normalMapElem = specularElem->GetElement("normal_map");
      EXPECT_TRUE(normalMapElem->HasAttribute("type"));
      EXPECT_EQ("tangent", normalMapElem->Get<std::string>("type"));
      EXPECT_EQ("normal_map_tangent.png", normalMapElem->Get<std::string>());

      // specular map
      EXPECT_TRUE(specularElem->HasElement("specular_map"));
      sdf::ElementPtr specularMapElem =
          specularElem->GetElement("specular_map");
      EXPECT_EQ("specular_map.png", specularMapElem->Get<std::string>());

      // glossiness map
      EXPECT_TRUE(specularElem->HasElement("glossiness_map"));
      sdf::ElementPtr glossinessMapElem =
          specularElem->GetElement("glossiness_map");
      EXPECT_EQ("glossiness_map.png", glossinessMapElem->Get<std::string>());

      // glossiness
      EXPECT_TRUE(specularElem->HasElement("glossiness"));
      sdf::ElementPtr glossinessElem = specularElem->GetElement("glossiness");
      EXPECT_DOUBLE_EQ(0.2, glossinessElem->Get<double>());

      // environment map
      EXPECT_TRUE(specularElem->HasElement("environment_map"));
      sdf::ElementPtr envMapElem = specularElem->GetElement("environment_map");
      EXPECT_EQ("environment_map.png", envMapElem->Get<std::string>());

      // ambient occlusion map
      EXPECT_TRUE(specularElem->HasElement("ambient_occlusion_map"));
      sdf::ElementPtr aoMapElem =
          specularElem->GetElement("ambient_occlusion_map");
      EXPECT_EQ("ambient_occlusion_map.png", aoMapElem->Get<std::string>());

      // emissive map
      EXPECT_TRUE(specularElem->HasElement("emissive_map"));
      sdf::ElementPtr emissiveMapElem =
          specularElem->GetElement("emissive_map");
      EXPECT_EQ("emissive_map.png", emissiveMapElem->Get<std::string>());
    }

    {
      // metal
      EXPECT_TRUE(pbrElem->HasElement("metal"));
      sdf::ElementPtr metalElem = pbrElem->GetElement("metal");

      // albedo map
      EXPECT_TRUE(metalElem->HasElement("albedo_map"));
      sdf::ElementPtr albedoMapElem = metalElem->GetElement("albedo_map");
      EXPECT_EQ("albedo_map.png", albedoMapElem->Get<std::string>());

      // normal map
      EXPECT_TRUE(metalElem->HasElement("normal_map"));
      sdf::ElementPtr normalMapElem = metalElem->GetElement("normal_map");
      EXPECT_TRUE(normalMapElem->HasAttribute("type"));
      EXPECT_EQ("object", normalMapElem->Get<std::string>("type"));
      EXPECT_EQ("normal_map_object.png", normalMapElem->Get<std::string>());

      // metalness map
      EXPECT_TRUE(metalElem->HasElement("metalness_map"));
      sdf::ElementPtr metalnessMapElem = metalElem->GetElement("metalness_map");
      EXPECT_EQ("metalness_map.png", metalnessMapElem->Get<std::string>());

      // metalness
      EXPECT_TRUE(metalElem->HasElement("metalness"));
      sdf::ElementPtr metalnessElem = metalElem->GetElement("metalness");
      EXPECT_DOUBLE_EQ(0.3, metalnessElem->Get<double>());

      // roughness map
      EXPECT_TRUE(metalElem->HasElement("roughness_map"));
      sdf::ElementPtr roughnessMapElem = metalElem->GetElement("roughness_map");
      EXPECT_EQ("roughness_map.png", roughnessMapElem->Get<std::string>());

      // roughness
      EXPECT_TRUE(metalElem->HasElement("roughness"));
      sdf::ElementPtr roughnessElem = metalElem->GetElement("roughness");
      EXPECT_DOUBLE_EQ(0.4, roughnessElem->Get<double>());

      // environment map
      EXPECT_TRUE(metalElem->HasElement("environment_map"));
      sdf::ElementPtr envMapElem = metalElem->GetElement("environment_map");
      EXPECT_EQ("environment_map.png", envMapElem->Get<std::string>());

      // ambient occlusion map
      EXPECT_TRUE(metalElem->HasElement("ambient_occlusion_map"));
      sdf::ElementPtr aoMapElem =
          metalElem->GetElement("ambient_occlusion_map");
      EXPECT_EQ("ambient_occlusion_map.png", aoMapElem->Get<std::string>());

      // emissive map
      EXPECT_TRUE(metalElem->HasElement("emissive_map"));
      sdf::ElementPtr emissiveMapElem = metalElem->GetElement("emissive_map");
      EXPECT_EQ("emissive_map.png", emissiveMapElem->Get<std::string>());
    }
  }
}