Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subdivision Surfaces - Pyramids with Creases example #94

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
*.bck.*
.DS_Store
*.pyc
**/backup/
649 changes: 649 additions & 0 deletions full_assets/SubdivisionSurfaces/Creases_SpinningPyramids.usda

Large diffs are not rendered by default.

50 changes: 50 additions & 0 deletions full_assets/SubdivisionSurfaces/Pyramid/Pyramid.usd
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#usda 1.0
(
defaultPrim = "Pyramid"
framesPerSecond = 24
metersPerUnit = 1
timeCodesPerSecond = 24
upAxis = "Y"
)

def Xform "Pyramid" (
assetInfo = {
asset identifier = @./Pyramid.usd@
string name = "Pyramid"
asset thumbnail = @./thumbnail.png@
}
prepend inherits = </__class__/Pyramid>
kind = "component"
prepend payload = @./payload.usda@
variants = {
string geo = "quad_creases"
string mtl = "previewsurface"
}
prepend variantSets = "geo"
)
{
variantSet "geo" = {
"quad_creases" (
prepend apiSchemas = ["GeomModelAPI"]
kind = "component"
) {
float3[] extentsHint = [(-0.9428103, 0, -0.8164976), (0.47140515, 1.3333297, 0.8164976)]

}
"quad_holes" (
prepend apiSchemas = ["GeomModelAPI"]
kind = "component"
) {
float3[] extentsHint = [(-0.9428103, 0, -0.8164976), (0.47140515, 1.3333297, 0.8164976)]

}
}
}

class "__class__"
{
class "Pyramid"
{
}
}

158 changes: 158 additions & 0 deletions full_assets/SubdivisionSurfaces/Pyramid/geo.usda
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
#usda 1.0
(
defaultPrim = "Pyramid"
framesPerSecond = 24
metersPerUnit = 1
timeCodesPerSecond = 24
upAxis = "Y"
)

