mirror of
https://github.com/Eragon-Brisingr/UShaderLab.git
synced 2026-09-15 14:54:36 +00:00
115 lines
2.7 KiB
Plaintext
115 lines
2.7 KiB
Plaintext
// Copyright UShaderLab. All Rights Reserved.
|
|
// Shared struct definitions for ShaderLab-generated Custom HLSL nodes.
|
|
// Included by every generated UMaterialExpressionCustom node via IncludeFilePaths.
|
|
|
|
#pragma once
|
|
|
|
// Per-pixel/vertex inputs are read through `UE_NodeName(...)` intrinsics (resolved by the graph
|
|
// builder to real material expression nodes), not through a context struct.
|
|
|
|
// Surface description filled by the Surface(...) body. Defaults mirror the
|
|
// UMaterialExpressionSubstrateSlabBSDF pin defaults so that fields the body does not
|
|
// touch keep Substrate's native behavior.
|
|
struct FShaderLabSurface
|
|
{
|
|
float3 DiffuseAlbedo;
|
|
float3 F0;
|
|
float3 F90;
|
|
float Roughness;
|
|
float Anisotropy;
|
|
float3 Normal;
|
|
float3 Tangent;
|
|
float3 SSSMFP;
|
|
float SSSMFPScale;
|
|
float SSSPhaseAnisotropy;
|
|
float3 EmissiveColor;
|
|
float SecondRoughness;
|
|
float SecondRoughnessWeight;
|
|
float FuzzRoughness;
|
|
float FuzzAmount;
|
|
float3 FuzzColor;
|
|
float GlintValue;
|
|
float2 GlintUV;
|
|
float Opacity;
|
|
float OpacityMask;
|
|
};
|
|
|
|
// Output for the PostProcess(...) entry (Domain = PostProcess). Color feeds the material EmissiveColor.
|
|
struct FShaderLabPostProcess
|
|
{
|
|
float3 Color;
|
|
float Opacity;
|
|
};
|
|
|
|
// Output for the UI(...) entry (Domain = UI). Color feeds EmissiveColor, Opacity the material Opacity.
|
|
struct FShaderLabUI
|
|
{
|
|
float3 Color;
|
|
float Opacity;
|
|
};
|
|
|
|
// Vertex-stage outputs filled by the optional Vertex(...) body.
|
|
struct FShaderLabVertex
|
|
{
|
|
float3 WorldPositionOffset;
|
|
float Displacement;
|
|
float2 CustomizedUV0;
|
|
float2 CustomizedUV1;
|
|
float2 CustomizedUV2;
|
|
float2 CustomizedUV3;
|
|
};
|
|
|
|
FShaderLabSurface ShaderLabDefaultSurface()
|
|
{
|
|
FShaderLabSurface S;
|
|
S.DiffuseAlbedo = float3(0.18, 0.18, 0.18);
|
|
S.F0 = float3(0.04, 0.04, 0.04);
|
|
S.F90 = float3(1, 1, 1);
|
|
S.Roughness = 0.5;
|
|
S.Anisotropy = 0;
|
|
S.Normal = float3(0, 0, 1);
|
|
S.Tangent = float3(1, 0, 0);
|
|
S.SSSMFP = float3(0, 0, 0);
|
|
S.SSSMFPScale = 1;
|
|
S.SSSPhaseAnisotropy = 1;
|
|
S.EmissiveColor = float3(0, 0, 0);
|
|
S.SecondRoughness = 0.5;
|
|
S.SecondRoughnessWeight = 0;
|
|
S.FuzzRoughness = 0.5;
|
|
S.FuzzAmount = 0;
|
|
S.FuzzColor = float3(0, 0, 0);
|
|
S.GlintValue = 1;
|
|
S.GlintUV = float2(0, 0);
|
|
S.Opacity = 1;
|
|
S.OpacityMask = 1;
|
|
return S;
|
|
}
|
|
|
|
FShaderLabPostProcess ShaderLabDefaultPostProcess()
|
|
{
|
|
FShaderLabPostProcess P;
|
|
P.Color = float3(0, 0, 0);
|
|
P.Opacity = 1;
|
|
return P;
|
|
}
|
|
|
|
FShaderLabUI ShaderLabDefaultUI()
|
|
{
|
|
FShaderLabUI U;
|
|
U.Color = float3(0, 0, 0);
|
|
U.Opacity = 1;
|
|
return U;
|
|
}
|
|
|
|
FShaderLabVertex ShaderLabDefaultVertex()
|
|
{
|
|
FShaderLabVertex V;
|
|
V.WorldPositionOffset = float3(0, 0, 0);
|
|
V.Displacement = 0;
|
|
V.CustomizedUV0 = float2(0, 0);
|
|
V.CustomizedUV1 = float2(0, 0);
|
|
V.CustomizedUV2 = float2(0, 0);
|
|
V.CustomizedUV3 = float2(0, 0);
|
|
return V;
|
|
}
|