dat shader

This commit is contained in:
klemek
2020-12-11 00:06:31 +01:00
parent 67f7123f4d
commit 3e9752dcad
5 changed files with 205 additions and 0 deletions
+87
View File
@@ -0,0 +1,87 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Background Material
m_Shader: {fileID: 4800000, guid: e56d41d82638fac4db3047c82137e7eb, type: 3}
m_ShaderKeywords: ETC1_EXTERNAL_ALPHA
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _Background: 0.2
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _Foreground: 0.553
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _MiddlePoint: 0.3
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _Size: 100
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Step: 5
- _UVSec: 0
- _WaveScale: 100
- _Width: 0.001
- _ZWrite: 1
m_Colors:
- _Background: {r: 0.3, g: 0.3, b: 0.3, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _Foreground: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_BuildTextureStacks: []
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7f247c265d325694a96c63ce0be3b314
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bd01bee9f19c27b489ede65e7df4d9bd
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+93
View File
@@ -0,0 +1,93 @@
Shader "Shaders101/Colored UV"
{
Properties
{
_Width("Width", Range(0.0001,0.05)) = 0.001
_Size("Object Size", Range(0.01,1000)) = 100
_MiddlePoint("Middle Point", Range(0, 1)) = 0.6
_Background("Background Color", Color) = (.2, .2, .2, 1)
_Foreground("Foreground Color", Color) = (.5, .5, .5, 1)
_Step("Step", Int) = 5
_MainTex("Texture", 2D) = "white" {}
}
SubShader
{
Tags
{
"PreviewType" = "Plane"
}
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float4 vertex : SV_POSITION;
float2 uv : TEXCOORD0;
float4 scrPos : TEXCOORD1;
};
sampler2D _MainTex;
v2f vert(appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.scrPos = ComputeScreenPos(v.vertex);
o.uv = v.uv;
return o;
}
float _Width;
float _Size;
float4 _Background;
float _MiddlePoint;
float4 _Foreground;
int _Step;
float4 frag(v2f i) : SV_Target
{
float d = length(ObjSpaceViewDir(i.scrPos));
float w = d * _Width;
i.uv *= _Size;
float k = log(d) / log(_Step);
float k0 = floor(k);
float x = d / pow(_Step, k0);
float s1 = pow(_Step, k0) * .1 / _Step;
float c1 = clamp(_MiddlePoint * (_Step - x) / (_Step - 1), 0, 1);
float s2 = s1 * _Step;
float c2 = clamp((1 - _MiddlePoint) * (_Step - x) / (_Step - 1) + _MiddlePoint, 0, 1);
float s3 = s2 * _Step;
float2 uv = i.uv;
float grid1 = clamp(1 - step(w, fmod(uv.x + w * .5, s1)) + 1 - step(w, fmod(uv.y + w * .5, s1)), 0, 1);
float grid2 = clamp(1 - step(w, fmod(uv.x + w * .5, s2)) + 1 - step(w, fmod(uv.y + w * .5, s2)), 0, 1);
float grid3 = clamp(1 - step(w, fmod(uv.x + w * .5, s3)) + 1 - step(w, fmod(uv.y + w * .5, s3)), 0, 1);
grid2 = clamp(grid2 - grid3, 0, 1);
grid1 = clamp(grid1 - grid2, 0, 1);
float a = (grid1 * c1 + grid2 * c2 + grid3);
return (1 - a) * _Background + a * _Foreground;
}
ENDCG
}
}
}
+9
View File
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: e56d41d82638fac4db3047c82137e7eb
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant: