浏览代码
Merge remote-tracking branch 'origin/master' into scriptablerenderloop-materialgraph
Merge remote-tracking branch 'origin/master' into scriptablerenderloop-materialgraph
# Conflicts: # .gitmodules/scriptablerenderloop-materialgraph
Paul Demeulenaere
8 年前
当前提交
f68e8b7c
共有 85 个文件被更改,包括 1103 次插入 和 1209 次删除
-
7Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.asset
-
2Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.asset.meta
-
9Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.cs
-
5Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Debug/DebugViewMaterialGBuffer.shader
-
19Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lighting/Deferred.shader
-
3Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lighting/Forward.hlsl
-
7Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lighting/LightDefinition.cs
-
3Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lighting/LightDefinition.cs.hlsl
-
29Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lighting/Lighting.hlsl
-
7Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lighting/SinglePass/SinglePass.cs
-
85Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lighting/SinglePass/SinglePass.hlsl
-
16Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lighting/SinglePass/SinglePassLoop.hlsl
-
3Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/Builtin/BuiltinData.cs.hlsl
-
2Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/LayeredLit/LayeredLit.shader
-
5Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/Lit/Lit.cs
-
3Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/Lit/Lit.cs.hlsl
-
18Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/Lit/Lit.hlsl
-
47Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/Lit/LitDefault.shader
-
2Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/Lit/PreIntegratedFGD.shader
-
47Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/Material.hlsl
-
3Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/Unlit/Unlit.cs.hlsl
-
9Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/Unlit/UnlitDefault.shader
-
2Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/PostProcess/FinalPass.shader
-
3Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/ShaderPass/ShaderPass.cs.hlsl
-
2Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/ShaderPass/ShaderPassForward.hlsl
-
2Assets/ScriptableRenderLoop/RenderPasses/ShadowRenderPass.cs
-
62Assets/ScriptableRenderLoop/ShaderLibrary/CommonLighting.hlsl
-
1Assets/ScriptableRenderLoop/ShaderLibrary/ImageBasedLighting.hlsl
-
4Assets/ScriptableRenderLoop/common/SkyboxHelper.cs
-
7Assets/ScriptableRenderLoop/fptl/LightDefinitions.cs.hlsl
-
29Assets/ScriptableRenderLoop/fptl/LightingConvexHullUtils.hlsl
-
12Assets/ScriptableRenderLoop/fptl/LightingUtils.hlsl
-
86Assets/ScriptableRenderLoop/fptl/lightlistbuild-bigtile.compute
-
87Assets/ScriptableRenderLoop/fptl/lightlistbuild-clustered.compute
-
165Assets/ScriptableRenderLoop/fptl/lightlistbuild.compute
-
2Assets/ScriptableRenderLoop/fptl/renderloopfptl.asset
-
205Assets/TestScenes/HDTest/HDRenderLoopTest.unity
-
226Assets/TestScenes/HDTest/Leaf/GroundLeaf/Materials/GroundLeaf_Albedo.mat
-
226Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/CubeTransparent.mat
-
294Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/test-transparent.mat
-
5Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Shadow/ShadowDefinition.cs.hlsl
-
8Assets/ShaderGenerator/Editor/CSharpToHLSL.cs
-
32Assets/ShaderGenerator/Editor/ShaderTypeGeneration.cs
-
9Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Shadow.meta
-
63Assets/ScriptableRenderLoop/ShaderLibrary/CommonMaterial.hlsl
-
9Assets/ScriptableRenderLoop/ShaderLibrary/CommonMaterial.hlsl.meta
-
14Assets/ScriptableRenderLoop/ShaderLibrary/CommonShadow.hlsl
-
9Assets/ScriptableRenderLoop/ShaderLibrary/CommonShadow.hlsl.meta
-
9Assets/ScriptableRenderLoop/fptl/LightingConvexHullUtils.hlsl.meta
-
117Assets/ScriptableRenderLoop/fptl/SortingComputeUtils.hlsl
-
9Assets/ScriptableRenderLoop/fptl/lightlistbuild-bigtile.compute.meta
-
9Assets/ShaderGenerator/Editor.meta
-
38Assets/ShaderGenerator/ShaderGeneratorAttributes.cs
-
12Assets/ShaderGenerator/ShaderGeneratorAttributes.cs.meta
-
9Assets/TestScenes/Big.meta
-
9Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Shadow/EVSM.meta
-
9Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Shadow/FixedSizePCF.meta
-
17Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Shadow/FixedSizePCF/FixedSizePCF.cs
-
12Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Shadow/FixedSizePCF/FixedSizePCF.cs.meta
-
17Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Shadow/FixedSizePCF/FixedSizePCF.hlsl
-
9Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Shadow/FixedSizePCF/FixedSizePCF.hlsl.meta
-
22Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Shadow/Shadow.hlsl
-
9Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Shadow/Shadow.hlsl.meta
-
30Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Shadow/ShadowDefinition.cs
-
25Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lighting/Shadow.hlsl
-
9Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lighting/Shadow.hlsl.meta
-
28Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lighting/ShadowDefinition.cs
-
9Assets/ScriptableRenderLoop/ForwardRenderLoop.meta
-
9Assets/TestScenes/ForwardRenderLoop.meta
-
0/Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Shadow/ShadowDefinition.cs.hlsl
-
0/Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Shadow/ShadowDefinition.cs.hlsl.meta
-
0/Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Shadow/ShadowDefinition.cs.meta
-
0/Assets/ShaderGenerator/Editor/CSharpToHLSL.cs.meta
-
0/Assets/ShaderGenerator/Editor/ICSharpCode.NRefactory.dll.meta
-
0/Assets/ShaderGenerator/Editor/ShaderGeneratorMenu.cs.meta
-
0/Assets/ShaderGenerator/Editor/ShaderTypeGeneration.cs.meta
-
0/Assets/ShaderGenerator/Editor/ICSharpCode.NRefactory.dll
-
0/Assets/ShaderGenerator/Editor/CSharpToHLSL.cs
-
0/Assets/ShaderGenerator/Editor/ShaderGeneratorMenu.cs
-
0/Assets/ShaderGenerator/Editor/ShaderTypeGeneration.cs
|
|||
fileFormatVersion: 2 |
|||
guid: 2400b74f5ce370c4481e5dc417d03703 |
|||
timeCreated: 1476885643 |
|||
timeCreated: 1477406009 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
userData: |
|
|||
#ifndef UNITY_LIGHTING_INCLUDED |
|||
#define UNITY_LIGHTING_INCLUDED |
|||
|
|||
// The lighting architecture is in charge to define the light loop |
|||
// It is also in charge to define the sampling function for shadowmap, ies, cookie and reflection |
|||
// as only the lighting architecture is aware of the usage of texture atlas, array and format (latlong, 2D, cube) |
|||
#include "CommonLighting.hlsl" |
|||
#include "CommonShadow.hlsl" |
|||
#include "Sampling.hlsl" |
|||
#include "AreaLighting.hlsl" |
|||
#include "ImageBasedLighting.hlsl" |
|||
|
|||
// The light loop (or lighting architecture) is in charge to: |
|||
// - Define light list |
|||
// - Define the light loop |
|||
// - Setup the constant/data |
|||
// - Do the reflection hierarchy |
|||
// - Provide sampling function for shadowmap, ies, cookie and reflection (depends on the specific use with the light loops like index array or atlas or single and texture format (cubemap/latlong)) |
|||
#define LIGHTING // This define is used to know that we have include lighting when compiling material, else it will generate "default" function that are neutral to use Material.hlsl alone. |
|||
#define HAS_LIGHTLOOP // Allow to not define LightLoop related function in Material.hlsl |
|||
#include "Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lighting/ShadowDefinition.cs.hlsl" |
|||
#include "Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lighting/LightDefinition.cs.hlsl" |
|||
#include "Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Shadow/ShadowDefinition.cs.hlsl" |
|||
#ifdef SINGLE_PASS |
|||
#ifdef LIGHTLOOP_SINGLE_PASS |
|||
//#elif ... |
|||
// Shadow use samling function define in header above and must be include before Material.hlsl |
|||
#include "Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Shadow/Shadow.hlsl" |
|||
#ifdef SINGLE_PASS |
|||
// LightLoop use evaluation BSDF function for light type define in Material.hlsl |
|||
#ifdef LIGHTLOOP_SINGLE_PASS |
|||
//#elif ... |
|||
#endif |
|||
|
|||
|
|
|||
fileFormatVersion: 2 |
|||
guid: 90ecdcec65552154d89b8e03c90039d4 |
|||
folderAsset: yes |
|||
timeCreated: 1477395055 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
#ifndef UNITY_COMMON_MATERIAL_INCLUDED |
|||
#define UNITY_COMMON_MATERIAL_INCLUDED |
|||
|
|||
//----------------------------------------------------------------------------- |
|||
// Helper function for anisotropy |
|||
//----------------------------------------------------------------------------- |
|||
|
|||
// Ref: http://blog.selfshadow.com/publications/s2012-shading-course/burley/s2012_pbs_disney_brdf_notes_v3.pdf (in addenda) |
|||
// Convert anisotropic ratio (0->no isotropic; 1->full anisotropy in tangent direction) to roughness |
|||
void ConvertAnisotropyToRoughness(float roughness, float anisotropy, out float roughnessT, out float roughnessB) |
|||
{ |
|||
float anisoAspect = sqrt(1.0 - 0.9 * anisotropy); |
|||
roughnessT = roughness * anisoAspect; |
|||
roughnessB = roughness / anisoAspect; |
|||
} |
|||
|
|||
// Fake anisotropic by distorting the normal as suggested by: |
|||
// Ref: Donald Revie - Implementing Fur Using Deferred Shading (GPU Pro 2) |
|||
// anisotropic ratio (0->no isotropic; 1->full anisotropy in tangent direction) |
|||
float3 GetAnisotropicModifiedNormal(float3 N, float3 T, float3 V, float anisotropy) |
|||
{ |
|||
float3 anisoT = cross(-V, T); |
|||
float3 anisoN = cross(anisoT, T); |
|||
|
|||
return normalize(lerp(N, anisoN, anisotropy)); |
|||
} |
|||
|
|||
//----------------------------------------------------------------------------- |
|||
// Helper function for perceptual roughness |
|||
//----------------------------------------------------------------------------- |
|||
|
|||
float PerceptualRoughnessToRoughness(float perceptualRoughness) |
|||
{ |
|||
return perceptualRoughness * perceptualRoughness; |
|||
} |
|||
|
|||
float RoughnessToPerceptualRoughness(float roughness) |
|||
{ |
|||
return sqrt(roughness); |
|||
} |
|||
|
|||
float PerceptualSmoothnessToRoughness(float perceptualSmoothness) |
|||
{ |
|||
return (1 - perceptualSmoothness) * (1 - perceptualSmoothness); |
|||
} |
|||
|
|||
float PerceptualSmoothnessToPerceptualRoughness(float perceptualSmoothness) |
|||
{ |
|||
return (1 - perceptualSmoothness); |
|||
} |
|||
|
|||
// ---------------------------------------------------------------------------- |
|||
// Parallax mapping |
|||
// ---------------------------------------------------------------------------- |
|||
|
|||
float2 ParallaxOffset(float3 viewDirTS, float height) |
|||
{ |
|||
// Parallax mapping with offset limiting to reduce weird artifcat (i.e do not divide by z), also save performance |
|||
return viewDirTS.xy * height; |
|||
} |
|||
|
|||
|
|||
#endif // UNITY_COMMON_MATERIAL_INCLUDED |
|
|||
fileFormatVersion: 2 |
|||
guid: 540178d5ddc29e74da771e38536aee22 |
|||
timeCreated: 1477404191 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
#ifndef UNITY_COMMON_SHADOW_INCLUDED |
|||
#define UNITY_COMMON_SHADOW_INCLUDED |
|||
|
|||
// Ref: https://mynameismjp.wordpress.com/2015/02/18/shadow-sample-update/ |
|||
// Calculates the offset to use for sampling the shadow map, based on the surface normal |
|||
float3 GetShadowPosOffset(float NdotL, float3 normalWS, float2 invShadowMapSize) |
|||
{ |
|||
float texelSize = 2.0 * invShadowMapSize.x; |
|||
float offsetScaleNormalize = saturate(1.0 - NdotL); |
|||
// return texelSize * OffsetScale * offsetScaleNormalize * normalWS; |
|||
return texelSize * offsetScaleNormalize * normalWS; |
|||
} |
|||
|
|||
#endif // UNITY_COMMON_SHADOW_INCLUDED |
|
|||
fileFormatVersion: 2 |
|||
guid: a85db80be6def144e938df4cbf0d1aa6 |
|||
timeCreated: 1477397630 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 97c18f9b04997a34aa7a246dbc1b2fac |
|||
timeCreated: 1477394758 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
#ifndef __SORTINGCOMPUTEUTILS_H__ |
|||
#define __SORTINGCOMPUTEUTILS_H__ |
|||
|
|||
unsigned int LimitPow2AndClamp(unsigned int value_in, unsigned int maxValue) |
|||
{ |
|||
#if 0 |
|||
unsigned int value = 1; |
|||
|
|||
while(value<value_in && (value<<1)<=maxValue) |
|||
value<<=1; |
|||
|
|||
return value_in==0 ? 0 : value; |
|||
#else |
|||
uint valpw2 = value_in==0 ? 0 : (1<<firstbithigh(value_in)); // firstbithigh(0) returns -1 |
|||
valpw2 = max(valpw2, valpw2<<(valpw2!=value_in ? 1 : 0)); // max() just in case of overflow |
|||
return min(valpw2, maxValue); |
|||
#endif |
|||
} |
|||
|
|||
// have to make this sort routine a macro unfortunately because hlsl doesn't take |
|||
// groupshared memory of unspecified length as an input parameter to a function. |
|||
// maxcapacity_in must be a power of two. |
|||
// all data from length_in and up to closest power of two will be filled with 0xffffffff |
|||
#define SORTLIST(data, length_in, maxcapacity_in, localThreadID_in, nrthreads_in) \ |
|||
{ \ |
|||
int length=(int) length_in, maxcapacity=(int) maxcapacity_in, localThreadID=(int) localThreadID_in, nrthreads=(int) nrthreads_in; \ |
|||
\ |
|||
const int N = (const int) LimitPow2AndClamp((unsigned int) length, (uint) maxcapacity); \ |
|||
for(int t=length+localThreadID; t<N; t+=nrthreads) { data[t]=0xffffffff; } \ |
|||
GroupMemoryBarrierWithGroupSync(); \ |
|||
\ |
|||
for(int k=2; k<=N; k=2*k) \ |
|||
{ \ |
|||
for(int j=k>>1; j>0; j=j>>1) \ |
|||
{ \ |
|||
for(int i=localThreadID; i<N; i+=nrthreads) \ |
|||
{ \ |
|||
int ixj=i^j; \ |
|||
if((ixj)>i) \ |
|||
{ \ |
|||
const unsigned int Avalue = data[i]; \ |
|||
const unsigned int Bvalue = data[ixj]; \ |
|||
\ |
|||
const bool mustSwap = ((i&k)!=0^(Avalue>Bvalue)) && Avalue!=Bvalue; \ |
|||
if(mustSwap) \ |
|||
{ \ |
|||
data[i]=Bvalue; \ |
|||
data[ixj]=Avalue; \ |
|||
} \ |
|||
} \ |
|||
} \ |
|||
\ |
|||
GroupMemoryBarrierWithGroupSync(); \ |
|||
} \ |
|||
} \ |
|||
} |
|||
|
|||
// have to make this sort routine a macro unfortunately because hlsl doesn't take |
|||
// groupshared memory of unspecified length as an input parameter to a function. |
|||
// merge-sort is not in-place so two buffers are required: data and tmpdata. |
|||
// These must both have a capacity of at least length_in entries and initial |
|||
// input is assumed to be in data and results will be delivered in data. |
|||
#define MERGESORTLIST(data, tmpdata, length_in, localThreadID_in, nrthreads_in) \ |
|||
{ \ |
|||
int length=(int) length_in, localThreadID=(int) localThreadID_in, nrthreads=(int) nrthreads_in; \ |
|||
\ |
|||
for(int curr_size=1; curr_size<=length-1; curr_size = 2*curr_size) \ |
|||
{ \ |
|||
for(int left_start=localThreadID*(2*curr_size); left_start<(length-1); left_start+=nrthreads*(2*curr_size)) \ |
|||
{ \ |
|||
int mid = left_start + curr_size - 1; \ |
|||
int right_end = min(left_start + 2*curr_size - 1, length-1); \ |
|||
{ \ |
|||
int l=left_start, m=mid, r=right_end; \ |
|||
\ |
|||
int i, j, k; \ |
|||
\ |
|||
int ol = l; \ |
|||
int or = m+1; \ |
|||
int sl = m - l + 1; \ |
|||
int sr = r - m; \ |
|||
\ |
|||
for(int i=l; i<=r; i++) tmpdata[i] = data[i]; \ |
|||
\ |
|||
i = 0; j = 0; k = l; \ |
|||
while (i < sl && j < sr) \ |
|||
{ \ |
|||
const uint lVal = tmpdata[ol+i]; \ |
|||
const uint rVal = tmpdata[or+j]; \ |
|||
bool pickLeft = lVal <= rVal; \ |
|||
i = pickLeft ? (i+1) : i; \ |
|||
j = pickLeft ? j : (j+1); \ |
|||
data[k] = pickLeft ? lVal : rVal; \ |
|||
k++; \ |
|||
} \ |
|||
\ |
|||
while (i < sl) \ |
|||
{ \ |
|||
data[k] = tmpdata[ol+i]; \ |
|||
i++; k++; \ |
|||
} \ |
|||
\ |
|||
while (j < sr) \ |
|||
{ \ |
|||
data[k] = tmpdata[or+j]; \ |
|||
j++; k++; \ |
|||
} \ |
|||
} \ |
|||
} \ |
|||
\ |
|||
GroupMemoryBarrierWithGroupSync(); \ |
|||
} \ |
|||
} |
|||
|
|||
|
|||
|
|||
#endif |
|
|||
fileFormatVersion: 2 |
|||
guid: b5507a2ffdae8a84f94211c10d428920 |
|||
timeCreated: 1477394781 |
|||
licenseType: Pro |
|||
ComputeShaderImporter: |
|||
currentAPIMask: 4 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: a7ecca2f74946b44494f07937e31b793 |
|||
folderAsset: yes |
|||
timeCreated: 1477487246 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
|
|||
namespace UnityEngine.Experimental.ScriptableRenderLoop |
|||
{ |
|||
public enum PackingRules |
|||
{ |
|||
Exact, |
|||
Aggressive |
|||
}; |
|||
|
|||
[AttributeUsage(AttributeTargets.Struct | AttributeTargets.Class | AttributeTargets.Enum)] |
|||
public class GenerateHLSL : System.Attribute |
|||
{ |
|||
public PackingRules packingRules; |
|||
public bool needAccessors; // Whether or not to generate the accessors
|
|||
public bool needParamDefines; // Wheter or not to generate define for each parameters of the struc
|
|||
public int paramDefinesStart; // Start of the generated define
|
|||
|
|||
public GenerateHLSL(PackingRules rules = PackingRules.Exact, bool needAccessors = true, bool needParamDefines = false, int paramDefinesStart = 1) |
|||
{ |
|||
packingRules = rules; |
|||
this.needAccessors = needAccessors; |
|||
this.needParamDefines = needParamDefines; |
|||
this.paramDefinesStart = paramDefinesStart; |
|||
} |
|||
} |
|||
|
|||
[AttributeUsage(AttributeTargets.Field)] |
|||
public class SurfaceDataAttributes : System.Attribute |
|||
{ |
|||
public string displayName; |
|||
|
|||
public SurfaceDataAttributes(string displayName = "") |
|||
{ |
|||
this.displayName = displayName; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: e55f53965f0bb7d43b389fea197e7b4f |
|||
timeCreated: 1477487684 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: ca7cab07164223b41b386440cf25cdca |
|||
folderAsset: yes |
|||
timeCreated: 1477402341 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 9b6009e82573a6742b8b06b75b22703d |
|||
folderAsset: yes |
|||
timeCreated: 1477395055 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: bf62af062defe384f9e1e45ef3cb4169 |
|||
folderAsset: yes |
|||
timeCreated: 1477395055 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.Rendering; |
|||
using System; |
|||
|
|||
//-----------------------------------------------------------------------------
|
|||
// structure definition
|
|||
//-----------------------------------------------------------------------------
|
|||
namespace UnityEngine.Experimental.ScriptableRenderLoop |
|||
{ |
|||
public class ShadowFilteringFixedSizePCF |
|||
{ |
|||
string GetKeyword() |
|||
{ |
|||
return "SHADOWFILTERING_FIXED_SIZE_PCF"; |
|||
} |
|||
}; |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: b17956545ea4cec4baa08a7779464f21 |
|||
timeCreated: 1477395219 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
//----------------------------------------------------------------------------- |
|||
// Fixed size Kernel PCF filtering |
|||
// 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; |
|||
} |
|||
|
|
|||
fileFormatVersion: 2 |
|||
guid: 1a0e3eff5288ddd409f3fb0bef8f9de9 |
|||
timeCreated: 1477395058 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
// TODO: |
|||
// - How to support a Gather sampling with such abstraction ? |
|||
// - What's belong to shadow and what's belong to renderloop ? (shadowmap size depends on the usage of atlas or not) |
|||
// - Is PunctualShadowData fixed or customizable ? Who is the owner ? Should it be pass to GetPunctualShadowAttenuation ? Sure it should... |
|||
// - Could be return by GetShadowTextureCoordinate() and pass to GetPunctualShadowAttenuation(). But in this case, who control the atlas application ? |
|||
// TODO: |
|||
// 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 |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 1c64d27a91e935140a9f402077f52fa0 |
|||
timeCreated: 1477395059 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
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 Vector3 unused; |
|||
}; |
|||
|
|||
} // namespace UnityEngine.Experimental.ScriptableRenderLoop
|
|
|||
//----------------------------------------------------------------------------- |
|||
// Shadow |
|||
// Ref: https://mynameismjp.wordpress.com/2015/02/18/shadow-sample-update/ |
|||
// ---------------------------------------------------------------------------- |
|||
|
|||
//------------------------------------------------------------------------------------------------- |
|||
// Calculates the offset to use for sampling the shadow map, based on the surface normal |
|||
//------------------------------------------------------------------------------------------------- |
|||
float3 GetShadowPosOffset(float NdotL, float3 normalWS, float2 invShadowMapSize) |
|||
{ |
|||
float texelSize = 2.0 * invShadowMapSize.x; |
|||
float offsetScaleNormalize = saturate(1.0 - NdotL); |
|||
// return texelSize * OffsetScale * offsetScaleNormalize * normalWS; |
|||
return texelSize * offsetScaleNormalize * normalWS; |
|||
} |
|||
|
|||
// TODO: implement various algorithm |
|||
|
|||
// GetShadowAttenuation is the "default" algorithm use, material can code explicitely a particular algorithm if required. |
|||
// TODO: how this work related to shadow format ? |
|||
float GetShadowAttenuation(LightLoopContext lightLoopContext, int index, float3 shadowCoord, float3 shadowPosDX, float3 shadowPosDY, float2 unPositionSS) |
|||
{ |
|||
// TODO: How to support a Gather sampling with such abstraction... |
|||
return SampleShadowCompare(lightLoopContext, index, shadowCoord); |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 272a43c3c23646a4e8bc73faebaf0ee5 |
|||
timeCreated: 1477313383 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine; |
|||
|
|||
//-----------------------------------------------------------------------------
|
|||
// structure definition
|
|||
//-----------------------------------------------------------------------------
|
|||
namespace UnityEngine.Experimental.ScriptableRenderLoop |
|||
{ |
|||
[GenerateHLSL] |
|||
public enum ShadowType |
|||
{ |
|||
Spot, |
|||
Directional, |
|||
Point |
|||
}; |
|||
|
|||
// 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
|
|
|||
fileFormatVersion: 2 |
|||
guid: 87cf696b5a0ce42438ce41ddcd5022c2 |
|||
folderAsset: yes |
|||
timeCreated: 1467034984 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 29953ebbc2b204bb6be8f121555f7029 |
|||
folderAsset: yes |
|||
timeCreated: 1467146873 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue