Как я написал конвертер 3D-моделей из подручных средств28.06.2023 10:17
#usda 1.0
(
customLayerData = {
string creator = "Yandex.Market. All rights reserved 2021"
}
defaultPrim = "Box"
upAxis = "Y"
metersPerUnit = 1
)
def Xform "Box" (
assetInfo = {
string name = "Box"
}
kind = "component"
)
{
def Scope "Geom" {
def Xform "Root"
{
def Mesh "Cube"
{
uniform bool doubleSided = 1
int[] faceVertexCounts = [4, 4, 4, 4, 4, 4]
int[] faceVertexIndices = [0, 1, 3, 2, 2, 3, 7, 6, 6, 7, 5, 4, 4, 5, 1, 0, 2, 6, 4, 0, 7, 3, 1, 5]
point3f[] points = [(-width, 0, 0), (-width, 0, length), (-width, height, 0), (-width, height, length), (width, 0, 0), (width, 0, length), (width, height, 0), (width, height, length)]
normal3f[] primvars:normals = [(-1, 0, 0), (0, 1, 0), (1, 0, 0), (0, 0, 0), (0, 0, -1), (0, 0, 1)] (
interpolation = "faceVarying"
)
int[] primvars:normals:indices = [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5]
uniform token subdivisionScheme = "none"
rel material:binding =
}
def Mesh "Plane1"
{
uniform bool doubleSided = 0
float3[] extent = [(-0.5, 0, 0), (0.5, 1, 0.0001)]
int[] faceVertexCounts = [3, 3]
int[] faceVertexIndices = [0, 1, 3, 0, 3, 2]
rel material:binding =
normal3f[] normals = [(0, 0, 1), (0, 0, 1), (0, 0, 1), (0, 0, 1)]
point3f[] points = [(-plane1Left, plane1Bot, plane1Depth), (plane1Right, plane1Bot, plane1Depth), (-plane1Left, plane1Top, plane1Depth), (plane1Right, plane1Top, plane1Depth)]
texCoord2f[] primvars:st = [(0, 0), (1, 0), (0, 1), (1, 1)] (
interpolation = "vertex"
)
uniform token subdivisionScheme = "none"
}
def Mesh "Plane2"
{
uniform bool doubleSided = 0
float3[] extent = [(-0.5, 0, 0), (0.5, 1, 0.0001)]
int[] faceVertexCounts = [3, 3]
int[] faceVertexIndices = [0, 1, 3, 0, 3, 2]
rel material:binding =
normal3f[] normals = [(0, 0, 1), (0, 0, 1), (0, 0, 1), (0, 0, 1)]
point3f[] points = [(-plane2Left, plane2Bot, plane2Depth), (plane2Right, plane2Bot, plane2Depth), (-plane2Left, plane2Top, plane2Depth), (plane2Right, plane2Top, plane2Depth)]
texCoord2f[] primvars:st = [(0, 0), (1, 0), (0, 1), (1, 1)] (
interpolation = "vertex"
)
uniform token subdivisionScheme = "none"
}
def Mesh "Plane3"
{
uniform bool doubleSided = 0
float3[] extent = [(-0.5, 0, 0), (0.5, 1, 0)]
int[] faceVertexCounts = [3, 3]
int[] faceVertexIndices = [0, 1, 3, 0, 3, 2]
rel material:binding =
normal3f[] normals = [(0, 0, 1), (0, 0, 1), (0, 0, 1), (0, 0, 1)]
point3f[] points = [(plane3Width, plane3Bot, plane3DepthClose), (plane3Width, plane3Bot, plane3DepthFar), (plane3Width, plane3Top, plane3DepthClose), (plane3Width, plane3Top, plane3DepthFar)]
texCoord2f[] primvars:st = [(0, 0), (tex3, 0), (0, 1), (tex3, 1)] (
interpolation = "vertex"
)
uniform token subdivisionScheme = "none"
}
def Mesh "Plane4"
{
uniform bool doubleSided = 0
float3[] extent = [(-0.5, 0, 0), (0.5, 1, 0)]
int[] faceVertexCounts = [3, 3]
int[] faceVertexIndices = [0, 1, 3, 0, 3, 2]
rel material:binding =
normal3f[] normals = [(0, 0, 1), (0, 0, 1), (0, 0, 1), (0, 0, 1)]
point3f[] points = [(-plane4Left, plane4Bot, plane4Depth), (plane4Right, plane4Bot, plane4Depth), (-plane4Left, plane4Top, plane4Depth), (plane4Right, plane4Top, plane4Depth)]
texCoord2f[] primvars:st = [(0, 0), (1, 0), (0, 1), (1, 1)] (
interpolation = "vertex"
)
uniform token subdivisionScheme = "none"
}
}
}
def Scope "Materials"
{
def Material "MTailMaterial"
{
token outputs:surface.connect =
def Shader "surfaceShader"
{
uniform token info:id = "UsdPreviewSurface"
color3f inputs:diffuseColor.connect =
color3f inputs:emissiveColor = (0, 0, 0)
float inputs:metallic = 0
normal3f inputs:normal = (0, 0, 1)
float inputs:occlusion = 1
float inputs:opacity.connect =
float inputs:roughness = 0.5
token outputs:surface
float inputs:opacityThreshold = 0.5
}
def Shader "st_texCoordReader"
{
uniform token info:id = "UsdPrimvarReader_float2"
token inputs:varname = "st"
float2 outputs:result
}
def Shader "diffuseColor_opacity_texture"
{
uniform token info:id = "UsdUVTexture"
asset inputs:file = @textures/m_tail.png@
float2 inputs:st.connect =
token inputs:wrapS = "clamp"
token inputs:wrapT = "clamp"
float3 outputs:rgb
float outputs:a
}
}
def Material "MLetterMaterial"
{
token outputs:surface.connect =
def Shader "surfaceShader"
{
uniform token info:id = "UsdPreviewSurface"
color3f inputs:diffuseColor.connect =
color3f inputs:emissiveColor = (0, 0, 0)
float inputs:metallic = 0
normal3f inputs:normal = (0, 0, 1)
float inputs:occlusion = 1
float inputs:opacity.connect =
float inputs:roughness = 1.0
token outputs:surface
float inputs:opacityThreshold = 0.5
}
def Shader "st_texCoordReader"
{
uniform token info:id = "UsdPrimvarReader_float2"
token inputs:varname = "st"
float2 outputs:result
}
def Shader "diffuseColor_opacity_texture"
{
uniform token info:id = "UsdUVTexture"
asset inputs:file = @textures/m_letter.png@
float2 inputs:st.connect =
token inputs:wrapS = "clamp"
token inputs:wrapT = "clamp"
float3 outputs:rgb
float outputs:a
}
}
def Material "LogoMaterial"
{
token outputs:surface.connect =
def Shader "surfaceShader"
{
uniform token info:id = "UsdPreviewSurface"
color3f inputs:diffuseColor.connect =
color3f inputs:emissiveColor = (0, 0, 0)
float inputs:metallic = 0
normal3f inputs:normal = (1, 1, 1)
float inputs:opacity.connect =
float inputs:roughness = 1.0
token outputs:surface
float inputs:opacityThreshold = 0.5
}
def Shader "st_texCoordReader"
{
uniform token info:id = "UsdPrimvarReader_float2"
token inputs:varname = "st"
float2 outputs:result
}
def Shader "diffuseColor_opacity_texture"
{
uniform token info:id = "UsdUVTexture"
asset inputs:file = @textures/plane1Name@
float2 inputs:st.connect =
token inputs:wrapS = "clamp"
token inputs:wrapT = "clamp"
float3 outputs:rgb
float outputs:a
}
}
def Material "PromoMaterial"
{
token outputs:surface.connect =
def Shader "surfaceShader"
{
uniform token info:id = "UsdPreviewSurface"
color3f inputs:diffuseColor.connect =
color3f inputs:emissiveColor = (0, 0, 0)
float inputs:metallic = 0
normal3f inputs:normal = (0, 0, 1)
float inputs:occlusion = 1
float inputs:opacity.connect =
float inputs:roughness = 1.0
token outputs:surface
float inputs:opacityThreshold = 0.5
}
def Shader "st_texCoordReader"
{
uniform token info:id = "UsdPrimvarReader_float2"
token inputs:varname = "st"
float2 outputs:result
}
def Shader "diffuseColor_opacity_texture"
{
uniform token info:id = "UsdUVTexture"
asset inputs:file = @textures/promo.png@
float2 inputs:st.connect =
token inputs:wrapS = "clamp"
token inputs:wrapT = "clamp"
float3 outputs:rgb
float outputs:a
}
}
def Material "BoxMaterial"
{
token outputs:surface.connect =
def Shader "pbr"
{
token info:id = "UsdPreviewSurface"
color3f inputs:diffuseColor = (boxRed, boxGreen, boxBlue)
color3f inputs:emissiveColor = (0.01, 0.01, 0.01)
float inputs:metallic = 0.4
normal3f inputs:normal = (1, 1, 1)
float inputs:occlusion = 1
float inputs:opacity = boxOpacity
float inputs:roughness = 0.3
token outputs:surface
float inputs:opacityThreshold = 0.2
}
}
}
}
© Habrahabr.ru