Jump to content

shadow catcher material


Recommended Posts

two ways to do this. the first is to use a normal 'shadow matte' vop and set the 'shadow mask' on your light to exclude the object you don't want to self shadow.

the other way is to do it in your shader with isshadowray() switching the opacity of the object off for shadows.

here's what that looks like:

post-4364-129753820194_thumb.jpg

  • Like 3
Link to comment
Share on other sites

Dude,

you'r awesome :)

Thanks!

two ways to do this. the first is to use a normal 'shadow matte' vop and set the 'shadow mask' on your light to exclude the object you don't want to self shadow.

the other way is to do it in your shader with isshadowray() switching the opacity of the object off for shadows.

here's what that looks like:

Link to comment
Share on other sites

  • 3 years later...

Hi guys,

 

By using the "isshadowray" solution the object stops casting shadows over the other objects as well. Is that what it actually does or I'm messing something?

 

How to turn off only the self shadow but keep cast shadows over the other objects?

 

 

I want to render pyro smoke that's occluded by mate object which cast shadows over the smoke. That's fine.

Now I want to output a render pass (mantra image plane) that contains only the smoke's shadow cast over the matte object.

I need both yellow frames to render at once not by using takes or any technique that needs to execute a second render.

 

shadowmatte_graphic1.jpg

 

 

Thanks!

Edited by dickagm
Link to comment
Share on other sites

Thanks for the reply and the hip file Marty!

 

That's a nice trick to control the self shadows with mantra surface, in my opinion that attribute should be exposed at upper user control level in to the mantra surface gui because it should have a common use in a complex compositing situations :) unfortunately the matte shadow node is still outputting with the self shadows included.

How can I combine the use of this trick with the use of matte_shadow node?

 

For now what I have achieved that's looking very close to what I need is the use of "isshadowray" combined with the matte_shadow node, unfortunately it completely stops the shadows casting of the object.

What I need so far is to stop somehow only the self shadows of the "matte_shadow" node, because I'm outputting my shadow pass using this node, I'll appreciate any additional workarounds of this issue.

 

 

Thanks!

Link to comment
Share on other sites

Is it possible to upload a very simple file showing what you want? 

 

Using the unchecked Enable Shadows and in Mantra using the 'direct_shadow' Vex Variable works for outputting a shadow pass without self-shadow.

 

Thanks!

post-8321-0-44785900-1398624479_thumb.pn

post-8321-0-54287000-1398624593_thumb.pn

SelfShadowPhantom2.hip

Edited by tar
Link to comment
Share on other sites

Hi Marty,

 

Here is the scene. There's a simple smoke sim and there are 3 takes:

 

main - where everything is visible (to get sense of the scene)

take1 - is where my beauty pass is exactly as I wanted (the smoke is cut by the matte object and have received shadow cast from the mate object as well) but the SHADOW_MATTE pass contains the self shadows of the matte object (which is the thing I don't want :) )

take2 - is where the beauty pass have loosed the shadow cast from the matte object (by use of isshadowray with the matteshadow nodes), but on cost of that the MATTE_SHADOW pass now contains only the smoke shadow cast over the matte object which is the exact thing I want from this pass

 

so I want to have in one render the beauty result from take1 (smoke, cut by matte object, recieve shadows from same matte object)

and shadow_matte result from take2 ( only the smoke's shadow cast over the matte object ).

 

 

Really appreciate your help Marty!

Thanks!

matte_shadow_test.hipnc

Link to comment
Share on other sites

After some more try outs it looks like there's no way to turn off the self shadow of a matteshadow shader? Is that possible if I write my own VEX shader for mantra, if so I'll appreciate any tips about the variable I'll have to play with to control the shadows?

 

I have old memories about mental ray shader that can separate the individual ray components like, primary rays, secondary rays, reflection rays, shadow rays and so on... which makes possible to tell the shader what to do with the shadow rays only or the ones you need. It was used mainly to control the sampling behind transparent objects like glass windows but I guess the same concept will be applicable to the matteshadow shader that I need.

 

The issshadowray node looks like the rayswitcher I'm talking above, so I only need a way to check the object's id at rendertime and if the shadow ray that is cast over certain object is caused by the same object then to dismiss it.

 

 

Thanks!

Link to comment
Share on other sites

  • 8 months later...
  • 9 months later...
  • 3 years later...
  • 6 months later...

I have realized that the above mentioned technique does not work for shadows that should be occluded from the shadow catcher.

I have updated the hipfile to simulated this scenario.

 

Image attached: all elements, shadow caster (green cubes), shadow caster shadows (red), shadow catcher (set, grid and big yellow cube) and the overlay of the shadow pass onto the set.

As you can see the highlighted shadow is not correct, the shadow catcher (the set) should have "blocked" that shadow from happening.

 

Any workarounds or totally different approach please?

 

Thanks.

shadow_catch__0.jpg

shadow_catch__1.jpg

shadow_catch__2.jpg

shadow_catch__3.jpg

shadow_catch__4.jpg

shadow_catcher_v010.hip

  • Like 1
Link to comment
Share on other sites

a clarification: this is happening because of the technique used.

The shadow catcher is excluded from the shadow mask parm of the key light in order to prevent self shadowing.

By doing this though the shadow catcher will not be consider as an occluder of the lightsource, hence letting the shadow from the caster drop multiple times on the catcher.

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

Solved it!

Just generate a shadow_catcher_shadow pass (Mantra: extra image planes / direct shadows, 1 light rays, reflection limit zero (no bounces) )

image.png.112838b1d2293cf5608f614c03b6ae27.png

Multiply the inverse of it with the shadow_caster_shadow (red). 

image.png.1a731886c45cf44149c3e2925bf47200.png

Use the result as shadow pass. 

 

I will provide an updated hip file with example as soon as I have the chance.

 

 

 

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...