浏览代码

HDRenderLoop: Renmae PositionHS to PositionCS + another pass on shadow design

/main
Sebastien Lagarde 8 年前
当前提交
e3c7667f
共有 24 个文件被更改,包括 153 次插入231 次删除
  1. 19
      Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.cs
  2. 19
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Debug/DebugViewMaterial.hlsl
  3. 7
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Debug/DebugViewMaterialGBuffer.shader
  4. 1
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lighting/Lighting.hlsl
  5. 27
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lighting/SinglePass/SinglePass.cs
  6. 67
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lighting/SinglePass/SinglePass.hlsl
  7. 12
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/LayeredLit/LayeredLitCommon.hlsl
  8. 12
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/Lit/Lit.hlsl
  9. 2
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/Lit/LitData.hlsl
  10. 9
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/Lit/LitShare.hlsl
  11. 2
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/Unlit/UnlitData.hlsl
  12. 2
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/Unlit/UnlitDefault.shader
  13. 10
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/Unlit/UnlitShare.hlsl
  14. 2
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/ShaderPass/ShaderPassForward.hlsl
  15. 2
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/ShaderPass/ShaderPassGBuffer.hlsl
  16. 12
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Shadow/FixedSizePCF/FixedSizePCF.hlsl
  17. 13
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Shadow/Shadow.hlsl
  18. 10
      Assets/ScriptableRenderLoop/ShaderLibrary/Common.hlsl
  19. 50
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lighting/SinglePass/SinglePass.cs.hlsl
  20. 9
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lighting/SinglePass/SinglePass.cs.hlsl.meta
  21. 9
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Shadow/ShadowDefinition.cs.hlsl.meta
  22. 12
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Shadow/ShadowDefinition.cs.meta
  23. 31
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Shadow/ShadowDefinition.cs
  24. 45
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Shadow/ShadowDefinition.cs.hlsl

19
Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.cs


// Must be in sync with DebugViewMaterial.hlsl
public enum DebugViewVaryingMode
{
Depth = 1,
TexCoord0 = 2,
TexCoord1 = 3,
TexCoord2 = 4,
VertexTangentWS = 5,
VertexBitangentWS = 6,
VertexNormalWS = 7,
VertexColor = 8,
TexCoord0 = 1,
TexCoord1 = 2,
TexCoord2 = 3,
VertexTangentWS = 4,
VertexBitangentWS = 5,
VertexNormalWS = 6,
VertexColor = 7,
Depth = 9,
BakeDiffuseLighting = 10,
Depth = 10,
BakeDiffuseLighting = 11,
}
public class DebugParameters

19
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Debug/DebugViewMaterial.hlsl


// All number below folow each others!
// Must be in sync with DebugViewVaryingMode
#define DEBUGVIEW_VARYING_DEPTH 1
#define DEBUGVIEW_VARYING_TEXCOORD0 2
#define DEBUGVIEW_VARYING_TEXCOORD1 3
#define DEBUGVIEW_VARYING_TEXCOORD2 4
#define DEBUGVIEW_VARYING_VERTEXTANGENTWS 5
#define DEBUGVIEW_VARYING_VERTEXBITANGENTWS 6
#define DEBUGVIEW_VARYING_VERTEXNORMALWS 7
#define DEBUGVIEW_VARYING_VERTEXCOLOR 8
#define DEBUGVIEW_VARYING_TEXCOORD0 1
#define DEBUGVIEW_VARYING_TEXCOORD1 2
#define DEBUGVIEW_VARYING_TEXCOORD2 3
#define DEBUGVIEW_VARYING_VERTEXTANGENTWS 4
#define DEBUGVIEW_VARYING_VERTEXBITANGENTWS 5
#define DEBUGVIEW_VARYING_VERTEXNORMALWS 6
#define DEBUGVIEW_VARYING_VERTEXCOLOR 7
#define DEBUGVIEW_GBUFFER_DEPTH 9
#define DEBUGVIEW_GBUFFER_BAKEDIFFUSELIGHTING 10
#define DEBUGVIEW_GBUFFER_DEPTH 10
#define DEBUGVIEW_GBUFFER_BAKEDIFFUSELIGHTING 11

7
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Debug/DebugViewMaterialGBuffer.shader


