美文网首页
将RenderTexture转换为Texture2D,为了读取R

将RenderTexture转换为Texture2D,为了读取R

作者: yeer_is_me | 来源:发表于2017-05-09 02:16 被阅读0次

    The trick here is to create a new Texture2D, and then use the ReadPixels method to read the pixels from the RenderTexture to the Texture2D, like this:

    RenderTexture.active=myRenderTexture;
    myTexture2D.ReadPixels(newRect(0,0,myRenderTexture.width,myRenderTexture.height),0,0);
    myTexture2D.Apply();
    myTexture2D.getPixel(......);
    

    原理就是使用 Texture2D.ReadPixels 将当前(RenderTexture.active)纹理读取到 Texture2D中。

    相关文章

      网友评论

          本文标题:将RenderTexture转换为Texture2D,为了读取R

          本文链接:https://www.haomeiwen.com/subject/hxfbtxtx.html