beeemtee Posted September 16, 2010 Share Posted September 16, 2010 Hi, is it possible to calculate raytrace shadows so, that the displacement of the surface doesn't contribute to the occlusion check? To put it another way, what I'm trying to achieve is like calculating shadows before doing the displacement. thanks bmt Quote Link to comment Share on other sites More sharing options...
Div Posted September 17, 2010 Share Posted September 17, 2010 (edited) 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 September 17, 2010 by Div Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted September 17, 2010 Share Posted September 17, 2010 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: ShadowMatte.017.hip HTH. Quote Link to comment Share on other sites More sharing options...
beeemtee Posted September 17, 2010 Author Share Posted September 17, 2010 (edited) 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 September 17, 2010 by beeemtee Quote Link to comment Share on other sites More sharing options...
Serg Posted September 20, 2010 Share Posted September 20, 2010 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.