struct Varyings
{
float4 positionHS : SV_POSITION;
float4 positionCS : SV_POSITION;
};
Varyings VertDeferred(Attributes input)

float3 positionWS = TransformObjectToWorld(input.positionOS);
output.positionHS = TransformWorldToHClip(positionWS);
output.positionCS = TransformWorldToHClip(positionWS);
return output;
}

Coordinate coord = GetCoordinate(input.positionHS.xy, _ScreenSize.zw);
float4 unPositionSS = input.positionCS; // as input we have the vpos
Coordinate coord = GetCoordinate(unPositionSS.xy, _ScreenSize.zw);
float depth = _CameraDepthTexture.Load(uint3(coord.unPositionSS, 0)).x;

1
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lighting/Lighting.hlsl


#define HAS_LIGHTLOOP // Allow to not define LightLoop related function in Material.hlsl
#include "Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lighting/LightDefinition.cs.hlsl"
#include "Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Shadow/ShadowDefinition.cs.hlsl"
#ifdef LIGHTLOOP_SINGLE_PASS
#include "Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lighting/SinglePass/SinglePass.hlsl"

27
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lighting/SinglePass/SinglePass.cs


return "LIGHTLOOP_SINGLE_PASS";
}
};
//-----------------------------------------------------------------------------
// structure definition
//-----------------------------------------------------------------------------
[GenerateHLSL]
public enum ShadowType
{
Spot,
Directional,
Point
};
// TODO: we may have to add various parameters here for shadow
// A point light is 6x PunctualShadowData
[GenerateHLSL]
public struct PunctualShadowData
{
// World to ShadowMap matrix
// Include scale and bias for shadow atlas if any
public Matrix4x4 worldToShadow;
public ShadowType shadowType;
public float bias;
public float quality;
public Vector2 unused;
};
}

67
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lighting/SinglePass/SinglePass.hlsl


// It use maxed list of lights of the scene - use just as proof of concept - do not used in regular game
//-----------------------------------------------------------------------------
#include "SinglePass.cs.hlsl"
//-----------------------------------------------------------------------------
// Constant and structure declaration
// ----------------------------------------------------------------------------

int _PunctualLightCount;
int _EnvLightCount;
EnvLightData _EnvLightSky;
float4 _ShadowMapSize;
CBUFFER_END
struct LightLoopContext

