GitHub
8 年前
当前提交
0d79a150
共有 23 个文件被更改,包括 445 次插入 和 157 次删除
-
2Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.asset.meta
-
73Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.cs
-
40Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/Builtin/BuiltinData.cs
-
5Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/Builtin/BuiltinData.cs.hlsl
-
31Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/Builtin/BuiltinData.hlsl
-
39Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/LayeredLit/LayeredLitDefault.shader
-
18Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/Lit/Lit.cs
-
27Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/Lit/LitData.hlsl
-
39Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/Lit/LitDefault.shader
-
13Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/Lit/LitDepthPass.hlsl
-
2Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/Lit/LitMetaPass.hlsl
-
2Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/Lit/LitSharePass.hlsl
-
98Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/Material.hlsl
-
6Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/ShaderConfig.cs
-
12Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/ShaderPass/ShaderPassGBuffer.hlsl
-
9Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/ShaderVariables.hlsl
-
5Assets/ScriptableRenderLoop/fptl/LightDefinitions.cs.hlsl
-
124Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/Lit/LitVelocityPass.hlsl
-
9Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/Lit/LitVelocityPass.hlsl.meta
-
18Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/ShaderPass/ShaderPassVelocity.hlsl
-
9Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/ShaderPass/ShaderPassVelocity.hlsl.meta
-
13Assets/HDRenderLoop.asset
-
8Assets/HDRenderLoop.asset.meta
|
|||
fileFormatVersion: 2 |
|||
guid: 2400b74f5ce370c4481e5dc417d03703 |
|||
timeCreated: 1477406009 |
|||
timeCreated: 1478744315 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
userData: |
|
|||
#ifndef SHADERPASS |
|||
#error Undefine_SHADERPASS |
|||
#endif |
|||
|
|||
#define NEED_TEXCOORD0 defined(_ALPHATEST_ON) |
|||
#define NEED_TANGENT_TO_WORLD NEED_TEXCOORD0 && (defined(_HEIGHTMAP) && !defined(_HEIGHTMAP_AS_DISPLACEMENT)) |
|||
|
|||
struct Attributes |
|||
{ |
|||
float3 positionOS : POSITION; |
|||
float3 previousPositionOS : NORMAL; // Contain previous transform position (in case of skinning for example) |
|||
#if NEED_TEXCOORD0 |
|||
float2 uv0 : TEXCOORD0; |
|||
#endif |
|||
#if NEED_TANGENT_TO_WORLD |
|||
float4 tangentOS : TANGENT; |
|||
#endif |
|||
}; |
|||
|
|||
struct Varyings |
|||
{ |
|||
float4 positionCS; |
|||
// Note: Z component is not use |
|||
float4 transferPositionCS; |
|||
float4 transferPreviousPositionCS; |
|||
#if NEED_TEXCOORD0 |
|||
float2 texCoord0; |
|||
#endif |
|||
#if NEED_TANGENT_TO_WORLD |
|||
float3 positionWS; |
|||
float3 tangentToWorld[3]; |
|||
#endif |
|||
}; |
|||
|
|||
struct PackedVaryings |
|||
{ |
|||
float4 positionCS : SV_Position; |
|||
#if NEED_TANGENT_TO_WORLD |
|||
float4 interpolators[5] : TEXCOORD0; |
|||
#elif NEED_TEXCOORD0 |
|||
float4 interpolators[2] : TEXCOORD0; |
|||
#else |
|||
float4 interpolators[2] : TEXCOORD0; |
|||
#endif |
|||
}; |
|||
|
|||
// Function to pack data to use as few interpolator as possible, the ShaderGraph should generate these functions |
|||
PackedVaryings PackVaryings(Varyings input) |
|||
{ |
|||
PackedVaryings output; |
|||
output.positionCS = input.positionCS; |
|||
output.interpolators[0] = float4(input.transferPositionCS.xyw, 0.0); |
|||
output.interpolators[1] = float4(input.transferPreviousPositionCS.xyw, 0.0); |
|||
|
|||
#if NEED_TANGENT_TO_WORLD |
|||
output.interpolators[0].w = input.texCoord0.x; |
|||
output.interpolators[1].w = input.texCoord0.y; |
|||
|
|||
output.interpolators[2].xyz = input.tangentToWorld[0]; |
|||
output.interpolators[3].xyz = input.tangentToWorld[1]; |
|||
output.interpolators[4].xyz = input.tangentToWorld[2]; |
|||
|
|||
output.interpolators[2].w = input.positionWS.x; |
|||
output.interpolators[3].w = input.positionWS.y; |
|||
output.interpolators[4].w = input.positionWS.z; |
|||
#elif NEED_TEXCOORD0 |
|||
output.interpolators[0].w = input.texCoord0.x; |
|||
output.interpolators[1].w = input.texCoord0.y; |
|||
#endif |
|||
|
|||
return output; |
|||
} |
|||
|
|||
FragInput UnpackVaryings(PackedVaryings input) |
|||
{ |
|||
FragInput output; |
|||
ZERO_INITIALIZE(FragInput, output); |
|||
|
|||
output.unPositionSS = input.positionCS; // as input we have the vpos |
|||
output.positionCS = float4(input.interpolators[0].xy, 0.0, input.interpolators[0].z); |
|||
output.previousPositionCS = float4(input.interpolators[1].xy, 0.0, input.interpolators[1].z); |
|||
|
|||
#if NEED_TANGENT_TO_WORLD |
|||
output.texCoord0.xy = float2(input.interpolators[0].w, input.interpolators[1].w); |
|||
output.positionWS.xyz = float2(input.interpolators[2].w, input.interpolators[3].w, input.interpolators[4].w); |
|||
output.tangentToWorld[0] = input.interpolators[2].xyz; |
|||
output.tangentToWorld[1] = input.interpolators[3].xyz; |
|||
output.tangentToWorld[2] = input.interpolators[4].xyz; |
|||
#elif NEED_TEXCOORD0 |
|||
output.texCoord0.xy = float2(input.interpolators[0].w, input.interpolators[1].w); |
|||
#endif |
|||
|
|||
return output; |
|||
} |
|||
|
|||
PackedVaryings Vert(Attributes input) |
|||
{ |
|||
Varyings output; |
|||
|
|||
float3 positionWS = TransformObjectToWorld(input.positionOS); |
|||
output.positionCS = TransformWorldToHClip(positionWS); |
|||
|
|||
// TODO: Clean this code, put in function ? |
|||
output.transferPositionCS = mul(_NonJitteredVP, mul(unity_ObjectToWorld, float4(input.positionOS, 1.0))); |
|||
output.transferPreviousPositionCS = mul(_PreviousVP, mul(_PreviousM, _HasLastPositionData ? float4(input.previousPositionOS, 1.0) : float4(input.positionOS, 1.0))); |
|||
|
|||
#if NEED_TEXCOORD0 |
|||
output.texCoord0 = input.uv0; |
|||
#endif |
|||
|
|||
#if NEED_TANGENT_TO_WORLD |
|||
output.positionWS = positionWS; |
|||
|
|||
float3 normalWS = TransformObjectToWorldNormal(input.normalOS); |
|||
float4 tangentWS = float4(TransformObjectToWorldDir(input.tangentOS.xyz), input.tangentOS.w); |
|||
|
|||
float3x3 tangentToWorld = CreateTangentToWorld(normalWS, tangentWS.xyz, tangentWS.w); |
|||
output.tangentToWorld[0] = tangentToWorld[0]; |
|||
output.tangentToWorld[1] = tangentToWorld[1]; |
|||
output.tangentToWorld[2] = tangentToWorld[2]; |
|||
#endif |
|||
|
|||
return PackVaryings(output); |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: e20c8a8a58e51844aad6d4df1dc7d3cd |
|||
timeCreated: 1478738809 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
#if SHADERPASS != SHADERPASS_VELOCITY |
|||
#error SHADERPASS_is_not_correctly_define |
|||
#endif |
|||
|
|||
float4 Frag(PackedVaryings packedInput) : SV_Target |
|||
{ |
|||
FragInput input = UnpackVaryings(packedInput); |
|||
|
|||
// Perform alpha testing + get velocity |
|||
SurfaceData surfaceData; |
|||
BuiltinData builtinData; |
|||
GetSurfaceAndBuiltinData(input, surfaceData, builtinData); |
|||
|
|||
float4 outBuffer; |
|||
EncodeVelocity(builtinData.velocity, outBuffer); |
|||
return outBuffer; |
|||
} |
|||
|
|
|||
fileFormatVersion: 2 |
|||
guid: 5f5d2672c7761b44fb3d549f7cea8877 |
|||
timeCreated: 1478738808 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 558064ecdbf6b6742892d699acb39aed, type: 3} |
|||
m_Name: HDRenderLoop |
|||
m_EditorClassIdentifier: |
|
|||
fileFormatVersion: 2 |
|||
guid: a760b5cf201f0f5478077e4ee5df8236 |
|||
timeCreated: 1474961622 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue