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

来自为知笔记(Wiz)

时间: 2024-08-12 08:54:29

16101301(MaterialLOD QualitySwitch)的相关文章

华为交换机配置telnet和SSH登录设备(简单实用版)

Telnet是Internet远程登陆服务的标准协议和主要方式.它为用户提供了在本地计算机上完成远程主机工作的能力.在终端使用者的电脑上使用telnet程序,用它连接到服务器.终端使用者可以在telnet程序中输入命令,这些命令会在服务器上运行,就像直接在服务器的控制台上输入一样.可以在本地就能控制服务器.要开始一个telnet会话,必须输入用户名和密码来登录服务器.Telnet是常用的远程控制Web服务器的方法,极大的提高了用户操作的灵活性. 测试拓扑图 配置telnet: 1.1普通认证登录

Java程序性能分析工具Java VisualVM(Visual GC)—程序员必备利器

VisualVM 是一款免费的\集成了多个JDK 命令行工具的可视化工具,它能为您提供强大的分析能力,对 Java 应用程序做性能分析和调优.这些功能包括生成和分析海量数据.跟踪内存泄漏.监控垃圾回收器.执行内存和 CPU 分析,同时它还支持在 MBeans 上进行浏览和操作. 在内存分析上,Java VisualVM的最大好处是可通过安装Visual GC插件来分析GC(Gabage Collection)趋势.内存消耗详细状况. 一  Visual GC(监控垃圾回收器) Java Visu

静态网页框架设计首次体验(文章改)

根据教材与上网成功解决了Tomcat与Myeclipse的安装,同时熟悉了Java web创建项目到部署运行整个过程.今天起正式开始学习有关Java web的编程部分.Java web静态网页(HTML网页)的标记含义.基本语法的介绍到框架设计基本模板与案例,今天的学习的内容,让网页编程有了一个初步的框架.结合自身所在协会的情况,计划制作一个关于协会的网页,已有初步想法,望通过学习不断完善和修改协会网站.根据今天所学,并参考书本30页框架设计案例对网页进行初步搭建. 具体代码如下 TW.jsp:

Windows10 使用Virtual Box一启动虚拟机就蓝屏(错误代码SYSTEM_SERVICE_EXCEPTION)解决方案

原文:Windows10 使用Virtual Box一启动虚拟机就蓝屏(错误代码SYSTEM_SERVICE_EXCEPTION)解决方案 一打开虚拟机电脑就立马蓝屏重启,新建虚拟机也没用,然后就开始百度,百度上全说什么驱动不对,然后我就卸载升级各种驱动,然后各种重装VirtualBox,还是不行,搞了一两个小时,都快放弃了.决定上个google,终于看到一篇文章说是因为Hyper-V与Virtual Box冲突了,只需要在控制面板关闭就行.然后抱着试一试的心态. 首先我们先打开控制面板.按Wi

winform学习日志(二十三)---------------socket(TCP)发送文件

一:由于在上一个随笔的基础之上拓展的所以直接上代码,客户端: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Net.Sockets; using Sys

UWP-消息提示(仿Android)

原文:UWP-消息提示(仿Android) 在UWP中的消息提示框(一)中介绍了一些常见的需要用户主动去干涉的一些消息提示框,接下来打算聊聊不需要用户主动去干涉的一些消息提示框.效果就是像双击退出的那种提示框. 先说说比较简单的吧,通过系统Toast通知方式(和Android的Toast是有区别的额,更像Android里的Notification),关于这种方式,在这里就不贴代码了,MSDN上讲的很清楚(快速入门:发送 Toast 通知),需要注意的事作为应用内消息提示弹出框,应该不要带音效(有

iOS instruments之ui automation的简单使用(高手绕道)

最近使用了几次instruments中的automation工具,现记录下automation的简单使用方法,希望对没接触过自动化测试又有需求的人有所帮助.  UI 自动测试是iOS 中重要的附加功能,它由名为"Automation"的新的工具对象支持.Automation工具的脚本是用JavaScript语言编写,主要用于分析应用的性能和用户行为,模仿/击发被请求的事件,利用它可以完成对被测应用的简单的UI测试及相关功能测试. 一. 简单的录制脚本 打开xcode,这里用我为我家亲爱

Java小案例-(逃离迷宫)

一,迷宫需求描述: 1,用户输入迷宫图(限制方形):字母1位墙,0为通,e为出口,m为入口,*为已访问的位置,用外围1围住迷宫 2,运行轨迹右,左,下,上 3,判断该迷宫是否能从入口走到出口,并将搜索过程输出 二,迷宫实现: 1,迷宫元素类MazeCell: package smalldemo.maze; class MazeCell { public int x,y; public MazeCell(){ } public MazeCell(int x,int y){ this.x=x; th

【第二组】项目冲刺(Beta版本)第六次每日例会 2017/7/24

项目冲刺(Beta版本)第六次每日例会 开发小组:Hunter 冲刺经理:林贵渊 小组成员:林轩宇,张太,李明君,刘仁人 1.每日例会内容 (1)昨天做了什么 1.林轩宇:Button音效及服务器相关内容. 2.刘仁人:二维码制作. 3.张太:查找本地内容. 4.李明君:LOGO设计,Button美化. 5.林贵渊:本地内容整理优化. (2)遇到了什么问题 1.图像传输问题(林轩宇) 2.部分功能存在一些小BUG(李明君,林贵渊) 3.控件及界面优化(刘仁人,李明君) 4.玩家交互没有好的构想[