X3D-USD File Translation Through X3DCPPSAIL
Through my work with the Laboratory for Digital Realism and Engineering in the Applied Metaverse (DREAM Lab) at the University of North Dakota, I have been given the opportunity to work on a file translator between X3D and USD, hoping to include this into the C++ AOUSD/Adobe File Translator Plugin. This stems from my original work, building an X3D C++ Scene Access Interface Library (X3DCPPSAIL) to meet the requirements of the X3D 4.1 specifications.
Working with the AOUSD/Adobe File Translator Plugin repository, I have been able to create my own private repository forked from the original, and engineer the X3D-USD file translator through here. With this in mind, I have been able to go to greater lengths establishing my own baseline tests to ensure everything is going smoothly, as well as prepare the repository for the public in the future, when the file translator is ready for overall use. Listed in the screenshot below is a view of my current repository, showing all of the current file translators available, as well as my new X3D addition.
The process to begin the work on a X3D-USD file translator took quite a bit of time to get the ball rolling, as the amount of new information to take in with USD was deep. To begin, I started attempting to translate basic geometry and lighting, to prove that what I am working on was possible. The screenshot below shows one of my first real tests, combining a shape and a light pointing down at it.
Showing that the basics were possible, the work began to speed up as the primary learning period was behind me. The next milestone included branching out my geometry, as well as the addition of PhysicalMaterial translation. The next screenshot provides 3 separate shapes, each portraying different properties, attempting to test the breadth of the current implementation.
It is also important to check the actual code generated by these translators, to ensure everything is being translated properly, as the overall goal of the project is to provide as minimal data loss as possible over roundtrip transmission. With USD requiring separate scalar inputs for metallic and roughness, and X3D packing these into a single texture, ensuring the code is correct is imperative. Comparing the code of the textured cube, we can see that the translation was successful.
X3D:
<Appearance>
<PhysicalMaterial baseColor='1 1 1' metallic='1' roughness='1'>
<ImageTexture containerField='baseTexture' url='"Cube_BaseColor.png"'/>
<ImageTexture containerField='metallicRoughnessTexture' url='"Cube_MetallicRoughness.png"'/>
</PhysicalMaterial>
</Appearance>
USD:
def Material "Material1"
{
asset inputs:baseColorTexture = @...phase_showcase_plinth.x3d[Cube_BaseColor.png]@ (
colorSpace = "srgb_texture" )
asset inputs:metallicTexture = @...phase_showcase_plinth.x3d[Cube_MetallicRoughness.png]@ (
colorSpace = "raw" )
asset inputs:roughnessTexture = @...phase_showcase_plinth.x3d[Cube_MetallicRoughness.png]@ (
colorSpace = "raw" )
def NodeGraph "UsdPreviewSurface"
{
def Shader "texCoordReader" {
uniform token info:id = "UsdPrimvarReader_float2"
string inputs:varname = "st"
}
def Shader "diffuseColor" {
uniform token info:id = "UsdUVTexture"
token inputs:sourceColorSpace = "sRGB"
float3 outputs:rgb
}
def Shader "metallic" {
uniform token info:id = "UsdUVTexture"
token inputs:sourceColorSpace = "raw"
float outputs:b
}
def Shader "roughness" {
uniform token info:id = "UsdUVTexture"
token inputs:sourceColorSpace = "raw"
float outputs:g
}
def Shader "UsdPreviewSurface" {
uniform token info:id = "UsdPreviewSurface"
color3f inputs:diffuseColor.connect = </...diffuseColor.outputs:rgb>
float inputs:metallic.connect = </...metallic.outputs:b>
float inputs:roughness.connect = </...roughness.outputs:g>
}
}
}
With the project in full swing, additional tests were needed to fit everything together, along with the inclusion of new nodes and properties joining the translation. I created multiple files that test everything implemented in all corners of the project, with scenes such as a robot arm, a spiraling tower, and a solar system.
The X3D-USD File Translator project has been overall successful in its current stage, and I am really happy with the progress being made. Next on the agenda is implementing DEF/USE into the project and allowing for translation of objects using instances of this. With some tweaks of X3DCPPSAIL and my current X3D-USD code, I then hope to dive into deeper hierarchy work and eventually, animation. I'm super happy with the success I have seen so far and I cannot wait to see what this project turns into!
More soon!
Ryker Ellingworth



