Is there a way to get sample with the offset in pixels relative to the screen in the screen coordinates?
I will try to multiply Offset on the “inverse” object transformation matrix for now.
You probably want to look into tangent space. You’ll need to convert the “light direction” from screen space, or maybe more simply from world space, into tangent space.
Shadows are faked - I just set the offset in pixels. No lights in the scene.
To make my question more short - I just want my “float4 sampleColor” to get some input parameter and offset in “world” pixels" and return the color which was there. What input parameters can I use? What will be inside that function?
I put “light direction” in quotes for a reason, your shadow offset is, in effect, a light direction. Tangent space is the technical term for “local UV direction”, most commonly used with normal maps and lighting, but you’re still asking for the same thing here where you want an on-screen pixel offset converted into a local UV position, and for that you need the starting UV position (which you have as the texcoord) plus an offset in UV space. When the polygon surface and screens space align then these are essentially the same thing, but when you rotate they don’t match and you get what you’re seeing, hence needing to convert from world / screen space into local UV space, aka tangent space.