This commit is contained in:
Andras Schmelczer 2026-09-13 20:53:11 +01:00
commit 36a53f343e
428 changed files with 300431 additions and 0 deletions

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 83715878d3a8db441aa5636641db69a3
folderAsset: yes
timeCreated: 1476176392
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: e7358848dd8737c459f4636f1c075835
folderAsset: yes
timeCreated: 1460361782
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,91 @@
#include "UnityCG.cginc"
RWStructuredBuffer<uint4> _Histogram;
Texture2D<float4> _Source;
CBUFFER_START (Params)
uint _IsLinear;
float4 _Res;
uint4 _Channels;
CBUFFER_END
groupshared uint4 gs_histogram[256];
#define GROUP_SIZE 16
#pragma kernel KHistogramGather
[numthreads(GROUP_SIZE, GROUP_SIZE,1)]
void KHistogramGather(uint2 dispatchThreadId : SV_DispatchThreadID, uint2 groupThreadId : SV_GroupThreadID)
{
const uint localThreadId = groupThreadId.y * GROUP_SIZE + groupThreadId.x;
if (localThreadId < 256)
gs_histogram[localThreadId] = uint4(0, 0, 0, 0);
GroupMemoryBarrierWithGroupSync();
if (dispatchThreadId.x < (uint)_Res.x && dispatchThreadId.y < (uint)_Res.y)
{
// We want a gamma histogram (like Photoshop & all)
float3 color = saturate(_Source[dispatchThreadId].xyz);
if (_IsLinear > 0)
color = LinearToGammaSpace(color);
// Convert color & luminance to histogram bin
uint3 idx_c = (uint3)(round(color * 255.0));
uint idx_l = (uint)(round(dot(color.rgb, float3(0.2125, 0.7154, 0.0721)) * 255.0));
// Fill the group shared histogram
if (_Channels.x > 0u) InterlockedAdd(gs_histogram[idx_c.x].x, 1); // Red
if (_Channels.y > 0u) InterlockedAdd(gs_histogram[idx_c.y].y, 1); // Green
if (_Channels.z > 0u) InterlockedAdd(gs_histogram[idx_c.z].z, 1); // Blue
if (_Channels.w > 0u) InterlockedAdd(gs_histogram[idx_l].w, 1); // Luminance
}
GroupMemoryBarrierWithGroupSync();
// Merge
if (localThreadId < 256)
{
uint4 h = gs_histogram[localThreadId];
if (_Channels.x > 0u && h.x > 0) InterlockedAdd(_Histogram[localThreadId].x, h.x); // Red
if (_Channels.y > 0u && h.y > 0) InterlockedAdd(_Histogram[localThreadId].y, h.y); // Green
if (_Channels.z > 0u && h.z > 0) InterlockedAdd(_Histogram[localThreadId].z, h.z); // Blue
if (_Channels.w > 0u && h.w > 0) InterlockedAdd(_Histogram[localThreadId].w, h.w); // Luminance
}
}
// Scaling pass
groupshared uint4 gs_pyramid[256];
#pragma kernel KHistogramScale
[numthreads(16,16,1)]
void KHistogramScale(uint2 groupThreadId : SV_GroupThreadID)
{
const uint localThreadId = groupThreadId.y * 16 + groupThreadId.x;
gs_pyramid[localThreadId] = _Histogram[localThreadId];
GroupMemoryBarrierWithGroupSync();
// Parallel reduction to find the max value
UNITY_UNROLL
for(uint i = 256 >> 1; i > 0; i >>= 1)
{
if(localThreadId < i)
gs_pyramid[localThreadId] = max(gs_pyramid[localThreadId], gs_pyramid[localThreadId + i]);
GroupMemoryBarrierWithGroupSync();
}
// Actual scaling
float4 factor = _Res.y / (float4)gs_pyramid[0];
_Histogram[localThreadId] = (uint4)round(_Histogram[localThreadId] * factor);
}
#pragma kernel KHistogramClear
[numthreads(GROUP_SIZE, GROUP_SIZE, 1)]
void KHistogramClear(uint2 dispatchThreadId : SV_DispatchThreadID)
{
if (dispatchThreadId.x < (uint)_Res.x && dispatchThreadId.y < (uint)_Res.y)
_Histogram[dispatchThreadId.y * _Res.x + dispatchThreadId.x] = uint4(0u, 0u, 0u, 0u);
}

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 51b7e4b4448c98f4a849081110fd6212
timeCreated: 1459956391
licenseType: Store
ComputeShaderImporter:
currentAPIMask: 4
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,141 @@
Shader "Hidden/Post FX/Monitors/Histogram Render"
{
SubShader
{
ZTest Always Cull Off ZWrite Off
Fog { Mode off }
CGINCLUDE
#pragma fragmentoption ARB_precision_hint_fastest
#pragma target 5.0
#include "UnityCG.cginc"
StructuredBuffer<uint4> _Histogram;
float2 _Size;
uint _Channel;
float4 _ColorR;
float4 _ColorG;
float4 _ColorB;
float4 _ColorL;
float4 FragSingleChannel(v2f_img i) : SV_Target
{
const float4 COLORS[4] = { _ColorR, _ColorG, _ColorB, _ColorL };
float remapI = i.uv.x * 255.0;
uint index = floor(remapI);
float delta = frac(remapI);
float v1 = _Histogram[index][_Channel];
float v2 = _Histogram[min(index + 1, 255)][_Channel];
float h = v1 * (1.0 - delta) + v2 * delta;
uint y = (uint)round(i.uv.y * _Size.y);
float4 color = float4(0.1, 0.1, 0.1, 1.0);
float fill = step(y, h);
color = lerp(color, COLORS[_Channel], fill);
return color;
}
float4 FragRgbMerged(v2f_img i) : SV_Target
{
const float4 COLORS[3] = { _ColorR, _ColorG, _ColorB };
float4 targetColor = float4(0.1, 0.1, 0.1, 1.0);
float4 emptyColor = float4(0.0, 0.0, 0.0, 1.0);
float remapI = i.uv.x * 255.0;
uint index = floor(remapI);
float delta = frac(remapI);
for (int j = 0; j < 3; j++)
{
float v1 = _Histogram[index][j];
float v2 = _Histogram[min(index + 1, 255)][j];
float h = v1 * (1.0 - delta) + v2 * delta;
uint y = (uint)round(i.uv.y * _Size.y);
float fill = step(y, h);
float4 color = lerp(emptyColor, COLORS[j], fill);
targetColor += color;
}
return saturate(targetColor);
}
float4 FragRgbSplitted(v2f_img i) : SV_Target
{
const float4 COLORS[3] = {_ColorR, _ColorG, _ColorB};
const float limitB = round(_Size.y / 3.0);
const float limitG = limitB * 2;
float4 color = float4(0.1, 0.1, 0.1, 1.0);
uint channel;
float offset;
if (i.pos.y < limitB)
{
channel = 2;
offset = 0.0;
}
else if (i.pos.y < limitG)
{
channel = 1;
offset = limitB;
}
else
{
channel = 0;
offset = limitG;
}
float remapI = i.uv.x * 255.0;
uint index = floor(remapI);
float delta = frac(remapI);
float v1 = offset + _Histogram[index][channel] / 3.0;
float v2 = offset + _Histogram[min(index + 1, 255)][channel] / 3.0;
float h = v1 * (1.0 - delta) + v2 * delta;
uint y = (uint)round(i.uv.y * _Size.y);
float fill = step(y, h);
color = lerp(color, COLORS[channel], fill);
return color;
}
ENDCG
// (0) Channel
Pass
{
CGPROGRAM
#pragma vertex vert_img
#pragma fragment FragSingleChannel
ENDCG
}
// (1) RGB merged
Pass
{
CGPROGRAM
#pragma vertex vert_img
#pragma fragment FragRgbMerged
ENDCG
}
// (2) RGB splitted
Pass
{
CGPROGRAM
#pragma vertex vert_img
#pragma fragment FragRgbSplitted
ENDCG
}
}
FallBack off
}

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 965efa32cf2345647a1c987546e08f86
timeCreated: 1459956391
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,76 @@
Shader "Hidden/Post FX/Monitors/Parade Render"
{
SubShader
{
ZTest Always Cull Off ZWrite Off
Fog { Mode off }
CGINCLUDE
#pragma fragmentoption ARB_precision_hint_fastest
#pragma target 5.0
#include "UnityCG.cginc"
StructuredBuffer<uint4> _Waveform;
float4 _Size;
float _Exposure;
float3 Tonemap(float3 x, float exposure)
{
const float a = 6.2;
const float b = 0.5;
const float c = 1.7;
const float d = 0.06;
x *= exposure;
x = max((0.0).xxx, x - (0.004).xxx);
x = (x * (a * x + b)) / (x * (a * x + c) + d);
return x * x;
}
float4 FragParade(v2f_img i) : SV_Target
{
const float3 red = float3(1.8, 0.03, 0.02);
const float3 green = float3(0.02, 1.3, 0.05);
const float3 blue = float3(0.0, 0.45, 1.75);
float3 color = float3(0.0, 0.0, 0.0);
const uint limitR = _Size.x / 3;
const uint limitG = limitR * 2;
if (i.pos.x < (float)limitR)
{
uint2 uvI = i.pos.xy;
color = _Waveform[uvI.y + uvI.x * _Size.y].r * red;
}
else if (i.pos.x < (float)limitG)
{
uint2 uvI = uint2(i.pos.x - limitR, i.pos.y);
color = _Waveform[uvI.y + uvI.x * _Size.y].g * green;
}
else
{
uint2 uvI = uint2(i.pos.x - limitG, i.pos.y);
color = _Waveform[uvI.y + uvI.x * _Size.y].b * blue;
}
color = Tonemap(color, _Exposure);
color += (0.1).xxx;
return float4(saturate(color), 1.0);
}
ENDCG
// (0)
Pass
{
CGPROGRAM
#pragma vertex vert_img
#pragma fragment FragParade
ENDCG
}
}
FallBack off
}

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 5ae1bfc1dd20ac04e8b74aa0f2f12eea
timeCreated: 1459956391
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,49 @@
#include "UnityCG.cginc"
RWStructuredBuffer<uint> _Vectorscope;
Texture2D<float4> _Source;
CBUFFER_START (Params)
uint _IsLinear;
float4 _Res;
CBUFFER_END
#define GROUP_SIZE 32
float3 RgbToYUV(float3 c)
{
float Y = 0.299 * c.r + 0.587 * c.g + 0.114 * c.b;
float U = -0.169 * c.r - 0.331 * c.g + 0.500 * c.b;
float V = 0.500 * c.r - 0.419 * c.g - 0.081 * c.b;
return float3(Y, U, V);
}
#pragma kernel KVectorscope
[numthreads(GROUP_SIZE,GROUP_SIZE,1)]
void KVectorscope(uint2 dispatchThreadId : SV_DispatchThreadID)
{
if (dispatchThreadId.x < (uint)_Res.x && dispatchThreadId.y < (uint)_Res.y)
{
float3 color = saturate(_Source[dispatchThreadId].xyz);
if (_IsLinear > 0)
color = LinearToGammaSpace(color);
float3 yuv = RgbToYUV(color);
if (length(yuv.yz) > 0.49)
yuv.yz = normalize(yuv.yz) * 0.49;
yuv.yz += (0.5).xx;
uint u = (uint)floor(yuv.y * _Res.x);
uint v = (uint)floor(yuv.z * _Res.y);
InterlockedAdd(_Vectorscope[v * _Res.x + u], 1);
}
}
#pragma kernel KVectorscopeClear
[numthreads(GROUP_SIZE,GROUP_SIZE,1)]
void KVectorscopeClear(uint2 dispatchThreadId : SV_DispatchThreadID)
{
if (dispatchThreadId.x < (uint)_Res.x && dispatchThreadId.y < (uint)_Res.y)
_Vectorscope[dispatchThreadId.y * _Res.x + dispatchThreadId.x] = 0u;
}

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 45de9ff58691e934c9810dc23de2ba50
timeCreated: 1459956391
licenseType: Store
ComputeShaderImporter:
currentAPIMask: 4
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,101 @@
Shader "Hidden/Post FX/Monitors/Vectorscope Render"
{
SubShader
{
ZTest Always Cull Off ZWrite Off
Fog { Mode off }
CGINCLUDE
#pragma fragmentoption ARB_precision_hint_fastest
#pragma target 5.0
#include "UnityCG.cginc"
StructuredBuffer<uint> _Vectorscope;
float2 _Size;
float _Exposure;
float Tonemap(float x, float exposure)
{
const float a = 6.2;
const float b = 0.5;
const float c = 1.7;
const float d = 0.06;
x *= exposure;
x = max(0.0, x - 0.004);
x = (x * (a * x + b)) / (x * (a * x + c) + d);
return x * x;
}
float3 YuvToRgb(float3 c)
{
float R = c.x + 0.000 * c.y + 1.403 * c.z;
float G = c.x - 0.344 * c.y - 0.714 * c.z;
float B = c.x - 1.773 * c.y + 0.000 * c.z;
return float3(R, G, B);
}
float4 FragBackground(v2f_img i) : SV_Target
{
i.uv.x = 1.0 - i.uv.x;
float2 uv = i.uv - (0.5).xx;
float3 c = YuvToRgb(float3(0.5, uv.x, uv.y));
float dist = sqrt(dot(uv, uv));
float delta = fwidth(dist);
float alphaOut = 1.0 - smoothstep(0.5 - delta, 0.5 + delta, dist);
float alphaIn = smoothstep(0.495 - delta, 0.495 + delta, dist);
uint2 uvI = i.pos.xy;
uint v = _Vectorscope[uvI.x + uvI.y * _Size.x];
float vt = saturate(Tonemap(v, _Exposure));
float4 color = float4(lerp(c, (0.0).xxx, vt), alphaOut);
color.rgb += alphaIn;
return color;
}
float4 FragNoBackground(v2f_img i) : SV_Target
{
i.uv.x = 1.0 - i.uv.x;
float2 uv = i.uv - (0.5).xx;
float dist = sqrt(dot(uv, uv));
float delta = fwidth(dist);
float alphaOut = 1.0 - smoothstep(0.5 - delta, 0.5 + delta, dist);
float alphaIn = smoothstep(0.495 - delta, 0.495 + delta, dist);
uint2 uvI = i.pos.xy;
uint v = _Vectorscope[uvI.x + uvI.y * _Size.x];
float vt = saturate(Tonemap(v, _Exposure));
float4 color = float4((1.0).xxx, vt + alphaIn * alphaOut);
return color;
}
ENDCG
// (0)
Pass
{
CGPROGRAM
#pragma vertex vert_img
#pragma fragment FragBackground
ENDCG
}
// (1)
Pass
{
CGPROGRAM
#pragma vertex vert_img
#pragma fragment FragNoBackground
ENDCG
}
}
FallBack off
}

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 1c4298cd35ef7834e892898e49d61ecd
timeCreated: 1461756159
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,42 @@
#include "UnityCG.cginc"
RWStructuredBuffer<uint4> _Waveform;
Texture2D<float4> _Source;
CBUFFER_START (Params)
uint _IsLinear;
uint4 _Channels;
CBUFFER_END
#define COLUMNS 384
#pragma kernel KWaveform
[numthreads(1,COLUMNS,1)]
void KWaveform(uint2 dispatchThreadId : SV_DispatchThreadID)
{
// We want a gamma corrected colors
float3 color = _Source[dispatchThreadId].rgb;
if (_IsLinear > 0u)
color = LinearToGammaSpace(color);
color = saturate(color);
// Convert color & luminance to histogram bins
const float kColumnsMinusOne = COLUMNS - 1.0;
uint3 idx_c = (uint3)(round(color * kColumnsMinusOne));
uint idx_l = (uint)(round(dot(color.rgb, float3(0.2126, 0.7152, 0.0722)) * kColumnsMinusOne));
// A lot of atomic operations will be skipped so there's no need to over-think this one.
uint j = dispatchThreadId.x * COLUMNS;
if (_Channels.x > 0u && idx_c.x > 0u) InterlockedAdd(_Waveform[j + idx_c.x].x, 1u); // Red
if (_Channels.y > 0u && idx_c.y > 0u) InterlockedAdd(_Waveform[j + idx_c.y].y, 1u); // Green
if (_Channels.z > 0u && idx_c.z > 0u) InterlockedAdd(_Waveform[j + idx_c.z].z, 1u); // Blue
if (_Channels.w > 0u) InterlockedAdd(_Waveform[j + idx_l].w, 1u); // Luminance
}
#pragma kernel KWaveformClear
[numthreads(1, COLUMNS, 1)]
void KWaveformClear(uint2 dispatchThreadId : SV_DispatchThreadID)
{
_Waveform[dispatchThreadId.x * COLUMNS + dispatchThreadId.y] = uint4(0u, 0u, 0u, 0u);
}

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 9d9b886f7a8fe7b4baf56624c42e3420
timeCreated: 1459956392
licenseType: Store
ComputeShaderImporter:
currentAPIMask: 4
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,65 @@
Shader "Hidden/Post FX/Monitors/Waveform Render"
{
SubShader
{
ZTest Always Cull Off ZWrite Off
Fog { Mode off }
CGINCLUDE
#pragma fragmentoption ARB_precision_hint_fastest
#pragma target 5.0
#include "UnityCG.cginc"
StructuredBuffer<uint4> _Waveform;
float2 _Size;
float4 _Channels;
float _Exposure;
float3 Tonemap(float3 x, float exposure)
{
const float a = 6.2;
const float b = 0.5;
const float c = 1.7;
const float d = 0.06;
x *= exposure;
x = max((0.0).xxx, x - (0.004).xxx);
x = (x * (a * x + b)) / (x * (a * x + c) + d);
return x * x;
}
float4 FragWaveform(v2f_img i) : SV_Target
{
const float3 red = float3(1.4, 0.03, 0.02);
const float3 green = float3(0.02, 1.1, 0.05);
const float3 blue = float3(0.0, 0.25, 1.5);
float3 color = float3(0.0, 0.0, 0.0);
uint2 uvI = i.pos.xy;
float4 w = _Waveform[uvI.y + uvI.x * _Size.y]; // Waveform data is stored in columns instead of rows
color += red * w.r * _Channels.r;
color += green * w.g * _Channels.g;
color += blue * w.b * _Channels.b;
color += w.aaa * _Channels.a * 1.5;
color = Tonemap(color, _Exposure);
color += (0.1).xxx;
return float4(saturate(color), 1.0);
}
ENDCG
// (0)
Pass
{
CGPROGRAM
#pragma vertex vert_img
#pragma fragment FragWaveform
ENDCG
}
}
FallBack off
}

