initial commit
This commit is contained in:
parent
6715289efe
commit
788c3389af
37645 changed files with 2526849 additions and 80 deletions
|
|
@ -0,0 +1,142 @@
|
|||
Pass
|
||||
{
|
||||
$splice(PassName)
|
||||
Tags
|
||||
{
|
||||
$splice(LightMode)
|
||||
}
|
||||
|
||||
// Render State
|
||||
$splice(RenderState)
|
||||
|
||||
// Debug
|
||||
$splice(Debug)
|
||||
|
||||
// --------------------------------------------------
|
||||
// Pass
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
// Pragmas
|
||||
$splice(PassPragmas)
|
||||
|
||||
$splice(DotsInstancingOptions)
|
||||
$splice(HybridV1InjectedBuiltinProperties)
|
||||
|
||||
// Keywords
|
||||
$splice(PassKeywords)
|
||||
$splice(GraphKeywords)
|
||||
|
||||
// Defines
|
||||
$features.graphVFX: #define HAVE_VFX_MODIFICATION
|
||||
|
||||
$Normal: #define _NORMALMAP 1
|
||||
$NormalDropOffTS: #define _NORMAL_DROPOFF_TS 1
|
||||
$NormalDropOffOS: #define _NORMAL_DROPOFF_OS 1
|
||||
$NormalDropOffWS: #define _NORMAL_DROPOFF_WS 1
|
||||
$Attributes.normalOS: #define ATTRIBUTES_NEED_NORMAL
|
||||
$Attributes.tangentOS: #define ATTRIBUTES_NEED_TANGENT
|
||||
$Attributes.uv0: #define ATTRIBUTES_NEED_TEXCOORD0
|
||||
$Attributes.uv1: #define ATTRIBUTES_NEED_TEXCOORD1
|
||||
$Attributes.uv2: #define ATTRIBUTES_NEED_TEXCOORD2
|
||||
$Attributes.uv3: #define ATTRIBUTES_NEED_TEXCOORD3
|
||||
$Attributes.color: #define ATTRIBUTES_NEED_COLOR
|
||||
$Attributes.vertexID: #define ATTRIBUTES_NEED_VERTEXID
|
||||
$Varyings.positionWS: #define VARYINGS_NEED_POSITION_WS
|
||||
$Varyings.normalWS: #define VARYINGS_NEED_NORMAL_WS
|
||||
$Varyings.tangentWS: #define VARYINGS_NEED_TANGENT_WS
|
||||
$Varyings.texCoord0: #define VARYINGS_NEED_TEXCOORD0
|
||||
$Varyings.texCoord1: #define VARYINGS_NEED_TEXCOORD1
|
||||
$Varyings.texCoord2: #define VARYINGS_NEED_TEXCOORD2
|
||||
$Varyings.texCoord3: #define VARYINGS_NEED_TEXCOORD3
|
||||
$Varyings.color: #define VARYINGS_NEED_COLOR
|
||||
$Varyings.elementToWorld0: #define VARYINGS_NEED_ELEMENT_TO_WORLD
|
||||
$Varyings.worldToElement0: #define VARYINGS_NEED_WORLD_TO_ELEMENT
|
||||
$Varyings.viewDirectionWS: #define VARYINGS_NEED_VIEWDIRECTION_WS
|
||||
$Varyings.bitangentWS: #define VARYINGS_NEED_BITANGENT_WS
|
||||
$Varyings.screenPosition: #define VARYINGS_NEED_SCREENPOSITION
|
||||
$Varyings.fogFactorAndVertexLight: #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT
|
||||
$Varyings.shadowCoord: #define VARYINGS_NEED_SHADOW_COORD
|
||||
$Varyings.cullFace: #define VARYINGS_NEED_CULLFACE
|
||||
$features.graphVertex: #define FEATURES_GRAPH_VERTEX
|
||||
$Universal.UseLegacySpriteBlocks: #define UNIVERSAL_USELEGACYSPRITEBLOCKS
|
||||
$splice(PassInstancing)
|
||||
$splice(GraphDefines)
|
||||
$splice(DotsInstancingVars)
|
||||
|
||||
|
||||
// custom interpolator pre-include
|
||||
$splice(sgci_CustomInterpolatorPreInclude)
|
||||
|
||||
// Includes
|
||||
$splice(PreGraphIncludes)
|
||||
|
||||
// --------------------------------------------------
|
||||
// Structs and Packing
|
||||
|
||||
// custom interpolators pre packing
|
||||
$splice(CustomInterpolatorPrePacking)
|
||||
|
||||
$splice(PassStructs)
|
||||
|
||||
$splice(InterpolatorPack)
|
||||
|
||||
// --------------------------------------------------
|
||||
// Graph
|
||||
|
||||
// Graph Properties
|
||||
$splice(GraphProperties)
|
||||
|
||||
// Graph Includes
|
||||
$splice(GraphIncludes)
|
||||
|
||||
// -- Property used by ScenePickingPass
|
||||
#ifdef SCENEPICKINGPASS
|
||||
float4 _SelectionID;
|
||||
#endif
|
||||
|
||||
// -- Properties used by SceneSelectionPass
|
||||
#ifdef SCENESELECTIONPASS
|
||||
int _ObjectId;
|
||||
int _PassValue;
|
||||
#endif
|
||||
|
||||
// Graph Functions
|
||||
$splice(GraphFunctions)
|
||||
|
||||
// Custom interpolators pre vertex
|
||||
$splice(CustomInterpolatorPreVertex)
|
||||
|
||||
// Graph Vertex
|
||||
$splice(GraphVertex)
|
||||
|
||||
// Custom interpolators, pre surface
|
||||
$splice(CustomInterpolatorPreSurface)
|
||||
|
||||
// Graph Pixel
|
||||
$splice(GraphPixel)
|
||||
|
||||
// --------------------------------------------------
|
||||
// Build Graph Inputs
|
||||
#ifdef HAVE_VFX_MODIFICATION
|
||||
#define VFX_SRP_ATTRIBUTES Attributes
|
||||
#define VFX_SRP_VARYINGS Varyings
|
||||
#define VFX_SRP_SURFACE_INPUTS SurfaceDescriptionInputs
|
||||
#endif
|
||||
$features.graphVFX: $include("VFXConfig.template.hlsl")
|
||||
$features.graphVertex: $include("BuildVertexDescriptionInputs.template.hlsl")
|
||||
$features.graphPixel: $include("SharedCode.template.hlsl")
|
||||
|
||||
// --------------------------------------------------
|
||||
// Main
|
||||
|
||||
$splice(PostGraphIncludes)
|
||||
|
||||
// --------------------------------------------------
|
||||
// Visual Effect Vertex Invocations
|
||||
#ifdef HAVE_VFX_MODIFICATION
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/VisualEffectVertex.hlsl"
|
||||
#endif
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e0c1f3f375c6ee44da3982445ffb92a4
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
SurfaceDescriptionInputs BuildSurfaceDescriptionInputs(Varyings input)
|
||||
{
|
||||
SurfaceDescriptionInputs output;
|
||||
ZERO_INITIALIZE(SurfaceDescriptionInputs, output);
|
||||
|
||||
#ifdef HAVE_VFX_MODIFICATION
|
||||
// FragInputs from VFX come from two places: Interpolator or CBuffer.
|
||||
$splice(VFXSetFragInputs)
|
||||
|
||||
$SurfaceDescriptionInputs.elementToWorld: BuildElementToWorld(input);
|
||||
$SurfaceDescriptionInputs.worldToElement: BuildWorldToElement(input);
|
||||
#endif
|
||||
|
||||
$splice(CustomInterpolatorCopyToSDI)
|
||||
|
||||
$SurfaceDescriptionInputs.WorldSpaceNormal: // must use interpolated tangent, bitangent and normal before they are normalized in the pixel shader.
|
||||
$SurfaceDescriptionInputs.WorldSpaceNormal: float3 unnormalizedNormalWS = input.normalWS;
|
||||
$SurfaceDescriptionInputs.WorldSpaceNormal: const float renormFactor = 1.0 / length(unnormalizedNormalWS);
|
||||
|
||||
$SurfaceDescriptionInputs.WorldSpaceBiTangent: // use bitangent on the fly like in hdrp
|
||||
$SurfaceDescriptionInputs.WorldSpaceBiTangent: // IMPORTANT! If we ever support Flip on double sided materials ensure bitangent and tangent are NOT flipped.
|
||||
$SurfaceDescriptionInputs.WorldSpaceBiTangent: float crossSign = (input.tangentWS.w > 0.0 ? 1.0 : -1.0)* GetOddNegativeScale();
|
||||
$SurfaceDescriptionInputs.WorldSpaceBiTangent: float3 bitang = crossSign * cross(input.normalWS.xyz, input.tangentWS.xyz);
|
||||
|
||||
$SurfaceDescriptionInputs.WorldSpaceNormal: output.WorldSpaceNormal = renormFactor * input.normalWS.xyz; // we want a unit length Normal Vector node in shader graph
|
||||
$SurfaceDescriptionInputs.ObjectSpaceNormal: output.ObjectSpaceNormal = normalize(mul(output.WorldSpaceNormal, (float3x3) UNITY_MATRIX_M)); // transposed multiplication by inverse matrix to handle normal scale
|
||||
$SurfaceDescriptionInputs.ViewSpaceNormal: output.ViewSpaceNormal = mul(output.WorldSpaceNormal, (float3x3) UNITY_MATRIX_I_V); // transposed multiplication by inverse matrix to handle normal scale
|
||||
$SurfaceDescriptionInputs.TangentSpaceNormal: output.TangentSpaceNormal = float3(0.0f, 0.0f, 1.0f);
|
||||
|
||||
$SurfaceDescriptionInputs.WorldSpaceTangent: // to pr eserve mikktspace compliance we use same scale renormFactor as was used on the normal.
|
||||
$SurfaceDescriptionInputs.WorldSpaceTangent: // This is explained in section 2.2 in "surface gradient based bump mapping framework"
|
||||
$SurfaceDescriptionInputs.WorldSpaceTangent: output.WorldSpaceTangent = renormFactor * input.tangentWS.xyz;
|
||||
$SurfaceDescriptionInputs.WorldSpaceBiTangent: output.WorldSpaceBiTangent = renormFactor * bitang;
|
||||
|
||||
$SurfaceDescriptionInputs.ObjectSpaceTangent: output.ObjectSpaceTangent = TransformWorldToObjectDir(output.WorldSpaceTangent);
|
||||
$SurfaceDescriptionInputs.ViewSpaceTangent: output.ViewSpaceTangent = TransformWorldToViewDir(output.WorldSpaceTangent);
|
||||
$SurfaceDescriptionInputs.TangentSpaceTangent: output.TangentSpaceTangent = float3(1.0f, 0.0f, 0.0f);
|
||||
$SurfaceDescriptionInputs.ObjectSpaceBiTangent: output.ObjectSpaceBiTangent = TransformWorldToObjectDir(output.WorldSpaceBiTangent);
|
||||
$SurfaceDescriptionInputs.ViewSpaceBiTangent: output.ViewSpaceBiTangent = TransformWorldToViewDir(output.WorldSpaceBiTangent);
|
||||
$SurfaceDescriptionInputs.TangentSpaceBiTangent: output.TangentSpaceBiTangent = float3(0.0f, 1.0f, 0.0f);
|
||||
$SurfaceDescriptionInputs.WorldSpaceViewDirection: output.WorldSpaceViewDirection = normalize(input.viewDirectionWS);
|
||||
$SurfaceDescriptionInputs.ObjectSpaceViewDirection: output.ObjectSpaceViewDirection = TransformWorldToObjectDir(output.WorldSpaceViewDirection);
|
||||
$SurfaceDescriptionInputs.ViewSpaceViewDirection: output.ViewSpaceViewDirection = TransformWorldToViewDir(output.WorldSpaceViewDirection);
|
||||
$SurfaceDescriptionInputs.TangentSpaceViewDirection: float3x3 tangentSpaceTransform = float3x3(output.WorldSpaceTangent, output.WorldSpaceBiTangent, output.WorldSpaceNormal);
|
||||
$SurfaceDescriptionInputs.TangentSpaceViewDirection: output.TangentSpaceViewDirection = mul(tangentSpaceTransform, output.WorldSpaceViewDirection);
|
||||
$SurfaceDescriptionInputs.WorldSpacePosition: output.WorldSpacePosition = input.positionWS;
|
||||
$SurfaceDescriptionInputs.ObjectSpacePosition: output.ObjectSpacePosition = TransformWorldToObject(input.positionWS);
|
||||
$SurfaceDescriptionInputs.ViewSpacePosition: output.ViewSpacePosition = TransformWorldToView(input.positionWS);
|
||||
$SurfaceDescriptionInputs.TangentSpacePosition: output.TangentSpacePosition = float3(0.0f, 0.0f, 0.0f);
|
||||
$SurfaceDescriptionInputs.AbsoluteWorldSpacePosition: output.AbsoluteWorldSpacePosition = GetAbsolutePositionWS(input.positionWS);
|
||||
$SurfaceDescriptionInputs.WorldSpacePositionPredisplacement: output.WorldSpacePositionPredisplacement = input.positionWS;
|
||||
$SurfaceDescriptionInputs.ObjectSpacePositionPredisplacement: output.ObjectSpacePositionPredisplacement = TransformWorldToObject(input.positionWS);
|
||||
$SurfaceDescriptionInputs.ViewSpacePositionPredisplacement: output.ViewSpacePositionPredisplacement = TransformWorldToView(input.positionWS);
|
||||
$SurfaceDescriptionInputs.TangentSpacePositionPredisplacement: output.TangentSpacePositionPredisplacement = float3(0.0f, 0.0f, 0.0f);
|
||||
$SurfaceDescriptionInputs.AbsoluteWorldSpacePositionPredisplacement:output.AbsoluteWorldSpacePositionPredisplacement = GetAbsolutePositionWS(input.positionWS);
|
||||
$SurfaceDescriptionInputs.ScreenPosition: output.ScreenPosition = ComputeScreenPos(TransformWorldToHClip(input.positionWS), _ProjectionParams.x);
|
||||
$SurfaceDescriptionInputs.uv0: output.uv0 = input.texCoord0;
|
||||
$SurfaceDescriptionInputs.uv1: output.uv1 = input.texCoord1;
|
||||
$SurfaceDescriptionInputs.uv2: output.uv2 = input.texCoord2;
|
||||
$SurfaceDescriptionInputs.uv3: output.uv3 = input.texCoord3;
|
||||
$SurfaceDescriptionInputs.VertexColor: output.VertexColor = input.color;
|
||||
$SurfaceDescriptionInputs.TimeParameters: output.TimeParameters = _TimeParameters.xyz; // This is mainly for LW as HD overwrite this value
|
||||
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
||||
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN output.FaceSign = IS_FRONT_VFACE(input.cullFace, true, false);
|
||||
#else
|
||||
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
|
||||
#endif
|
||||
$SurfaceDescriptionInputs.FaceSign: BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
|
||||
#undef BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
|
||||
|
||||
return output;
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ed33028ae86f863468162a7c6b0ae962
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Add table
Add a link
Reference in a new issue