Jump to content

Shadow without displace


Recommended Posts

You could try by copying your normals attribute to another one in sops, create an attribute containing your points position, then bring those attribute in your shader as parameters. You could then replace your "N" variable in the shader with your own normal attribute, and replace the "l" variable by subtracting the camera position to your own position attributes. This way you can "shade" and get the shadows of the undisplaced geometry in your displaced one...

Hope that makes sense..

Cheers,

nico

//edit:

Of course this works only for the shadows on your object, if you are looking for doing that with the shadows projected on the others objects,You may want to try it by excluding your object from shadows and use a copy of it with no shader and render it as phantom object... Or use different passes

Edited by Div
Link to comment
Share on other sites

As far as I know, displacement shaders are run before surface/shadow shaders (I believe the order is displacement->surface->light->shadow->fog, though surface, light, and shadow could happen concurrently). So, if that's true, then I don't think you'll be able to compute shadows and then displace (no matter what non-surface position you choose to do your calculations from).

But just in case that what you're trying to do is to remove self-shadowing from a shadow pass (like from a shadow matte shader), then yes, this is an issue that I brought up during the H11 Alpha period, and it's a real problem -- we're mostly interested in cast shadows during a shadow pass, not self-shadows, and the current ShadowMatte shader doesn't distinguish between the two. Anyway; it's an acknowledged RFE, but I don't think it made it for the release.

I still have the files from the Alpha post, so I'm attaching that here (the code for the "NewShadowMatte" shader is embedded in the hip file). This is a sketch for one possible way to get around the problem (actually there are 3 approaches in the code, but only one is active). It should work for either traced or mapped shadows (switch the L_Sun light between the two shadow types to check).

Even if it's not exactly what you were looking for, it might come in handy for someone else, so I thought I'd post it anyway, since it's already "public". :)

A few images showing the existing problem with the factory shadowmatte shader, and then the results from one of the solutions proposed in the sketch:

post-148-128469864021_thumb.jpg

ShadowMatte.017.hip

HTH.

Link to comment
Share on other sites

Thank you for your answers!

Unfortunately since we want to get rid of some self shadowing, simply calculating shading from the original point doesn't solve our problem.

I will check Mario's shader to see if it can be adapted to our situation. (it's a fractured object with lot of pieces, so the meaning of "self" is not that clear, as if the pieces would be separate objects.

Thanks again

bmt

Edited by beeemtee
Link to comment
Share on other sites

Thank you for your answers!

Unfortunately since we want to get rid of some self shadowing, simply calculating shading from the original point doesn't solve our problem.

I will check Mario's shader to see if it can be adapted to our situation. (it's a fractured object with lot of pieces, so the meaning of "self" is not that clear, as if the pieces would be separate objects.

Thanks again

bmt

You could duplicate the object, then on one of them turn On Phantom and Off displacements, and exclude the displaced object from the light's shadows. If the displacement goes In as well as out the un-displaced mesh will cause shadows in the cavities of the displaced mesh, but then you could duplicated the light and use the light/shadow masks to rig up whatever combination.

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