Cleaned up and commented version.

This commit is contained in:
Thorbjoern
2025-10-02 00:07:11 +02:00
parent 2b86d9f0a2
commit 4c613c3436
66 changed files with 260 additions and 1020 deletions
@@ -0,0 +1,42 @@
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
TEXTURE2D_X(_CameraDepthTexture);
SAMPLER(sampler_CameraDepthTexture);
float3 _GazeOrigin;
float3 _GazeDirection;
float _FoveaAngle;
float _PeriAngle;
float4 _FoveaColor = float4(0,1,0,0.25);
float4 _periColor = float4(1,0,0,0.18);
float4 _BlockedCol = float4(0.3,0.3,0.3,0.22);
half4 frag (Varyings input) : SV_Target
{
return float4(1, 0, 1, 0.5);
// Nimmt die Depth Texture und rekonstruiert daraus die World Position
//float depth = SAMPLE_TEXTURE2D_X(_CameraDepthTexture, sampler_CameraDepthTexture, input.texcoord).r;
//float4 clip = float4(input.texcoord * 2 - 1, depth, 1);
//float4 view = mul(UNITY_MATRIX_I_P, clip); view /= view.w;
//float3 world = mul(UNITY_MATRIX_I_V, view).xyz;
// Eryeugt einen Vektor vom Origin zum gewünschten Pixel
//float3 v = normalize(world - _GazeOrigin);
//float cosAng = dot(v, normalize(_GazeOrigin));
// Berechnung Cosinus
//float cosF = cos(_FoveaAngle);
//float cosP = cos(_PeriAngle);
//float4 col;
//if (cosAng >= cosF) col = _FoveaColor;
//else if (cosAng >= cosP) col = _periColor;
//else discard;
//uint gLayer = 8;
//if (unity_RenderingLayer.x & (1u << gLayer))
//col = _BlockedCol;
//return col;
}