关于RenderTarget纹理大小的问题

[复制链接]
查看4772 | 回复10 | 2016-10-20 17:53:59 | 显示全部楼层 |阅读模式
本帖最后由 yql0105 于 2016-10-21 10:32 编辑

我在我的场景中做了一个镜面的效果,使用的SceneCapture2D组件渲染到一张RenderTarget上再作为模型贴图放到场景模型上去。
但我发现当我将RenderTarget的大小设置的超过1920*1080(我设置的是2048*2048)的时候,不用编辑器模式(使用客户端进程连接服务器)运行的时候,场景会变的很卡,当然用编辑器模式运行也会有点卡只是不是那么明显。
后来我将客户端日志打出来后发现是系统渲染的时候一直不停地在重新分配RenderTarget的大小,差不多是每隔1帧就会重新分配RenderTarget的大小为1920*1080然后再分配为2048*2048,具体日志如下:
LogRenderer:Reallocating scene render targets to support 1920x1080 (Frame:371).
LogRenderer:Reallocating scene render targets to support 2048x2048 (Frame:371).LogRenderer:Reallocating scene render targets to support 1920x1080 (Frame:373).
LogRenderer:Reallocating scene render targets to support 2048x2048 (Frame:373).
LogRenderer:Reallocating scene render targets to support 1920x1080 (Frame:375).
LogRenderer:Reallocating scene render targets to support 2048x2048 (Frame:375).
LogRenderer:Reallocating scene render targets to support 1920x1080 (Frame:377).
LogRenderer:Reallocating scene render targets to support 2048x2048 (Frame:377).
LogRenderer:Reallocating scene render targets to support 1920x1080 (Frame:379).
LogRenderer:Reallocating scene render targets to support 2048x2048 (Frame:379)....
如果设置RenderTarget大小小于1920*1080就不会出现以上的问题和log,蓝瘦香菇,求大神帮忙看一下这是什么问题导致的,该如何解决





yuemingxishan | 2016-10-20 22:27:35 | 显示全部楼层
同样关注这个东,帮顶一下!
回复 支持 反对

使用道具 举报

boxe | 2016-10-20 23:13:15 | 显示全部楼层
可以 这样的贴顶起来 很实用的
回复 支持 反对

使用道具 举报

gaoshuo | 2016-10-21 09:48:19 | 显示全部楼层
6666666666666666
回复 支持 反对

使用道具 举报

yql0105 | 2016-10-21 10:27:43 | 显示全部楼层
已经解决非常卡的问题
根据4L发的网址中的一个解决方案,将配置文件
YourProject/Config/DefaultEngine.ini -> Script/Engine/RenderSettings

and Add:

r.SceneRenderTargetResizeMethod=2
r.SceneCaptureResizeMethod=1

现在已经不是那么的卡了,但是帧数仍然不高,继续优化吧
回复 支持 反对

使用道具 举报

yql0105 | 2016-10-21 11:28:30 | 显示全部楼层
后来我发现在Engine代码SceneCapture.cpp中第208行有这样一段注释:
    //NOTE: ikrimae: Ensure that the main gameview is > CaptureWidth x CaptureHeight. Bug in UE4 that won't re-alloc scene render targets to the correct size
    //               when the scenecapture component > current window render target. https://answers.unrealengine.com ... max-resolution.html
    //TODO: ikrimae: Ensure that r.SceneRenderTargetResizeMethod=2
所以看来这是ue4的一个BUG,就是不能将Capture的精度设置的超过窗口大小
回复 支持 反对

使用道具 举报

UnrealSyy | 2016-11-10 18:22:53 | 显示全部楼层
可以可以  很实用
回复 支持 反对

使用道具 举报

kiben4 | 2016-11-15 10:49:45 | 显示全部楼层
学习了~受教了!!!!
回复 支持 反对

使用道具 举报

bluemain | 2016-12-12 13:11:09 | 显示全部楼层
感谢分享问题
回复 支持 反对

使用道具 举报

lieque2016 | 2016-12-13 11:43:38 | 显示全部楼层
我去这个太好了啊
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

1

主题

2

回帖

231

积分

游客

积分
231