Unreal-BirthdayGift的技术拆解
文件操作
读取本地 JSON 文件
可以通过JSON Blueprint Utilities插件来实现。
Json | Unreal Engine Documentation
内嵌 HTML 网页
可以通过Web Browser插件来实现,制作一个 Web Browser 类型的 UI 控件,并设置其 url 属性。
教程:https://www.youtube.com/watch?v=k3hlRvGXi68
常见问题
如何添加到场景中?
将控件添加到 viewport 中才会生效。
注意直接添加到 viewport 中,默认是覆盖屏幕离用户最近的一层视图,而不是置于 3D 空间中。
如何将网页放置在 3D 空间中?
可以将网页控件和 Actor 绑定,然后通过调整 Actor,就可以调整网页在 3D 空间中的位置和大小了。
参考:https://forums.unrealengine.com/t/3d-widgets-rotation/429852
如果启动游戏后,在场景中看不到添加的网页,有一种可能是角度问题:网页是单面显示的,你可能是从网页的背面看过来的,就没有看到任何内容。
可以尝试将这个网页 actor 的 Z 轴旋转 180 度试试。
(TODO)嵌入的网页过度曝光怎么办?
控件闪烁怎么办?
这是因为深度测试(DepthTest)导致的。
在 detail 面板中,给控件的 Material 去掉 depth test 即可。
The material is called Widget3DPassThrough, you can find it in the Engine Content. Duplicate it, tick Disable Depth Test and assign it.
更换字体
很简单,拖进 Content 即可:
从哪里下载字体文件
播放视频
官方教程:
mp4 格式的视频无法播放
这是 DX12 的 BUG:
https://forums.unrealengine.com/t/video-wont-play-in-unreal-5-just-me/550994
解决方案就是修改项目的 RHI:
Go to project settings → Windows → Under Default RHI, select Default.
附:什么是 RHI?
RHI = Rendering Hardware Interface. It’s the C++ interface which the high-level platform-independent rendering code in Unreal Engine 4 uses to communicate with the several platform-dependent implementations that exist for Direct3D, OpenGL, etc.
Unreal has an abstraction layer (called RHI) above these platform-dependent apis, so it is able to use dx11 (soon dx12/vulkan) on windows, opengl (soon vulkan) on linux, metal on mac, etc
调整角色初始位置
修改 PlayerStart 的位置信息
更换角色模型
针对 UE 官方提供的虚幻争霸的模型,步骤很简单:
1、将模型加入项目,并重启项目(不重启项目,选择 Mesh 的地方有时候不会显示新模型的选项)
2、打开 Content/ThirdPerson/Blueprints/BP_ThirdPersonCharacter 蓝图,左侧菜单中选中 Mesh
3、右侧详情面板中更换 Mesh 和 Anim Class
如何平移动画到新模型
这个还没实践过:
绑定模型动画
通过参考自这个视频:
https://www.bilibili.com/video/BV164411R7BD?p=2&vd_source=1ddc293a4439c7106ebd7878040f7c81
音频可视化
效果:
UE4 入门教学感谢 CG 学习笔记
https://www.bilibili.com/video/BV1b741147fb
自发光教学感谢 UE4 丶阿文
https://www.bilibili.com/video/BV1u441187Rw?from=search&seid=5522083730863902403