jjk_by
2017-12-04 05:28求教,Unity3D 如何 截屏高于分辨率 的 texture
比如用unity3D导出的应用跑4K分辨率,想截取左下4分之一屏的 保存一张 texture,分辨率也为4K,有没有大神知道??
使用ScreenCapture.CaptureScreenshot() 虽然能整体放大数倍,但是无法设置具体的截图范围和大小。
类似以下方法可截取自己设定的位置和大小,但是大小无法大于当前应用运行 的分辨率。
IEnumerator SavePhoto(Rect rect,string name)
{
yield return new WaitForEndOfFrame();
Texture2D t = new Texture2D(rect.width, rect.height);
t.ReadPixels(new Rect(0, 0, rect.width, rect.height), 0, 0, false);
//距X左的距离 距Y屏上的距离
// t.ReadPixels(rect, 0, 0, false);
t.Apply();
byte[] byts = t.EncodeToJPG(100);
File.WriteAllBytes(path_Save + name + ".jpg", byts);
}
- 点赞
- 回答
- 收藏
- 复制链接分享
1条回答
为你推荐
- 渲染与单遍渲染不同
- framebuffer
- opengl
- 1个回答
- Go:函数回调返回接口的实现
- return-value
- return-type
- callback
- interface
- 1个回答
- Unity将图像上载到服务器,但Codeigniter不起作用
- codeigniter
- php
- unity3d
- c#
- 2个回答
- 如何将数据库中的多个图像显示为统一
- mysql
- php
- unity3d
- c#
- 1个回答
- unity怎么读取动态加载的图片的像素颜色
- 权限
- 4个回答
换一换