quite good i think
This commit is contained in:
parent
d0ebab4643
commit
56cff00ba5
@ -117,21 +117,26 @@ Material:
|
||||
- _Surface: 0
|
||||
- _WorkflowMode: 1
|
||||
- _ZWrite: 1
|
||||
- u_bend: 1.32
|
||||
- u_noise_amount: 0.96
|
||||
- u_noise_size: 246.53
|
||||
- u_scanline_amount: -2.9
|
||||
- u_scanline_size_1: 1.09
|
||||
- u_scanline_size_2: 1.69
|
||||
- u_scanline_speed_1: 0.08
|
||||
- u_scanline_speed_2: 1.28
|
||||
- u_time: 15.02
|
||||
- u_vignette_edge_round: 0.44
|
||||
- u_vignette_size: 0.41
|
||||
- u_vignette_smoothness: 0.28
|
||||
- u_bend: 2.21
|
||||
- u_noise_amount: 0.012
|
||||
- u_noise_size: 337
|
||||
- u_scanlin_transparence1: 0.38
|
||||
- u_scanlin_transparence2: 0.098
|
||||
- u_scanline_amount: 0.019
|
||||
- u_scanline_size_1: 308
|
||||
- u_scanline_size_2: 521
|
||||
- u_scanline_speed_1: 94.13
|
||||
- u_scanline_speed_2: 14.83
|
||||
- u_time: 15.95
|
||||
- u_vignette_edge_round: 7
|
||||
- u_vignette_size: 1.89
|
||||
- u_vignette_smoothness: 0.56
|
||||
m_Colors:
|
||||
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
- u_blue_offset: {r: 0, g: 0.002, b: 0, a: 0}
|
||||
- u_green_offset: {r: 0, g: 0, b: 0, a: 0}
|
||||
- u_red_offset: {r: 0, g: 0.002, b: 0, a: 0}
|
||||
m_BuildTextureStacks: []
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1f823cbc83e54d88a90cd594398385d1
|
||||
timeCreated: 1666894558
|
||||
@ -23,25 +23,6 @@ MonoBehaviour:
|
||||
DirectLightingStrength: 0.25
|
||||
Radius: 0.25
|
||||
SampleCount: 12
|
||||
--- !u!114 &-1742716298934962613
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d2d5de177d814a8d8c64638ad49b1b1d, type: 3}
|
||||
m_Name: PixelPass
|
||||
m_EditorClassIdentifier:
|
||||
m_Active: 0
|
||||
settings:
|
||||
Event: 300
|
||||
blitMaterial: {fileID: 2100000, guid: bc45e5f0151133446b26221ec8ea680c, type: 2}
|
||||
blitMaterialPassIndex: 0
|
||||
destination: 0
|
||||
textureId: _BlitPassTexture
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -59,9 +40,8 @@ MonoBehaviour:
|
||||
type: 3}
|
||||
m_RendererFeatures:
|
||||
- {fileID: -1878332245247344467}
|
||||
- {fileID: -1742716298934962613}
|
||||
- {fileID: 6059349672888060108}
|
||||
m_RendererFeatureMap: adc0de57c6d2eee54bb6b269c2a0d0e7cc485f766c221754
|
||||
m_RendererFeatureMap: adc0de57c6d2eee5cc485f766c221754
|
||||
m_UseNativeRenderPass: 0
|
||||
postProcessData: {fileID: 11400000, guid: 41439944d30ece34e96484bdb6645b55, type: 2}
|
||||
xrSystemData: {fileID: 11400000, guid: 60e1133243b97e347b653163a8c01b64, type: 2}
|
||||
@ -120,3 +100,4 @@ MonoBehaviour:
|
||||
blitMaterialPassIndex: 0
|
||||
destination: 0
|
||||
textureId: _BlitPassTexture
|
||||
alwaysRender: 1
|
||||
|
||||
@ -82,6 +82,7 @@ namespace Shaders
|
||||
public int blitMaterialPassIndex = -1;
|
||||
public Target destination = Target.Color;
|
||||
public string textureId = "_BlitPassTexture";
|
||||
public bool alwaysRender = false;
|
||||
}
|
||||
|
||||
public enum Target
|
||||
@ -116,8 +117,11 @@ namespace Shaders
|
||||
return;
|
||||
}
|
||||
|
||||
if (Application.isPlaying || settings.alwaysRender)
|
||||
{
|
||||
blitPass.Setup(src, dest);
|
||||
renderer.EnqueuePass(blitPass);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Assets/Shaders/BlitShaderGUI.cs
Normal file
19
Assets/Shaders/BlitShaderGUI.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Shaders
|
||||
{
|
||||
public class BlitShaderGUI : ShaderGUI
|
||||
{
|
||||
public override void OnGUI (MaterialEditor materialEditor, MaterialProperty[] properties)
|
||||
{
|
||||
// var propertiesList = properties.ToList()
|
||||
// .Where(prop => prop.displayName != "Texture");
|
||||
// properties = propertiesList.ToArray();
|
||||
|
||||
base.OnGUI (materialEditor, properties);
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Shaders/BlitShaderGUI.cs.meta
Normal file
3
Assets/Shaders/BlitShaderGUI.cs.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea9e1aab61914fdc984d1ba78a132f7c
|
||||
timeCreated: 1667020752
|
||||
@ -2,19 +2,29 @@ Shader "CRTShader"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
u_time("u_time",float) = 0.5
|
||||
u_bend("u_bend",float) = 0.5
|
||||
u_scanline_size_1("u_scanline_size_1",float) = 0.5
|
||||
u_scanline_speed_1("u_scanline_speed_1",float) = 0.5
|
||||
u_scanline_size_2("u_scanline_size_2",float) = 0.5
|
||||
u_scanline_speed_2("u_scanline_speed_2",float) = 0.5
|
||||
u_scanline_amount("u_scanline_amount",float) = 0.5
|
||||
u_vignette_size("u_vignette_size",float) = 0.5
|
||||
u_vignette_smoothness("u_vignette_smoothness",float) = 0.5
|
||||
u_vignette_edge_round("u_vignette_edge_round",float) = 0.5
|
||||
u_noise_size("u_noise_size",float) = 0.5
|
||||
u_noise_amount("u_noise_amount",float) = 0.5
|
||||
_MainTex("Texture", 2D) = "Transparent" {}
|
||||
u_time("Time",float) = 0.5
|
||||
u_bend("Bend",range(0.5, 5.0)) = 0.5
|
||||
u_scanlin_transparence1("Scanline 1 Transparence",range(0, 1)) = 0.5
|
||||
u_scanline_size_1("Scanline Size 1",range(0, 750)) = 0.5
|
||||
u_scanline_speed_1("Scanline Speed 1",float) = 0.5
|
||||
u_scanlin_transparence2("Scanline 2 Transparence",range(0, 1)) = 0.5
|
||||
u_scanline_size_2("Scanline Size 2",range(0, 750)) = 0.5
|
||||
u_scanline_speed_2("Scanline Speed2",float) = 0.5
|
||||
u_scanline_amount("Scanline Amount",range(0, 1)) = 0.5
|
||||
u_vignette_size("Vignette Size",range(0, 10)) = 0.5
|
||||
u_vignette_smoothness("Vignette Smoothness",range(0, 2)) = 0.5
|
||||
u_vignette_edge_round("Vignette Edge Round",range(0, 100)) = 0.5
|
||||
u_noise_size("Noise Size",range(0, 500 )) = 0.5
|
||||
u_noise_amount("Noise Amount",range(0, 0.3)) = 0.5
|
||||
[ShowAsVector2] u_red_offset("Red Offset",Vector) = (.25, .5, .5, 0)
|
||||
[ShowAsVector2] u_green_offset("Green Offset",Vector) = (.25, .5, .5, 0)
|
||||
[ShowAsVector2] u_blue_offset("Blue Offset",Vector) = (.25, .5, .5, 0)
|
||||
}
|
||||
|
||||
// The Unity Editor uses the class ExampleCustomEditor to configure the Inspector for this shader asset
|
||||
CustomEditor "Shaders.BlitShaderGUI"
|
||||
|
||||
SubShader
|
||||
{
|
||||
// No culling or depth
|
||||
@ -52,8 +62,10 @@ Shader "CRTShader"
|
||||
|
||||
uniform float u_time;
|
||||
uniform float u_bend;
|
||||
uniform float u_scanlin_transparence1;
|
||||
uniform float u_scanline_size_1;
|
||||
uniform float u_scanline_speed_1;
|
||||
uniform float u_scanlin_transparence2;
|
||||
uniform float u_scanline_size_2;
|
||||
uniform float u_scanline_speed_2;
|
||||
uniform float u_scanline_amount;
|
||||
@ -86,13 +98,14 @@ Shader "CRTShader"
|
||||
return smoothstep(0, smoothness, amount);
|
||||
}
|
||||
|
||||
float scanline(half2 uv, float lines, float speed)
|
||||
float scanline(half2 uv, float lines, float speed, float transparence)
|
||||
{
|
||||
return sin(uv.y * lines + u_time * speed);
|
||||
return sin(uv.y * lines + u_time * speed) * transparence;
|
||||
}
|
||||
|
||||
float random(half2 uv)
|
||||
{
|
||||
|
||||
return frac(sin(dot(uv, half2(15.1511, 42.5225))) * 12341.51611 * sin(u_time * 0.03));
|
||||
}
|
||||
|
||||
@ -113,6 +126,7 @@ Shader "CRTShader"
|
||||
|
||||
fixed4 frag(v2f i) : SV_Target
|
||||
{
|
||||
u_time = _Time;
|
||||
half2 crt_uv = crt_coords(i.uv, u_bend);
|
||||
fixed4 col;
|
||||
col.r = tex2D(_MainTex, crt_uv + u_red_offset).r;
|
||||
@ -120,8 +134,8 @@ Shader "CRTShader"
|
||||
col.b = tex2D(_MainTex, crt_uv + u_blue_offset).b;
|
||||
col.a = tex2D(_MainTex, crt_uv).a;
|
||||
|
||||
float s1 = scanline(i.uv, u_scanline_size_1, u_scanline_speed_1);
|
||||
float s2 = scanline(i.uv, u_scanline_size_2, u_scanline_speed_2);
|
||||
float s1 = scanline(i.uv, u_scanline_size_1, u_scanline_speed_1, u_scanlin_transparence1);
|
||||
float s2 = scanline(i.uv, u_scanline_size_2, u_scanline_speed_2,u_scanlin_transparence2);
|
||||
|
||||
col = lerp(col, fixed(s1 + s2), u_scanline_amount);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user