float randomNoise(float x, float y) { return frac(sin(dot(float2(x, y), float2(12.9898, 78.233))) * 43758.5453); } half4 Frag_Horizontal(VaryingsDefault i) : SV_Target { float splitAmount = _Indensity * randomNoise(_TimeX, 2); half4 ColorR = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, float2(i.texcoord.x + splitAmount, i.texcoord.y)); half4 ColorG = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord); half4 ColorB = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, float2(i.texcoord.x - splitAmount, i.texcoord.y)); return half4(ColorR.r, ColorG.g, ColorB.b, 1); }
half4 Frag_Horizontal(VaryingsDefault i): SV_Target { float splitAmout = (1.0 + sin(_TimeX * 6.0)) * 0.5; splitAmout *= 1.0 + sin(_TimeX * 16.0) * 0.5; splitAmout *= 1.0 + sin(_TimeX * 19.0) * 0.5; splitAmout *= 1.0 + sin(_TimeX * 27.0) * 0.5; splitAmout = pow(splitAmout, _Amplitude); splitAmout *= (0.05 * _Amount); half3 finalColor; finalColor.r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, fixed2(i.texcoord.x + splitAmout, i.texcoord.y)).r; finalColor.g = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord).g; finalColor.b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, fixed2(i.texcoord.x - splitAmout, i.texcoord.y)).b; finalColor *= (1.0 - splitAmout * 0.5); return half4(finalColor, 1.0); }
half2 block = randomNoise(floor(i.texcoord * _BlockSize));
half displaceNoise = pow(block.x, 8.0) * pow(block.x, 3.0);
half ColorR = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord).r; half ColorG = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord + float2(displaceNoise * 0.05 * randomNoise(7.0), 0.0)).g; half ColorB = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord - float2(displaceNoise * 0.05 * randomNoise(13.0), 0.0)).b; return half4(ColorR, ColorG, ColorB, 1.0);
inline float randomNoise(float2 seed) { return frac(sin(dot(seed * floor(_Time.y * _Speed), float2(17.13, 3.71))) * 43758.5453123); } inline float randomNoise(float seed) { return randomNoise(float2(seed, 1.0)); } half4 Frag(VaryingsDefault i) : SV_Target { half2 block = randomNoise(floor(i.texcoord * _BlockSize)); float displaceNoise = pow(block.x, 8.0) * pow(block.x, 3.0); float splitRGBNoise = pow(randomNoise(7.2341), 17.0); float offsetX = displaceNoise - splitRGBNoise * _MaxRGBSplitX; float offsetY = displaceNoise - splitRGBNoise * _MaxRGBSplitY; float noiseX = 0.05 * randomNoise(13.0); float noiseY = 0.05 * randomNoise(7.0); float2 offset = float2(offsetX * noiseX, offsetY* noiseY); half4 colorR = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord); half4 colorG = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord + offset); half4 colorB = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord - offset); return half4(colorR.r , colorG.g, colorB.z, (colorR.a + colorG.a + colorB.a)); }
float2 blockLayer1 = floor(uv * float2(_BlockLayer1_U, _BlockLayer1_V)); float2 blockLayer2 = floor(uv * float2(_BlockLayer2_U, _BlockLayer2_V)); float lineNoise1 = pow(randomNoise(blockLayer1), _BlockLayer1_Indensity); float lineNoise2 = pow(randomNoise(blockLayer2), _BlockLayer2_Indensity); float RGBSplitNoise = pow(randomNoise(5.1379), 7.1) * _RGBSplit_Indensity; float lineNoise = lineNoise1 * lineNoise2 * _Offset - RGBSplitNoise;
float trunc(float x, float num_levels) { return floor(x * num_levels) / num_levels; } //生成随机强度梯度线条 float truncTime = trunc(_TimeX, 4.0); float uv_trunc = randomNoise(trunc(uv.yy, float2(8, 8)) + 100.0 * truncTime);
float uv_randomTrunc = 6.0 * trunc(_TimeX, 24.0 * uv_trunc);
//生成随机梯度的非等宽线条 float blockLine_random = 0.5 * randomNoise(trunc(uv.yy + uv_randomTrunc, float2(8 * _LinesWidth, 8 * _LinesWidth))); blockLine_random += 0.5 * randomNoise(trunc(uv.yy + uv_randomTrunc, float2(7, 7))); blockLine_random = blockLine_random * 2.0 - 1.0; blockLine_random = sign(blockLine_random) * saturate((abs(blockLine_random) - _Amount) / (0.4)); blockLine_random = lerp(0, blockLine_random, _Offset);
// 生成源色调的blockLine Glitch float2 uv_blockLine = uv; uv_blockLine = saturate(uv_blockLine + float2(0.1 * blockLine_random, 0)); float4 blockLineColor = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, abs(uv_blockLine));
// 将RGB转到YUV空间,并做色调偏移 // RGB -> YUV float3 blockLineColor_yuv = rgb2yuv(blockLineColor.rgb); // adjust Chrominance | 色度 blockLineColor_yuv.y /= 1.0 - 3.0 * abs(blockLine_random) * saturate(0.5 - blockLine_random); // adjust Chroma | 浓度 blockLineColor_yuv.z += 0.125 * blockLine_random * saturate(blockLine_random - 0.5); float3 blockLineColor_rgb = yuv2rgb(blockLineColor_yuv); // 与源场景图进行混合 float4 sceneColor = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord); return lerp(sceneColor, float4(blockLineColor_rgb, blockLineColor.a), _Alpha);
#if USING_FREQUENCY_INFINITE strength = 1; #else strength = 0.5 + 0.5 * cos(_Time.y * _Frequency); #endif if (fmod(uv.y * _SplittingNumber, 2) < 1.0) { #if JITTER_DIRECTION_HORIZONTAL uv.x += pixelSizeX * cos(_Time.y * _JitterSpeed) * _JitterAmount * strength; #else uv.y += pixelSizeX * cos(_Time.y * _JitterSpeed) * _JitterAmount * strength; #endif }
half4 sceneColor = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, uv);
float randomNoise(float x, float y) { return frac(sin(dot(float2(x, y), float2(12.9898, 78.233))) * 43758.5453); } half4 Frag_Horizontal(VaryingsDefault i): SV_Target { float jitter = randomNoise(i.texcoord.y, _Time.x) * 2 - 1; jitter *= step(_ScanLineJitter.y, abs(jitter)) * _ScanLineJitter.x; half4 sceneColor = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, frac(i.texcoord + float2(jitter, 0))); return sceneColor; }
for (int y = 0; y < _noiseTexture.height; y++) { for (int x = 0; x < _noiseTexture.width; x++) { //随机值若大于给定strip随机阈值,重新随机颜色 if (UnityEngine.Random.value > stripLength) { color = XPostProcessingUtility.RandomColor(); } //设置贴图像素值 _noiseTexture.SetPixel(x, y, color); } }
half4 Frag(VaryingsDefault i): SV_Target { // 基础数据准备 half4 stripNoise = SAMPLE_TEXTURE2D(_NoiseTex, sampler_NoiseTex, i.texcoord); half threshold = 1.001 - _Indensity * 1.001; // uv偏移 half uvShift = step(threshold, pow(abs(stripNoise.x), 3)); float2 uv = frac(i.texcoord + stripNoise.yz * uvShift); half4 source = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, uv); #ifndef NEED_TRASH_FRAME return source; #endif // 基于废弃帧插值 half stripIndensity = step(threshold, pow(abs(stripNoise.w), 3)) * _StripColorAdjustIndensity; half3 color = lerp(source, _StripColorAdjustColor, stripIndensity).rgb; return float4(color, source.a); }
float noiseX = randomNoise(_TimeX * _Speed + i.texcoord / float2(-213, 5.53)); float noiseY = randomNoise(_TimeX * _Speed - i.texcoord / float2(213, -5.53)); float noiseZ = randomNoise(_TimeX * _Speed + i.texcoord / float2(213, 5.53)); sceneColor.rgb += 0.25 * float3(noiseX,noiseY,noiseZ) - 0.125;
half luminance = dot(noiseColor.rgb, fixed3(0.22, 0.707, 0.071)); if (randomNoise(float2(_TimeX * _Speed, _TimeX * _Speed)) > _LuminanceJitterThreshold) { noiseColor = float4(luminance, luminance, luminance, luminance); }
half4 Frag_Vertical(VaryingsDefault i): SV_Target { float jump = lerp(i.texcoord.y, frac(i.texcoord.y + _JumpTime), _JumpIndensity); half4 sceneColor = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, frac(float2(i.texcoord.x, jump))); return sceneColor; }
half4 Frag_Horizontal(VaryingsDefault i): SV_Target { float jump = lerp(i.texcoord.x, frac(i.texcoord.x + _JumpTime), _JumpIndensity); half4 sceneColor = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, frac(float2(jump, i.texcoord.y))); return sceneColor; }
half4 Frag_Horizontal(VaryingsDefault i): SV_Target { float shake = (randomNoise(_Time.x, 2) - 0.5) * _ScreenShake; half4 sceneColor = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, frac(float2(i.texcoord.x + shake, i.texcoord.y))); return sceneColor; }
half4 Frag_Vertical(VaryingsDefault i): SV_Target { float shake = (randomNoise(_Time.x, 2) - 0.5) * _ScreenShake; half4 sceneColor = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, frac(float2(i.texcoord.x, i.texcoord.y + shake))); return sceneColor; }
float uv_y = i.texcoord.y * _Resolution.y; float noise_wave_1 = snoise(float2(uv_y * 0.01, _Time.y * _Speed * 20)) * (strength * _Amount * 32.0); float noise_wave_2 = snoise(float2(uv_y * 0.02, _Time.y * _Speed * 10)) * (strength * _Amount * 4.0); float noise_wave_x = noise_wave_1 / _Resolution.x; float uv_x = i.texcoord.x + noise_wave_x; float4 color = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, float2(uv_x, i.texcoord.y));
float4 Frag_Horizontal(VaryingsDefault i): SV_Target { half strength = 0.0; #if USING_FREQUENCY_INFINITE strength = 1; #else strength = 0.5 + 0.5 *cos(_Time.y * _Frequency); #endif // Prepare UV float uv_y = i.texcoord.y * _Resolution.y; float noise_wave_1 = snoise(float2(uv_y * 0.01, _Time.y * _Speed * 20)) * (strength * _Amount * 32.0); float noise_wave_2 = snoise(float2(uv_y * 0.02, _Time.y * _Speed * 10)) * (strength * _Amount * 4.0); float noise_wave_x = noise_wave_1 * noise_wave_2 / _Resolution.x; float uv_x = i.texcoord.x + noise_wave_x; float rgbSplit_uv_x = (_RGBSplit * 50 + (20.0 * strength + 1.0)) * noise_wave_x / _Resolution.x; // Sample RGB Color half4 colorG = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, float2(uv_x, i.texcoord.y)); half4 colorRB = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, float2(uv_x + rgbSplit_uv_x, i.texcoord.y)); return half4(colorRB.r, colorG.g, colorRB.b, colorRB.a + colorG.a); }
内容因剧透、敏感不适等原因被隐藏
点击查看内容因剧透、敏感不适等原因被隐藏
点击查看内容因剧透、敏感不适等原因被隐藏
点击查看内容因剧透、敏感不适等原因被隐藏
点击查看内容因剧透、敏感不适等原因被隐藏
点击查看内容因剧透、敏感不适等原因被隐藏
点击查看内容因剧透、敏感不适等原因被隐藏
点击查看内容因剧透、敏感不适等原因被隐藏
点击查看内容因剧透、敏感不适等原因被隐藏
点击查看
评论区
共 59 条评论热门最新