NVIDIAGameWorks / Displacement-MicroMap-Toolkit

Other
136 stars 10 forks source link

USD Schema for MicromeshAPI? #2

Open boberfly opened 1 year ago

boberfly commented 1 year ago

Hello, I was wondering if the USD schema for DMM is located anywhere.

For planning on integration into an existing USD asset pipeline, it would be good to reference the MicromeshAPI schema that was mentioned in the Asset Pipeline documentation.

Referencing https://github.com/NVIDIAGameWorks/Displacement-MicroMap-Toolkit/issues/1 by @oscarbg I opened the issue so I can be notified when it’s released...

bbarran commented 1 year ago

Hi @boberfly, the USD schema plugin, along with a .bary file format plugin, have not yet been released but here is the generated schema which can be used as a guide. There may be small changes to the schema before release. The main thing to note about the MicromeshAPI schema is it exposes the micromap data as a structure of arrays instead of array of structures so that it fits well with the USD attributes/primvars.

generatedSchema.txt

`#usda 1.0 ( "WARNING: THIS FILE IS GENERATED. DO NOT EDIT." customLayerData = { string[] appliedAPISchemas = ["BarycentricFileAPI", "MicromeshAPI"] dictionary multipleApplyAPISchemas = { } } ) ​ class "BarycentricFileAPI" ( doc = "BarycentricFileAPI API Schema" ) { int baryFile:directionBoundsOffset ( doc = "byte offset into the direction bounds property" ) int baryFile:directionsOffset ( doc = "byte offset into the directions property" ) asset baryFile:file ( doc = ".bary file" ) int baryFile:groupOffset ( doc = "bary group index" ) int baryFile:mapIndicesOffset ( doc = "byte offset into map indices property" ) int baryFile:mapOffset ( doc = "offset added to each of the mapIndices values" ) int baryFile:topologyFlagsOffset ( doc = "byte offset into topology flags property" ) float baryFile:valueBiasAndScaleFactor = 1 ( doc = "Factor used to scale up or down displacement amount" ) } ​ class "MicromeshAPI" ( doc = "MicromeshAPI API Schema" ) { bool primvars:micromesh:compressed ( doc = "" ) float2[] primvars:micromesh:directionBounds ( doc = "per-vertex displacement direction bounds (unpack 2-vector per format)" ) float3[] primvars:micromesh:directions ( doc = "per-vertex displacement directions (unpack 3-vector per format)" ) float primvars:micromesh:floatBias ( doc = "" ) float primvars:micromesh:floatScale ( doc = "" ) uint[] primvars:micromesh:histogramBlockFormats ( doc = "required for compressed data" ) uint[] primvars:micromesh:histogramCounts ( doc = "required for compressed data" ) uint[] primvars:micromesh:histogramSubdivLevels ( doc = "required for compressed data" ) uint primvars:micromesh:maxSubdivLevel ( doc = "" ) uint primvars:micromesh:minSubdivLevel ( doc = "" ) asset primvars:micromesh:normalMap ( doc = "normal map texture" ) uint[] primvars:micromesh:triangleBlockFormats ( doc = "" ) uchar[] primvars:micromesh:triangleFlags ( doc = "per-triangle edge flags" ) uint primvars:micromesh:triangleFlagsByteAlignment ( doc = "" ) uint primvars:micromesh:triangleFlagsByteSize ( doc = "" ) uint primvars:micromesh:triangleFlagsCount ( doc = "" ) uint primvars:micromesh:triangleFlagsFormat ( doc = "" ) uchar[] primvars:micromesh:triangleMappings ( doc = "maps triangle ID to base primitive (unpack per format)" ) uint primvars:micromesh:triangleMappingsByteAlignment ( doc = "" ) uint primvars:micromesh:triangleMappingsByteSize ( doc = "" ) uint primvars:micromesh:triangleMappingsCount ( doc = "" ) uint primvars:micromesh:triangleMappingsFormat ( doc = "" ) uchar[] primvars:micromesh:triangleMinMaxs ( doc = "optional" ) uint primvars:micromesh:triangleMinMaxsByteAlignment ( doc = "optional" ) uint primvars:micromesh:triangleMinMaxsByteSize ( doc = "optional" ) uint primvars:micromesh:triangleMinMaxsCount ( doc = "optional" ) uint primvars:micromesh:triangleMinMaxsFormat ( doc = "optional" ) uint[] primvars:micromesh:triangleSubdivLevels ( doc = "" ) uint[] primvars:micromesh:triangleValueOffsets ( doc = "" ) asset primvars:micromesh:uvRemap ( doc = "uv remap texture" ) uint primvars:micromesh:valueByteAlignment ( doc = "" ) uint primvars:micromesh:valueByteSize ( doc = "" ) uint primvars:micromesh:valueCount ( doc = "" ) uint primvars:micromesh:valueFormat ( doc = "" ) uint primvars:micromesh:valueFrequency ( doc = "" ) uint primvars:micromesh:valueLayout ( doc = "" ) uchar[] primvars:micromesh:values ( doc = "per-vertex displacement values" ) uint primvars:micromesh:version ( doc = "" ) } ​​`