Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any workaround for HDRP? #21

Open
Seratonin opened this issue Jul 6, 2021 · 4 comments
Open

Any workaround for HDRP? #21

Seratonin opened this issue Jul 6, 2021 · 4 comments

Comments

@Seratonin
Copy link

Seratonin commented Jul 6, 2021

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);
}
@miraclestar
Copy link

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

@rrahim
Copy link

rrahim commented May 27, 2023

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

@miraclestar
Copy link

miraclestar commented Aug 24, 2023

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

sometimes will error

[UnityCapture] Error while reading texture image data

@rrahim
Copy link

rrahim commented Aug 24, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants