MTLX - Alpha

   530   2   0
User Avatar
Member
1898 posts
Joined: 9月 2015
Offline
I was wondering how people typically apply settings to get an alpha channel in their output images using MTLX.

The purpose being for working with image layers say in Photoshop.

With a principal shader I can simply define my points with f@Alpha and the shader picks up it and gives me the results I want.

With MTLX that doesn't seem to work in the sense no different outcome is seen from having that attribute present.

I've tried using a usdprimvarreader for the Alpha attribute and apply it to transimission, but that doesn't give the result.

What does work(for what I want as a result) is using a usdprimvareader and mtlxcombine(vector3) and plug that into Opacity,

although I don't think that really generates an Alpha channel.

Otherwise is there another way to specify/define an Alpha channel with an MTLX Surface Shader so that I get the areas of my image to be 'transparent' alpha-wise?
User Avatar
Member
683 posts
Joined: 7月 2005
Online
USD has its own naming conventions for certain attributes. Solaris will rename these attribs to be "USD compliant" when bringing in SOP geometry. For example:
pscale -> widths
Cd -> displayColor
Alpha -> displayOpacity

If you look at your mesh primitive in the Scene Graph Details pane you will see that Alpha is nowhere to be found, but you now have displayOpacity.

MaterialX will need to be specifically told to use the displayOpacity attribute (aka primvar). The USD Primvar Reader node is actually hidden now in the mtlx subnet context as it is sort of deprecated for use in MaterialX networks. The "proper" node to use would be Mtlx Geometry Property Value. You can use that to call displayOpacity, convert it to color/vector with Mtlx Convert (or Combine3) and feed it into the Opacity input of the Standard Surface material.

Transmission deals with refraction, as in glass, water, etc and won't give you the correct result.
Edited by Siavash Tehrani - 2022年11月26日 13:34:22

Attachments:
twisty.png (125.3 KB)
mtlx_alpha.hiplc (779.7 KB)

User Avatar
Member
1898 posts
Joined: 9月 2015
Offline
Thanks very much Slavish.
  • Quick Links