kMotion icon indicating copy to clipboard operation
kMotion copied to clipboard

Help needed

Open UserUser510 opened this issue 2 years ago • 3 comments

kMotion doesn't work, even after applying @EsiNikko's hotfixes, and I keep getting these warning logs:

CommandBuffer: temporary render texture _CameraColorTexture not found while executing Motion Blur (Blit source)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

and

CommandBuffer: temporary render texture _CameraColorTexture not found while executing Motion Blur (Blit destination)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

Is there a way to fix this issue? (2021.3.6f1)

UserUser510 avatar Nov 14 '22 14:11 UserUser510

I‘m using 2021.3.6f1 and also applied @EsiNikko's hotfixes. Try following steps:

  1. In MotionBlurRenderPass.cs

    // comment out this line, and use next line
    // var colorTextureIdentifier = new RenderTargetIdentifier("_CameraColorTexture");
    var colorTextureIdentifier = renderingData.cameraData.renderer.cameraColorTarget;
    
  2. Note Unity 2021.3.6f1 already include source code of kMotion, with same shader name but slightly different implementation (What a surprise!). So Shader.Find() may result finding the wrong version of kMotion shader. Change shader name in 1st line of CameraMotionVectors.shader and ObjectMotionVectors.shader. Then In MotionVectorRenderPass.cs, change these lines:

    const string kCameraShader = "Hidden/kMotion/CameraMotionVectors";   // use new shader name
    const string kObjectShader = "Hidden/kMotion/ObjectMotionVectors";   // use new shader name
    
  3. In ObjectMotionVectors.shader, comment out following lines once you see redefinition warning in Editor log.

    float4x4 unity_MatrixPreviousM;
    float4 unity_MotionVectorsParams;
    

caogtaa avatar Nov 16 '22 15:11 caogtaa

@caogtaa You are a savior! By downloading @EsiNikko 's version (link) and following all your steps, I got object-based motion blur working with Unity 2022.1.20f1 and URP 13.1.8 🙏

maxsamarin avatar Jan 31 '23 15:01 maxsamarin

I‘m using 2021.3.6f1 and also applied @EsiNikko's hotfixes. Try following steps:

  1. In MotionBlurRenderPass.cs
    // comment out this line, and use next line
    // var colorTextureIdentifier = new RenderTargetIdentifier("_CameraColorTexture");
    var colorTextureIdentifier = renderingData.cameraData.renderer.cameraColorTarget;
    
  2. Note Unity 2021.3.6f1 already include source code of kMotion, with same shader name but slightly different implementation (What a surprise!). So Shader.Find() may result finding the wrong version of kMotion shader. Change shader name in 1st line of CameraMotionVectors.shader and ObjectMotionVectors.shader. Then In MotionVectorRenderPass.cs, change these lines:
    const string kCameraShader = "Hidden/kMotion/CameraMotionVectors";   // use new shader name
    const string kObjectShader = "Hidden/kMotion/ObjectMotionVectors";   // use new shader name
    
  3. In ObjectMotionVectors.shader, comment out following lines once you see redefinition warning in Editor log.
    float4x4 unity_MatrixPreviousM;
    float4 unity_MotionVectorsParams;
    

thanks

UserUser510 avatar Sep 08 '23 13:09 UserUser510