UnityCapture icon indicating copy to clipboard operation
UnityCapture copied to clipboard

Any workaround for HDRP?

Open Seratonin opened this issue 3 years ago • 4 comments

I am looking to tweak the script to be compatible with HDRP. I heard there is a workaround by setting your camera to render to a RenderTexture. Can anyone help me modify this script with the following

public RenderTexture source;

private void Update()
{
    var tempRT = RenderTexture.GetTemporary(640, 480);
    Graphics.Blit(source, tempRT);

    switch (CaptureInterface.SendTexture(source, Timeout, DoubleBuffering, ResizeMode, MirrorMode))
    {
        case ECaptureSendResult.SUCCESS: break;
        case ECaptureSendResult.WARNING_FRAMESKIP: if (!HideWarnings) Debug.LogWarning("[UnityCapture] Capture device did skip a frame read, capture frame rate will not match render frame rate."); break;
        case ECaptureSendResult.WARNING_CAPTUREINACTIVE: if (!HideWarnings) Debug.LogWarning("[UnityCapture] Capture device is inactive"); break;
        case ECaptureSendResult.ERROR_UNSUPPORTEDGRAPHICSDEVICE: Debug.LogError("[UnityCapture] Unsupported graphics device (only D3D11 supported)"); break;
        case ECaptureSendResult.ERROR_PARAMETER: Debug.LogError("[UnityCapture] Input parameter error"); break;
        case ECaptureSendResult.ERROR_TOOLARGERESOLUTION: Debug.LogError("[UnityCapture] Render resolution is too large to send to capture device"); break;
        case ECaptureSendResult.ERROR_TEXTUREFORMAT: Debug.LogError("[UnityCapture] Render texture format is unsupported (only basic non-HDR (ARGB32) and HDR (FP16/ARGB Half) formats are supported)"); break;
        case ECaptureSendResult.ERROR_READTEXTURE: Debug.LogError("[UnityCapture] Error while reading texture image data"); break;
        case ECaptureSendResult.ERROR_INVALIDCAPTUREINSTANCEPTR: Debug.LogError("[UnityCapture] Invalid Capture Instance Pointer"); break;
    }

    RenderTexture.ReleaseTemporary(tempRT);
}

Seratonin avatar Jul 06 '21 13:07 Seratonin

have you done with this? I need use in HDRP too

miraclestar avatar Jul 07 '22 10:07 miraclestar

Has anyone figured out how to do this in URP or HDRP?

rrahim avatar May 27 '23 20:05 rrahim

RenderPipelineManager.endCameraRendering += OnEndFrameRendering; I use this to solve,but not stable;

sometimes will error

[UnityCapture] Error while reading texture image data

miraclestar avatar Aug 24 '23 02:08 miraclestar

Thanks, I'll test. But I need something stable though :(


From: miraclestar @.> Sent: Wednesday, August 23, 2023 10:28 PM To: schellingb/UnityCapture @.> Cc: rrahim @.>; Comment @.> Subject: Re: [schellingb/UnityCapture] Any workaround for HDRP? (#21)

[Uploading image.png…] I use this to solve,but not stable;

sometimes will error

[UnityCapture] Error while reading texture image data

— Reply to this email directly, view it on GitHubhttps://github.com/schellingb/UnityCapture/issues/21#issuecomment-1690895529, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADQ6VBK4ZCECPG2EQW2YJRDXW2357ANCNFSM474RUOHQ. You are receiving this because you commented.Message ID: @.***>

rrahim avatar Aug 24 '23 16:08 rrahim