Wednesday, 8 May 2019

Using custom shader results in black image

I use unity 2018.3.5f1. I would like to overlay a custom shader while rendering an image. Following is my onRenderImage Function.

void OnRenderImage(RenderTexture src, RenderTexture dest) {
        // shaderMaterial renders the image with Barrel distortion and disparity effect
        Graphics.Blit(camTextureHolder.mainTexture, nullRenderTexture, shaderMaterial);

        // measure average frames per second
        m_FpsAccumulator++;
        if (Time.realtimeSinceStartup > m_FpsNextPeriod) {
            m_CurrentFps = (int)(m_FpsAccumulator / fpsMeasurePeriod);
            m_FpsAccumulator = 0;
            m_FpsNextPeriod += fpsMeasurePeriod;
        }
    }

The issue is that the entire screen appears to be black while I'm trying to do so. May I know how do I fix this issue?



from Using custom shader results in black image

No comments:

Post a Comment