Skip to content

Commit 84b3eea

Browse files
committed
added background and opacity material option
1 parent 4172134 commit 84b3eea

File tree

12 files changed

+116
-1
lines changed

12 files changed

+116
-1
lines changed

test_assets/TextureFileFormatTests/Readme.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
This set of assets is intended to test support for loading and rendering basic texture file formats.
44

5+
The left material for each texture case is not using opacity. The right material is.
6+
57
## Screenshot
68

79
![screenshot](screenshots/all_files.png)

test_assets/TextureFileFormatTests/_scene.usda

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,48 @@ def Xform "Scene" (
3939
float2 outputs:result
4040
}
4141
}
42+
43+
def Material "MainMaterialWithOpacity"
44+
{
45+
token outputs:surface.connect = </Scene/Looks/MainMaterialWithOpacity/PbrPreview.outputs:surface>
46+
47+
def Shader "PbrPreview"
48+
{
49+
uniform token info:id = "UsdPreviewSurface"
50+
color3f inputs:diffuseColor.connect = </Scene/Looks/MainMaterialWithOpacity/Diffuse.outputs:rgb>
51+
float inputs:opacity.connect = </Scene/Looks/MainMaterialWithOpacity/Diffuse.outputs:a>
52+
token outputs:surface
53+
}
54+
55+
def Shader "Diffuse"
56+
{
57+
uniform token info:id = "UsdUVTexture"
58+
float2 inputs:st.connect = </Scene/Looks/MainMaterialWithOpacity/Primvar.outputs:result>
59+
float3 outputs:rgb
60+
float outputs:a
61+
}
62+
63+
def Shader "Primvar"
64+
{
65+
uniform token info:id = "UsdPrimvarReader_float2"
66+
string inputs:varname = "st"
67+
float2 outputs:result
68+
}
69+
}
4270
}
4371

4472
def Xform "Geom"
4573
{
74+
def Mesh "Backgroud"
75+
{
76+
color3f[] primvars:displayColor = [(0.7, 0, 0.7)] (
77+
interpolation = "constant"
78+
)
79+
int[] faceVertexCounts = [4]
80+
int[] faceVertexIndices = [0, 1, 2, 3]
81+
point3f[] points = [(-0.1,-0.1,-0.1), (2.2,-0.1,-0.1), (2.2,1.1,-0.1), (-0.1,1.1,-0.1)]
82+
}
83+
4684
def Mesh "Plane" (
4785
prepend apiSchemas = ["MaterialBindingAPI"]
4886
)
@@ -53,5 +91,16 @@ def Xform "Scene" (
5391
int[] faceVertexIndices = [0, 1, 2, 3]
5492
point3f[] points = [(0,0,0), (1,0,0), (1,1,0), (0,1,0)]
5593
}
94+
95+
def Mesh "PlaneWithOpacity" (
96+
prepend apiSchemas = ["MaterialBindingAPI"]
97+
)
98+
{
99+
rel material:binding = </Scene/Looks/MainMaterialWithOpacity>
100+
float2[] primvars:st = [(0, 0), (1, 0), (1, 1), (0, 1)] (interpolation = "vertex")
101+
int[] faceVertexCounts = [4]
102+
int[] faceVertexIndices = [0, 1, 2, 3]
103+
point3f[] points = [(1.1,0,0), (2.1,0,0), (2.1,1,0), (1.1,1,0)]
104+
}
56105
}
57106
}

test_assets/TextureFileFormatTests/all_files.usda

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def Scope "Scene" (
4848
}
4949

5050
def Xform "png" {
51-
double3 xformOp:translate = (2, 0, 0)
51+
double3 xformOp:translate = (3, 0, 0)
5252
uniform token[] xformOpOrder = ["xformOp:translate"]
5353

5454
over "png_grayscale_8bit" (

test_assets/TextureFileFormatTests/jpeg_cmyk_8-bit.usda

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,13 @@ over "Scene"
2222
asset inputs:file = @jpeg_cmyk_8-bit.jpg@
2323
}
2424
}
25+
26+
over "MainMaterialWithOpacity"
27+
{
28+
over "Diffuse"
29+
{
30+
asset inputs:file = @jpeg_cmyk_8-bit.jpg@
31+
}
32+
}
2533
}
2634
}

test_assets/TextureFileFormatTests/jpeg_grayscale_8-bit.usda

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,13 @@ over "Scene"
2222
asset inputs:file = @jpeg_grayscale_8-bit.jpg@
2323
}
2424
}
25+
26+
over "MainMaterialWithOpacity"
27+
{
28+
over "Diffuse"
29+
{
30+
asset inputs:file = @jpeg_grayscale_8-bit.jpg@
31+
}
32+
}
2533
}
2634
}

test_assets/TextureFileFormatTests/jpeg_rgb_8-bit.usda

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,13 @@ over "Scene"
2222
asset inputs:file = @jpeg_rgb_8-bit.jpg@
2323
}
2424
}
25+
26+
over "MainMaterialWithOpacity"
27+
{
28+
over "Diffuse"
29+
{
30+
asset inputs:file = @jpeg_rgb_8-bit.jpg@
31+
}
32+
}
2533
}
2634
}

test_assets/TextureFileFormatTests/png_grayscale_16-bit.usda

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,13 @@ over "Scene"
2222
asset inputs:file = @png_grayscale_16-bit.png@
2323
}
2424
}
25+
26+
over "MainMaterialWithOpacity"
27+
{
28+
over "Diffuse"
29+
{
30+
asset inputs:file = @png_grayscale_16-bit.png@
31+
}
32+
}
2533
}
2634
}

test_assets/TextureFileFormatTests/png_grayscale_8-bit.usda

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,13 @@ over "Scene"
2222
asset inputs:file = @png_grayscale_8-bit.png@
2323
}
2424
}
25+
26+
over "MainMaterialWithOpacity"
27+
{
28+
over "Diffuse"
29+
{
30+
asset inputs:file = @png_grayscale_8-bit.png@
31+
}
32+
}
2533
}
2634
}

test_assets/TextureFileFormatTests/png_rgb_16-bit.usda

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,13 @@ over "Scene"
2222
asset inputs:file = @png_rgb_16-bit.png@
2323
}
2424
}
25+
26+
over "MainMaterialWithOpacity"
27+
{
28+
over "Diffuse"
29+
{
30+
asset inputs:file = @png_rgb_16-bit.png@
31+
}
32+
}
2533
}
2634
}

test_assets/TextureFileFormatTests/png_rgb_32-bit.usda

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,13 @@ over "Scene"
2222
asset inputs:file = @png_rgb_32-bit.png@
2323
}
2424
}
25+
26+
over "MainMaterialWithOpacity"
27+
{
28+
over "Diffuse"
29+
{
30+
asset inputs:file = @png_rgb_32-bit.png@
31+
}
32+
}
2533
}
2634
}

0 commit comments

Comments
 (0)