浏览代码

Merge pull request #278 from Unity-Technologies/node-bugfixes

Node bugfixes
/main
GitHub 7 年前
当前提交
16df8b10
共有 4 个文件被更改,包括 36 次插入2 次删除
  1. 2
      com.unity.shadergraph/Editor/Data/Nodes/Input/Scene/LightProbeNode.cs
  2. 2
      com.unity.shadergraph/Editor/Data/Nodes/Math/Basic/MultiplyNode.cs
  3. 2
      com.unity.shadergraph/ShaderGraphLibrary/ShaderVariables.hlsl
  4. 32
      com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl

2
com.unity.shadergraph/Editor/Data/Nodes/Input/Scene/LightProbeNode.cs


return
@"
{
Out = ShadeSH9(float4(Normal , 1));
Out = SampleSH(Normal);
}
";
}

2
com.unity.shadergraph/Editor/Data/Nodes/Math/Basic/MultiplyNode.cs


public sealed override void UpdateNodeAfterDeserialization()
{
AddSlot(new DynamicValueMaterialSlot(Input1SlotId, kInput1SlotName, kInput1SlotName, SlotType.Input, Matrix4x4.zero));
AddSlot(new DynamicValueMaterialSlot(Input2SlotId, kInput2SlotName, kInput2SlotName, SlotType.Input, new Matrix4x4(new Vector4(2,2,2,2), Vector4.zero, Vector4.zero, Vector4.zero)));
AddSlot(new DynamicValueMaterialSlot(Input2SlotId, kInput2SlotName, kInput2SlotName, SlotType.Input, new Matrix4x4(new Vector4(2,2,2,2), new Vector4(2,2,2,2), new Vector4(2,2,2,2), new Vector4(2,2,2,2))));
AddSlot(new DynamicValueMaterialSlot(OutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, Matrix4x4.zero));
RemoveSlotsNameNotMatching(new[] { Input1SlotId, Input2SlotId, OutputSlotId });
}

2
com.unity.shadergraph/ShaderGraphLibrary/ShaderVariables.hlsl


float4 unity_AmbientEquator;
float4 unity_AmbientGround;
float4 unity_IndirectSpecColor;
float4 unity_FogParams;
half4 unity_FogColor;
#if !defined(USING_STEREO_MATRICES)
float4x4 glstate_matrix_projection;

32
com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl


projMatrix._13_23_33_43 = -projMatrix._13_23_33_43;
}
#if UNITY_REVERSED_Z
#if SHADER_API_OPENGL || SHADER_API_GLES || SHADER_API_GLES3
//GL with reversed z => z clip range is [near, -far] -> should remap in theory but dont do it in practice to save some perf (range is close enough)
#define UNITY_Z_0_FAR_FROM_CLIPSPACE(coord) max(-(coord), 0)
#else
//D3d with reversed Z => z clip range is [near, 0] -> remapping to [0, far]
//max is required to protect ourselves from near plane not being correct/meaningfull in case of oblique matrices.
#define UNITY_Z_0_FAR_FROM_CLIPSPACE(coord) max(((1.0-(coord)/_ProjectionParams.y)*_ProjectionParams.z),0)
#endif
#elif UNITY_UV_STARTS_AT_TOP
//D3d without reversed z => z clip range is [0, far] -> nothing to do
#define UNITY_Z_0_FAR_FROM_CLIPSPACE(coord) (coord)
#else
//Opengl => z clip range is [-near, far] -> should remap in theory but dont do it in practice to save some perf (range is close enough)
#define UNITY_Z_0_FAR_FROM_CLIPSPACE(coord) (coord)
#endif
half3 SampleSH(half3 normalWS)
{
// LPPV is not supported in Ligthweight Pipeline
real4 SHCoefficients[7];
SHCoefficients[0] = unity_SHAr;
SHCoefficients[1] = unity_SHAg;
SHCoefficients[2] = unity_SHAb;
SHCoefficients[3] = unity_SHBr;
SHCoefficients[4] = unity_SHBg;
SHCoefficients[5] = unity_SHBb;
SHCoefficients[6] = unity_SHC;
return max(half3(0, 0, 0), SampleSH9(SHCoefficients, normalWS));
}
#endif // UNITY_SHADER_VARIABLES_FUNCTIONS_INCLUDED
正在加载...
取消
保存