Autodesk / Autodesk/maya-usd

Exporting displayColor set results in nan values

Open
#4,352 1 comment 0 reactions 1 assignee Claimed by @santosg87 View on GitHub
bug
Dominant language
Wolfram Language
Stars
905
Forks
223
Avg merge
2d 5h
Merged PRs (30d)
16

Description

**Describe the bug**
When exporting geometry containg a color set that has negative values, the resulting color value becomes nan.

**Steps to reproduce**
1. Create a piece of geometry (a cube in this case) with a USD preview shader. Set the values to a negative value. (ex: (1.2, -0.2, 4))
2. Export selected as USD. Make sure you are exporting color sets and displayColor
3. Here is the result:

```openUSD
#usda 1.0
(
defaultPrim = "pCube1"
metersPerUnit = 0.01
upAxis = "Y"
)

def Mesh "pCube1" (
prepend apiSchemas = ["MaterialBindingAPI"]
kind = "component"
)
{
uniform bool doubleSided = 1
float3[] extent = [(-0.5, -0.5, -0.5), (0.5, 0.5, 0.5)]
int[] faceVertexCounts = [4, 4, 4, 4, 4, 4]
int[] faceVertexIndices = [0, 1, 3, 2, 2, 3, 5, 4, 4, 5, 7, 6, 6, 7, 1, 0, 1, 7, 5, 3, 6, 0, 2, 4]
rel material:binding =
point3f[] points = [(-0.5, -0.5, 0.5), (0.5, -0.5, 0.5), (-0.5, 0.5, 0.5), (0.5, 0.5, 0.5), (-0.5, 0.5, -0.5), (0.5, 0.5, -0.5), (-0.5, -0.5, -0.5), (0.5, -0.5, -0.5)]
color3f[] primvars:displayColor = [(1.4934778, nan, 21.112127)] (
customData = {
dictionary Maya = {
bool generated = 1
}
}
)

def Scope "mtl"
{
def Material "usdPreviewSurface2SG"
{
token outputs:surface.connect =

def Shader "usdPreviewSurface2"
{
uniform token info:id = "UsdPreviewSurface"
color3f inputs:diffuseColor = (1.2, -0.2, 4)
token outputs:displacement
token outputs:surface
}
}
}
}
```

**Expected behavior**
I would have expected the value to be the result of the diffuseColor having the ASECcg transformation applied.

sRGB -> ASECcg:
sRGB value: (1.2, -0.2, 4)
Expected ASECcg value: (2.124096632003784, 0.43282783031463623, 22.048145294189453)

Why is the result (1.4934778, nan, 21.112127)? Where did the nan come from?

I'm by no means an expert at color transformations, so I may have fundamentally misunderstood something, but I'm happy to learn. Thanks!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.