Alpha Masking with Render Materials

Good afternoon all,

I am trying to figure out if and how to use alpha masking with render materials in Rhino Cycles/Rhino Render. I have two goals here:

  • Transparent background renders.
  • Material specific Alpha values and masking

Transparent Background Example:

Material Specific Example:
Yellow Gold Alpha = 0
Green Gold Alpha = 1

Ideally I’d like to be able to use these buttons to show the Alpha Mask and the RGBA Channel image.
alpha

Presently I am doing some manual screen capturing/masking and bitmap merging on the side, but I’d like to be able to do this the right way, and use the appropriate buttons in the Render Window.

Is there currently any way to assign material specific alpha mask values that would produce this kind of cutout result with a cycles render? Any info would be great.

Thanks,
Andrew

There is currently no material or setting available for users to do this. The holdout node is what would be needed.

1 Like

@nathanletwory,

Thanks for clarifying that; that was still my assumption, but wanted to check incase anything had changed recently in Rhino 7.

I know we spoke sometime last year about getting holdout notes into the cycles PBR materials - is that still something in the works?

Thanks,
Andrew

On my long-term list. I have no time estimate to give.

1 Like

10-4, I appreciate the info. Thanks.

@nathanletwory So does the alpha button in the render output window not work at all in Rhino 7?

We just need that clarification so our users, don’t expect that functionality to work after we deploy on Rhino 7.

The alpha button works. I am talking about a holdout option for objects essentially. So that they create an alpha hole where they are in the image.

https://docs.blender.org/manual/en/2.83/render/shader_nodes/shader/holdout.html

The first alpha button on the render output window as shown in the original post is for showing the final result with alpha visible. And the alpha channel button should also work, it would show the alpha channel only.

Hey Nathan,

I do understand that the holdout materials would be needed to create the holes, and we don’t have those materials yet, which is fine. I also understand that those buttons do work, and they toggle the appropriate channels on and off, which is good.

Currently I am making the alpha mask my self and merging the images post-render; however, I would like to know if there is a way for me to programatically access the active render window and activate an alpha channel and inject the alpha mask, so that these buttons would behave as intended, and show the appropriate channels when clicked.

I know the RenderWindow class has some methods like AddChannel() and SetRGBAChannelColors() that seem like they would allow me to do this. If you have an example code or information on how I can do that, that would be fantastic.

Thanks,
Andrew

I think you could try just opening the alpha channel with OpenChannel giving it the Alpha member from StandardChannels. Then I imaginr you should be able to set the alpha mask as you see fit.

Opening channels and setting data I do for instance here:

I can look more into this when I am back at work (starting second week of August).

1 Like

Hey Nathan,

Thanks for that. I can definitely understand being able to make that call inside of the RenderEngine class, however, I am not longer building my own Cycles based plugin; I am simply calling “!_Render” via RhinoScript.

Do you or anyone else (@dale maybe?) have any suggestions on how I can invoke the Render method within the default Rhino Render plugin programatically so that I can make adjustments to these render window channels? Any more info would be awesome.

Thanks,
Andrew

I am not aware of any mechanism to hook into that when started from _Render.

I understand your usecase, but I don’t know if it would be possible.

@johnc, is it possible for a plug-in dev to modify channel contents of a render window that is created by a call to the _Render command? I would assume maybe something like using RenderWindow.FromSessionId? Would this work also after a render session already has signalled completion - to change channel contents still after that?