Jump to content

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

Link to comment
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
Link to comment
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 :-)

 

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...