How to get the camera vector in the shadow pass?

The most I can get its the forward vector, but it only matches the camera vector in the directional lights(Transforming (1,0,0) from view space to world). I had tested view property but it allways outputs the player camera settings(despite description says it should work).

I am experimenting with signed distance functions and Im stuggling to make the objects cast apropiate shadows.

bump!!!

TransformVector and TransformPosition material expressions have ViewSpace and CameraSpace option. Use the first one and it will work correctly in shadow pass.

Trying to transform the cameravector from world space to view space doesnt give the right results. Im trying to get the “shadowmap camera UVs”, tried diffrent methods, none of them work. I must be forgetting something. So far the most “logic” tries were:
-Transforming camera vector from world to view
-Transforming Normalize(WorldPosition - ViewPosition) from world space to view

All the coords I get moves when I move or rotate the camera.

Camera vector in shadow view is world position, transformed to from world to view space and normalized and multiplied by minus one. In that order.

I have tested that, with World position and camera vector, and none of them work. The shadow still relative to world (0,0,0) or playerCameraPosition.

Results in the adjunted images.

Bump!!!


I transform the vertex normal from WS to tangent space to improvise a fresnel. Hope it helps.