this works quite well, but when i turn on shadows, both projecting and receiving don’t work properly - shadow casting / receiving behaves as if the displacement didn’t occur.
is there a way to apply the same displacement in the shadow projection / receive code? i guess it has got to do with the AutoLight.cginc and UnityCG.cginc, but i’m a bit lost there - perhaps somebody can give me a hint where to change stuff?
thx a lot in advance
ps: the code also uses the uv coords of the mesh - hope that is available in the shadow code…
When shadows are done, they render scene geometry using special projector and collector passes. There are a few default ones (to handle things like alpha testing), but if you want something fancy like vertex displacement, you’ll have to write your own. Luckily, all the source for those functions is available (built-in source and UnityCg/AutoLight) and the engine will call them automatically as long as they’re tagged properly.
thanks for the prompt answers! one more question: is there any sample code for shadow collector passes? couldn’t find any in the builtin shaders… :?
edit: guess they are in the autolight.cginc, as has already been pointed out
so all i have to do for collectors is to insert some code in the shadow helpers, correct?