update colour diffuser shader
This commit is contained in:
parent
64d0a00c5c
commit
e3e6752304
3 changed files with 119 additions and 116 deletions
|
@ -941,7 +941,7 @@ Transform:
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 336599934}
|
m_GameObject: {fileID: 336599934}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: -1.814, y: -0.803, z: -0.392}
|
m_LocalPosition: {x: -1.443, y: -0.803, z: -0.382}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
|
@ -2768,7 +2768,7 @@ MonoBehaviour:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
type: 3
|
type: 3
|
||||||
objectId: 33b20ab7-2ff6-4c44-b628-b744c98aa181
|
objectId: 33b20ab7-2ff6-4c44-b628-b744c98aa181
|
||||||
randomNum: 83942149
|
randomNum: 51528520
|
||||||
unityVersion: 2021.3.41f1
|
unityVersion: 2021.3.41f1
|
||||||
cckVersion: 3.10:132
|
cckVersion: 3.10:132
|
||||||
--- !u!114 &1829270554
|
--- !u!114 &1829270554
|
||||||
|
|
|
@ -1,85 +1,88 @@
|
||||||
Shader "CrispyPin/diffuse"
|
Shader "CrispyPin/diffuse" {
|
||||||
{
|
Properties {
|
||||||
Properties
|
[NoScaleOffset]
|
||||||
{
|
_LastFrame ("Render texture", 2D) = "white" {}
|
||||||
[NoScaleOffset]
|
[NoScaleOffset]
|
||||||
_LastFrame ("Render texture", 2D) = "white" {}
|
_Noise ("Noise", 2D) = "white" {}
|
||||||
[NoScaleOffset]
|
}
|
||||||
_Noise ("Noise", 2D) = "white" {}
|
SubShader {
|
||||||
}
|
Tags { "RenderType"="Opaque" }
|
||||||
SubShader
|
LOD 100
|
||||||
{
|
Pass {
|
||||||
Tags { "RenderType"="Opaque" }
|
CGPROGRAM
|
||||||
LOD 100
|
#pragma vertex vert
|
||||||
|
#pragma fragment frag
|
||||||
Pass
|
|
||||||
{
|
#include "UnityCG.cginc"
|
||||||
CGPROGRAM
|
|
||||||
#pragma vertex vert
|
#define WIDTH 256
|
||||||
#pragma fragment frag
|
|
||||||
|
struct appdata {
|
||||||
#include "UnityCG.cginc"
|
float4 vertex : POSITION;
|
||||||
|
float2 uv : TEXCOORD0;
|
||||||
#define WIDTH 256
|
};
|
||||||
|
|
||||||
struct appdata
|
struct v2f {
|
||||||
{
|
float2 uv : TEXCOORD0;
|
||||||
float4 vertex : POSITION;
|
float4 vertex : SV_POSITION;
|
||||||
float2 uv : TEXCOORD0;
|
};
|
||||||
};
|
|
||||||
|
texture2D _LastFrame;
|
||||||
struct v2f
|
sampler2D _Noise;
|
||||||
{
|
|
||||||
float2 uv : TEXCOORD0;
|
v2f vert (appdata v) {
|
||||||
float4 vertex : SV_POSITION;
|
v2f o;
|
||||||
};
|
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||||
|
o.uv = v.uv;
|
||||||
texture2D _LastFrame;
|
return o;
|
||||||
sampler2D _Noise;
|
}
|
||||||
|
|
||||||
v2f vert (appdata v)
|
float3 modify(float2 uv, float3 source) {
|
||||||
{
|
float3 rand = tex2D(_Noise, uv + _Time.yz + source);
|
||||||
v2f o;
|
float3 q = 0.01 * rand;
|
||||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
return source - q;
|
||||||
o.uv = v.uv;
|
}
|
||||||
return o;
|
|
||||||
}
|
float3 source_pixel(uint2 p, float2 uv, float2 rand_offset) {
|
||||||
|
const uint dir = tex2D(_Noise, uv + _Time.xy + rand_offset).r * (10.0 + sin(_Time.y*10) * 6.);
|
||||||
float3 source_pixel(uint2 p, float2 uv, float2 rand_offset) {
|
if (dir == 0) {
|
||||||
const uint dir = tex2D(_Noise, uv + _Time.xy + rand_offset).r * 4.0;
|
p.x += 1;
|
||||||
if (dir == 0) {
|
} else if (dir == 1) {
|
||||||
p.x += 1;
|
p.y += 1;
|
||||||
} else if (dir == 1) {
|
} else if (dir == 2) {
|
||||||
p.x -= 1;
|
p.x -= 1;
|
||||||
} else if (dir == 2) {
|
} else if (dir == 3) {
|
||||||
p.y += 1;
|
p.y -= 1;
|
||||||
} else if (dir == 3) {
|
} else {
|
||||||
p.y -= 1;
|
return modify(uv, _LastFrame[p]);
|
||||||
}
|
// return _LastFrame[p];
|
||||||
return _LastFrame[p];
|
}
|
||||||
}
|
return _LastFrame[p];
|
||||||
|
}
|
||||||
float4 frag (v2f i) : SV_Target {
|
|
||||||
if(_ProjectionParams.z > 1) discard;
|
|
||||||
|
float4 frag (v2f i) : SV_Target {
|
||||||
const uint2 p = i.uv * WIDTH;
|
if(_ProjectionParams.z > 1) discard;
|
||||||
|
|
||||||
float red = _LastFrame[p].r - (1./255.);
|
const uint2 p = i.uv * WIDTH;
|
||||||
float green = _LastFrame[p].g - (1./255.);
|
|
||||||
float blue = _LastFrame[p].b - (1./255.);
|
float3 s = modify(i.uv, _LastFrame[p]);
|
||||||
|
float red = s.r;
|
||||||
if (red <= 0) {
|
float green = s.g;
|
||||||
red = source_pixel(p, i.uv, float2(0.34, 0.89)).r;
|
float blue = s.b;
|
||||||
}
|
const float epsilon = 0.1;
|
||||||
if (green <= 0) {
|
if (red <= epsilon) {
|
||||||
green = source_pixel(p, i.uv, float2(0.43, 0.19)).g;
|
red = source_pixel(p, i.uv, float2(0.34, 0.89)).r;
|
||||||
}
|
}
|
||||||
if (blue <= 0) {
|
if (green <= epsilon) {
|
||||||
blue = source_pixel(p, i.uv, float2(0.03, 0.39)).b;
|
green = source_pixel(p, i.uv, float2(0.43, 0.19)).g;
|
||||||
}
|
}
|
||||||
return float4(red, green, blue, 1);
|
if (blue <= epsilon) {
|
||||||
}
|
blue = source_pixel(p, i.uv, float2(0.03, 0.39)).b;
|
||||||
ENDCG
|
}
|
||||||
}
|
return float4(red, green, blue, 1);
|
||||||
}
|
}
|
||||||
|
ENDCG
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ MonoBehaviour:
|
||||||
width: 1920
|
width: 1920
|
||||||
height: 1029
|
height: 1029
|
||||||
m_ShowMode: 4
|
m_ShowMode: 4
|
||||||
m_Title: Game
|
m_Title: Scene
|
||||||
m_RootView: {fileID: 6}
|
m_RootView: {fileID: 6}
|
||||||
m_MinSize: {x: 875, y: 300}
|
m_MinSize: {x: 875, y: 300}
|
||||||
m_MaxSize: {x: 10000, y: 10000}
|
m_MaxSize: {x: 10000, y: 10000}
|
||||||
|
@ -48,7 +48,7 @@ MonoBehaviour:
|
||||||
m_MinSize: {x: 300, y: 200}
|
m_MinSize: {x: 300, y: 200}
|
||||||
m_MaxSize: {x: 24288, y: 16192}
|
m_MaxSize: {x: 24288, y: 16192}
|
||||||
vertical: 0
|
vertical: 0
|
||||||
controlID: 97
|
controlID: 86
|
||||||
--- !u!114 &3
|
--- !u!114 &3
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 52
|
m_ObjectHideFlags: 52
|
||||||
|
@ -68,8 +68,8 @@ MonoBehaviour:
|
||||||
y: 0
|
y: 0
|
||||||
width: 390
|
width: 390
|
||||||
height: 979
|
height: 979
|
||||||
m_MinSize: {x: 275, y: 50}
|
m_MinSize: {x: 276, y: 71}
|
||||||
m_MaxSize: {x: 4000, y: 4000}
|
m_MaxSize: {x: 4001, y: 4021}
|
||||||
m_ActualView: {fileID: 14}
|
m_ActualView: {fileID: 14}
|
||||||
m_Panes:
|
m_Panes:
|
||||||
- {fileID: 14}
|
- {fileID: 14}
|
||||||
|
@ -94,8 +94,8 @@ MonoBehaviour:
|
||||||
y: 0
|
y: 0
|
||||||
width: 378
|
width: 378
|
||||||
height: 692
|
height: 692
|
||||||
m_MinSize: {x: 200, y: 200}
|
m_MinSize: {x: 201, y: 221}
|
||||||
m_MaxSize: {x: 4000, y: 4000}
|
m_MaxSize: {x: 4001, y: 4021}
|
||||||
m_ActualView: {fileID: 15}
|
m_ActualView: {fileID: 15}
|
||||||
m_Panes:
|
m_Panes:
|
||||||
- {fileID: 15}
|
- {fileID: 15}
|
||||||
|
@ -223,7 +223,7 @@ MonoBehaviour:
|
||||||
m_MinSize: {x: 200, y: 200}
|
m_MinSize: {x: 200, y: 200}
|
||||||
m_MaxSize: {x: 16192, y: 16192}
|
m_MaxSize: {x: 16192, y: 16192}
|
||||||
vertical: 1
|
vertical: 1
|
||||||
controlID: 98
|
controlID: 87
|
||||||
--- !u!114 &10
|
--- !u!114 &10
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 52
|
m_ObjectHideFlags: 52
|
||||||
|
@ -248,7 +248,7 @@ MonoBehaviour:
|
||||||
m_MinSize: {x: 200, y: 100}
|
m_MinSize: {x: 200, y: 100}
|
||||||
m_MaxSize: {x: 16192, y: 8096}
|
m_MaxSize: {x: 16192, y: 8096}
|
||||||
vertical: 0
|
vertical: 0
|
||||||
controlID: 99
|
controlID: 88
|
||||||
--- !u!114 &11
|
--- !u!114 &11
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 52
|
m_ObjectHideFlags: 52
|
||||||
|
@ -259,7 +259,7 @@ MonoBehaviour:
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 1
|
m_EditorHideFlags: 1
|
||||||
m_Script: {fileID: 12006, guid: 0000000000000000e000000000000000, type: 0}
|
m_Script: {fileID: 12006, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
m_Name: GameView
|
m_Name: SceneView
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Position:
|
m_Position:
|
||||||
|
@ -270,14 +270,14 @@ MonoBehaviour:
|
||||||
height: 692
|
height: 692
|
||||||
m_MinSize: {x: 202, y: 221}
|
m_MinSize: {x: 202, y: 221}
|
||||||
m_MaxSize: {x: 4002, y: 4021}
|
m_MaxSize: {x: 4002, y: 4021}
|
||||||
m_ActualView: {fileID: 17}
|
m_ActualView: {fileID: 16}
|
||||||
m_Panes:
|
m_Panes:
|
||||||
- {fileID: 16}
|
- {fileID: 16}
|
||||||
- {fileID: 17}
|
- {fileID: 17}
|
||||||
- {fileID: 12}
|
- {fileID: 12}
|
||||||
- {fileID: 19}
|
- {fileID: 19}
|
||||||
m_Selected: 1
|
m_Selected: 0
|
||||||
m_LastSelected: 0
|
m_LastSelected: 1
|
||||||
--- !u!114 &12
|
--- !u!114 &12
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 52
|
m_ObjectHideFlags: 52
|
||||||
|
@ -347,23 +347,23 @@ MonoBehaviour:
|
||||||
m_SkipHidden: 0
|
m_SkipHidden: 0
|
||||||
m_SearchArea: 1
|
m_SearchArea: 1
|
||||||
m_Folders:
|
m_Folders:
|
||||||
- Assets/julia
|
- Assets/automata
|
||||||
m_Globs: []
|
m_Globs: []
|
||||||
m_OriginalText:
|
m_OriginalText:
|
||||||
m_FilterByTypeIntersection: 0
|
m_FilterByTypeIntersection: 0
|
||||||
m_ViewMode: 1
|
m_ViewMode: 1
|
||||||
m_StartGridSize: 64
|
m_StartGridSize: 64
|
||||||
m_LastFolders:
|
m_LastFolders:
|
||||||
- Assets/julia
|
- Assets/automata
|
||||||
m_LastFoldersGridSize: -1
|
m_LastFoldersGridSize: -1
|
||||||
m_LastProjectPath: /home/crispypin/proj/unity/cvr-props
|
m_LastProjectPath: /home/crispypin/proj/unity/cvr-props
|
||||||
m_LockTracker:
|
m_LockTracker:
|
||||||
m_IsLocked: 0
|
m_IsLocked: 0
|
||||||
m_FolderTreeState:
|
m_FolderTreeState:
|
||||||
scrollPos: {x: 0, y: 50}
|
scrollPos: {x: 0, y: 50}
|
||||||
m_SelectedIDs: a2560000
|
m_SelectedIDs: 7c560000
|
||||||
m_LastClickedID: 22178
|
m_LastClickedID: 22140
|
||||||
m_ExpandedIDs: 0000000040560000425600004456000000ca9a3b
|
m_ExpandedIDs: 000000006a5600006c5600006e56000000ca9a3b
|
||||||
m_RenameOverlay:
|
m_RenameOverlay:
|
||||||
m_UserAcceptedRename: 0
|
m_UserAcceptedRename: 0
|
||||||
m_Name:
|
m_Name:
|
||||||
|
@ -391,7 +391,7 @@ MonoBehaviour:
|
||||||
scrollPos: {x: 0, y: 0}
|
scrollPos: {x: 0, y: 0}
|
||||||
m_SelectedIDs:
|
m_SelectedIDs:
|
||||||
m_LastClickedID: 0
|
m_LastClickedID: 0
|
||||||
m_ExpandedIDs: 00000000405600004256000044560000
|
m_ExpandedIDs: 000000006a5600006c5600006e560000
|
||||||
m_RenameOverlay:
|
m_RenameOverlay:
|
||||||
m_UserAcceptedRename: 0
|
m_UserAcceptedRename: 0
|
||||||
m_Name:
|
m_Name:
|
||||||
|
@ -418,7 +418,7 @@ MonoBehaviour:
|
||||||
m_ListAreaState:
|
m_ListAreaState:
|
||||||
m_SelectedInstanceIDs:
|
m_SelectedInstanceIDs:
|
||||||
m_LastClickedInstanceID: 0
|
m_LastClickedInstanceID: 0
|
||||||
m_HadKeyboardFocusLastEvent: 1
|
m_HadKeyboardFocusLastEvent: 0
|
||||||
m_ExpandedInstanceIDs: c6230000
|
m_ExpandedInstanceIDs: c6230000
|
||||||
m_RenameOverlay:
|
m_RenameOverlay:
|
||||||
m_UserAcceptedRename: 0
|
m_UserAcceptedRename: 0
|
||||||
|
@ -521,9 +521,9 @@ MonoBehaviour:
|
||||||
m_SceneHierarchy:
|
m_SceneHierarchy:
|
||||||
m_TreeViewState:
|
m_TreeViewState:
|
||||||
scrollPos: {x: 0, y: 0}
|
scrollPos: {x: 0, y: 0}
|
||||||
m_SelectedIDs: 22580000
|
m_SelectedIDs: da550000
|
||||||
m_LastClickedID: 22562
|
m_LastClickedID: 21978
|
||||||
m_ExpandedIDs: faf7ffffbef8ffff32fbffff
|
m_ExpandedIDs: 32fbffff
|
||||||
m_RenameOverlay:
|
m_RenameOverlay:
|
||||||
m_UserAcceptedRename: 0
|
m_UserAcceptedRename: 0
|
||||||
m_Name:
|
m_Name:
|
||||||
|
@ -667,7 +667,7 @@ MonoBehaviour:
|
||||||
containerId: overlay-container--right
|
containerId: overlay-container--right
|
||||||
floating: 0
|
floating: 0
|
||||||
collapsed: 0
|
collapsed: 0
|
||||||
displayed: 1
|
displayed: 0
|
||||||
snapOffset: {x: 0, y: 0}
|
snapOffset: {x: 0, y: 0}
|
||||||
snapOffsetDelta: {x: 0, y: 0}
|
snapOffsetDelta: {x: 0, y: 0}
|
||||||
snapCorner: 0
|
snapCorner: 0
|
||||||
|
@ -828,9 +828,9 @@ MonoBehaviour:
|
||||||
m_PlayAudio: 0
|
m_PlayAudio: 0
|
||||||
m_AudioPlay: 0
|
m_AudioPlay: 0
|
||||||
m_Position:
|
m_Position:
|
||||||
m_Target: {x: 1.6600684, y: 0.78829163, z: 3.0949337}
|
m_Target: {x: -0.24334723, y: 0.9864835, z: 1.7148334}
|
||||||
speed: 2
|
speed: 2
|
||||||
m_Value: {x: 1.6600684, y: 0.78829163, z: 3.0949337}
|
m_Value: {x: -0.24334723, y: 0.9864835, z: 1.7148334}
|
||||||
m_RenderMode: 0
|
m_RenderMode: 0
|
||||||
m_CameraMode:
|
m_CameraMode:
|
||||||
drawMode: 0
|
drawMode: 0
|
||||||
|
@ -877,13 +877,13 @@ MonoBehaviour:
|
||||||
m_GridAxis: 1
|
m_GridAxis: 1
|
||||||
m_gridOpacity: 0.5
|
m_gridOpacity: 0.5
|
||||||
m_Rotation:
|
m_Rotation:
|
||||||
m_Target: {x: -0.0111987265, y: 0.9788394, z: -0.19677207, w: -0.061388683}
|
m_Target: {x: -0.01534271, y: 0.98336965, z: -0.11157136, w: -0.14511934}
|
||||||
speed: 2
|
speed: 2
|
||||||
m_Value: {x: -0.010918733, y: 0.9793527, z: -0.19229415, w: -0.06141567}
|
m_Value: {x: -0.01516958, y: 0.9832132, z: -0.11155192, w: -0.14358965}
|
||||||
m_Size:
|
m_Size:
|
||||||
m_Target: 1.2177774
|
m_Target: 0.17853571
|
||||||
speed: 2
|
speed: 2
|
||||||
m_Value: 1.2177774
|
m_Value: 0.17853571
|
||||||
m_Ortho:
|
m_Ortho:
|
||||||
m_Target: 0
|
m_Target: 0
|
||||||
speed: 2
|
speed: 2
|
||||||
|
@ -970,7 +970,7 @@ MonoBehaviour:
|
||||||
m_HSlider: 0
|
m_HSlider: 0
|
||||||
m_VSlider: 0
|
m_VSlider: 0
|
||||||
m_IgnoreScrollWheelUntilClicked: 0
|
m_IgnoreScrollWheelUntilClicked: 0
|
||||||
m_EnableMouseInput: 1
|
m_EnableMouseInput: 0
|
||||||
m_EnableSliderZoomHorizontal: 0
|
m_EnableSliderZoomHorizontal: 0
|
||||||
m_EnableSliderZoomVertical: 0
|
m_EnableSliderZoomVertical: 0
|
||||||
m_UniformScale: 1
|
m_UniformScale: 1
|
||||||
|
|
Loading…
Reference in a new issue