Install
You must be registered to see the links
and use this command line :
Code:
convert.exe "image with shadow.png" "image without shadow.png" -alpha off +repage ( -clone 0 -clone 1 -compose difference -composite -threshold 0 ) ( -clone 0 -clone 2 -compose multiply -composite ) -delete 0,1 +swap -alpha off -compose copy_opacity -composite "shadow only.png"
But be aware that this method (like any other automated method) need for the two images to be strictly identical except their differences. This mean that they need to be 100% noise free and each point need to have the exact same color. Alas, this isn't the case with rendered 3D images, whatever the engine you'll use, unless you use high quality setting to render them ; which obviously increase more than significantly the time needed to render each images.
Despite the fact that two images looks identical to our eyes, they have a shit tons of differences which will totally mess with an automated processing.
This said, there's perhaps a way to do this without post processing, by directly rendering only the shadows. But if it's possible, it will depend of the engine used to render the images.
HopesGaming I more or less remember you talking about something like that once ; some kind of "the object aren't rendered anymore, but the shadows will be cast". Is my memory right, and if yes, how to do it ?
All this said, why do you need this ?
I would understand if it was "remove the background". It would have reduced the size of the game by having only one generic background and adding the characters (shadow included) in his actual pose on top of it.
But like this I don't understand. The shadow will depend of the character, his clothes and his position. Therefore separating it from his shadow is a lot of works for nothing, since you'll end with a couple character/shadow for every single combination of pose and clothing.