runes
8 年前
当前提交
86db7d67
共有 5 个文件被更改,包括 125 次插入 和 1056 次删除
-
1001Assets/ScriptableRenderLoop/fptl/FptlLighting.cs
-
108Assets/ScriptableRenderLoop/fptl/LightingUtils.hlsl
-
5Assets/ScriptableRenderLoop/fptl/renderloopfptl.asset
-
58Assets/ScriptableRenderLoop/fptl/LightBoundsDebug.shader
-
9Assets/ScriptableRenderLoop/fptl/LightBoundsDebug.shader.meta
1001
Assets/ScriptableRenderLoop/fptl/FptlLighting.cs
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
// 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 5.0 |
|||
|
|||
#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; |
|||
return UnityViewToClipPos(viewPos); |
|||
} |
|||
|
|||
fixed4 frag() : SV_Target |
|||
{ |
|||
return float4(1.0f, 0.5f, 0.3f, 0.1f); |
|||
} |
|||
ENDCG |
|||
} |
|||
} |
|||
Fallback Off |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 33f2a444e9120d34396d41e40795d712 |
|||
timeCreated: 1477309800 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue