Adaug proiectul Unity

This commit is contained in:
2026-11-01 23:39:55 +02:00
parent cb14d9d37d
commit 863eac8f2c
23463 changed files with 5412601 additions and 0 deletions
@@ -0,0 +1,162 @@
Shader "Hidden/ColbyO/VNTG/Editor/ColorBar"
{
Properties
{
_InColor ("Input Color", Vector) = (1,1,1,1)
_Dimensions ("Rect Width (X) Height (Y)", Vector) = (1,1,0,0)
_Radius ("Corner Radius", Float) = 4.0
_SliderMode ("Slider Mode (0-2=RGB, 3-6=HSV, 7=Lightness From HSV, 8-10=CIELAB, 11-13=HSL)", Int) = 0
_IsHorizontal ("Is Horizontal Toggle (0=False, 1=True)", Int) = 1
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent" }
Blend SrcAlpha OneMinusSrcAlpha
ZWrite Off
Cull Off
Pass
{
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
#include "Assets/ColbyO/VNTG/Shaders/HLSL/ColorSpace.hlsl"
struct Attributes
{
float4 positionOS : POSITION;
float2 uv : TEXCOORD0;
};
struct Varyings
{
float4 positionCS : SV_POSITION;
float2 uv : TEXCOORD0;
};
float4 _InColor;
float4 _Dimensions;
float _Radius;
int _SliderMode;
int _IsHorizontal;
float RoundedRectangleAlpha(float2 uv, float2 size, float radius)
{
float2 pixelPos = uv * size;
float2 halfSize = size * 0.5;
float2 d = abs(pixelPos - halfSize) - (halfSize - radius);
float dist = length(max(d, 0.0)) + min(max(d.x, d.y), 0.0);
return 1.0 - smoothstep(radius - 1.0, radius, dist);
}
Varyings vert(Attributes input)
{
Varyings output;
output.positionCS = TransformObjectToHClip(input.positionOS.xyz);
output.uv = input.uv;
return output;
}
float4 frag(Varyings input) : SV_Target
{
float alpha = RoundedRectangleAlpha(input.uv, _Dimensions.xy, _Radius);
if (alpha <= 0.001) discard;
float evaluationCoordinate = (_IsHorizontal == 1) ? input.uv.x : input.uv.y;
float t = clamp(evaluationCoordinate, 0.0001, 0.9999);
float3 rgbOutput = float3(0, 0, 0);
if (_SliderMode == 0)
{
rgbOutput = float3(t, _InColor.g, _InColor.b);
}
else if (_SliderMode == 1)
{
rgbOutput = float3(_InColor.r, t, _InColor.b);
}
else if (_SliderMode == 2)
{
rgbOutput = float3(_InColor.r, _InColor.g, t);
}
else if (_SliderMode == 3)
{
rgbOutput = HSVToRGB(float3(_InColor.x, _InColor.y, t));
}
else if (_SliderMode == 4)
{
rgbOutput = HSVToRGB(float3(t, _InColor.y, _InColor.z));
}
else if (_SliderMode == 5)
{
rgbOutput = HSVToRGB(float3(_InColor.x, t, _InColor.z));
}
else if (_SliderMode == 6)
{
rgbOutput = HSVToRGB(float3(_InColor.x, _InColor.y, t));
}
else if (_SliderMode == 7)
{
float3 currentHsl = HSVToHSL(_InColor.xyz);
currentHsl.z = t;
float3 mappedHsv = HSLToHSV(currentHsl);
rgbOutput = HSVToRGB(mappedHsv);
}
else if (_SliderMode == 8)
{
rgbOutput = LabToRGB(t * 100.0, _InColor.g, _InColor.b);
if (input.uv.y < 0.25 && (rgbOutput.r > 1 || rgbOutput.r < 0 || rgbOutput.g > 1 || rgbOutput.g < 0 || rgbOutput.b > 1 || rgbOutput.b < 0))
{
rgbOutput = float3(1, 0, 0);
}
}
else if (_SliderMode == 9)
{
float targetA = lerp(-128.0, 127.0, t);
rgbOutput = LabToRGB(_InColor.r, targetA, _InColor.b);
if (input.uv.y < 0.25 && (rgbOutput.r > 1 || rgbOutput.r < 0 || rgbOutput.g > 1 || rgbOutput.g < 0 || rgbOutput.b > 1 || rgbOutput.b < 0))
{
rgbOutput = float3(1, 0, 0);
}
}
else if (_SliderMode == 10)
{
float targetB = lerp(-128.0, 127.0, t);
rgbOutput = LabToRGB(_InColor.r, _InColor.g, targetB);
if (input.uv.y < 0.25 && (rgbOutput.r > 1 || rgbOutput.r < 0 || rgbOutput.g > 1 || rgbOutput.g < 0 || rgbOutput.b > 1 || rgbOutput.b < 0))
{
rgbOutput = float3(1, 0, 0);
}
}
else if (_SliderMode == 11)
{
rgbOutput = HSLToRGB(float3(t, _InColor.g, _InColor.b));
}
else if (_SliderMode == 12)
{
rgbOutput = HSLToRGB(float3(_InColor.r, t, _InColor.b));
}
else if (_SliderMode == 13)
{
rgbOutput = HSLToRGB(float3(_InColor.r, _InColor.g, t));
}
#ifndef UNITY_COLORSPACE_GAMMA
rgbOutput = SRGBToLinear(rgbOutput);
#endif
return float4(rgbOutput, alpha);
}
ENDHLSL
}
}
}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 0b8ee3e3fa6a0134da9a622f7ec66d08
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,88 @@
Shader "Hidden/ColbyO/VNTG/Editor/ColorWheel"
{
Properties
{
_WheelType ("Wheel Type", Float) = 0
_Modifier ("Fixed Channel Value", Range(0, 1)) = 1
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent" }
Blend SrcAlpha
OneMinusSrcAlpha
ZWrite
Off
Pass
{
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
#include "Assets/ColbyO/VNTG/Shaders/HLSL/ColorSpace.hlsl"
struct Attributes
{
float4 positionOS : POSITION;
float2 uv : TEXCOORD0;
};
struct Varyings
{
float4 positionCS : SV_POSITION;
float2 uv : TEXCOORD0;
};
float _WheelType;
float _Modifier;
Varyings vert(Attributes input)
{
Varyings output;
output.positionCS = TransformObjectToHClip(input.positionOS.xyz);
output.uv = input.uv;
return output;
}
float4 frag(Varyings input) : SV_Target
{
float2 uvDir = input.uv - 0.5;
float dist = length(uvDir);
float radius = 0.5;
float aaWidth = 0.005;
float alpha = smoothstep(radius, radius - aaWidth, dist);
if (alpha <= 0.0) return float4(0, 0, 0, 0);
float angle = atan2(uvDir.y, uvDir.x);
float hue = angle / (2.0 * 3.14159265);
if (hue < 0.0) hue += 1.0;
float saturation = 0.0;
float brightness = 0.0;
if (_WheelType < 0.5)
{
saturation = clamp(dist / radius, 0.0, 1.0);
brightness = _Modifier;
}
else
{
saturation = _Modifier;
brightness = clamp(dist / radius, 0.0, 1.0);
}
float3 rgb = HSVToRGB(float3(hue, saturation, brightness));
#ifndef UNITY_COLORSPACE_GAMMA
rgb = SRGBToLinear(rgb);
#endif
return float4(rgb, alpha);
}
ENDHLSL
}
}
}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: b21535b419497d4478b2c26e8103815c
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,151 @@
Shader "Hidden/ColbyO/VNTG/Editor/PalettePreviewGenerator"
{
Properties
{
_WheelRadius ("Wheel Radius", Float) = 35.8
_OutlineSize ("Outline Size", Float) = 2.5
_CardFoldSize ("Card Fold Size", Float) = 28.16
_CardCornerRadius ("Card Corner Radius", Float) = 7.68
_OutlineColor ("Outline Color", Color) = (0.1, 0.1, 0.1, 1.0)
_FileColor ("File Color", Color) = (0.2, 0.2, 0.2, 1.0)
_BackgroundColor ("Background Color", Color) = (0.0, 0.0, 0.0, 0.0)
}
SubShader
{
Tags { "RenderPipeline" = "UniversalPipeline" "RenderType"="Opaque" }
LOD 100
Pass
{
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
struct Attributes
{
float4 positionOS : POSITION;
float2 uv : TEXCOORD0;
};
struct Varyings
{
float2 uv : TEXCOORD0;
float4 positionCS : SV_POSITION;
};
float _Width;
float _Height;
float _WheelRadius;
float _OutlineSize;
float2 _CardHalfSize;
float _CardCornerRadius;
float _CardFoldSize;
float4 _OutlineColor;
float4 _FileColor;
float4 _BackgroundColor;
int _PaletteCount;
float4 _PaletteColors[256];
Varyings vert (Attributes input)
{
Varyings output;
output.positionCS = TransformObjectToHClip(input.positionOS.xyz);
output.uv = input.uv;
return output;
}
float ChamferedRectSDF(float2 p, float2 size, float radius, float cutSize)
{
float2 d = max(abs(p) - size + radius, 0.0);
float boxSDF = length(d) - radius;
float cutPlane = (p.x - (size.x - cutSize)) + (p.y - (size.y - cutSize)) - cutSize;
return max(boxSDF, cutPlane);
}
float GetAngleAt(float2 delta)
{
float angle = atan2(delta.y, delta.x) * 57.2957795;
if (angle < 0.0) angle += 360.0;
return angle;
}
float4 GetSliceColor(float2 delta, float distFromCenter)
{
if (_PaletteCount <= 0) return _FileColor;
if (_PaletteCount == 1) return _PaletteColors[0];
float angle = GetAngleAt(delta);
float sliceSize = 360.0 / (float)_PaletteCount;
float angularPixelWidth = (1.0 / (distFromCenter + 0.001)) * 57.2957795;
float remainder = fmod(angle, sliceSize);
float distToEdge = min(remainder, sliceSize - remainder);
int currentIndex = min((int)floor(angle / sliceSize), _PaletteCount - 1);
if (distToEdge < angularPixelWidth * 0.5)
{
float t = clamp((distToEdge + (angularPixelWidth * 0.5)) / angularPixelWidth, 0.0, 1.0);
int neighborIndex = (remainder < sliceSize * 0.5)
? (currentIndex - 1 + _PaletteCount) % _PaletteCount
: (currentIndex + 1) % _PaletteCount;
return lerp(_PaletteColors[neighborIndex], _PaletteColors[currentIndex], t);
}
return _PaletteColors[currentIndex];
}
float4 SamplePreviewColorWheel(float2 delta, float distFromCenter)
{
float aaWidth = 1.0;
float innerEdge = _WheelRadius;
float outerEdge = _WheelRadius + _OutlineSize;
if (distFromCenter >= outerEdge + aaWidth) return _FileColor;
float4 wheelColor = GetSliceColor(delta, distFromCenter);
float toOutline = clamp((distFromCenter - (innerEdge - aaWidth * 0.5)) / aaWidth, 0.0, 1.0);
float toBackground = clamp((distFromCenter - (outerEdge - aaWidth * 0.5)) / aaWidth, 0.0, 1.0);
float4 mixedColor = lerp(wheelColor, _OutlineColor, toOutline);
return lerp(mixedColor, _FileColor, toBackground);
}
float4 frag (Varyings input) : SV_Target
{
float2 pixelPos = input.uv * float2(_Width, _Height);
float2 center = float2(_Width, _Height) * 0.5;
float2 delta = pixelPos - center;
float distFromCenter = length(delta);
float sdf = ChamferedRectSDF(delta, _CardHalfSize, _CardCornerRadius, _CardFoldSize);
if (sdf <= 0.0)
{
if (sdf > -_OutlineSize)
{
return _OutlineColor;
}
else
{
return SamplePreviewColorWheel(delta, distFromCenter);
}
}
return _BackgroundColor;
}
ENDHLSL
}
}
}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 68d65ede5cf801f408526469b1a69903
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant: