Skip to content

Commit

Permalink
added background and opacity material option
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSchwank committed May 17, 2024
1 parent 4172134 commit 84b3eea
Show file tree
Hide file tree
Showing 12 changed files with 116 additions and 1 deletion.
2 changes: 2 additions & 0 deletions test_assets/TextureFileFormatTests/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

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

The left material for each texture case is not using opacity. The right material is.

## Screenshot

![screenshot](screenshots/all_files.png)
Expand Down
49 changes: 49 additions & 0 deletions test_assets/TextureFileFormatTests/_scene.usda
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,48 @@ def Xform "Scene" (
float2 outputs:result
}
}

def Material "MainMaterialWithOpacity"
{
token outputs:surface.connect = </Scene/Looks/MainMaterialWithOpacity/PbrPreview.outputs:surface>

def Shader "PbrPreview"
{
uniform token info:id = "UsdPreviewSurface"
color3f inputs:diffuseColor.connect = </Scene/Looks/MainMaterialWithOpacity/Diffuse.outputs:rgb>
float inputs:opacity.connect = </Scene/Looks/MainMaterialWithOpacity/Diffuse.outputs:a>
token outputs:surface
}

def Shader "Diffuse"
{
uniform token info:id = "UsdUVTexture"
float2 inputs:st.connect = </Scene/Looks/MainMaterialWithOpacity/Primvar.outputs:result>
float3 outputs:rgb
float outputs:a
}

def Shader "Primvar"
{
uniform token info:id = "UsdPrimvarReader_float2"
string inputs:varname = "st"
float2 outputs:result
}
}
}

def Xform "Geom"
{
def Mesh "Backgroud"
{
color3f[] primvars:displayColor = [(0.7, 0, 0.7)] (
interpolation = "constant"
)
int[] faceVertexCounts = [4]
int[] faceVertexIndices = [0, 1, 2, 3]
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)]
}

def Mesh "Plane" (
prepend apiSchemas = ["MaterialBindingAPI"]
)
Expand All @@ -53,5 +91,16 @@ def Xform "Scene" (
int[] faceVertexIndices = [0, 1, 2, 3]
point3f[] points = [(0,0,0), (1,0,0), (1,1,0), (0,1,0)]
}

def Mesh "PlaneWithOpacity" (
prepend apiSchemas = ["MaterialBindingAPI"]
)
{
rel material:binding = </Scene/Looks/MainMaterialWithOpacity>
float2[] primvars:st = [(0, 0), (1, 0), (1, 1), (0, 1)] (interpolation = "vertex")
int[] faceVertexCounts = [4]
int[] faceVertexIndices = [0, 1, 2, 3]
point3f[] points = [(1.1,0,0), (2.1,0,0), (2.1,1,0), (1.1,1,0)]
}
}
}
2 changes: 1 addition & 1 deletion test_assets/TextureFileFormatTests/all_files.usda
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def Scope "Scene" (
}

def Xform "png" {
double3 xformOp:translate = (2, 0, 0)
double3 xformOp:translate = (3, 0, 0)
uniform token[] xformOpOrder = ["xformOp:translate"]

over "png_grayscale_8bit" (
Expand Down
8 changes: 8 additions & 0 deletions test_assets/TextureFileFormatTests/jpeg_cmyk_8-bit.usda
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,13 @@ over "Scene"
asset inputs:file = @jpeg_cmyk_8-bit.jpg@
}
}

over "MainMaterialWithOpacity"
{
over "Diffuse"
{
asset inputs:file = @jpeg_cmyk_8-bit.jpg@
}
}
}
}
8 changes: 8 additions & 0 deletions test_assets/TextureFileFormatTests/jpeg_grayscale_8-bit.usda
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,13 @@ over "Scene"
asset inputs:file = @jpeg_grayscale_8-bit.jpg@
}
}

over "MainMaterialWithOpacity"
{
over "Diffuse"
{
asset inputs:file = @jpeg_grayscale_8-bit.jpg@
}
}
}
}
8 changes: 8 additions & 0 deletions test_assets/TextureFileFormatTests/jpeg_rgb_8-bit.usda
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,13 @@ over "Scene"
asset inputs:file = @jpeg_rgb_8-bit.jpg@
}
}

over "MainMaterialWithOpacity"
{
over "Diffuse"
{
asset inputs:file = @jpeg_rgb_8-bit.jpg@
}
}
}
}
8 changes: 8 additions & 0 deletions test_assets/TextureFileFormatTests/png_grayscale_16-bit.usda
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,13 @@ over "Scene"
asset inputs:file = @png_grayscale_16-bit.png@
}
}

over "MainMaterialWithOpacity"
{
over "Diffuse"
{
asset inputs:file = @png_grayscale_16-bit.png@
}
}
}
}
8 changes: 8 additions & 0 deletions test_assets/TextureFileFormatTests/png_grayscale_8-bit.usda
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,13 @@ over "Scene"
asset inputs:file = @png_grayscale_8-bit.png@
}
}

over "MainMaterialWithOpacity"
{
over "Diffuse"
{
asset inputs:file = @png_grayscale_8-bit.png@
}
}
}
}
8 changes: 8 additions & 0 deletions test_assets/TextureFileFormatTests/png_rgb_16-bit.usda
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,13 @@ over "Scene"
asset inputs:file = @png_rgb_16-bit.png@
}
}

over "MainMaterialWithOpacity"
{
over "Diffuse"
{
asset inputs:file = @png_rgb_16-bit.png@
}
}
}
}
8 changes: 8 additions & 0 deletions test_assets/TextureFileFormatTests/png_rgb_32-bit.usda
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,13 @@ over "Scene"
asset inputs:file = @png_rgb_32-bit.png@
}
}

over "MainMaterialWithOpacity"
{
over "Diffuse"
{
asset inputs:file = @png_rgb_32-bit.png@
}
}
}
}
8 changes: 8 additions & 0 deletions test_assets/TextureFileFormatTests/png_rgb_8-bit.usda
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,13 @@ over "Scene"
asset inputs:file = @png_rgb_8-bit.png@
}
}

over "MainMaterialWithOpacity"
{
over "Diffuse"
{
asset inputs:file = @png_rgb_8-bit.png@
}
}
}
}
Binary file modified test_assets/TextureFileFormatTests/screenshots/all_files.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 84b3eea

Please sign in to comment.