over "ASSET_geo_variant_0" (
hidden = true
)
{
def Xform "ASSET" (
variants = {
string geo = "quad_creases"
}
prepend variantSets = "geo"
)
{
variantSet "geo" = {
"quad_creases" (
kind = "component"
variants = {
string creases = "none"
}
prepend variantSets = "creases"
) {
def Scope "geo" (
prepend apiSchemas = ["GeomModelAPI"]
)
{
float3[] extentsHint = [(-0.9428103, 0, -0.8164976), (0.47140515, 1.3333297, 0.8164976)]
uniform token purpose = "default"

def Mesh "shape"
{
float3[] extent = [(-0.9428103, 0, -0.8164976), (0.47140515, 1.3333297, 0.8164976)]
int[] faceVertexCounts = [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]
int[] faceVertexIndices = [1, 12, 10, 0, 1, 13, 14, 2, 2, 14, 15, 3, 3, 15, 13, 1, 4, 16, 17, 5, 5, 17, 18, 6, 6, 18, 16, 4, 7, 16, 19, 8, 8, 19, 17, 9, 9, 17, 16, 7, 10, 16, 18, 11, 11, 18, 19, 12, 12, 19, 16, 10, 13, 19, 18, 14, 14, 18, 17, 15, 15, 17, 19, 13, 0, 4, 5, 3, 3, 5, 6, 2, 2, 6, 4, 0, 0, 7, 8, 1, 1, 8, 9, 3, 3, 9, 7, 0, 0, 10, 11, 2, 2, 11, 12, 1]
normal3f[] normals = [(-0.47140422, 0.3333345, 0.8164962), (-0.47140425, 0.33333454, 0.8164963), (-0.47140434, 0.33333454, 0.8164962), (-0.47140434, 0.3333345, 0.8164962), (-0, -1, 0), (0, -1, -0), (-0, -1, -0), (0, -1, -0), (0, -1, -0), (-0, -1, -0), (-0, -1, 0), (-0, -1, -0), (-0, -1, -0), (-0, -1, 0), (0, -1, -0), (-0, -1, 0), (0.1669245, -0.47131485, 0.8660246), (0.43523034, -0.49223801, 0.7538409), (0.34826502, -0.24626227, 0.9044702), (0.166923, -0.47131535, 0.86602455), (-0.3330771, 0.9428996, -0), (-0.0869659, 0.9847577, 0.15062922), (-0.08696596, 0.9847577, -0.15062916), (-0.33307716, 0.9428996, -0), (0.16692315, -0.4713153, -0.86602455), (0.3482651, -0.24626227, -0.90447015), (0.43523034, -0.492238, -0.75384104), (0.16692461, -0.47131476, -0.8660246), (0.66653705, -0.47131473, -0.5775732), (0.43523034, -0.492238, -0.75384104), (0.6091617, -0.24626227, -0.7538414), (0.6665379, -0.47131523, -0.5775718), (0.16653852, 0.9428997, 0.28845322), (0.17393166, 0.9847577, 3.9618154e-8), (-0.0869659, 0.9847577, 0.15062922), (0.16653846, 0.9428997, 0.2884531), (-0.8334607, -0.47131535, 0.28845286), (-0.95742667, -0.24626237, 0.1506288), (-0.87046057, -0.4922382, 3.96181e-8), (-0.83346146, -0.47131482, 0.2884516), (-0.83346146, -0.47131482, -0.28845155), (-0.87046057, -0.4922382, 3.96181e-8), (-0.95742667, -0.24626233, -0.1506288), (-0.8334607, -0.47131535, -0.28845286), (0.16653848, 0.9428997, -0.28845313), (-0.08696596, 0.9847577, -0.15062916), (0.17393166, 0.9847577, 3.9618154e-8), (0.16653849, 0.9428996, -0.28845316), (0.6665379, -0.47131523, 0.57757175), (0.60916173, -0.2462622, 0.75384146), (0.43523034, -0.49223801, 0.7538409), (0.6665371, -0.47131482, 0.57757306), (0.50000006, -0.00027398957, -0.8660254), (0.6091617, -0.24626227, -0.7538414), (0.3482651, -0.24626227, -0.90447015), (0.5, -0.00027408465, -0.8660254), (-0.99999994, -0.0002739021, -0), (-0.95742667, -0.24626233, -0.1506288), (-0.95742667, -0.24626237, 0.1506288), (-1, -0.00027397228, -0), (0.5, -0.00027392784, 0.8660254), (0.34826502, -0.24626227, 0.9044702), (0.60916173, -0.2462622, 0.75384146), (0.5, -0.0002738146, 0.8660254), (0.9428085, 0.33333457, 0), (0.94280857, 0.3333346, 0), (0.9428085, 0.33333445, 5.228378e-8), (0.94280857, 0.3333345, 1.5208453e-8), (0.94280857, 0.3333345, 1.5208453e-8), (0.9428085, 0.33333445, 5.228378e-8), (0.9428085, 0.33333445, -5.228378e-8), (0.94280857, 0.3333345, -1.5208453e-8), (0.94280857, 0.3333345, -1.5208453e-8), (0.9428085, 0.33333445, -5.228378e-8), (0.94280857, 0.3333346, 0), (0.9428085, 0.33333457, 0), (-0.47140434, 0.3333345, -0.8164962), (-0.47140434, 0.33333454, -0.8164962), (-0.47140425, 0.33333454, -0.8164963), (-0.47140422, 0.3333345, -0.8164962), (-0.47140422, 0.3333345, -0.8164962), (-0.47140425, 0.33333454, -0.8164963), (-0.47140425, 0.33333457, -0.8164962), (-0.47140434, 0.33333454, -0.8164962), (-0.47140434, 0.33333454, -0.8164962), (-0.47140425, 0.33333457, -0.8164962), (-0.47140434, 0.33333454, -0.8164962), (-0.47140434, 0.3333345, -0.8164962), (-0.47140434, 0.3333345, 0.8164962), (-0.47140434, 0.33333454, 0.8164962), (-0.47140425, 0.33333457, 0.8164962), (-0.47140434, 0.33333454, 0.8164962), (-0.47140434, 0.33333454, 0.8164962), (-0.47140425, 0.33333457, 0.8164962), (-0.47140425, 0.33333454, 0.8164963), (-0.47140422, 0.3333345, 0.8164962)] (
interpolation = "faceVarying"
)
uniform token orientation = "rightHanded"
point3f[] points = [(0, 1.3333297, 0), (-0.9428103, 0, 0), (0.47140515, 0, 0.8164976), (0.47140515, 0, -0.8164976), (0.2000002, 0.7676461, 0), (0.37140477, 0.2828426, -0.2968815), (0.37140477, 0.2828426, 0.2968815), (-0.100000076, 0.767646, -0.17320523), (-0.44280922, 0.28284258, -0.17320524), (0.07140455, 0.28284258, -0.4700867), (-0.100000076, 0.767646, 0.17320523), (0.07140455, 0.28284258, 0.4700867), (-0.44280922, 0.28284258, 0.17320524), (-0.34281015, 0, 0), (0.17140517, 0, 0.2968824), (0.17140517, 0, -0.2968824), (2.9802322e-8, 0.69681245, -1.1570335e-8), (0.17134704, 0.21217267, -0.29678172), (0.17134705, 0.21217266, 0.2967817), (-0.34269392, 0.21217264, -2.1429756e-8)] (
interpolation = "vertex"
)
float primvars:coverage = 0.5407419
int[] primvars:coverage:indices = None
color3f[] primvars:displayColor = [(0.97494125, 0.06529765, 0.055584475), (0.9968833, 0.9185242, 0.03472861), (0.9467732, 0.018363958, 0.99876523), (0.008025134, 0.9938322, 0.6843996), (0.9931611, 0.46066093, 0.01035705), (0.57898384, 0.96838266, 0.060374074), (0.9947585, 0.6403281, 0.00183379), (0.32176924, 0.9813758, 0.04705893), (0.08376516, 0.99208397, 0.031928644), (0.98660034, 0.90130025, 0.014679497), (0.019984307, 0.547497, 0.99022424), (0.9728471, 0.09234106, 0.14325786), (0.40028083, 0.9590799, 0.020620039), (0.704215, 0.9777674, 0.022657953), (0.5095006, 0.07365145, 0.98261684), (0.31949833, 0.02229975, 0.97868997), (0.35788813, 0.9825174, 0.08772965), (0.4489419, 0.034428142, 0.98012024), (0.019264918, 0.9887445, 0.25305086), (0.58588773, 0.9979753, 0.0022557508), (0.9750521, 0.18337734, 0.063028514), (0.049839947, 0.2665377, 0.9788028), (0.87276286, 0.9905392, 0.055511575), (0.0376994, 0.33380193, 0.9963375)] (
interpolation = "uniform"
)
int[] primvars:displayColor:indices = None
int primvars:numnonpacked = 0
int[] primvars:numnonpacked:indices = None
texCoord2f[] primvars:st = [(0.0009765625, 0.62417525), (0.16361426, 0.5302765), (0.349459, 0.53027654), (0.5120958, 0.62417525), (0.22949219, 0.39175323), (0.3921296, 0.29785445), (0.5779755, 0.29785448), (0.7406129, 0.39175323), (0.48828125, 0.60659695), (0.6509186, 0.51269823), (0.8367646, 0.51269823), (0.9994019, 0.60659695), (0.48828125, 0.1769095), (0.65091866, 0.08301075), (0.8367645, 0.083010726), (0.9994019, 0.17690949), (0.42240247, 0.7451202), (0.4224338, 0.67871094), (0.6082159, 0.678711), (0.6082472, 0.7451202), (0.8367642, 0.7004957), (0.83673304, 0.7669049), (0.65095013, 0.7669049), (0.6509189, 0.70049566), (0.16263765, 0.066409364), (0.16266899, 1.4039668e-7), (0.34845114, 0), (0.34848246, 0.06640934), (0.34945902, 0.71807396), (0.34942773, 0.78448325), (0.1636456, 0.7844832), (0.16361424, 0.718074), (0.8367642, 0.27080825), (0.836733, 0.33721742), (0.65095013, 0.33721745), (0.65091896, 0.27080822), (0.6082472, 0.93291765), (0.6082159, 0.99932694), (0.42243376, 0.99932694), (0.4224024, 0.9329177), (0.34848243, 0.2542068), (0.34845114, 0.32061613), (0.162669, 0.320616), (0.16263764, 0.25420684), (0.57797515, 0.48565194), (0.577944, 0.5520612), (0.3921611, 0.5520612), (0.3921299, 0.48565194), (0.16361426, 0.5302765), (0.16364552, 0.46386728), (0.3494277, 0.4638672), (0.349459, 0.53027654), (0.3921296, 0.29785445), (0.39216116, 0.23144531), (0.577944, 0.23144534), (0.5779755, 0.29785448), (0.6509186, 0.51269823), (0.65095013, 0.4462891), (0.836733, 0.44628906), (0.8367646, 0.51269823), (0.65091866, 0.08301075), (0.6509502, 0.016601562), (0.836733, 0.016601626), (0.8367645, 0.083010726), (0.25976562, 0.83901894), (0.42240247, 0.7451202), (0.6082472, 0.7451202), (0.7708849, 0.83901894), (0.9994019, 0.60659695), (0.8367642, 0.7004957), (0.6509189, 0.70049566), (0.48828125, 0.60659695), (0, 0.16030803), (0.16263765, 0.066409364), (0.34848246, 0.06640934), (0.51111925, 0.16030805), (0.5120958, 0.62417525), (0.34945902, 0.71807396), (0.16361424, 0.718074), (0.0009765625, 0.62417525), (0.9994019, 0.17690949), (0.8367642, 0.27080825), (0.65091896, 0.27080822), (0.48828125, 0.1769095), (0.7708849, 0.83901894), (0.6082472, 0.93291765), (0.4224024, 0.9329177), (0.25976562, 0.83901894), (0.51111925, 0.16030805), (0.34848243, 0.2542068), (0.16263764, 0.25420684), (0, 0.16030803), (0.7406129, 0.39175323), (0.57797515, 0.48565194), (0.3921299, 0.48565194), (0.22949219, 0.39175323)] (
interpolation = "faceVarying"
)
int[] primvars:st:indices = None
uniform token subdivisionScheme = "catmullClark"
}
}
variantSet "creases" = {
"corners" {
over "geo"
{
def Mesh "shape"
{
int[] cornerIndices = [0, 2]
float[] cornerSharpnesses = [25, 25]
int[] faceVertexCounts = [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]
int[] faceVertexIndices = [1, 12, 10, 0, 1, 13, 14, 2, 2, 14, 15, 3, 3, 15, 13, 1, 4, 16, 17, 5, 5, 17, 18, 6, 6, 18, 16, 4, 7, 16, 19, 8, 8, 19, 17, 9, 9, 17, 16, 7, 10, 16, 18, 11, 11, 18, 19, 12, 12, 19, 16, 10, 13, 19, 18, 14, 14, 18, 17, 15, 15, 17, 19, 13, 0, 4, 5, 3, 3, 5, 6, 2, 2, 6, 4, 0, 0, 7, 8, 1, 1, 8, 9, 3, 3, 9, 7, 0, 0, 10, 11, 2, 2, 11, 12, 1]
uniform token orientation = "rightHanded"
uniform token subdivisionScheme = "catmullClark"
}
}

}
"edges" {
over "geo"
{
def Mesh "shape"
{
int[] creaseIndices = [0, 2, 0, 1, 1, 3, 1, 2, 0, 3, 2, 3]
int[] creaseLengths = [2, 2, 2, 2, 2, 2]
float[] creaseSharpnesses = [100, 100, 100, 100, 100, 100]
int[] faceVertexCounts = [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]
int[] faceVertexIndices = [1, 12, 10, 0, 1, 13, 14, 2, 2, 14, 15, 3, 3, 15, 13, 1, 4, 16, 17, 5, 5, 17, 18, 6, 6, 18, 16, 4, 7, 16, 19, 8, 8, 19, 17, 9, 9, 17, 16, 7, 10, 16, 18, 11, 11, 18, 19, 12, 12, 19, 16, 10, 13, 19, 18, 14, 14, 18, 17, 15, 15, 17, 19, 13, 0, 4, 5, 3, 3, 5, 6, 2, 2, 6, 4, 0, 0, 7, 8, 1, 1, 8, 9, 3, 3, 9, 7, 0, 0, 10, 11, 2, 2, 11, 12, 1]
uniform token orientation = "rightHanded"
uniform token subdivisionScheme = "catmullClark"
}
}

}
"none" {

}
}

}
}
}
}

