Skip to content

Commit

Permalink
Example of using the UsdSemantics schema
Browse files Browse the repository at this point in the history
  • Loading branch information
nvaszabo committed Nov 1, 2024
1 parent e45ffe6 commit 137f694
Showing 1 changed file with 188 additions and 0 deletions.
188 changes: 188 additions & 0 deletions extras/usd/examples/usdSemanticsExamples/bookshelf.usda
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
#usda 1.0
(
doc = "This layer represents an example of using UsdSemantics"
upAxis = "Y"
startTimeCode = 0
endTimeCode = 200
)

def Xform "Booshelf" (
apiSchemas = ["SemanticsLabelsAPI:category", "SemanticsLabelsAPI:style"]
)
{
token[] semantics:labels:category = ["furniture", "cabinet"]
token[] semantics:labels:style = ["modern", "chic"]
double3 xformOp:translate = (0, 100.87384788680441, 0)
uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:rotateXYZ", "xformOp:scale"]

def Xform "Shelves" (
apiSchemas = ["SemanticsLabelsAPI:category"]
)
{
token[] semantics:labels:category = ["horizontal shelving"]
double3 xformOp:translate = (113, 0, 0)
uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:rotateXYZ", "xformOp:scale"]

def Cube "shelf_geo_01" (
apiSchemas = ["MaterialBindingAPI", "SemanticsLabelsAPI:state"]
)
{
token[] semantics:labels:state.timeSamples = {
0: ["empty"],
50: ["partially full"],
100: ["full"]
}
float3[] extent = [(-50, -50, -50), (50, 50, 50)]
rel material:binding = </looks/wood> (
bindMaterialAs = "weakerThanDescendants"
)
double size = 100
double3 xformOp:scale = (0.9999999999999999, 0.0773693394230031, 0.7625704657327257)
double3 xformOp:translate = (-113, 70.05470741643151, 0)
uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:rotateXYZ", "xformOp:scale"]
}

def Cube "shelf_geo_02" (
apiSchemas = ["MaterialBindingAPI", "SemanticsLabelsAPI:state"]
)
{
token[] semantics:labels:state = ["partially full"]
float3[] extent = [(-50, -50, -50), (50, 50, 50)]
rel material:binding = </looks/wood> (
bindMaterialAs = "weakerThanDescendants"
)
double size = 100
double3 xformOp:scale = (0.9999999999999999, 0.0773693394230031, 0.7625704657327257)
double3 xformOp:translate = (-113, 28.205436432969066, 0)
uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:rotateXYZ", "xformOp:scale"]
}

def Cube "shelf_geo_03" (
apiSchemas = ["MaterialBindingAPI", "SemanticsLabelsAPI:state"]
)
{
token[] semantics:labels:state = ["full"]
float3[] extent = [(-50, -50, -50), (50, 50, 50)]
rel material:binding = </looks/wood> (
bindMaterialAs = "weakerThanDescendants"
)
double size = 100
double3 xformOp:scale = (0.9999999999999999, 0.0773693394230031, 0.7625704657327257)
double3 xformOp:translate = (-113, -14.418843141218574, 0)
uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:rotateXYZ", "xformOp:scale"]
}

def Cube "shelf_geo_04" (
apiSchemas = ["MaterialBindingAPI"]
)
{
float3[] extent = [(-50, -50, -50), (50, 50, 50)]
rel material:binding = </looks/wood> (
bindMaterialAs = "weakerThanDescendants"
)
double size = 100
double3 xformOp:scale = (0.9999999999999999, 0.0773693394230031, 0.7625704657327257)
double3 xformOp:translate = (-113, -57.934833429151425, 0)
uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:rotateXYZ", "xformOp:scale"]
}

def Cube "shelf_geo_05" (
apiSchemas = ["MaterialBindingAPI"]
)
{
float3[] extent = [(-50, -50, -50), (50, 50, 50)]
rel material:binding = </looks/wood> (
bindMaterialAs = "weakerThanDescendants"
)
double size = 100
double3 xformOp:scale = (0.9999999999999999, 0.0773693394230031, 0.7625704657327257)
double3 xformOp:translate = (-113, -99.27174085182759, 0)
uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:rotateXYZ", "xformOp:scale"]
}
}

def Cube "bookshelf_geo" (
apiSchemas = ["MaterialBindingAPI"]
)
{
float3[] extent = [(-50, -50, -50), (50, 50, 50)]
rel material:binding = </looks/wood> (
bindMaterialAs = "weakerThanDescendants"
)
double size = 100
double3 xformOp:scale = (1.0484495248498045, 1.991987664077115, 0.13958063483880567)
uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:rotateXYZ", "xformOp:scale"]
}
}

def Scope "looks"
{
def Material "wood" (
apiSchemas = ["SemanticsLabelsAPI:material"]
)
{
token[] semantics:labels:material = ["wood", "oak", "American White Oak"]
token outputs:displacement.connect = </looks/wood/Shader.outputs:displacement>
token outputs:surface.connect = </looks/wood/Shader.outputs:surface>

def Shader "Shader"
{
uniform token info:id = "UsdPreviewSurface"
float inputs:clearcoat = 0 (
hidden = false
)
float inputs:clearcoatRoughness = 0.01 (
hidden = false
)
color3f inputs:diffuseColor = (0.5145, 0.3639, 0.229) (
hidden = false
renderType = "color"
)
float inputs:displacement = 0 (
hidden = false
)
color3f inputs:emissiveColor = (0, 0, 0) (
hidden = false
renderType = "color"
)
float inputs:ior = 1.5 (
hidden = false
)
float inputs:metallic = 0 (
hidden = false
)
normal3f inputs:normal = (0, 0, 1) (
hidden = false
)
float inputs:occlusion = 1 (
doc = """This parameter is unused."""
hidden = false
)
float inputs:opacity = 1 (
hidden = false
)
float inputs:opacityThreshold = 0 (
connectability = "interfaceOnly"
hidden = false
)
float inputs:roughness = 0.5 (
hidden = false
)
color3f inputs:specularColor = (0, 0, 0) (
hidden = false
renderType = "color"
)
int inputs:useSpecularWorkflow = 0 (
connectability = "interfaceOnly"
hidden = false
)
token outputs:displacement (
renderType = "material"
)
token outputs:surface (
renderType = "material"
)
}
}
}

0 comments on commit 137f694

Please sign in to comment.