PBR materials for o3dv format.

This commit is contained in:
kovacsv 2021-08-05 15:38:07 +02:00
parent 669ab1f8b4
commit 2a71f7d6b5
2 changed files with 73 additions and 1 deletions

View File

@ -52,7 +52,7 @@ OV.ImporterO3dv = class extends OV.ImporterBase
ImportMaterial (materialContent)
{
let material = new OV.Material (OV.MaterialType.Phong);
let material = new OV.Material (OV.MaterialType.Physical);
material.color.Set (255, 255, 255);
if (materialContent.name !== undefined) {
material.name = materialContent.name;
@ -60,6 +60,8 @@ OV.ImporterO3dv = class extends OV.ImporterBase
if (materialContent.color !== undefined) {
material.color = OV.ArrayToColor (materialContent.color);
}
material.metalness = OV.ValueOrDefault (materialContent.metalness, 0.0);
material.roughness = OV.ValueOrDefault (materialContent.roughness, 1.0);
this.model.AddMaterial (material);
}

View File

@ -0,0 +1,70 @@
{
"materials" : [
{
"name" : "Material 1",
"color" : [200, 0, 0],
"metalness" : 1.0,
"roughness" : 0.0
},
{
"name" : "Material 2",
"color" : [0, 200, 0],
"metalness" : 1.0,
"roughness" : 0.25
},
{
"name" : "Material 3",
"color" : [0, 0, 200],
"metalness" : 1.0,
"roughness" : 0.5
},
{
"name" : "Material 4",
"color" : [200, 200, 0],
"metalness" : 1.0,
"roughness" : 0.75
}
],
"meshes" : [
{
"type" : "sphere",
"parameters" : {
"radius" : 0.5
},
"transformation" : {
"translation" : [0.0, 0.0, 0.0]
},
"material" : 0
},
{
"type" : "sphere",
"parameters" : {
"radius" : 0.5
},
"transformation" : {
"translation" : [1.5, 0.0, 0.0]
},
"material" : 1
},
{
"type" : "sphere",
"parameters" : {
"radius" : 0.5
},
"transformation" : {
"translation" : [3.0, 0.0, 0.0]
},
"material" : 2
},
{
"type" : "sphere",
"parameters" : {
"radius" : 0.5
},
"transformation" : {
"translation" : [4.5, 0.0, 0.0]
},
"material" : 3
}
]
}