diff options
author | Gaia Clary <gaia.clary@machinimatrix.org> | 2019-06-04 15:31:22 +0300 |
---|---|---|
committer | Gaia Clary <gaia.clary@machinimatrix.org> | 2019-06-05 13:42:54 +0300 |
commit | eda377c223cfc0460e3294c95771313f8d4388c3 (patch) | |
tree | d8c7d5d74a74f19b993ad18f09d098f5ed039549 /source/blender/collada/DocumentImporter.cpp | |
parent | 98cea7edcefa58d5eb7e2350461b8efe33fe7d9e (diff) |
update Collada Importer: reworked export and import of Materials
- added import of transparency and emission into principled BSDF Shader
- added support for importing all default collada material parameters
* diffuse
* emission
* index_of_refraction
* shininess (mapped to BSDF Roughness)
* reflectivity (mapped to BSDF Metallic)
* transparency + transparent mapped to BSDF Alpha)
* ambient (creates unconnected texture node)
* specular (creates unconnected texture node)
* reflective(creates unconnected texture node)
- added support for exporting collada material parameters:
* diffuse
* emission
* index_of_refraction
* shininess (mapped to BSDF Roughness)
* reflectivity (mapped to BSDF Metallic)
* transparency + transparent mapped to BSDF Alpha)
- prepared support for exporting the following parameters
but currently commented out:
* ambient (creates unconnected texture node)
* specular (creates unconnected texture node)
* reflective(creates unconnected texture node)
Problem: For now we only allow export of principled BSDF based
materials. I am not sure from where to get ambient, specular
and reflective as those values are not included in the
principled BSDF Shader (wip).
Diffstat (limited to 'source/blender/collada/DocumentImporter.cpp')
-rw-r--r-- | source/blender/collada/DocumentImporter.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index 1c241671c81..06f6682f401 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -796,14 +796,21 @@ bool DocumentImporter::writeMaterial(const COLLADAFW::Material *cmat) void DocumentImporter::write_profile_COMMON(COLLADAFW::EffectCommon *ef, Material *ma) { MaterialNode matNode = MaterialNode(mContext, ef, ma, uid_image_map); - matNode.set_reflectivity(ef->getReflectivity().getFloatValue()); - matNode.set_ior(ef->getIndexOfRefraction().getFloatValue()); - matNode.set_diffuse(ef->getDiffuse(), "Diffuse"); - matNode.set_ambient(ef->getAmbient(), "Ambient"); - matNode.set_specular(ef->getSpecular(), "Specular"); - matNode.set_reflective(ef->getReflective(), "Reflective"); - matNode.set_emission(ef->getEmission(), "Emission"); - matNode.set_opacity(ef->getOpacity(), "Opacity"); + + /* Direct mapping to principled BSDF Shader */ + matNode.set_diffuse(ef->getDiffuse()); + matNode.set_emission(ef->getEmission()); + matNode.set_ior(ef->getIndexOfRefraction()); + matNode.set_alpha(ef->getOpaqueMode(), ef->getTransparent(), ef->getTransparency()); + + /* following mapping still needs to be verified */ + matNode.set_shininess(ef->getShininess()); + matNode.set_reflectivity(ef->getReflectivity()); + + /* not supported by principled BSDF */ + matNode.set_ambient(ef->getAmbient()); + matNode.set_specular(ef->getSpecular()); + matNode.set_reflective(ef->getReflective()); } /** When this method is called, the writer must write the effect. |