浏览代码
Rename scriptableRenderLoop Folder to ScriptableRenderPipeline
Rename scriptableRenderLoop Folder to ScriptableRenderPipeline
- Rename all "loop" name to "pipeline" name for FPTL/Basic/HD - Update all include in HDRenderPipeline to match C++ #include path that is Asset/ScriptableRenderPipeline Caution: This PR require the new C++ code/Branch_Batching2
Sebastien Lagarde
8 年前
当前提交
a1e0f1e9
共有 82 个文件被更改,包括 565 次插入 和 628 次删除
-
2Assets/Editor/Tests/RenderloopTests/RenderPipelineTestFixture.cs
-
22Assets/TestScenes/HDTest/GraphicTest/LayeredTessellation/Layer-2-woord-rock.mat
-
9Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_HeightBased.mat
-
353Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/test.mat
-
8Assets/ScriptableRenderPipeline/fptl/FPTLRenderPipeline.asset
-
6Assets/ScriptableRenderPipeline/fptl/FptlLighting.cs
-
2Assets/ScriptableRenderPipeline/fptl/Internal-DeferredReflections.shader
-
280Assets/ScriptableRenderPipeline/fptl/Internal-DeferredShading.shader
-
126Assets/ScriptableRenderPipeline/fptl/LightBoundsDebug.shader
-
2Assets/ScriptableRenderPipeline/fptl/LightDefinitions.cs.hlsl
-
4Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderConfig.cs.hlsl
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/SkyManager.cs.hlsl
-
4Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/Resources/BuildProbabilityTables.compute
-
4Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/Resources/ComputeGgxIblSampleData.compute
-
4Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/Resources/GGXConvolve.shader
-
6Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/ProceduralSky/Resources/SkyProcedural.shader
-
6Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/HDRISky/Resources/SkyHDRI.shader
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderPass/FragInputs.hlsl
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderPass/ShaderPass.cs.hlsl
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderPass/ShaderPassDebugViewMaterial.hlsl
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderPass/ShaderPassLightTransport.hlsl
-
4Assets/ScriptableRenderPipeline/HDRenderPipeline/PostProcess/Resources/Bloom.shader
-
4Assets/ScriptableRenderPipeline/HDRenderPipeline/PostProcess/Resources/EyeAdaptation.shader
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/PostProcess/Resources/EyeHistogram.compute
-
6Assets/ScriptableRenderPipeline/HDRenderPipeline/PostProcess/Resources/FinalPass.shader
-
4Assets/ScriptableRenderPipeline/HDRenderPipeline/PostProcess/Resources/LutGen.shader
-
16Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Material.hlsl
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Unlit/Unlit.cs.hlsl
-
12Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Unlit/Unlit.shader
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.cs.hlsl
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl
-
20Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.shader
-
4Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitData.hlsl
-
22Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitTessellation.shader
-
4Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/PatchStandardShaderToNewNamingConvention.cginc
-
4Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Resources/CombineSubsurfaceScattering.shader
-
6Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Resources/PreIntegratedFGD.shader
-
20Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLit.shader
-
22Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLitTessellation.shader
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Builtin/BuiltinData.cs.hlsl
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Builtin/BuiltinData.hlsl
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightDefinition.cs.hlsl
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TileLightLoopProducer.cs
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePass.cs.hlsl
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePassResources.cs
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/Resources/lightlistbuild-bigtile.compute
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/Resources/lightlistbuild-clustered.compute
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/Resources/lightlistbuild.compute
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/Resources/scrbound.compute
-
12Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/Resources/shadeopaque.compute
-
12Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/Resources/Deferred.shader
-
22Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/Lighting.hlsl
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugViewMaterial.cs.hlsl
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/HDRenderPipelineDebug.cs.hlsl
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/Resources/DebugDisplayShadowMap.shader
-
12Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/Resources/DebugViewMaterialGBuffer.shader
-
8Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/Resources/DebugViewTiles.shader
-
14Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.asset
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.asset.meta
-
2Assets/BasicRenderPipelineTutorial/BasicRenderPipeline.asset
-
16Assets/BasicRenderPipelineTutorial/BasicRenderPipeline.cs
-
11ProjectSettings/GraphicsSettings.asset
-
9Assets/ScriptableRenderPipeline/fptl/FPTLRenderPipeline.asset.meta
-
9Assets/BasicRenderPipelineTutorial/BasicRenderPipeline.asset.meta
-
8Assets/BasicRenderPipelineTutorial/BasicRenderPipelineScene.unity.meta
-
8Assets/ScriptableRenderPipeline/fptl/renderloopfptl.asset.meta
-
8Assets/BasicRenderPipelineTutorial/BasicRenderLoopScene.unity.meta
-
8Assets/BasicRenderPipelineTutorial/BasicRenderLoop.asset.meta
-
0/Assets/Editor/Tests/RenderloopTests/RenderPipelineTestFixture.cs.meta
-
0/Assets/Editor/Tests/RenderloopTests/RenderPipelineTestFixture.cs
-
0/Assets/BasicRenderPipelineTutorial.meta
-
0/Assets/ScriptableRenderPipeline.meta
-
0/Assets/ScriptableRenderPipeline
-
0/Assets/ScriptableRenderPipeline/fptl/FPTLRenderPipeline.asset
-
0/Assets/BasicRenderPipelineTutorial
-
0/Assets/BasicRenderPipelineTutorial/BasicRenderPipeline.cs.meta
-
0/Assets/BasicRenderPipelineTutorial/BasicRenderPipelineScene.unity
-
0/Assets/BasicRenderPipelineTutorial/BasicRenderPipelineShader.shader
-
0/Assets/BasicRenderPipelineTutorial/BasicRenderPipelineShader.shader.meta
-
0/Assets/BasicRenderPipelineTutorial/BasicRenderPipeline.asset
-
0/Assets/BasicRenderPipelineTutorial/BasicRenderPipeline.cs
|
|||
Shader "Hidden/Internal-Obscurity" { |
|||
Properties { |
|||
_LightTexture0 ("", any) = "" {} |
|||
_ShadowMapTexture ("", any) = "" {} |
|||
_SrcBlend ("", Float) = 1 |
|||
_DstBlend ("", Float) = 1 |
|||
} |
|||
SubShader { |
|||
|
|||
|
|||
|
|||
|
|||
Pass |
|||
{ |
|||
ZWrite Off |
|||
ZTest Always |
|||
Cull Off |
|||
Blend Off |
|||
//Blend [_SrcBlend] [_DstBlend] |
|||
|
|||
|
|||
CGPROGRAM |
|||
#pragma target 4.5 |
|||
#pragma vertex vert |
|||
#pragma fragment frag |
|||
|
|||
#pragma multi_compile USE_FPTL_LIGHTLIST USE_CLUSTERED_LIGHTLIST |
|||
#pragma multi_compile __ ENABLE_DEBUG |
|||
|
|||
#include "UnityLightingCommon.cginc" |
|||
|
|||
float3 EvalMaterial(UnityLight light, UnityIndirect ind); |
|||
|
|||
// uses the optimized single layered light list for opaques only |
|||
|
|||
#ifdef USE_FPTL_LIGHTLIST |
|||
#define OPAQUES_ONLY |
|||
#endif |
|||
|
|||
#include "TiledLightingTemplate.hlsl" |
|||
|
|||
|
|||
Texture2D_float _CameraDepthTexture; |
|||
Texture2D _CameraGBufferTexture0; |
|||
Texture2D _CameraGBufferTexture1; |
|||
Texture2D _CameraGBufferTexture2; |
|||
Texture2D _CameraGBufferTexture3; |
|||
|
|||
|
|||
struct v2f { |
|||
float4 vertex : SV_POSITION; |
|||
float2 texcoord : TEXCOORD0; |
|||
}; |
|||
|
|||
v2f vert (float4 vertex : POSITION, float2 texcoord : TEXCOORD0) |
|||
{ |
|||
v2f o; |
|||
o.vertex = UnityObjectToClipPos(vertex); |
|||
o.texcoord = texcoord.xy; |
|||
return o; |
|||
} |
|||
|
|||
struct StandardData |
|||
{ |
|||
float3 specularColor; |
|||
float3 diffuseColor; |
|||
float3 normalWorld; |
|||
float smoothness; |
|||
float3 emission; |
|||
}; |
|||
|
|||
struct LocalDataBRDF |
|||
{ |
|||
StandardData gbuf; |
|||
|
|||
// extras |
|||
float oneMinusReflectivity; |
|||
float3 Vworld; |
|||
}; |
|||
|
|||
static LocalDataBRDF g_localParams; |
|||
|
|||
StandardData UnityStandardDataFromGbufferAux(float4 gbuffer0, float4 gbuffer1, float4 gbuffer2, float4 gbuffer3) |
|||
{ |
|||
StandardData data; |
|||
|
|||
data.normalWorld = normalize(2*gbuffer2.xyz-1); |
|||
data.smoothness = gbuffer1.a; |
|||
data.diffuseColor = gbuffer0.xyz; data.specularColor = gbuffer1.xyz; |
|||
float ao = gbuffer0.a; |
|||
data.emission = gbuffer3.xyz; |
|||
|
|||
return data; |
|||
} |
|||
|
|||
|
|||
float3 EvalMaterial(UnityLight light, UnityIndirect ind) |
|||
{ |
|||
StandardData data = g_localParams.gbuf; |
|||
return UNITY_BRDF_PBS(data.diffuseColor, data.specularColor, g_localParams.oneMinusReflectivity, data.smoothness, data.normalWorld, g_localParams.Vworld, light, ind); |
|||
} |
|||
|
|||
|
|||
half4 frag (v2f i) : SV_Target |
|||
{ |
|||
uint2 pixCoord = ((uint2) i.vertex.xy); |
|||
|
|||
float zbufDpth = FetchDepth(_CameraDepthTexture, pixCoord.xy).x; |
|||
float linDepth = GetLinearDepth(zbufDpth); |
|||
|
|||
float3 vP = GetViewPosFromLinDepth(i.vertex.xy, linDepth); |
|||
float3 vPw = mul(g_mViewToWorld, float4(vP, 1)).xyz; |
|||
float3 Vworld = normalize(mul((float3x3) g_mViewToWorld, -vP).xyz); //unity_CameraToWorld |
|||
|
|||
float4 gbuffer0 = _CameraGBufferTexture0.Load( uint3(pixCoord.xy, 0) ); |
|||
float4 gbuffer1 = _CameraGBufferTexture1.Load( uint3(pixCoord.xy, 0) ); |
|||
float4 gbuffer2 = _CameraGBufferTexture2.Load( uint3(pixCoord.xy, 0) ); |
|||
float4 gbuffer3 = _CameraGBufferTexture3.Load( uint3(pixCoord.xy, 0) ); |
|||
|
|||
StandardData data = UnityStandardDataFromGbufferAux(gbuffer0, gbuffer1, gbuffer2, gbuffer3); |
|||
|
|||
g_localParams.gbuf = data; |
|||
g_localParams.oneMinusReflectivity = 1.0 - SpecularStrength(data.specularColor.rgb); |
|||
g_localParams.Vworld = Vworld; |
|||
|
|||
uint numLightsProcessed = 0; |
|||
float3 c = data.emission + ExecuteLightList(numLightsProcessed, pixCoord, vP, vPw, Vworld); |
|||
|
|||
#if ENABLE_DEBUG |
|||
c = OverlayHeatMap(pixCoord & 15, numLightsProcessed, c); |
|||
#endif |
|||
return float4(c,1.0); |
|||
} |
|||
|
|||
ENDCG |
|||
} |
|||
|
|||
} |
|||
Fallback Off |
|||
} |
|||
Shader "Hidden/Internal-Obscurity" { |
|||
Properties { |
|||
_LightTexture0 ("", any) = "" {} |
|||
_ShadowMapTexture ("", any) = "" {} |
|||
_SrcBlend ("", Float) = 1 |
|||
_DstBlend ("", Float) = 1 |
|||
} |
|||
SubShader { |
|||
|
|||
|
|||
|
|||
|
|||
Pass |
|||
{ |
|||
ZWrite Off |
|||
ZTest Always |
|||
Cull Off |
|||
Blend Off |
|||
//Blend [_SrcBlend] [_DstBlend] |
|||
|
|||
|
|||
CGPROGRAM |
|||
#pragma target 4.5 |
|||
#pragma vertex vert |
|||
#pragma fragment frag |
|||
|
|||
#pragma multi_compile USE_FPTL_LIGHTLIST USE_CLUSTERED_LIGHTLIST |
|||
#pragma multi_compile __ ENABLE_DEBUG |
|||
|
|||
#include "UnityLightingCommon.cginc" |
|||
|
|||
float3 EvalMaterial(UnityLight light, UnityIndirect ind); |
|||
|
|||
// uses the optimized single layered light list for opaques only |
|||
|
|||
#ifdef USE_FPTL_LIGHTLIST |
|||
#define OPAQUES_ONLY |
|||
#endif |
|||
|
|||
#include "TiledLightingTemplate.hlsl" |
|||
|
|||
|
|||
UNITY_DECLARE_TEX2D_FLOAT(_CameraDepthTexture); |
|||
Texture2D _CameraGBufferTexture0; |
|||
Texture2D _CameraGBufferTexture1; |
|||
Texture2D _CameraGBufferTexture2; |
|||
Texture2D _CameraGBufferTexture3; |
|||
|
|||
|
|||
struct v2f { |
|||
float4 vertex : SV_POSITION; |
|||
float2 texcoord : TEXCOORD0; |
|||
}; |
|||
|
|||
v2f vert (float4 vertex : POSITION, float2 texcoord : TEXCOORD0) |
|||
{ |
|||
v2f o; |
|||
o.vertex = UnityObjectToClipPos(vertex); |
|||
o.texcoord = texcoord.xy; |
|||
return o; |
|||
} |
|||
|
|||
struct StandardData |
|||
{ |
|||
float3 specularColor; |
|||
float3 diffuseColor; |
|||
float3 normalWorld; |
|||
float smoothness; |
|||
float3 emission; |
|||
}; |
|||
|
|||
struct LocalDataBRDF |
|||
{ |
|||
StandardData gbuf; |
|||
|
|||
// extras |
|||
float oneMinusReflectivity; |
|||
float3 Vworld; |
|||
}; |
|||
|
|||
static LocalDataBRDF g_localParams; |
|||
|
|||
StandardData UnityStandardDataFromGbufferAux(float4 gbuffer0, float4 gbuffer1, float4 gbuffer2, float4 gbuffer3) |
|||
{ |
|||
StandardData data; |
|||
|
|||
data.normalWorld = normalize(2*gbuffer2.xyz-1); |
|||
data.smoothness = gbuffer1.a; |
|||
data.diffuseColor = gbuffer0.xyz; data.specularColor = gbuffer1.xyz; |
|||
float ao = gbuffer0.a; |
|||
data.emission = gbuffer3.xyz; |
|||
|
|||
return data; |
|||
} |
|||
|
|||
|
|||
float3 EvalMaterial(UnityLight light, UnityIndirect ind) |
|||
{ |
|||
StandardData data = g_localParams.gbuf; |
|||
return UNITY_BRDF_PBS(data.diffuseColor, data.specularColor, g_localParams.oneMinusReflectivity, data.smoothness, data.normalWorld, g_localParams.Vworld, light, ind); |
|||
} |
|||
|
|||
|
|||
half4 frag (v2f i) : SV_Target |
|||
{ |
|||
uint2 pixCoord = ((uint2) i.vertex.xy); |
|||
|
|||
float zbufDpth = FetchDepth(_CameraDepthTexture, pixCoord.xy).x; |
|||
float linDepth = GetLinearDepth(zbufDpth); |
|||
|
|||
float3 vP = GetViewPosFromLinDepth(i.vertex.xy, linDepth); |
|||
float3 vPw = mul(g_mViewToWorld, float4(vP, 1)).xyz; |
|||
float3 Vworld = normalize(mul((float3x3) g_mViewToWorld, -vP).xyz); //unity_CameraToWorld |
|||
|
|||
float4 gbuffer0 = _CameraGBufferTexture0.Load( uint3(pixCoord.xy, 0) ); |
|||
float4 gbuffer1 = _CameraGBufferTexture1.Load( uint3(pixCoord.xy, 0) ); |
|||
float4 gbuffer2 = _CameraGBufferTexture2.Load( uint3(pixCoord.xy, 0) ); |
|||
float4 gbuffer3 = _CameraGBufferTexture3.Load( uint3(pixCoord.xy, 0) ); |
|||
|
|||
StandardData data = UnityStandardDataFromGbufferAux(gbuffer0, gbuffer1, gbuffer2, gbuffer3); |
|||
|
|||
g_localParams.gbuf = data; |
|||
g_localParams.oneMinusReflectivity = 1.0 - SpecularStrength(data.specularColor.rgb); |
|||
g_localParams.Vworld = Vworld; |
|||
|
|||
uint numLightsProcessed = 0; |
|||
float3 c = data.emission + ExecuteLightList(numLightsProcessed, pixCoord, vP, vPw, Vworld); |
|||
|
|||
#if ENABLE_DEBUG |
|||
c = OverlayHeatMap(pixCoord & 15, numLightsProcessed, c); |
|||
#endif |
|||
return float4(c,1.0); |
|||
} |
|||
|
|||
ENDCG |
|||
} |
|||
|
|||
} |
|||
Fallback Off |
|||
} |
|
|||
// Final compositing pass, just does gamma conversion for now. |
|||
|
|||
Shader "Hidden/LightBoundsDebug" |
|||
{ |
|||
Properties { } |
|||
SubShader { |
|||
Pass { |
|||
ZTest Always |
|||
Cull Off |
|||
ZWrite Off |
|||
Blend SrcAlpha One |
|||
|
|||
CGPROGRAM |
|||
#pragma vertex vert |
|||
#pragma fragment frag |
|||
#pragma target 4.5 |
|||
|
|||
#include "UnityCG.cginc" |
|||
#include "LightDefinitions.cs.hlsl" |
|||
|
|||
StructuredBuffer<SFiniteLightBound> g_data : register(t0); |
|||
|
|||
float4 vert(uint globalIndex : SV_VertexID) : SV_POSITION |
|||
{ |
|||
uint lightIndex = globalIndex / 36; |
|||
uint localIndex = globalIndex - lightIndex * 36; |
|||
uint faceIndex = localIndex / 6; |
|||
uint vertexIndex = localIndex - faceIndex * 6; |
|||
int remapTrisToQuad[6] = { 0,1,2,2,3,0 }; // Remap tri indices to quad indices: 012345->012230 |
|||
vertexIndex = remapTrisToQuad[vertexIndex]; |
|||
|
|||
uint faces[6][4] = { |
|||
{0, 2, 6, 4}, //-x |
|||
{1, 5, 7, 3}, //+x |
|||
{0, 4, 5, 1}, //-y |
|||
{2, 3, 7, 6}, //+y |
|||
{0, 1, 3, 2}, //-z |
|||
{4, 6, 7, 5}, //+z |
|||
}; |
|||
|
|||
SFiniteLightBound lightData = g_data[lightIndex]; |
|||
uint coordIndex = faces[faceIndex][vertexIndex]; |
|||
float3 coord = float3((coordIndex & 1) ? 1.0f : -1.0f, (coordIndex & 2) ? 1.0f : -1.0f, (coordIndex & 4) ? 1.0f : -1.0f); |
|||
coord.xy *= (coordIndex >= 4) ? lightData.scaleXY : float2(1, 1); |
|||
|
|||
float3 viewPos = lightData.center + coord.x * lightData.boxAxisX.xyz + coord.y * lightData.boxAxisY.xyz + coord.z * -lightData.boxAxisZ.xyz; |
|||
#if USE_LEFTHAND_CAMERASPACE |
|||
// not completely sure why this is necessary since the old stuff pretends camera coordinate system is also left-hand. |
|||
// see: Camera::CalculateMatrixShaderProps() |
|||
viewPos.z = -viewPos.z; |
|||
#endif |
|||
return UnityViewToClipPos(viewPos); |
|||
} |
|||
|
|||
fixed4 frag() : SV_Target |
|||
{ |
|||
return float4(1.0f, 0.5f, 0.3f, 0.1f); |
|||
} |
|||
ENDCG |
|||
} |
|||
} |
|||
Fallback Off |
|||
} |
|||
// Final compositing pass, just does gamma conversion for now. |
|||
|
|||
Shader "Hidden/LightBoundsDebug" |
|||
{ |
|||
Properties { } |
|||
SubShader { |
|||
Pass { |
|||
ZTest Always |
|||
Cull Off |
|||
ZWrite Off |
|||
Blend SrcAlpha One |
|||
|
|||
CGPROGRAM |
|||
#pragma vertex vert |
|||
#pragma fragment frag |
|||
#pragma target 4.5 |
|||
|
|||
#include "UnityCG.cginc" |
|||
#include "LightDefinitions.cs.hlsl" |
|||
|
|||
StructuredBuffer<SFiniteLightBound> g_data : register(t0); |
|||
|
|||
float4 vert(uint globalIndex : SV_VertexID) : SV_POSITION |
|||
{ |
|||
uint lightIndex = globalIndex / 36; |
|||
uint localIndex = globalIndex - lightIndex * 36; |
|||
uint faceIndex = localIndex / 6; |
|||
uint vertexIndex = localIndex - faceIndex * 6; |
|||
int remapTrisToQuad[6] = { 0,1,2,2,3,0 }; // Remap tri indices to quad indices: 012345->012230 |
|||
vertexIndex = remapTrisToQuad[vertexIndex]; |
|||
|
|||
uint faces[6][4] = { |
|||
{0, 2, 6, 4}, //-x |
|||
{1, 5, 7, 3}, //+x |
|||
{0, 4, 5, 1}, //-y |
|||
{2, 3, 7, 6}, //+y |
|||
{0, 1, 3, 2}, //-z |
|||
{4, 6, 7, 5}, //+z |
|||
}; |
|||
|
|||
SFiniteLightBound lightData = g_data[lightIndex]; |
|||
uint coordIndex = faces[faceIndex][vertexIndex]; |
|||
float3 coord = float3((coordIndex & 1) ? 1.0f : -1.0f, (coordIndex & 2) ? 1.0f : -1.0f, (coordIndex & 4) ? 1.0f : -1.0f); |
|||
coord.xy *= (coordIndex >= 4) ? lightData.scaleXY : float2(1, 1); |
|||
|
|||
float3 viewPos = lightData.center + coord.x * lightData.boxAxisX.xyz + coord.y * lightData.boxAxisY.xyz + coord.z * -lightData.boxAxisZ.xyz; |
|||
#if USE_LEFTHAND_CAMERASPACE |
|||
// not completely sure why this is necessary since the old stuff pretends camera coordinate system is also left-hand. |
|||
// see: Camera::CalculateMatrixShaderProps() |
|||
viewPos.z = -viewPos.z; |
|||
#endif |
|||
return UnityViewToClipPos(viewPos); |
|||
} |
|||
|
|||
fixed4 frag() : SV_Target |
|||
{ |
|||
return float4(1.0f, 0.5f, 0.3f, 0.1f); |
|||
} |
|||
ENDCG |
|||
} |
|||
} |
|||
Fallback Off |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 6aaf534559faf7e499945c3d9eb97d9f |
|||
timeCreated: 1486895883 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
mainObjectFileID: 11400000 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: b2922f2accf82e74e923ddee28eac590 |
|||
timeCreated: 1486895880 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
mainObjectFileID: 11400000 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: f3016d8f760fe4b49a7bd701916e2466 |
|||
timeCreated: 1486895671 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 4dc14083116279a438e1b2de3830999f |
|||
timeCreated: 1468020641 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 3b0ce1a6123f2ad4dafc215e41e43949 |
|||
timeCreated: 1478094608 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: b03c9b2b48c84914e93527b52d6044cb |
|||
timeCreated: 1481014594 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue