Shadow catcher[finished half-baked]

Hi,

I started playing arround with render nodes and maybe found a solution to render out shadows by using passes and nodes without rendering layers and masking and double render times. I don`t know if thats helpful because i started today and have no Idea if that might be helpful or not. Maybe it is complete trash… But at the moment it seems to work.
The problem to me was that I could not find a solution or tutorial for a shadow catcher option in cycles without rendering 2 times. Maybe I did reinvent the wheel because i could not find a solution and i dont know if my idea works well but I tink I can share this and maybe one of you can and tell me.

My shadowpass node can be linked from the blend file below. It works well to me at the moment but I did not test everything.

If you like to test just setup the objects you want to cast shadows by setting the object ID or material IDs to 5 (S=5 like Shadows :) ). This Objects are the objects that should cast a transparent shadow in your final render with transparency. My ShadowPass render Node has 4 inputs.. you have to enable the shadow pass, OB Index pass, Material Index pass , and Environment pass under render layers passes. Render your image and connect the passes to my ShadowPass Node and link the outputs. Set your save folder and it should work. There are two output channels. One for only shadow and one for objects with shadows. Dont know… but looks good to me at the moment :wink:

[ATTACH=CONFIG]287267[/ATTACH]
setup nodes
https://dl.dropboxusercontent.com/u/81779736/Blender_ShadowCatcher/shadowpass.jpg
blend file
https://db.tt/UkG709Ud

Ho! my help question about shadow casting option in Blender! Good find, Piet!
Sincere congratulation.

Edit: Your two attachements links are breaked! Weird.

awesome i’ve been waiting a longtime for this, but man Your two attachments links are broken!

o.k. sorry… there is something wrong… I did upload everything on dropbox. Hopefully it is working now and useful.
I did also a little change in the node. Now you can desaturate the shadows if thats needed.
Tell me if it works for you.
Thanks

Piet

There is still a problem with 2 of the 3 links … the jpg image (middle link) did open up OK, but not the other 2

the first one i cant delete… sorry… try to right click the third one and save tagret or something like that… it is dropbox and im not expert with internet things... should work ;) attachments are not working or Im to stupid to upload files…sorry about that

thank you, testing…

https://dl.dropboxusercontent.com/u/81779736/Blender_ShadowCatcher/Shadow_Pass_V2.blend

I tested a little bit more and added a value “slider” to darken the shadows.

@bat3a thank you for testing !

Did some tests and realized that there are some strange edges… i could fix that. Think it is o.k. now. Would be nice to have some response if thats useful or not… working or not… and if there needs something to be changed do it or tell me. So if somebody has some time for testing. Anyway… I`m happy with that and it works quite well.

https://dl.dropboxusercontent.com/u/81779736/Blender_ShadowCatcher/Shadow_Pass_V3.blend

cheers

Piet

it has some issues that appear after you try to add the shadow to the scene, but good start, if u can eliminate the error luminance, it would be perfect.


i wounder why the devs doesn’t care adding a matte material (it is not even on the roadmap)?, it saves a lot of time in render and composting, especially in animation projects!

Hi,

@bat3a thanks a lot! did not test that so far… Think I could fix that. I did also add some new settings to manipulate the shadow if thats necessary.
Thanks for testing!

[ATTACH=CONFIG]287816[/ATTACH]

https://dl.dropboxusercontent.com/u/81779736/Blender_ShadowCatcher/Shadow_Pass_V4.blend
cheers

Hi Piet,
absolutely great Node-Setup.

But there is a Bug with Meshlights.
If I take Meshlights, the Shadow_Catcher is visible and the “Normal” Objects are transparent.

Win 7
blender-2.69-4393398-win64-vc12

Spotlight:


Meshlight:


Blend:

Spotlight is on Layer 2.
Meshlight is on Layer 3.

Can you fix this?

Hi Dito,

thanks for testing… I did test it with the last version and it works. But there are some other problems happening with meshlights… shadow colors are changing now… crazy… Another thing is that the meshlight is visible when rendering the scene… Have no idea at the moment how to fix that. A solution for the problem with visible meshlights is to put the light out of your scene at the moment… Maybe this can be solved… I will take a look at it. Hopefully not ending up in a too difficult and confusing to use nodesetup.
Thanks for response and testing ! If somebody has Ideas feel free to modify everything!

[edit] i tested your scene… there is something different to my meshlight test …in your scene it is not working… thanks!
[edit] o.k. i found the problem… the shadow pass is only affected by lamp object… stupid.
So it looks like that test has an early end. I will think about it… little bit curious that my meshlight scene seems to work… there is something happening i don`t understand at the moment.
Anyways… thanks for testing !

Thanks for your fast answer, Piet.

I made the Testscene with V3, but also V4 doesn’t work for me.

The blender-2.69-4393398-win64-vc12 Version is from today.

O.K. I did think about it and realy believe with meshlights there is no chance to do a setup. There are no passes for maybe excluding mesh emission shadows… they are not there because they don`t affect the shadow pass and there is no chance to grab them.
Anyways if you have a scene that has no meshlights a setup like that can save a lot of time. So it was not completely senseless.
Lets hope for a shadow catcher or better shadow pass. Rendering a picture two times is realy a bit frustrating :wink:
Thanks a lot bat3a,Dito,Spirou4D,harleynut97 and them who try to find a better solution for that and all the developers of blender.

cheers

Piet

testing v4… thanks

Rendering a picture two times is realy a bit frustrating :wink:

yeah i wonder if osl is useful for this? Tomas Dinges say some time ago that he could implement this, i don’t know what happened, wish someone do a proper matt.

I`m not sure but i believe osl does not solve that. It is much more a question how cycles interacts with that realy cool render passes we have. Simpliest solution would be a meshlight is affecting the shadow pass to me. Thats everything we need… i think… cheers
[edit] or a shadow catcher shader would be fine for cycles;)

ok v4 is better, although mesh and world light doesn’t work (due to the weird shadow pass cycles have as it doesn’t consider world, mesh lighting), i can safely add a simple cube, notice that i plugged the scene alpha to the fac. of the mix which helped, thanks.


Hi Piet,

too bad it does not work with Meshlights, nevertheless a really great work simplification.

Many Thanks
Dito

Neat, even with existing limitations this will be useful in compositing work.

I wonder why it doesn’t work with mesh lights, something to do with how the rays are cast and/or light path calculation?

If only the “is shadow ray” on the lightpath node was for objects recieving rather than casting shadows, then it would be possible to use a mix with holdout shader and make this a whole lot easier. However that might give a clue if there is still some way to figure out a workaround. Perhaps some script node on the object casting shadows to collect the lightpath info for shadow rays and put it into a user-defined attribute, and an attribute node mixing holdout on the shadow catcher to control its alpha? (Too bad my scripting skills are weak in this regard, but somebody that understands that stuff better could give it a try.)

I’d also guess that with a bit of modification, it would also be possible to make a material to catch reflections as well.