MaterialX icon indicating copy to clipboard operation
MaterialX copied to clipboard

Documentation: transparency hints and opacity

Open hybridherbst opened this issue 5 months ago • 0 comments

Hi, I'm trying to understand how to properly create transparent materials with MaterialX. My understanding is that the opacity property for both surface_unlit and standard_surface represent what in OpenPBR is called geometry_opacity, and not transmission.

I saw in the docs that there is some sort of "transparency hint" that can be provided by materials, so that the generator knows what kind of shader to emit. However, I haven't found an example of how that works.

In the following sections, I will post images of what I did get to work and what I did not get to work. Here's a file that demonstrates these various cases: CutoutShader.mtlx.zip


Unlit Surface

[Expected] When I naively plug something into "opacity" on surface_unlit, I get a transparent object:

Image

[Not Expected] When I run the same value through smoothstep or ifgreatereq and then plug that into "opacity", I get an opaque object that looks like its trying to be "cutout" (which would make sense) but failing to discard pixels:

Image

Standard Surface

[Not Expected] For standard_surface, in both of these cases I get an opaque object that is not transparent, but instead has black areas where it should be either transparent or cut out:

Image Image

OpenPBR

[Expected] With OpenPBR, I get transparency in both cases, and am not sure if I can get actual "cutout" behaviour (e.g. rendering opaque but discarding pixels):

Image

UsdPreviewSurface

[Expected] With UsdPreviewSurface, I can get "cutout" explicitly by providing opacityThreshold:

Image

[Not Expected] I believe I should be able to use "opacityMode" to get either transmissive or transparent behaviour with UsdPreviewSurface, but it seems that instead of an enum, it's currently an integer in MaterialXGraphEditor, so I can't test that.

hybridherbst avatar Jul 11 '25 15:07 hybridherbst