View file

@ -0,0 +1,65 @@
Shader "Hidden/Post FX/Monitors/Waveform Render"
{
SubShader
{
ZTest Always Cull Off ZWrite Off
Fog { Mode off }
CGINCLUDE
#pragma fragmentoption ARB_precision_hint_fastest
#pragma target 5.0
#include "UnityCG.cginc"
StructuredBuffer<uint4> _Waveform;
float2 _Size;
float4 _Channels;
float _Exposure;
float3 Tonemap(float3 x, float exposure)
{
const float a = 6.2;
const float b = 0.5;
const float c = 1.7;
const float d = 0.06;
x *= exposure;
x = max((0.0).xxx, x - (0.004).xxx);
x = (x * (a * x + b)) / (x * (a * x + c) + d);
return x * x;
}
float4 FragWaveform(v2f_img i) : SV_Target
{
const float3 red = float3(1.4, 0.03, 0.02);
const float3 green = float3(0.02, 1.1, 0.05);
const float3 blue = float3(0.0, 0.25, 1.5);
float3 color = float3(0.0, 0.0, 0.0);
uint2 uvI = i.pos.xy;
float4 w = _Waveform[uvI.y + uvI.x * _Size.y]; // Waveform data is stored in columns instead of rows
color += red * w.r * _Channels.r;
color += green * w.g * _Channels.g;
color += blue * w.b * _Channels.b;
color += w.aaa * _Channels.a * 1.5;
color = Tonemap(color, _Exposure);
color += (0.1).xxx;
return float4(saturate(color), 1.0);
}
ENDCG
// (0)
Pass
{
CGPROGRAM
#pragma vertex vert_img
#pragma fragment FragWaveform
ENDCG
}
}
FallBack off
}

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: e7358848dd8737c459f4636f1c075835
folderAsset: yes
timeCreated: 1460361782
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,63 @@
Shader "Hidden/Post FX/UI/Curve Background"
{
CGINCLUDE
#pragma target 3.0
#include "UnityCG.cginc"
float _DisabledState;
float3 HsvToRgb(float3 c)
{
float4 K = float4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
float3 p = abs(frac(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * lerp(K.xxx, saturate(p - K.xxx), c.y);
}
float4 FragHue(v2f_img i) : SV_Target
{
float3 hsv = HsvToRgb(float3(i.uv.x, 1.0, 0.2));
float4 color = float4((0.0).xxx, 1.0);
color.rgb = lerp(color.rgb, hsv, smoothstep(0.5, 1.1, 1.0 - i.uv.y)) + lerp(color.rgb, hsv, smoothstep(0.5, 1.1, i.uv.y));
color.rgb += (0.15).xxx;
return float4(color.rgb, color.a * _DisabledState);
}
float4 FragSat(v2f_img i) : SV_Target
{
float4 color = float4((0.0).xxx, 1.0);
float sat = i.uv.x / 2;
color.rgb += lerp(color.rgb, (sat).xxx, smoothstep(0.5, 1.2, 1.0 - i.uv.y)) + lerp(color.rgb, (sat).xxx, smoothstep(0.5, 1.2, i.uv.y));
color.rgb += (0.15).xxx;
return float4(color.rgb, color.a * _DisabledState);
}
ENDCG
SubShader
{
Cull Off ZWrite Off ZTest Always
// (0) Hue
Pass
{
CGPROGRAM
#pragma vertex vert_img
#pragma fragment FragHue
ENDCG
}
// (1) Sat/lum
Pass
{
CGPROGRAM
#pragma vertex vert_img
#pragma fragment FragSat
ENDCG
}
}
}

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: b1b2bfb2897659e45983f0c3e7dda2c8
timeCreated: 1460970196
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Some files were not shown because too many files have changed in this diff Show more