over "ASSET_geo_variant_1" (
hidden = true
)
{
def Xform "ASSET" (
variants = {
string geo = "quad_holes"
}
prepend variantSets = "geo"
)
{
variantSet "geo" = {
"quad_holes" (
kind = "component"
) {
def Scope "geo" (
prepend apiSchemas = ["GeomModelAPI"]
)
{
float3[] extentsHint = [(-0.9428103, 0, -0.8164976), (0.47140515, 1.3333297, 0.8164976)]
uniform token purpose = "default"

def Mesh "shape"
{
float3[] extent = [(-0.9428103, 0, -0.8164976), (0.47140515, 1.3333297, 0.8164976)]
int[] faceVertexCounts = [3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]
int[] faceVertexIndices = [4, 6, 5, 7, 9, 8, 10, 12, 11, 13, 15, 14, 0, 4, 5, 3, 3, 5, 6, 2, 2, 6, 4, 0, 0, 7, 8, 1, 1, 8, 9, 3, 3, 9, 7, 0, 0, 10, 11, 2, 2, 11, 12, 1, 1, 12, 10, 0, 1, 13, 14, 2, 2, 14, 15, 3, 3, 15, 13, 1]
int[] holeIndices = [0, 1, 2, 3]
uniform token orientation = "rightHanded"
point3f[] points = [(0, 1.3333297, 0), (-0.9428103, 0, 0), (0.47140515, 0, 0.8164976), (0.47140515, 0, -0.8164976), (0.2000002, 0.7676461, 0), (0.37140477, 0.2828426, -0.2968815), (0.37140477, 0.2828426, 0.2968815), (-0.100000076, 0.767646, -0.17320523), (-0.44280922, 0.28284258, -0.17320524), (0.07140455, 0.28284258, -0.4700867), (-0.100000076, 0.767646, 0.17320523), (0.07140455, 0.28284258, 0.4700867), (-0.44280922, 0.28284258, 0.17320524), (-0.34281015, 0, 0), (0.17140517, 0, 0.2968824), (0.17140517, 0, -0.2968824)] (
interpolation = "vertex"
)
color3f[] primvars:displayColor = [(1, 0, 0), (1, 0, 0), (1, 0, 0), (1, 0, 0), (0.22173825, 0.22173825, 0.22173825), (0.57073903, 0.57073903, 0.57073903), (0.12559389, 0.12559389, 0.12559389), (0.5839105, 0.5839105, 0.5839105), (0.35338718, 0.35338718, 0.35338718), (0.6352648, 0.6352648, 0.6352648), (0.5959357, 0.5959357, 0.5959357), (0.38499352, 0.38499352, 0.38499352), (0.18189418, 0.18189418, 0.18189418), (0.3232037, 0.3232037, 0.3232037), (0.3230929, 0.3230929, 0.3230929), (0.549813, 0.549813, 0.549813)] (
interpolation = "uniform"
)
int[] primvars:displayColor:indices = None
uniform token subdivisionScheme = "catmullClark"
}
}

}
}
}
}

