[Bf-blender-cvs] [945be6aa02d] usd-importer-T81257: USD Import: material conversion minor updates.

makowalski noreply at git.blender.org
Thu Mar 4 00:55:17 CET 2021


Commit: 945be6aa02da250f8a560102603ba539e2bb753d
Author: makowalski
Date:   Wed Mar 3 18:48:53 2021 -0500
Branches: usd-importer-T81257
https://developer.blender.org/rB945be6aa02da250f8a560102603ba539e2bb753d

USD Import: material conversion minor updates.

Added comment re UsdPreviewSurface conversion.  Now handling
lowercase raw color space specification.

===================================================================

M	source/blender/io/usd/import/usd_material_importer.cc
M	source/blender/io/usd/import/usd_material_importer.h

===================================================================

diff --git a/source/blender/io/usd/import/usd_material_importer.cc b/source/blender/io/usd/import/usd_material_importer.cc
index 6acba783aaa..11978db442e 100644
--- a/source/blender/io/usd/import/usd_material_importer.cc
+++ b/source/blender/io/usd/import/usd_material_importer.cc
@@ -68,6 +68,7 @@ static const pxr::TfToken st("st", pxr::TfToken::Immortal);
 static const pxr::TfToken varname("varname", pxr::TfToken::Immortal);
 
 // Color space names
+static const pxr::TfToken raw("raw", pxr::TfToken::Immortal);
 static const pxr::TfToken RAW("RAW", pxr::TfToken::Immortal);
 
 // USD shader names.
@@ -498,7 +499,7 @@ void USDMaterialImporter::convert_usd_uv_texture(const pxr::UsdShadeShader &usd_
           // assuming sRGB otherwise, but more complex logic might be
           // required if the color space is "auto".
           pxr::TfToken colorSpace = file_input.GetAttr().GetColorSpace();
-          if (colorSpace == usdtokens::RAW) {
+          if (colorSpace == usdtokens::RAW || colorSpace == usdtokens::raw) {
             STRNCPY(image->colorspace_settings.name, "Raw");
           }
         }
diff --git a/source/blender/io/usd/import/usd_material_importer.h b/source/blender/io/usd/import/usd_material_importer.h
index 5013deffec4..3eed7946b18 100644
--- a/source/blender/io/usd/import/usd_material_importer.h
+++ b/source/blender/io/usd/import/usd_material_importer.h
@@ -50,6 +50,24 @@ struct NodePlacementContext {
 
 /* Converts USD materials to Blender representation. */
 
+// The current implementation converts UsdPreviewSurface to Blender
+// nodes as follows:
+//
+// UsdPreviewSurface -> Pricipled BSDF
+// UsdUVTexture -> Texture Image + Normal Map
+// UsdPrimvarReader_float2 -> UV Map
+//
+// Limitations: arbitrary primvar readers or UsdTransform2d not yet
+// supported. For UsdPreviewSurface, only the file and st inputs
+// are handled, and the color space is retrieved from the texture
+// metadata.
+//
+// TODO(makowalski):  Investigate adding support for converting additional
+// shaders and inputs.  Supporting certain types of inputs, such as texture
+// scale and bias, will probably require creating Blender Group nodes with
+// the corresponding inputs.
+
+
 class USDMaterialImporter {
  protected:
   USDImporterContext context_;



More information about the Bf-blender-cvs mailing list