分享

unity中graphs.blit使用问题

 mediatv 2024-03-09 发布于上海

在unity后处理回调函数OnPostImage函数中,直接用

Graphisc.blit(RenderTexture.active, myRendtexture) 会出现拷贝数据不正确的现象

不能进行纹理缩放,

解决方法:

          使用一个中间纹理处理:

        Graphics.blit(RenderTexture.active, myRendtexture1);

        Graphics.blit(myRendtexture1, myRendtexture);

这样可以使用带放缩的拷贝函数:

例如:

      Graphics.blit(myRendtexture1, myRendtexture, new Vector2(2,2), new Vector2(0,0));

new Vector2(2,2) 表示对原纹理缩小2倍到myRendtexture 中,然后使用ReadPixels读取到

cpu纹理的Texture2d纹理中

    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多