[Closed] Saving Alpha Channel
Is there a way to save / capture into separate bitmap Alpha Channel of rendered image?
I know it is possible to do sort of work around – create new bitmap and then edit all the pixels of the rendered image to make them into alphas ( saturation = 0, .h = .a) and copy into new bitmap, but that takes time, especially on big images. I wonder if there is a way to simply save the alpha channel…?
if you don’t necessarily need to script this, try using the File Output render effect. Set the output type to TGA, enable Alpha Split so it saves the alpha channel out to a separate file, and… done.
You can do much the same with scripting:
myRender = render()
BitMap:
targa.setAlphaSplit true
OK
myRender.filename = "c:\ est.tga"
"c: est.tga"
save myRender
true
getFiles "c:\\*test.tga"
#("c: est.tga", "c:\A_test.tga")
“A_test.tga” is the alpha channel.
Depending on the renderer, you may also be able to use…
“<bitmap>getChannelAsMask #shaderTransparency”.
…but I wouldn’t advise it.
or you can use render elements
(
local ReMngr = MaxOps.GetCurRenderElementMgr()
-- if using vray: VrayAlpha() for vray 1.5sp1 and Vray_Alpha() for vray 1.5sp2
local alphaEl = Alpha()
ReMngr.AddRenderElement alphaEl
-- 0 based !
ReMngr.SetRenderElementFilename (ReMngr.numrenderelements() - 1) "c:\\myalpha.bmp"
)
Thank you, guys!
I think TGA alpha split is the way to go here, since render elements Alpha is different in a sense that it is always solid while eg transparency of the materials has no effect on it, or am I doing something wrong?
Renderer wise in this project I use Mental Ray.