I have rendered an object using hdri and lamp lights. Using render layers i want to have object and shadows only. I show you my nodes. I need to know how to transform white pixels to alpha channel using nodes.
-
$\begingroup$ No it is not. I want to know how to do it using render layers in order to have an alpha channel. Just i need to transform white pixel to alpha. $\endgroup$– jagoji3dCommented Apr 30, 2015 at 18:57
-
$\begingroup$ Jerryno, I need a pgn image in order to use it as image web site. Just, the object and shadow only. $\endgroup$– jagoji3dCommented Apr 30, 2015 at 19:01
-
$\begingroup$ You cannot transform white to alpha, you can transform black pixels to alpha but that won't give you shadow. You can transform white pixels for CMYK mode into alpha. $\endgroup$– Jaroslav Jerryno NovotnyCommented Apr 30, 2015 at 19:01
-
$\begingroup$ related:blender.stackexchange.com/questions/5158/… $\endgroup$– user1853Commented May 1, 2015 at 2:48
-
$\begingroup$ @jagoji3d That question has the answers you want, you just need to output the transparent image and not add it onto the background image. $\endgroup$– J SargentCommented May 1, 2015 at 12:44
1 Answer
One solution would be to enable a shadow pass, invert the colors and use that as alpha using a Set Alpha node.
The Dilate/Erode will help with the antialiasing of the shadow pass.
EDIT
Now... if you hate the previous option and absolutely want to use the layers you have set up, you can try this:
From the background layer you can indeed subtract the shadow layer, creating a black and white image that holds the shadow information only. But use difference instead of subtract (also, you don't need the invert node because you can invert the image with the curves node, but you do need to get rid of the color information). Next, combine that image with the alpha channel of the sphere, and use the resulting image as alpha channel on the mix of the shadow and the sphere...