thx 4 reply, didnt see your reply when i make my last reply post yesterday, i will check out those repos later.
actually upon carrying on the code yesterday, i pass the data through propertyblock, and made non-skin renderer work (the RG output are the same just like the standard unity motion vector output).
but not really working with skin mesh renderer, must be something else needed to be sent for the skin renderer
the code is something like this :
_cam.RemoveCommandBuffer(CameraEvent.AfterForwardOpaque, _cb1);
_cb1.Clear();
_cb1.SetGlobalMatrix("_NonJitteredVP", no_jitter_vp);
_cb1.SetGlobalMatrix("_PreviousVP", vp_matt_prev);
_cb1.SetGlobalTexture("_TbCamDepthBuffer", _DepthBuffer);
_cb1.Blit(null, _MotionBuffer, _motVecMatt, 0);
_cb1.SetRenderTarget(_MotionBuffer, _DepthBuffer);
//_cb1.ClearRenderTarget(false, false, Color.black);
var count = _MotVecObjs.Length;
for (var i = 0; i < count; i++)
{
var rend = _MotVecObjs[i];
if (rend == null) continue;
var matts = rend.sharedMaterials;
if (matts == null) continue;
var isSkin = rend is SkinnedMeshRenderer;
var matt_count = matts.Length;
for (var j = 0; j < matt_count; j++)
{
var eaMatt = matts[j];
if (eaMatt == null) continue;
var usingPassName = isSkin ? "TbMotionVectors" : "TbMotionVectors_Camera";
//TbMotionVectors
var passIndex = eaMatt.FindPass("TbMotionVectors");
if (passIndex < 0) {
UnityEngine.Debug.LogWarning("Cannot Find Pass Name : TbMotionVectors");
continue;
}
//eaMatt.SetShaderPassEnabled("TbMotionVectors", false);
var trans = rend.transform;
PerObjectData_TbMotVec perObjData;
if (_perObjData_keeper.ContainsKey(rend))
perObjData = _perObjData_keeper[rend];
else {
perObjData = PerObjectData_TbMotVec.Default();
//_perObjData_keeper.Add(rend, perObjData);
}
MaterialPropertyBlock mb = new MaterialPropertyBlock();
mb.SetFloat("_ForceNoMotion", rend.motionVectorGenerationMode == MotionVectorGenerationMode.ForceNoMotion ? 1.0f : 0.0f);
mb.SetFloat("_HasLastPositionData", perObjData._HasLastPositionData ? 1.0f : 0.0f);
mb.SetFloat("_MotionVectorDepthBias", perObjData._MotionVectorDepthBias);
mb.SetMatrix("_PreviousM", perObjData._PreviousM);
rend.SetPropertyBlock(mb);
//eaMatt.SetFloat("_ForceNoMotion", rend.motionVectorGenerationMode == MotionVectorGenerationMode.ForceNoMotion ? 1.0f : 0.0f);
//eaMatt.SetFloat("_HasLastPositionData", perObjData._HasLastPositionData ? 1.0f : 0.0f);
//eaMatt.SetFloat("_MotionVectorDepthBias", perObjData._MotionVectorDepthBias);
//eaMatt.SetMatrix("_PreviousM", perObjData._PreviousM);
_cb1.DrawRenderer(rend, eaMatt, 0, passIndex);
//eaMatt.SetShaderPassEnabled("TbMotionVectors", false);
perObjData._PreviousM = trans.localToWorldMatrix;
perObjData._HasLastPositionData = false;
_perObjData_keeper[rend] = perObjData;
}
}
question remains :
what are [_HasLastPositionData] , [_MotionVectorDepthBias] ?

and [oldPos] ?