#define SINGLE_PASS_CONTEXT_SAMPLE_SHADOWATLAS 0
#define SINGLE_PASS_CONTEXT_SAMPLE_SHADOWARRAY 1
PunctualShadowData GetPunctualShadowData(LightLoopContext lightLoopContext, int index, float3 L)
float GetPunctualShadowAttenuation(LightLoopContext lightLoopContext, float3 positionWS, int index, float3 L, float2 unPositionSS)
int faceIndex = 0;
if (_PunctualShadowList[index].shadowType == SHADOWTYPE_POINT)
{
GetCubeFaceID(L, faceIndex);
}
int faceIndex = 0;
if (_PunctualShadowList[index].shadowType == SHADOWTYPE_POINT)
{
GetCubeFaceID(L, faceIndex);
}
return _PunctualShadowList[index + faceIndex];
}
PunctualShadowData shadowData = _PunctualShadowList[index + faceIndex];
float3 GetShadowTextureCoordinate(LightLoopContext lightLoopContext, PunctualShadowData shadowData, float3 positionWS)
{
// Note: scale and bias of shadow atlas are included in ShadowTransform but could be apply here.
float4 positionTXS = mul(float4(positionWS, 1.0), shadowData.worldToShadow);
positionTXS.xyz /= positionTXS.w;
// positionTXS.z -= shadowData.bias; // Apply a linear bias
// Note: scale and bias of shadow atlas are included in ShadowTransform but could be apply here.
float4 positionTXS = mul(float4(positionWS, 1.0), shadowData.worldToShadow);
positionTXS.xyz /= positionTXS.w;
// positionTXS.z -= shadowData.bias; // Apply a linear bias
#if UNITY_REVERSED_Z
positionTXS.z = 1.0 - positionTXS.z;
#endif
return positionTXS;
}
// float3 shadowPosDX = ddx_fine(positionTXS);
// float3 shadowPosDY = ddy_fine(positionTXS);
float4 SampleShadowCompare(LightLoopContext lightLoopContext, int index, float3 texCoord)
{
// if (lightLoopContext.sampleShadow == SINGLE_PASS_CONTEXT_SAMPLE_SHADOWATLAS)
{
float objDepth = saturate(1.0 - texCoord.z);
// Index could be use to get scale bias for uv but this is already merged into the shadow matrix
return SAMPLE_TEXTURE2D_SHADOW(g_tShadowBuffer, samplerg_tShadowBuffer, float3(texCoord.xy, objDepth)).xxxx;
}
/*
else // SINGLE_PASS_CONTEXT_SAMPLE_SHADOWARRAY
{
return SAMPLE_TEXTURE2D_ARRAY_SHADOW(_ShadowArray, sampler_ShadowArray, texCoord, index);
}
*/
return SAMPLE_TEXTURE2D_SHADOW(g_tShadowBuffer, samplerg_tShadowBuffer, positionTXS);
/*
float4 SampleShadow(LightLoopContext lightLoopContext, int index, float2 texCoord)
{
if (lightLoopContext.sampleShadow == SINGLE_PASS_CONTEXT_SAMPLE_SHADOWATLAS)
{
// Index could be use to get scale bias for uv but this is already merged into the shadow matrix
return SAMPLE_TEXTURE2D(_ShadowAtlas, sampler_ManualShadowArray, texCoord);
}
else // SINGLE_PASS_CONTEXT_SAMPLE_SHADOWARRAY
{
return SAMPLE_TEXTURE2D_ARRAY(_ShadowArray, sampler_ManualShadowAtlas, texCoord, index);
}
}
*/
//-----------------------------------------------------------------------------
// IES sampling function

12
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/LayeredLit/LayeredLitCommon.hlsl


struct Varyings
{
float4 positionHS;
float4 positionCS;
float3 positionWS;
float2 texCoord0;
float3 tangentToWorld[3];

struct PackedVaryings
{
float4 positionHS : SV_Position;
float4 positionCS : SV_Position;
float4 interpolators[6] : TEXCOORD0;
#ifdef SHADER_STAGE_FRAGMENT

PackedVaryings PackVaryings(Varyings input)
{
PackedVaryings output;
output.positionHS = input.positionHS;
output.positionCS = input.positionCS;
output.interpolators[0].xyz = input.positionWS.xyz;
output.interpolators[0].w = input.texCoord0.x;
output.interpolators[1].xyz = input.tangentToWorld[0];

Varyings UnpackVaryings(PackedVaryings input)
{
Varyings output;
output.positionHS = input.positionHS;
output.positionCS = input.positionCS;
output.positionWS.xyz = input.interpolators[0].xyz;
output.texCoord0.x = input.interpolators[0].w;
output.texCoord0.y = input.interpolators[4].x;

output.positionWS = TransformObjectToWorld(input.positionOS);
// TODO deal with camera center rendering and instancing (This is the reason why we always perform tow steps transform to clip space + instancing matrix)
output.positionHS = TransformWorldToHClip(output.positionWS);
output.positionCS = TransformWorldToHClip(output.positionWS);
float3 normalWS = TransformObjectToWorldNormal(input.normalOS);

{
case DEBUGVIEW_VARYING_DEPTH:
// TODO: provide a customize parameter (like a slider)
float linearDepth = frac(LinearEyeDepth(input.positionHS.z, _ZBufferParams) * 0.1);
float linearDepth = frac(LinearEyeDepth(input.positionCS.z, _ZBufferParams) * 0.1);
result = linearDepth.xxx;
break;
case DEBUGVIEW_VARYING_TEXCOORD0:

12
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/Lit/Lit.hlsl


[branch] if (lightData.shadowIndex >= 0 && illuminance > 0.0f)
{
PunctualShadowData shadowData = GetPunctualShadowData(lightLoopContext, lightData.shadowIndex, L);
// Apply offset
float3 offset = float3(0.0, 0.0, 0.0); // GetShadowPosOffset(nDotL, normal);
float3 shadowCoord = GetShadowTextureCoordinate(lightLoopContext, shadowData, positionWS + offset);
float3 shadowPosDX = ddx_fine(shadowCoord);
float3 shadowPosDY = ddy_fine(shadowCoord);
float shadowAttenuation = GetPunctualShadowAttenuation(lightLoopContext, lightData.shadowIndex, shadowData, shadowCoord, shadowPosDX, shadowPosDY, preLightData.unPositionSS);
float3 offset = float3(0.0, 0.0, 0.0); // GetShadowPosOffset(nDotL, normal);
float shadowAttenuation = GetPunctualShadowAttenuation(lightLoopContext, positionWS + offset, lightData.shadowIndex, L, preLightData.unPositionSS);
shadowAttenuation = lerp(1.0, shadowAttenuation, lightData.shadowDimmer);
illuminance *= shadowAttenuation;

2
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/Lit/LitData.hlsl


struct FragInput
{
float4 positionHS;
float4 unPositionSS; // This is the position return by VPOS, only xy is use
float3 positionWS;
float2 texCoord0;
float2 texCoord1;

9
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/Lit/LitShare.hlsl


struct Varyings
{
float4 positionHS;
float4 positionCS;
float3 positionWS;
float2 texCoord0;
float2 texCoord1;

struct PackedVaryings
{
float4 positionHS : SV_Position;
float4 positionCS : SV_Position;
#if (DYNAMICLIGHTMAP_ON) || (SHADERPASS == SHADERPASS_DEBUG_VIEW_MATERIAL)
float4 interpolators[5] : TEXCOORD0;
#else

PackedVaryings PackVaryings(Varyings input)
{
PackedVaryings output;
output.positionHS = input.positionHS;
output.positionCS = input.positionCS;
output.interpolators[0].xyz = input.positionWS.xyz;
output.interpolators[1].xyz = input.tangentToWorld[0];
output.interpolators[2].xyz = input.tangentToWorld[1];

FragInput output;
ZERO_INITIALIZE(FragInput, output);
output.positionHS = input.positionHS;
output.positionWS.xyz = input.interpolators[0].xyz;
output.tangentToWorld[0] = input.interpolators[1].xyz;
output.tangentToWorld[1] = input.interpolators[2].xyz;

output.positionWS = TransformObjectToWorld(input.positionOS);
// TODO deal with camera center rendering and instancing (This is the reason why we always perform tow steps transform to clip space + instancing matrix)
output.positionHS = TransformWorldToHClip(output.positionWS);
output.positionCS = TransformWorldToHClip(output.positionWS);
float3 normalWS = TransformObjectToWorldNormal(input.normalOS);

2
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/Unlit/UnlitData.hlsl


struct FragInput
{
float4 positionHS;
float4 positionCS;
float2 texCoord0;
};

2
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/Unlit/UnlitDefault.shader


{
case DEBUGVIEW_VARYING_DEPTH:
// TODO: provide a customize parameter (like a slider)
float linearDepth = frac(LinearEyeDepth(input.positionHS.z, _ZBufferParams) * 0.1);
float linearDepth = frac(LinearEyeDepth(input.positionCS.z, _ZBufferParams) * 0.1);
result = linearDepth.xxx;
break;
case DEBUGVIEW_VARYING_TEXCOORD0:

10
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/Unlit/UnlitShare.hlsl


struct Varyings
{
float4 positionHS;
float4 positionCS;
float4 positionHS : SV_Position;
float4 positionCS : SV_Position;
float4 interpolators[1] : TEXCOORD0;
};

output.positionHS = input.positionHS;
output.positionCS = input.positionCS;
output.interpolators[0] = float4(input.texCoord0.xy, 0.0, 0.0);
return output;

FragInput output;
ZERO_INITIALIZE(FragInput, output);
output.positionHS = input.positionHS;
output.positionCS = input.positionCS;
output.texCoord0.xy = input.interpolators[0].xy;
return output;

Varyings output;
float3 positionWS = TransformObjectToWorld(input.positionOS);
output.positionHS = TransformWorldToHClip(positionWS);
output.positionCS = TransformWorldToHClip(positionWS);
output.texCoord0 = input.uv0;

2
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/ShaderPass/ShaderPassForward.hlsl


GetSurfaceAndBuiltinData(input, surfaceData, builtinData);
BSDFData bsdfData = ConvertSurfaceDataToBSDFData(surfaceData);
Coordinate coord = GetCoordinate(input.positionHS.xy, _ScreenSize.zw);
Coordinate coord = GetCoordinate(input.unPositionSS.xy, _ScreenSize.zw);
PreLightData preLightData = GetPreLightData(V, positionWS, coord, bsdfData);
float4 diffuseLighting;

2
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/ShaderPass/ShaderPassGBuffer.hlsl


GetSurfaceAndBuiltinData(input, surfaceData, builtinData);
BSDFData bsdfData = ConvertSurfaceDataToBSDFData(surfaceData);
Coordinate coord = GetCoordinate(input.positionHS.xy, _ScreenSize.zw);
Coordinate coord = GetCoordinate(input.unPositionSS, _ScreenSize.zw);
PreLightData preLightData = GetPreLightData(V, positionWS, coord, bsdfData);
ENCODE_INTO_GBUFFER(surfaceData, outGBuffer);

12
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Shadow/FixedSizePCF/FixedSizePCF.hlsl


// Ref: https://mynameismjp.wordpress.com/2015/02/18/shadow-sample-update/
// ----------------------------------------------------------------------------
// Here we define specific constant use by this shadow filtering algorithm
CBUFFER_START(UnityShadowPerLightLoop)
float4 _ShadowMapSize; // xy size, zw inv size
CBUFFER_END
// GetPunctualShadowAttenuation is the "default" algorithm use for punctual light, material can call explicitely a particular algorithm if required (in this case users must ensure that the algorithm is present in the project).
// TODO: how this work related to shadow format ?
float GetShadowAttenuationFixedSizePCF(LightLoopContext lightLoopContext, int index, PunctualShadowData shadowData, float3 shadowCoord, float3 shadowPosDX, float3 shadowPosDY, float2 unPositionSS)
{
return SampleShadowCompare(lightLoopContext, index, shadowCoord).x;
}

13
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Shadow/Shadow.hlsl


// Caution: formula doesn't work as we are texture atlas...
// if (max3(abs(NDC.x), abs(NDC.y), 1.0f - texCoordXYZ.z) <= 1.0f) return 1.0;
#ifdef SHADOWFILTERING_FIXED_SIZE_PCF
#include "FixedSizePCF/FixedSizePCF.hlsl"
#endif
// GetPunctualShadowAttenuation is the "default" algorithm use for punctual light, material can call explicitely a particular algorithm if required (in this case users must ensure that the algorithm is present in the project).
float GetPunctualShadowAttenuation(LightLoopContext lightLoopContext, int index, PunctualShadowData shadowData, float3 shadowCoord, float3 shadowPosDX, float3 shadowPosDY, float2 unPositionSS)
{
#ifdef SHADOWFILTERING_FIXED_SIZE_PCF
return GetShadowAttenuationFixedSizePCF(lightLoopContext, index, shadowData, shadowCoord, shadowPosDX, shadowPosDY, unPositionSS);
#else
return 1.0;
#endif
}

10
Assets/ScriptableRenderLoop/ShaderLibrary/Common.hlsl


// WS: world space
// VS: view space
// OS: object space
// HS: Homogenous clip space
// CS: clips space
// CS: Homogenous clip spaces
// TS: tangent space
// TXS: texture space
// Example: NormalWS

// This function is use to provide an easy way to sample into a screen texture, either from a pixel or a compute shaders.
// This allow to easily share code.
// If a compute shader call this function inPositionSS is an integer usually calculate like: uint2 inPositionSS = groupId.xy * BLOCK_SIZE + groupThreadId.xy
Coordinate GetCoordinate(float2 positionSS, float2 invScreenSize)
Coordinate GetCoordinate(float2 unPositionSS, float2 invScreenSize)
coord.positionSS = positionSS;
// TODO: How to detect automatically that we are a compute shader ?
#if SHADER_STAGE_COMPUTE
// In case of compute shader an extra half offset is added to the screenPos to shift the integer position to pixel center.

coord.unPositionSS = int2(positionSS);
return coord;
}

// For information. In Unity Depth is always in range 0..1 (even on OpenGL) but can be reversed.
float3 UnprojectToWorld(float depth, float2 screenPos, float4x4 invViewProjectionMatrix)
{
float4 positionHS = float4(screenPos.xy * 2.0 - 1.0, depth, 1.0);
float4 hpositionWS = mul(invViewProjectionMatrix, positionHS);
return hpositionWS.xyz / hpositionWS.w;
}

50
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lighting/SinglePass/SinglePass.cs.hlsl


//
// This file was automatically generated from Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lighting/SinglePass/SinglePass.cs. Please don't edit by hand.
//
#ifndef SINGLEPASS_CS_HLSL
#define SINGLEPASS_CS_HLSL
//
// UnityEngine.Experimental.ScriptableRenderLoop.ShadowType: static fields
//
#define SHADOWTYPE_SPOT (0)
#define SHADOWTYPE_DIRECTIONAL (1)
#define SHADOWTYPE_POINT (2)
// Generated from UnityEngine.Experimental.ScriptableRenderLoop.PunctualShadowData
// PackingRules = Exact
struct PunctualShadowData
{
float4x4 worldToShadow;
int shadowType;
float bias;
float quality;
float2 unused;
};
//
// Accessors for UnityEngine.Experimental.ScriptableRenderLoop.PunctualShadowData
//
float4x4 GetWorldToShadow(PunctualShadowData value)
{
return value.worldToShadow;
}
int GetShadowType(PunctualShadowData value)
{
return value.shadowType;
}
float GetBias(PunctualShadowData value)
{
return value.bias;
}
float GetQuality(PunctualShadowData value)
{
return value.quality;
}
float2 GetUnused(PunctualShadowData value)
{
return value.unused;
}
#endif

9
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lighting/SinglePass/SinglePass.cs.hlsl.meta


fileFormatVersion: 2
guid: 353b54fe916c28f41b202e2d9396e4cf
timeCreated: 1477611341
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

9
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Shadow/ShadowDefinition.cs.hlsl.meta


fileFormatVersion: 2
guid: f22956c3631d5f64388bdb93e12ec747
timeCreated: 1477268655
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

12
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Shadow/ShadowDefinition.cs.meta


fileFormatVersion: 2
guid: 548c943bc73a18d4998420073b25d44b
timeCreated: 1477263464
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

31
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Shadow/ShadowDefinition.cs


using UnityEngine;
namespace UnityEngine.Experimental.ScriptableRenderLoop
{
//-----------------------------------------------------------------------------
// structure definition
//-----------------------------------------------------------------------------
[GenerateHLSL]
public enum ShadowType
{
Spot,
Directional,
Point
};
// TODO: we may have to add various parameters here for shadow
// A point light is 6x PunctualShadowData
[GenerateHLSL]
public struct PunctualShadowData
{
// World to ShadowMap matrix
// Include scale and bias for shadow atlas if any
public Matrix4x4 worldToShadow;
public ShadowType shadowType;
public float bias;
public Vector2 unused;
};
} // namespace UnityEngine.Experimental.ScriptableRenderLoop

45
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Shadow/ShadowDefinition.cs.hlsl


//
// This file was automatically generated from Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Shadow/ShadowDefinition.cs. Please don't edit by hand.
//
#ifndef SHADOWDEFINITION_CS_HLSL
#define SHADOWDEFINITION_CS_HLSL
//
// UnityEngine.Experimental.ScriptableRenderLoop.ShadowType: static fields
//
#define SHADOWTYPE_SPOT (0)
#define SHADOWTYPE_DIRECTIONAL (1)
#define SHADOWTYPE_POINT (2)
// Generated from UnityEngine.Experimental.ScriptableRenderLoop.PunctualShadowData
// PackingRules = Exact
struct PunctualShadowData
{
float4x4 worldToShadow;
int shadowType;
float bias;
float2 unused;
};
//
// Accessors for UnityEngine.Experimental.ScriptableRenderLoop.PunctualShadowData
//
float4x4 GetWorldToShadow(PunctualShadowData value)
{
return value.worldToShadow;
}
int GetShadowType(PunctualShadowData value)
{
return value.shadowType;
}
float GetBias(PunctualShadowData value)
{
return value.bias;
}
float2 GetUnused(PunctualShadowData value)
{
return value.unused;
}
#endif
正在加载...
取消
保存