I’m trying to calculate individual velocity of the vertex/pixel. As there are some other things involved in the material, I just want to make sure that custom expression is correct:
float4 clip = mul(float4(WSP.xyz,1), View.WorldToClip);
float4 prevclip = mul(clip, View.ClipToPrevClip);
float4 prevview = mul(prevclip, View.PrevClipToView);
float4 prevpos = mul(prevview, View.PrevInvViewProj);
return float3(prevpos.xyz);
WSP is Absolute World Space Position at current frame, the point of these transformations is to get world space location at previous frame. Maybe there is easier way or I’m missing something?