Search - User list
Full Version: UsdPreviewSurface use alpha of UsdUVTexture as opacity input
Root » Solaris and Karma » UsdPreviewSurface use alpha of UsdUVTexture as opacity input
msearl001
Hi,

am I doing something wrong, or is this something that is not fully featured in Karma yet?
Trying to use the alpha channel of my png file to plug into the opacity field of the UsdPreviewSurface shader, which doesn't work.
The only thing that works is to put the rgb value into the opacity channel (which doesn't make sense, as this is a vector3 instead of a float input and I also don't want).

So I've created that material and then created this Inline USD node to check by syntax according to the pixar usd documentation what pieces I have to change.

over "camera" (
)
{
over Material "material" (
)
{
over Shader "material"
{
uniform token info:id = "UsdPreviewSurface"
color3f inputs:diffuseColor = (1, 1, 1)
color3f inputs:emissiveColor.connect = </camera/material/texture.outputs:rgb>
float inputs:ior = 1
float inputs:metallic = 1
float inputs:opacity.connect = </camera/material/texture.outputs:rgb>
float inputs:opacityThreshold = 0.5
float inputs:roughness = 0
token outputs:displacement
token outputs:surface
}

over Shader "texture"
{
uniform token info:id = "UsdUVTexture"
asset inputs:file = @/opt/dev/mytexture.png@
float outputs:a
vector3f outputs:rgb
}

This line: float inputs:opacity.connect = </camera/material/texture.outputs:rgb>
Should be: float inputs:opacity.connect = </camera/material/texture.outputs:a>
Although when I only use the alpha channel of the texture (which is a png and has an alpha channel, I've checked that in Nuke), I don't get any alpha at all. Using only r, g or b as a value works, so it can't be related to vector vs float inputs. Maybe the UsdUVTexture is unable to read the alpha channel of pngs?

Is that a bug? Is there something wrong in my setup, although this setup is quite basic.

Cheers
mark
This should be supported - it looks like a bug. I've submitted one into the bug database for you.
mark
This should be fixed in tomorrow's daily build of H18.

If you load up the attached .hip file you should see the surface become refractive where the opacity is zero. If you want a cut-out behaviour instead, you can increase the opacityThreshold to a very small amount (0.0001).
msearl001
Awesome. Thanks for this quick support! You guys rock!
Michela Ledwidge
Should USDZ work on iOS Quick Look with this example? In HOU19.0.383 this example, adjusted with the following suggestion

> increase the opacityThreshold to a very small amount (0.0001).

still shows as a grid, no alpha
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB