maya-usd
maya-usd copied to clipboard
Issues and expectations on import/export
Describe the bug
Hi,
We recently have tested the USD import/export and found some issues:
- Import Does not import custom attributes (non-primvars)
- Example:
- See the example USD file with custom attributes and primvars below
- Custom attributes,
"my_int"
,"my_bool"
etc. are missing after importing -
- Question:
- Is it configurable for the import command?
- If not, is it the only way by implementing custom adaptor / chaser?
- Expectation:
- Custom attributes can be imported as Maya attributes in Maya
-
Import Does not import
color4f
/float4f
/vector4f
and their array form, the plugin throws error saying "not supported"
- Example:
- See the notes in the example USD file with custom attributes and primvars below
- Expectation:
- Support importing
color4f
/float4f
/vector4f
and their array form
- Support importing
-
Import Does not have option to import
displayColor
anddisplayOpacity
as combined RGBA color set (comparing with AL_USDMaya), these two special primvars are always created as separated color sets, separately
-
Example:
- See the example USD file with constant displayColor and displayOpacity below
-
-
Expectation:
- Provide configurable option to combine displayColor and displayOpacity as one RGBA color set
- Import float[]/float3[]/color3f[] primvars are handled differently
-
Problems:
- By default, float[] becomes alpha (A); float3[] and color3f[] become RGB channel
- These primvars can be configured to not become 'color set' via import options 'excludePrimvar', but this is not ideal:
- Those primvars would be ignored completely (missing after importing) if they are marked with 'excludePrimvar' option
- User (or the pipeline tool) will need to know the list of exclusive names beforehand, otherwise the tool will need to traverse the hierarchy to collect the list of primvar names. this might not be practical: imaging if the tool needs to import a heavy scene with different kinds of meshes and those meshes have different custom primvars for different purposes.
- Using 'excludePrimvarNamespace' might work for excluding a set of primvars but unfortunately it does not work for workflow that does not have namespaced primvars
-
Example:
- See the example USD file with custom attributes and primvars below
-
-
Expectation:
- Have option to import float[]/float3[]/color3f[] primvars as Maya custom attributes, just like other primvar types
- Export The custom primvars are imported as Maya custom attributes (on the shape), but the exporter does not seem to export them back to USD except the ones that previously imported as 'color set'
- Example:
- See the example USD file with custom attributes and primvars below
- Example output:
#usda 1.0
(
defaultPrim = "root"
metersPerUnit = 0.01
upAxis = "Y"
)
def Xform "root" (
kind = "component"
)
{
def Mesh "geo" (
kind = "component"
)
{
float3[] extent = [(-0.5, 0, -0.5), (0.5, 0, 0.5)]
int[] faceVertexCounts = [4, 4, 4, 4]
int[] faceVertexIndices = [0, 1, 4, 3, 1, 2, 5, 4, 3, 4, 7, 6, 4, 5, 8, 7]
point3f[] points = [(-0.5, 0, 0.5), (0, 0, 0.5), (0.5, 0, 0.5), (-0.5, 0, 0), (0, 0, 0), (0.5, 0, 0), (-0.5, 0, -0.5), (0, 0, -0.5), (0.5, 0, -0.5)]
color3f[] primvars:custom_color3f_array = [(1, 1, 1)]
int[] primvars:custom_color3f_array:indices = [0]
color3f[] primvars:custom_float3_array = [(1, 2, 3)]
int[] primvars:custom_float3_array:indices = [0]
float[] primvars:custom_float_array = [1]
int[] primvars:custom_float_array:indices = [0]
color3f[] primvars:displayColor = [(0.13320851, 0.13320851, 0.13320851)] (
customData = {
dictionary Maya = {
bool generated = 1
}
}
)
}
}
- Expectation:
- Support exporting custom Maya attributes on the shape as custom USD primvars
- Export Constant color sets seem to be always exported as indexed primvars without correct interpolation
- Example:
- See the example USD file with constant displayColor and displayOpacity below
- Example output:
def Mesh "plane_constant" (
kind = "component"
)
{
uniform bool doubleSided = 1
float3[] extent = [(-0.5, 0, -0.5), (0.5, 0, 0.5)]
int[] faceVertexCounts = [4, 4, 4, 4]
int[] faceVertexIndices = [0, 1, 4, 3, 1, 2, 5, 4, 3, 4, 7, 6, 4, 5, 8, 7]
point3f[] points = [(-0.5, 0, 0.5), (0, 0, 0.5), (0.5, 0, 0.5), (-0.5, 0, 0), (0, 0, 0), (0.5, 0, 0), (-0.5, 0, -0.5), (0, 0, -0.5), (0.5, 0, -0.5)]
color3f[] primvars:displayColor = [(1, 0, 0)]
int[] primvars:displayColor:indices = [0]
float[] primvars:displayOpacity = [0.2]
int[] primvars:displayOpacity:indices = [0]
}
- Expectation:
- Being able to export constant color sets with correct interpolation ('interpolation = constant')
Steps to reproduce Steps to reproduce the behavior:
- Launch Maya and import these two USD example files
Expected behavior
See the individual expectations on each item above.
Attachments
Example USD file with custom attributes and primvars:
#usda 1.0
(
defaultPrim = "root"
)
def Xform "root"
{
def Mesh "geo" (
kind = "component"
)
{
float3[] extent = [(-0.5, 0, -0.5), (0.5, 0, 0.5)]
int[] faceVertexCounts = [4, 4, 4, 4]
int[] faceVertexIndices = [0, 1, 4, 3, 1, 2, 5, 4, 3, 4, 7, 6, 4, 5, 8, 7]
normal3f[] normals = [(0, 1, 0)] (
interpolation = "constant"
)
point3f[] points = [(-0.5, 0, 0.5), (0, 0, 0.5), (0.5, 0, 0.5), (-0.5, 0, 0), (0, 0, 0), (0.5, 0, 0), (-0.5, 0, -0.5), (0, 0, -0.5), (0.5, 0, -0.5)]
double3 xformOp:translate = (0, 0, 0)
uniform token[] xformOpOrder = ["xformOp:translate"]
# Custom attributes
custom bool my_bool = 1
custom int my_int = 1
custom int[] my_int_array = [1, 2, 3, 4]
custom float my_float = 2
custom float[] my_float_array = [1, 2, 3, 4]
custom float3[] my_float3_array = [(1, 2, 3)]
# custom float4 my_float4 = (1, 2, 3, 4) # NOTE: maya-usd does not support "float4"
# custom float4[] my_float4_array = [(1, 2, 3, 4)] # NOTE: maya-usd does not support "float4[]"
custom color3f my_color3f = (1, 1, 1)
custom color3f[] my_color3f_array = [(1, 1, 1), (1, 1, 1), (1, 1, 1)]
# custom color4f my_color4f = (1, 1, 1, 1) # NOTE: maya-usd does not support "color4f"
# custom color4f[] my_color4f_array = [(1, 1, 1, 1), (1, 1, 1, 1), (1, 1, 1, 1)] # NOTE: maya-usd does not support "color4f[]"
custom point3f my_point3f = (1, 2, 3)
custom point3f[] my_point3f_array = [(1, 1, 1), (2, 2, 2), (3, 3, 3)]
custom normal3f my_normal3f = (1, 2, 3)
custom normal3f[] my_normal3f_array = [(1, 1, 1), (2, 2, 2), (3, 3, 3)]
custom vector3f my_vector3f = (1, 2, 3)
custom vector3f[] my_vector3f_array = [(1, 1, 1), (2, 2, 2), (3, 3, 3)]
custom token my_token = "custom token value"
custom token[] my_token_array = ["A", "B", "C"]
# Custom primvars
custom bool primvars:my_bool_primvar = 1
custom int primvars:my_int_primvar = 2
custom int[] primvars:my_int_array_primvar = [1, 2, 3, 4]
custom float primvars:my_float_primvar = 2
custom float[] primvars:my_float_array_primvar = [1, 2, 3, 4]
custom float3[] primvars:my_float3_array_primvar = [(1, 2, 3)]
# custom float4 primvars:my_float4_primvar = (1, 2, 3, 4) # NOTE: maya-usd does not support "float4"
# custom float4[] primvars:my_float4_array_primvar = [(1, 2, 3, 4)] # NOTE: maya-usd does not support "float4[]"
custom color3f primvars:my_color3f_primvar = (1, 1, 1)
custom color3f[] primvars:my_color3f_array_primvar = [(1, 1, 1), (1, 1, 1), (1, 1, 1)]
# custom color4f primvars:my_color4f_primvar = (1, 1, 1, 1) # NOTE: maya-usd does not support "color4f"
# custom color4f[] primvars:my_color4f_array_primvar = [(1, 1, 1, 1), (1, 1, 1, 1), (1, 1, 1, 1)] # NOTE: maya-usd does not support "color4f[]"
custom point3f primvars:my_point3f_primvar = (1, 2, 3)
custom point3f[] primvars:my_point3f_array_primvar = [(1, 1, 1), (2, 2, 2), (3, 3, 3)]
custom normal3f primvars:my_normal3f_primvar = (1, 2, 3)
custom normal3f[] primvars:my_normal3f_array_primvar = [(1, 1, 1), (2, 2, 2), (3, 3, 3)]
custom vector3f primvars:my_vector3f_primvar = (1, 2, 3)
custom vector3f[] primvars:my_vector3f_array_primvar = [(1, 1, 1), (2, 2, 2), (3, 3, 3)]
custom token primvars:my_token_primvar = "custom primvar token"
custom token[] primvars:my_token_array_primvar = ["primvar A", "primvar B", "primvar C"]
}
}
Example USD file with constant displayColor and displayOpacity
#usda 1.0
(
defaultPrim = "root"
)
def Xform "root" (
kind = "group"
)
{
def Mesh "plane_constant" (
kind = "component"
)
{
int[] faceVertexCounts = [4, 4, 4, 4]
int[] faceVertexIndices = [0, 1, 4, 3, 1, 2, 5, 4, 3, 4, 7, 6, 4, 5, 8, 7]
point3f[] points = [(-0.5, 0, 0.5), (0, 0, 0.5), (0.5, 0, 0.5), (-0.5, 0, 0), (0, 0, 0), (0.5, 0, 0), (-0.5, 0, -0.5), (0, 0, -0.5), (0.5, 0, -0.5)]
color3f[] primvars:displayColor = [(1, 0, 0)] (
interpolation = "constant"
)
float[] primvars:displayOpacity = [0.2] (
interpolation = "constant"
)
uniform bool doubleSided = 1
double3 xformOp:translate = (0, 0, 0)
uniform token[] xformOpOrder = ["xformOp:translate"]
}
}
Specs (if applicable):
- OS & version: CentOS 7.8
- Compiler & version: GCC 6.3
- Maya version: Maya-2023.3
- Maya USD commit SHA: Official v0.24.0
- Pixar USD commit SHA: Tested against official USD-21.8/22.5/23.2