Open hybridherbst opened 10 months ago
Filed as internal issue #USD-8901
@hybridherbst , UsdPreviewSurface does not support opacity scaling. Rather, there is only an opacityThreshold input. I haven't looked at your assets, so I don't know how you are translating/specifying an opacity scale (are you using UsdUVTexture's scale/bias inputs on the alpha component?)
On the assumption that is what you are doing, I do believe there has been a problem with Storm's handling of specular reflections when opacity is zero... though I thought it was only for MaterialX shading. Pinging @klucknav for more up-to-date info... I see you're testing with 23.11 which is great - thanks!
Thanks @spiffmon! Yes, with opacity scaling I mean providing a UsdUVTexture scale of (1,1,1,alphaScale) on the texture that already has an alpha channel.
Running into this issue again, I still think this kind of material should properly have scaled down opacity, but it doesn't in usdview:
def Material "Material_7"
{
def Shader "PreviewSurface"
{
uniform token info:id = "UsdPreviewSurface"
color3f inputs:diffuseColor.connect = </StageRoot/Materials/Material_7/Texture_6_diffuse.outputs:rgb>
float inputs:opacity.connect = </StageRoot/Materials/Material_7/Texture_6_diffuse.outputs:a>
int inputs:useSpecularWorkflow = 0
token outputs:surface
}
token outputs:surface.connect = </StageRoot/Materials/Material_7/PreviewSurface.outputs:surface>
def Shader "uvReader_st"
{
uniform token info:id = "UsdPrimvarReader_float2"
token inputs:varname = "st"
float2 inputs:fallback = (0.0, 0.0)
float2 outputs:result
}
def Shader "uvReader_st2"
{
uniform token info:id = "UsdPrimvarReader_float2"
token inputs:varname = "st2"
float2 inputs:fallback = (0.0, 0.0)
float2 outputs:result
}
def Shader "Texture_6_diffuse"
{
uniform token info:id = "UsdUVTexture"
asset inputs:file = @textures/Texture_6_ffffff_0.101960786.png@
token inputs:sourceColorSpace = "sRGB"
float2 inputs:st.connect = </StageRoot/Materials/Material_7/uvReader_st.outputs:result>
float4 inputs:scale = (1, 1, 1, 0.101960786)
token inputs:wrapS = "repeat"
token inputs:wrapT = "repeat"
float outputs:r
float outputs:g
float outputs:b
float3 outputs:rgb
float outputs:a
}
}
Example file: IgnoredOpacityScale.usdz.zip
My workaround is currently applying opacity values to the texture (massively increasing the number of textures in some edge cases).
Description of Issue
While working on some more glTF-USD-conversion topics, I noticed that usdview's output for opacity scale does not match what I would expect. Specifically, it looks like opacity scale does something but not exactly scale the opacity. My understanding would be that with opacity scale going to zero, the material becomes more and more "glass-like".
Steps to Reproduce
Or am I understanding something wrong and scaling the opacity output of a texture works differently?
System Information (OS, Hardware)
Windows 11, RTX 3060
Package Versions
23.11