浏览代码

HDRenderPipeline: Add a command to update SSS material

/Yibing-Project-2
sebastienlagarde 7 年前
当前提交
9e164ff0
共有 1 个文件被更改,包括 50 次插入1 次删除
  1. 51
      ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineMenuItems.cs

51
ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineMenuItems.cs


using System.IO;
using System.IO;
using UnityEngine;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Experimental.Rendering.HDPipeline;

i / (float)(length - 1));
HDEditorUtils.ResetMaterialKeywords(mat);
}
}
finally
{
EditorUtility.ClearProgressBar();
}
}
[MenuItem("HDRenderPipeline/Update/Update SSS profile indices")]
static void UpdateSSSProfileIndices()
{
try
{
var materials = Resources.FindObjectsOfTypeAll<Material>();
for (int i = 0, length = materials.Length; i < length; i++)
{
EditorUtility.DisplayProgressBar(
"Setup materials Keywords...",
string.Format("{0} / {1} materials SSS updated.", i, length),
i / (float)(length - 1));
if (materials[i].shader.name == "HDRenderPipeline/LitTessellation" ||
materials[i].shader.name == "HDRenderPipeline/Lit")
{
float fvalue = materials[i].GetFloat("_MaterialID");
if (fvalue == 0.0) // SSS
{
int ivalue = materials[i].GetInt("_SubsurfaceProfile");
materials[i].SetInt("_SubsurfaceProfile", ivalue + 1);
}
EditorUtility.SetDirty(materials[i]);
}
else if ( materials[i].shader.name == "HDRenderPipeline/LayeredLit" ||
materials[i].shader.name == "HDRenderPipeline/LayeredLitTessellation")
{
float fvalue = materials[i].GetFloat("_MaterialID");
if (fvalue == 0.0) // SSS
{
int numLayer = (int)materials[i].GetFloat("_LayerCount");
for (int x = 0; x < numLayer; ++x)
{
int ivalue = materials[i].GetInt("_SubsurfaceProfile" + x);
materials[i].SetInt("_SubsurfaceProfile + x", ivalue + 1);
}
EditorUtility.SetDirty(materials[i]);
}
}
}
}
finally

正在加载...
取消
保存