def "Pyramid" (
prepend references = [
</ASSET_geo_variant_1/ASSET>,
</ASSET_geo_variant_0/ASSET>
]
)
{
}

64 changes: 64 additions & 0 deletions full_assets/SubdivisionSurfaces/Pyramid/mtl.usda
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#usda 1.0
(
defaultPrim = "Pyramid"
framesPerSecond = 24
metersPerUnit = 1
timeCodesPerSecond = 24
upAxis = "Y"
)

over "ASSET_mtl_previewsurface"
{
def Scope "mtl"
{
def Material "PyramidMaterial" (
prepend inherits = </__class_mtl__/PyramidMaterial>
)
{
token outputs:surface.connect = </ASSET_mtl_previewsurface/mtl/PyramidMaterial/usdpreviewsurface1.outputs:surface>

def Shader "usdpreviewsurface1"
{
uniform token info:id = "UsdPreviewSurface"
color3f inputs:diffuseColor.connect = </ASSET_mtl_previewsurface/mtl/PyramidMaterial/usdprimvarreader1.outputs:result>
float inputs:roughness = 0.1625
token outputs:surface
}

def Shader "usdprimvarreader1"
{
uniform token info:id = "UsdPrimvarReader_float3"
string inputs:varname = "displayColor"
vector3f outputs:result
}
}
}
}

