16101301(MaterialLOD QualitySwitch)
【目标】
MaterialLOD QualitySwitch
【思路】
1 QualitySwitch
UE4有三挡
UE3
2 现在UE3需要添加三挡
3
UE3
class UMaterialExpressionQualitySwitch : public UMaterialExpression
{
public:
//## BEGIN PROPS MaterialExpressionQualitySwitch
FExpressionInput High;
FExpressionInput Low;
4
【步骤】
1 修改UMaterialExpressionQualitySwitch
\ue3\Development\Src\Engine\Classes\MaterialExpressionQualitySwitch.uc
var ExpressionInput High;
var ExpressionInput Mid;
var ExpressionInput Low;
2 修改EMaterialShaderQuality 添加中级
enum EMaterialShaderQuality
{
MSQ_HIGH =0,
MSQ_MID =1,
MSQ_LOW =2,
MSQ_MAX =3,
// Terrain only supports high quality
MSQ_TERRAIN =MSQ_HIGH,
// Use an invalid value for default value to functions when not specifying a quality
MSQ_UNSPECIFIED =MSQ_MAX,
};
3 修改\ue3\Development\Src\Engine\Classes\Material.uc
var const native duplicatetransient pointer MaterialResources[3]{FMaterialResource};
修改UMaterial.MaterialResources 相关的
4 UMaterial.Serialize中有序列化的东西
还是要添加个版本号
EUnrealEngineObjectVersion
// - Add MaterialShaderQuality Mid
VER_UNIFORM_EXPRESSIONS_IN_SHADER_CACHE = 872,
UMaterial.Serialize
if (
QualityIndex < 2 || // MaterialResources's old size is 2
(QualityIndex >=2 && Ar.Ver() >= VER_ADD_EXPRESSIONS_SHADERQUALITY_MID)
)
{
// Serialize the material resource.
MaterialResources[QualityIndex]->Serialize(Ar);
if (Ar.Ver() < VER_UNIFORM_EXPRESSIONS_IN_SHADER_CACHE)
{
// If we are loading a material resource saved before texture references were managed by the material resource,
// Pass the legacy texture references to the material resource.
MaterialResources[QualityIndex]->AddLegacyTextures(ReferencedTextures_DEPRECATED);
// Empty legacy texture references on load
ReferencedTextures_DEPRECATED.Empty();
}
}
4 修改MSQ_MAX 相关的
UMaterialInstance.StaticPermutationResources
UMaterialInstance.StaticParameters
\ue3\Development\Src\Engine\Classes\MaterialInstance.uc 改成3个
/**
* The set of static parameters that this instance will be compiled with.
* This is indexed by EMaterialShaderPlatform.
* Only the first entry is ever used now that SM2 is no longer supported,
* But the member is kept as an array to make adding future material platforms easier.
* The second entry is to work around the script compile error from having an array with one element.
*/
var const native duplicatetransient pointer StaticParameters[3]{FStaticParameterSet};
/**
* The material resources for this instance.
* This is indexed by EMaterialShaderPlatform.
* Only the first entry is ever used now that SM2 is no longer supported,
* But the member is kept as an array to make adding future material platforms easier.
* The second entry is to work around the script compile error from having an array with one element.
*/
var const native duplicatetransient pointer StaticPermutationResources[3]{FMaterialResource};
上面直接改uc数组大小的方式 貌似会有问题,序列化会出问题
make报错
手动改h文件 编译exe 再修改uc,make
5 修改FSystemSettings.bAllowHighQualityMaterials 相关
添加一个新的成员
/** Materials Quality Level */
INT QualityMaterialsLevel;
/** Materials Quality Level */
{ SST_INT, SSI_SCALABILITY, TEXT( "QualityMaterialsLevel" ), &GSystemSettings.QualityMaterialsLevel, &VSSMaterilQuality, TEXT( "Materials Quality Level." ) },
FSystemSettings.ApplySettings
// Reattach components if world-detail settings have changed.
if( OldSystemSettings.DetailMode != DetailMode ||
OldSystemSettings.bAllowHighQualityMaterials != bAllowHighQualityMaterials ||
OldSystemSettings.QualityMaterialsLevel != QualityMaterialsLevel)
{
在BaseSystemSettings.ini配置
QualityMaterialsLevel=0
ExampleSystemSettings.ini同理
6 UMaterialInterface.GetDesiredQualityLevel
Quality = GSystemSettings.bAllowHighQualityMaterials ? MSQ_HIGH : MSQ_LOW;
改为
Quality = EMaterialShaderQuality(GSystemSettings.QualityMaterialsLevel);
FMaterial.CacheShaders
if (Quality == MSQ_UNSPECIFIED)
{
Quality = GSystemSettings.bAllowHighQualityMaterials ? MSQ_HIGH : MSQ_LOW;
}
改为
if (Quality == MSQ_UNSPECIFIED)
{
Quality = EMaterialShaderQuality(GSystemSettings.QualityMaterialsLevel);
}
7 修改Material切换按钮响应
void WxEditorFrame::MenuMaterialQualityToggle( wxCommandEvent& In )
{
// to be safe, we wait until rendering thread is complete
FlushRenderingCommands();
// toggle the system setting, mimicing what the console command does - it would be nice
// if system settings had a function interface instead of console commands
// GSystemSettings.bAllowHighQualityMaterials ^= 1;
GSystemSettings.QualityMaterialsLevel ++;
if (GSystemSettings.QualityMaterialsLevel >= EMaterialShaderQuality::MSQ_MAX)
GSystemSettings.QualityMaterialsLevel = EMaterialShaderQuality::MSQ_HIGH;
8 显示出Quality值到编辑器
WxMaterialEditorBase.DrawMaterialInfoStrings.
FLinkedObjDrawUtils::DrawShadowedString(
Canvas,
5,
DrawPositionY,
*FString::Printf(TEXT("Quality[%d] DrawCall: %d Instructions: %d DrawTime:%.6f ms"),
GSystemSettings.QualityMaterialsLevel,
PreviewMeshComponent->LastDrawCalls,PreviewMeshComponent->GetUsedMaterialsInstructionCounts(),PreviewMeshComponent->LastDrawTimes),
FontToUse,
FLinearColor(0.8,1,1)
);
9
scale set QualityMaterialsLevel 0-2
【运行】
"/cgi-bin/micromsg-bin/auth";
"/cgi-bin/micromsg-bin/sendmsg";
"/cgi-bin/micromsg-bin/sync";
"/cgi-bin/micromsg-bin/uploadmsgimg";
"/cgi-bin/micromsg-bin/getmsgimg";
"/cgi-bin/micromsg-bin/init";
"/cgi-bin/micromsg-bin/getupdatepack";
"/cgi-bin/micromsg-bin/searchfriend";
"/cgi-bin/micromsg-bin/getinvitefriend";
3
16101301(MaterialLOD QualitySwitch)的更多相关文章
- git-简单流程(学习笔记)
这是阅读廖雪峰的官方网站的笔记,用于自己以后回看 1.进入项目文件夹 初始化一个Git仓库,使用git init命令. 添加文件到Git仓库,分两步: 第一步,使用命令git add <file ...
- 读书笔记:JavaScript DOM 编程艺术(第二版)
读完还是能学到很多的基础知识,这里记录下,方便回顾与及时查阅. 内容也有自己的一些补充. JavaScript DOM 编程艺术(第二版) 1.JavaScript简史 JavaScript由Nets ...
- Recurrent Neural Network系列1--RNN(循环神经网络)概述
作者:zhbzz2007 出处:http://www.cnblogs.com/zhbzz2007 欢迎转载,也请保留这段声明.谢谢! 本文翻译自 RECURRENT NEURAL NETWORKS T ...
- 谈谈一些有趣的CSS题目(十二)-- 你该知道的字体 font-family
开本系列,谈谈一些有趣的 CSS 题目,题目类型天马行空,想到什么说什么,不仅为了拓宽一下解决问题的思路,更涉及一些容易忽视的 CSS 细节. 解题不考虑兼容性,题目天马行空,想到什么说什么,如果解题 ...
- RxJS + Redux + React = Amazing!(译一)
今天,我将Youtube上的<RxJS + Redux + React = Amazing!>翻译(+机译)了下来,以供国内的同学学习,英文听力好的同学可以直接看原版视频: https:/ ...
- ASP.NET Core 中文文档 第四章 MVC(3.8)视图中的依赖注入
原文:Dependency injection into views 作者:Steve Smith 翻译:姚阿勇(Dr.Yao) 校对:孟帅洋(书缘) ASP.NET Core 支持在视图中使用 依赖 ...
- 从0开始搭建SQL Server AlwaysOn 第三篇(配置AlwaysOn)
从0开始搭建SQL Server AlwaysOn 第三篇(配置AlwaysOn) 第一篇http://www.cnblogs.com/lyhabc/p/4678330.html第二篇http://w ...
- 恢复SQL Server被误删除的数据(再扩展)
恢复SQL Server被误删除的数据(再扩展) 大家对本人之前的文章<恢复SQL Server被误删除的数据> 反应非常热烈,但是文章里的存储过程不能实现对备份出来的日志备份里所删数据的 ...
- 浅谈WEB页面提速(前端向)
记得面试现在这份工作的时候,一位领导语重心长地谈道——当今的世界是互联网的世界,IT企业之间的竞争是很激烈的,如果一个网页的加载和显示速度,相比别人的站点页面有那么0.1秒的提升,那也是很大的一个成就 ...
随机推荐
- 获取去除参数url地址
获取url地址除去?后的链接地址 var url = "12345.htm?x=666&y=777"; if(url.indexOf("?") != - ...
- 【前端】CommonJS的模块加载机制
CommonJS的模块加载机制 CommonJS模块的加载机制是,输入的是被输出的值的拷贝.也就是说,一旦输出一个值,模块内部的变化就影响不到这个值. 例如: // lib.js var counte ...
- 如何运用CSS写小三角
<html> <div class="con"></div> </html> <style> .con{width:0; ...
- vue.js存储--localStorage
//list例子:绑定从localStorage中读取的数据,动态添加list并监听将数据变化存储在localStorage中,绑定点击事件改变样式, 页面 data数据: input_name:'' ...
- HTTP 错误 403.14 - Forbidden Web 服务器被配置为不列出此目录的内容
今天把一个.NET的网站部署到IIS上打开网页的时候出现了这个错误,刚开始以为是没有配置默认页,但是直接打开固定的页面地址也不行. 于是怀疑是.NET版本的问题,但是看了一下程序的目标框架是4.0没错 ...
- HDFS体系架构
Master-slaver结构,namenode是中心服务器维护着文件系统树和整个树内的文件目录, 负责整个数据集群的管理.datanode分布在不同的机架上,在客户端和namenode的调度下 存储 ...
- [OC]UILabel 文字长的截断方式
Tip: 参考文档:http://blog.csdn.net/reylen/article/details/21012859 @property(nonatomic) NSLineBreakMode ...
- Sublime Text 3 提高工作效率的使用技巧
Sublime Text 3对于Sublime Text 2压倒性的优势就是秒启动,启动非常非常快,所以从2012年到2016年我一直用Sublime Text 2,但是安装了3并且启动试用后,我再也 ...
- 图解MySQL5.5详细安装与配置过程
MySQL是一个开源的关系型数据库管理系统,原由瑞典MySQL AB公司开发,目前属于Oracle公司旗下.MySQL是目前世界上开源数据库中最受欢迎的产品之一,是应用最为广泛的开源数据库.MySQL ...
- Openfire Strophe IE跨域问题
Openfire和Strophejs网站 域名不同如何进行通信,这个问题总算解决,下面是解决步骤. 解决方案一: Chrome浏览器默认支持跨域访问 IE浏览器需要做配置:点击IE浏览器的的“工具-& ...