Jump to content
StepbyStepVFX

SelfShadowing for objects having the same material...

Recommended Posts

Hello,

This is not really a new topic, but I never found any convincing answer to it.

Here is the scene : (i) a ground plane A which has a shadowmatte shader applied into it; (ii) a cube B that also has the same shadowmatte material applied to it and (iii) a volume having the form of a sphere C to which a billowysmoke material is applied (for fun, I could have taken a solid with a classic shader).

I want B to cast shadows on C but not on A; I want simultaneously to have C to cast shadows on A. Said otherwise, I would like that all objects having the shadowmatte applied onto them cast and receive shadows onto / from objects having a different material, and avoid any "selfshadowing" ("self" being understood as objects having this same shader applied onto them)

Therefore, saying B don't cast shadows don't work, neither saying A don't receive shadows. By the way, it seems that all masks options can't work in this situation, nor making groups.

It seems to me that it would requires to change the code of the shader, so that when a ray hits a surface, it should "understand" what was the previous surface he was bouncing from and get its shader name, to know if ultimately it can be considered a shadow ray or not... Being quite weak in shading, I may express that very badly, but in short : does anyone knows any tricks to solve the problem above ?

The only way I can get what I want is through having different passes / AOV with masks and solve that in comp. But a one shot solution would make gain some time :-)

selfShadowingTest.hip

Share this post


Link to post
Share on other sites

Hi, 

having different passes is the way to go. currently, i don't think there is more straightforward way to do such a thing (in Mantra). Objects can be excluded from casting or receiving shadows but that always work globally for all objects in the scene. you would have do some shader coding for what you want (as you figured out yourself).

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, davpe said:

Hi, 

having different passes is the way to go. currently, i don't think there is more straightforward way to do such a thing (in Mantra). Objects can be excluded from casting or receiving shadows but that always work globally for all objects in the scene. you would have do some shader coding for what you want (as you figured out yourself).

Thanks David, I was hoping some magicians would have some good tricks :-)

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×