浏览代码

Emission Support - Converted custom HLSL into Shadergraph Subgraph, and added that to the Toon Shadergraph

/UI
vanoverc 4 年前
当前提交
e5c6e42f
共有 4 个文件被更改,包括 137 次插入89 次删除
  1. 128
      UOP1_Project/Assets/Shaders/SubGraphs/Emission.shadersubgraph
  2. 62
      UOP1_Project/Assets/Shaders/Toon.shadergraph
  3. 27
      UOP1_Project/Assets/Shaders/CustomHLSL/CustomEmission.hlsl
  4. 9
      UOP1_Project/Assets/Shaders/CustomHLSL/CustomEmission.hlsl.meta

128
UOP1_Project/Assets/Shaders/SubGraphs/Emission.shadersubgraph
文件差异内容过多而无法显示
查看文件

62
UOP1_Project/Assets/Shaders/Toon.shadergraph
文件差异内容过多而无法显示
查看文件

27
UOP1_Project/Assets/Shaders/CustomHLSL/CustomEmission.hlsl


#ifndef CUSTOM_EMISSION_INCLUDED
#define CUSTOM_EMISSION_INCLUDED
/***********************************************************
* Emission_float scales an input color, InColor, based on the emission variables:
* bool Emission - Flag that tells shader to apply emission scaling
* float Intensity - The amount the scale InColor. Higher values = more emission
* float3 Mask - Texture mask to control areas of emission on the model. 0. (Black) = No Emission, 1. (White) = full Emission
* float3 InColor - Current value of the material before emission
* And outputs the desired color, OutColor
* float3 OutColor - Output color, masked to apply targeted emission, and scaled for intensity
***********************************************************/
void Emission_float(bool Emission, float Intensity, float3 Mask, float3 InColor, out float3 OutColor)
{
float minEmit = 0.;
float3 emit = Mask * Intensity; // Scale Emission Mask value by the Intensity
if(!Emission || (emit.r <= minEmit && emit.g <= minEmit && emit.b <= minEmit))
{
OutColor = InColor; // Don't do emission
}
else
{
OutColor = 1.5 + emit * InColor; // Do emission (Even black will emit at 1.5)
}
}
#endif

9
UOP1_Project/Assets/Shaders/CustomHLSL/CustomEmission.hlsl.meta


fileFormatVersion: 2
guid: 15cc213f25e6bdd4694946ad9ffc5890
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存