def Xform "Pyramid" (
prepend references = </ASSET_mtl_previewsurface>
variants = {
string mtl = "previewsurface"
}
prepend variantSets = "mtl"
)
{
def Scope "mtl"
{
}
variantSet "mtl" = {
"previewsurface" {
over "geo"
{
over "shape" (
prepend apiSchemas = ["MaterialBindingAPI"]
)
{
rel material:binding = </Pyramid/mtl/PyramidMaterial>
}
}

}
}
}

19 changes: 19 additions & 0 deletions full_assets/SubdivisionSurfaces/Pyramid/payload.usda
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#usda 1.0
(
defaultPrim = "Pyramid"
framesPerSecond = 24
metersPerUnit = 1
timeCodesPerSecond = 24
upAxis = "Y"
)

def "Pyramid" (
kind = "component"
prepend references = [
@./mtl.usda@,
@./geo.usda@
]
)
{
}

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions full_assets/SubdivisionSurfaces/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Subdivision Surfaces

Scenes and geometry demonstrating subdivision surface features in USD.

## Creases - Spinning Pyramids

![Creases_SpinningPyramids_Storm](media/Creases_SpinningPyramids_Storm.jpg)

Provides 3 spinning subdivs demonstrating creases on the Pyramid model:
* `/World/Pyramid_EdgeCreases` - Sharpens the outer edges
* `/World/Pyramid_CornerCreases` - Sharpens two points
* `/World/Pyramid_NoCreases` - Subdiv without creases for comparison

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading