1
0
forked from cgvr/DeltaVR

Remove unused assets, asset cleaner and bakery

This commit is contained in:
Toomas Tamm
2021-03-06 14:59:36 +02:00
parent d12bcaecea
commit 14cb8f42df
598 changed files with 197 additions and 1949461 deletions

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 873f21b23168e9c4b8f050b03a062cd1
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 9bed0f95cef8a5b40b671e51c81b913a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: bfe91211d04298546aa37179ceea76f5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 90e6382921155aa42a8dbeec11dbbc27
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 837cfb9725d386c44b24203d8a659f07
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,6 +0,0 @@
fileFormatVersion: 2
guid: 194c5f733c7534ed790e101791e86518
folderAsset: yes
DefaultImporter:
userData:
assetBundleName:

View File

@@ -1,111 +0,0 @@
// Per pixel bumped refraction.
// Uses a normal map to distort the image behind, and
// an additional texture to tint the color.
Shader "FX/Glass/Stained BumpDistort" {
Properties {
_BumpAmt ("Distortion", range (0,128)) = 10
_MainTex ("Tint Color (RGB)", 2D) = "white" {}
_Color("Color", Color) = (1, 1, 1, 1)
_BumpMap ("Normalmap", 2D) = "bump" {}
}
Category {
// We must be transparent, so other objects are drawn before this one.
Tags { "Queue"="Transparent" "RenderType"="Opaque" }
SubShader {
// This pass grabs the screen behind the object into a texture.
// We can access the result in the next pass as _GrabTexture
GrabPass {
Name "BASE"
Tags { "LightMode" = "Always" }
}
// Main pass: Take the texture grabbed above and use the bumpmap to perturb it
// on to the screen
Pass {
Name "BASE"
Tags { "LightMode" = "Always" }
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_fog
#include "UnityCG.cginc"
struct appdata_t {
float4 vertex : POSITION;
float2 texcoord: TEXCOORD0;
};
struct v2f {
float4 vertex : SV_POSITION;
float4 uvgrab : TEXCOORD0;
float2 uvbump : TEXCOORD1;
float2 uvmain : TEXCOORD2;
UNITY_FOG_COORDS(3)
};
float _BumpAmt;
float4 _BumpMap_ST;
float4 _MainTex_ST;
float4 _Color;
v2f vert (appdata_t v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uvgrab = ComputeGrabScreenPos(o.vertex);
o.uvbump = TRANSFORM_TEX( v.texcoord, _BumpMap );
o.uvmain = TRANSFORM_TEX( v.texcoord, _MainTex );
UNITY_TRANSFER_FOG(o,o.vertex);
return o;
}
sampler2D _GrabTexture;
float4 _GrabTexture_TexelSize;
sampler2D _BumpMap;
sampler2D _MainTex;
half4 frag (v2f i) : SV_Target
{
#if UNITY_SINGLE_PASS_STEREO
i.uvgrab.xy = TransformStereoScreenSpaceTex(i.uvgrab.xy, i.uvgrab.w);
#endif
// calculate perturbed coordinates
half2 bump = UnpackNormal(tex2D( _BumpMap, i.uvbump )).rg; // we could optimize this by just reading the x & y without reconstructing the Z
float2 offset = bump * _BumpAmt * _GrabTexture_TexelSize.xy;
#ifdef UNITY_Z_0_FAR_FROM_CLIPSPACE //to handle recent standard asset package on older version of unity (before 5.5)
i.uvgrab.xy = offset * UNITY_Z_0_FAR_FROM_CLIPSPACE(i.uvgrab.z) + i.uvgrab.xy;
#else
i.uvgrab.xy = offset * i.uvgrab.z + i.uvgrab.xy;
#endif
half4 col = tex2Dproj( _GrabTexture, UNITY_PROJ_COORD(i.uvgrab));
half4 tint = tex2D(_MainTex, i.uvmain);
col *= tint * _Color;
UNITY_APPLY_FOG(i.fogCoord, col);
return col;
}
ENDCG
}
}
// ------------------------------------------------------------------
// Fallback for older cards and Unity non-Pro
SubShader {
Blend DstColor Zero
Pass {
Name "BASE"
SetTexture [_MainTex] { combine texture }
}
}
}
}

View File

@@ -1,6 +0,0 @@
fileFormatVersion: 2
guid: 963484209d11fd7f110076aa44295342
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:

View File

@@ -1,6 +0,0 @@
fileFormatVersion: 2
guid: 8869f43d702ae4d6d8930649833d6bee
folderAsset: yes
DefaultImporter:
userData:
assetBundleName:

View File

@@ -1,52 +0,0 @@
fileFormatVersion: 2
guid: 19555d7d9d114c7f1100f5ab44295342
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 2
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 256
textureSettings:
filterMode: 2
aniso: 1
mipBias: 0
wrapMode: 0
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: 0
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:

View File

@@ -1,52 +0,0 @@
fileFormatVersion: 2
guid: 4b8d081e9d114c7f1100f5ab44295342
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 1
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 2
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 1
externalNormalMap: 1
heightScale: .117766477
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 512
textureSettings:
filterMode: 2
aniso: 1
mipBias: 0
wrapMode: 0
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: 1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:

View File

@@ -1,103 +0,0 @@
fileFormatVersion: 2
guid: e2446e114a8ffaf4988cf144f7b08505
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 0
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 1
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,103 +0,0 @@
fileFormatVersion: 2
guid: 165e239691dc58c43b4bafc3c8f8c181
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 0
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 1
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,6 +0,0 @@
fileFormatVersion: 2
guid: 488ccf78ce5fbe14db33f20cccd9f386
folderAsset: yes
DefaultImporter:
userData:
assetBundleName:

View File

@@ -1,6 +0,0 @@
fileFormatVersion: 2
guid: 280da6451a1e556438ce789a0d7e1f65
folderAsset: yes
DefaultImporter:
userData:
assetBundleName:

View File

@@ -1,58 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 3
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: ToonBasic
m_Shader: {fileID: 4800000, guid: d84268709d11078d11005b9844295342, type: 3}
m_ShaderKeywords: []
m_CustomRenderQueue: -1
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _ToonShade
second:
m_Texture: {fileID: 8900000, guid: b995d4bd9d11078d11005b9844295342, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
data:
first:
name: _Shininess
second: .699999988
data:
first:
name: _Outline
second: .00701886788
m_Colors:
data:
first:
name: _Color
second: {r: .462686539, g: .462686539, b: .462686539, a: 1}
data:
first:
name: _Emission
second: {r: 0, g: 0, b: 0, a: 0}
data:
first:
name: _SpecColor
second: {r: 1, g: 1, b: 1, a: 1}
data:
first:
name: _OutlineColor
second: {r: 0, g: 0, b: 0, a: 1}
--- !u!1002 &2100001
EditorExtensionImpl:
serializedVersion: 6

View File

@@ -1,5 +0,0 @@
fileFormatVersion: 2
guid: 84b9e1d19d11078d11005b9844295342
NativeFormatImporter:
userData:
assetBundleName:

View File

@@ -1,58 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 3
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: ToonBasicOutline
m_Shader: {fileID: 4800000, guid: 9ce107479d11178d11005b9844295342, type: 3}
m_ShaderKeywords: []
m_CustomRenderQueue: -1
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _ToonShade
second:
m_Texture: {fileID: 8900000, guid: b995d4bd9d11078d11005b9844295342, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
data:
first:
name: _Shininess
second: .57971698
data:
first:
name: _Outline
second: .00659701508
m_Colors:
data:
first:
name: _Color
second: {r: .462686539, g: .462686539, b: .462686539, a: 1}
data:
first:
name: _Emission
second: {r: 0, g: 0, b: 0, a: 0}
data:
first:
name: _SpecColor
second: {r: 1, g: 1, b: 1, a: 1}
data:
first:
name: _OutlineColor
second: {r: 0, g: 0, b: 0, a: 1}
--- !u!1002 &2100001
EditorExtensionImpl:
serializedVersion: 6

View File

@@ -1,5 +0,0 @@
fileFormatVersion: 2
guid: 215977489d11178d11005b9844295342
NativeFormatImporter:
userData:
assetBundleName:

View File

@@ -1,80 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 3
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: ToonLit
m_Shader: {fileID: 4800000, guid: 48dca5b99d113b8d11006bab44295342, type: 3}
m_ShaderKeywords: []
m_CustomRenderQueue: -1
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 2800000, guid: 9ca701319d113f2d1100ff9b44295342, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _BumpMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _ToonShade
second:
m_Texture: {fileID: 8900000, guid: ed7fefe29d117c8d11005e4844295342, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _Ramp
second:
m_Texture: {fileID: 2800000, guid: 4a056241e2722dc46a7262a8e7073fd9, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
data:
first:
name: _Shininess
second: .699999988
data:
first:
name: _Outline
second: .00807547197
m_Colors:
data:
first:
name: _Color
second: {r: .50251013, g: .50251013, b: .50251013, a: 1}
data:
first:
name: _MainTex_ST
second: {r: 1, g: 1, b: 0, a: 0}
data:
first:
name: _Emission
second: {r: 0, g: 0, b: 0, a: 0}
data:
first:
name: _SpecColor
second: {r: 1, g: 1, b: 1, a: 1}
data:
first:
name: _OutlineColor
second: {r: 0, g: 0, b: 0, a: 1}
data:
first:
name: _ToonShade_ST
second: {r: 1, g: 1, b: 0, a: 0}
--- !u!1002 &2100001
EditorExtensionImpl:
serializedVersion: 6

View File

@@ -1,5 +0,0 @@
fileFormatVersion: 2
guid: c9e6294c9d11cb8d11006bf944295342
NativeFormatImporter:
userData:
assetBundleName:

View File

@@ -1,65 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 3
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: ToonLitOutline
m_Shader: {fileID: 4800000, guid: 054a31a99d11e49d110086ba44295342, type: 3}
m_ShaderKeywords: []
m_CustomRenderQueue: -1
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _ToonShade
second:
m_Texture: {fileID: 8900000, guid: ed7fefe29d117c8d11005e4844295342, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _Ramp
second:
m_Texture: {fileID: 2800000, guid: 4a056241e2722dc46a7262a8e7073fd9, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
data:
first:
name: _Shininess
second: .699999988
data:
first:
name: _Outline
second: .00701492419
m_Colors:
data:
first:
name: _Color
second: {r: .50251013, g: .50251013, b: .50251013, a: 1}
data:
first:
name: _Emission
second: {r: 0, g: 0, b: 0, a: 0}
data:
first:
name: _SpecColor
second: {r: 1, g: 1, b: 1, a: 1}
data:
first:
name: _OutlineColor
second: {r: 0, g: 0, b: 0, a: 1}
--- !u!1002 &2100001
EditorExtensionImpl:
serializedVersion: 6

View File

@@ -1,5 +0,0 @@
fileFormatVersion: 2
guid: 5d69df9d9d11e49d110086ba44295342
NativeFormatImporter:
userData:
assetBundleName:

View File

@@ -1,6 +0,0 @@
fileFormatVersion: 2
guid: adec466a1f9044ea78471a5ce6f78271
folderAsset: yes
DefaultImporter:
userData:
assetBundleName:

View File

@@ -1,63 +0,0 @@
Shader "Toon/Basic" {
Properties {
_Color ("Main Color", Color) = (.5,.5,.5,1)
_MainTex ("Base (RGB)", 2D) = "white" {}
_ToonShade ("ToonShader Cubemap(RGB)", CUBE) = "" { }
}
SubShader {
Tags { "RenderType"="Opaque" }
Pass {
Name "BASE"
Cull Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_fog
#include "UnityCG.cginc"
sampler2D _MainTex;
samplerCUBE _ToonShade;
float4 _MainTex_ST;
float4 _Color;
struct appdata {
float4 vertex : POSITION;
float2 texcoord : TEXCOORD0;
float3 normal : NORMAL;
};
struct v2f {
float4 pos : SV_POSITION;
float2 texcoord : TEXCOORD0;
float3 cubenormal : TEXCOORD1;
UNITY_FOG_COORDS(2)
};
v2f vert (appdata v)
{
v2f o;
o.pos = UnityObjectToClipPos(v.vertex);
o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex);
o.cubenormal = mul (UNITY_MATRIX_MV, float4(v.normal,0));
UNITY_TRANSFER_FOG(o,o.pos);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
fixed4 col = _Color * tex2D(_MainTex, i.texcoord);
fixed4 cube = texCUBE(_ToonShade, i.cubenormal);
fixed4 c = fixed4(2.0f * cube.rgb * col.rgb, col.a);
UNITY_APPLY_FOG(i.fogCoord, c);
return c;
}
ENDCG
}
}
Fallback "VertexLit"
}

View File

@@ -1,6 +0,0 @@
fileFormatVersion: 2
guid: d84268709d11078d11005b9844295342
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:

View File

@@ -1,70 +0,0 @@
Shader "Toon/Basic Outline" {
Properties {
_Color ("Main Color", Color) = (.5,.5,.5,1)
_OutlineColor ("Outline Color", Color) = (0,0,0,1)
_Outline ("Outline width", Range (.002, 0.03)) = .005
_MainTex ("Base (RGB)", 2D) = "white" { }
_ToonShade ("ToonShader Cubemap(RGB)", CUBE) = "" { }
}
CGINCLUDE
#include "UnityCG.cginc"
struct appdata {
float4 vertex : POSITION;
float3 normal : NORMAL;
};
struct v2f {
float4 pos : SV_POSITION;
UNITY_FOG_COORDS(0)
fixed4 color : COLOR;
};
uniform float _Outline;
uniform float4 _OutlineColor;
v2f vert(appdata v) {
v2f o;
o.pos = UnityObjectToClipPos(v.vertex);
float3 norm = normalize(mul ((float3x3)UNITY_MATRIX_IT_MV, v.normal));
float2 offset = TransformViewToProjection(norm.xy);
#ifdef UNITY_Z_0_FAR_FROM_CLIPSPACE //to handle recent standard asset package on older version of unity (before 5.5)
o.pos.xy += offset * UNITY_Z_0_FAR_FROM_CLIPSPACE(o.pos.z) * _Outline;
#else
o.pos.xy += offset * o.pos.z * _Outline;
#endif
o.color = _OutlineColor;
UNITY_TRANSFER_FOG(o,o.pos);
return o;
}
ENDCG
SubShader {
Tags { "RenderType"="Opaque" }
UsePass "Toon/Basic/BASE"
Pass {
Name "OUTLINE"
Tags { "LightMode" = "Always" }
Cull Front
ZWrite On
ColorMask RGB
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_fog
fixed4 frag(v2f i) : SV_Target
{
UNITY_APPLY_FOG(i.fogCoord, i.color);
return i.color;
}
ENDCG
}
}
Fallback "Toon/Basic"
}

View File

@@ -1,6 +0,0 @@
fileFormatVersion: 2
guid: 9ce107479d11178d11005b9844295342
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:

View File

@@ -1,53 +0,0 @@
Shader "Toon/Lit" {
Properties {
_Color ("Main Color", Color) = (0.5,0.5,0.5,1)
_MainTex ("Base (RGB)", 2D) = "white" {}
_Ramp ("Toon Ramp (RGB)", 2D) = "gray" {}
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf ToonRamp
sampler2D _Ramp;
// custom lighting function that uses a texture ramp based
// on angle between light direction and normal
#pragma lighting ToonRamp exclude_path:prepass
inline half4 LightingToonRamp (SurfaceOutput s, half3 lightDir, half atten)
{
#ifndef USING_DIRECTIONAL_LIGHT
lightDir = normalize(lightDir);
#endif
half d = dot (s.Normal, lightDir)*0.5 + 0.5;
half3 ramp = tex2D (_Ramp, float2(d,d)).rgb;
half4 c;
c.rgb = s.Albedo * _LightColor0.rgb * ramp * (atten * 2);
c.a = 0;
return c;
}
sampler2D _MainTex;
float4 _Color;
struct Input {
float2 uv_MainTex : TEXCOORD0;
};
void surf (Input IN, inout SurfaceOutput o) {
half4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
}
Fallback "Diffuse"
}

View File

@@ -1,6 +0,0 @@
fileFormatVersion: 2
guid: 48dca5b99d113b8d11006bab44295342
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:

View File

@@ -1,17 +0,0 @@
Shader "Toon/Lit Outline" {
Properties {
_Color ("Main Color", Color) = (0.5,0.5,0.5,1)
_OutlineColor ("Outline Color", Color) = (0,0,0,1)
_Outline ("Outline width", Range (.002, 0.03)) = .005
_MainTex ("Base (RGB)", 2D) = "white" {}
_Ramp ("Toon Ramp (RGB)", 2D) = "gray" {}
}
SubShader {
Tags { "RenderType"="Opaque" }
UsePass "Toon/Lit/FORWARD"
UsePass "Toon/Basic Outline/OUTLINE"
}
Fallback "Toon/Lit"
}

View File

@@ -1,6 +0,0 @@
fileFormatVersion: 2
guid: 054a31a99d11e49d110086ba44295342
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:

View File

@@ -1,6 +0,0 @@
fileFormatVersion: 2
guid: 651770f8be26443fdb85aa3594fa349c
folderAsset: yes
DefaultImporter:
userData:
assetBundleName:

View File

@@ -1,53 +0,0 @@
fileFormatVersion: 2
guid: b995d4bd9d11078d11005b9844295342
TextureImporter:
fileIDToRecycleName:
8900000: generatedCubemap
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 2
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 1
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: 3
maxTextureSize: 512
textureSettings:
filterMode: 1
aniso: 1
mipBias: 0
wrapMode: 0
nPOTScale: 0
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: -1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:

View File

@@ -1,52 +0,0 @@
fileFormatVersion: 2
guid: 4a056241e2722dc46a7262a8e7073fd9
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 0
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 2
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: 5
maxTextureSize: 1024
textureSettings:
filterMode: 0
aniso: 1
mipBias: 0
wrapMode: 1
nPOTScale: 0
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: 5
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: a7025194b82ee4746add09a6b9424531
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: a0ecfe2f9de70b0428967a9ada0e15f0
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,75 +0,0 @@
Shader "Custom/ClipShaderV2"
{
Properties
{
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
_BackFaceColor ("Inside color", Color) = (1,1,1,1)
_FadeColor ("Rim color", Color) = (1,1,1,1)
_FadeDistance ("Fade distance", Float) = 10
_FadeSmooth ("Fade smooth distance", Float) = 1
}
SubShader
{
Tags { "RenderType"="Opaque"}
Cull Off
LOD 200
CGPROGRAM
#pragma surface surf Standard noshadow
#pragma target 3.0
#include "UnityCG.cginc"
sampler2D _MainTex;
float4 _FadeColor, _BackFaceColor;
float _FadeDistance, _FadeSmooth;
struct Input {
float3 worldPos;
float2 uv_MainTex;
float facing : VFACE;//-1 = if backface
};
half _Glossiness;
half _Metallic;
fixed4 _Color;
void surf (Input IN, inout SurfaceOutputStandard o) {
//color
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
// Other unity stuff
o.Metallic = _Metallic;
o.Smoothness = _Glossiness;
o.Alpha = c.a;
if(IN.facing == -1) {//backface
o.Albedo = _BackFaceColor;
}
//Camera sphere clip
fixed3 vec = IN.worldPos.xyz - _WorldSpaceCameraPos;
float dis = vec.x*vec.x + vec.y*vec.y + vec.z*vec.z;
float fadeDis = _FadeDistance * _FadeDistance;
float fade = _FadeSmooth * _FadeSmooth;
float fadeSmooth = fadeDis + fade;
if(dis < fadeDis) {
clip(-1);
}
else if (dis < fadeSmooth && IN.facing == 1) {
float v = (1-(fadeSmooth-dis)/fade);
o.Albedo = o.Albedo * v + (1-v) * _FadeColor;
}
}
ENDCG
}
FallBack "Diffuse"
}

View File

@@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 1403bcce49d7b7643abd13849ba8da2e
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,91 +0,0 @@
Shader "DBV/Kristo/WallClip"
{
Properties
{
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
_Color ("Main color", Color) = (1,1,1,1)
_FadeDistance ("Fade distance", Float) = 10
_FadeSmooth ("Fade smooth distance", Float) = 1
_DitherTex ("Texture", 2D) = "grey" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Standard fullforwardshadows
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
half _Glossiness;
half _Metallic;
sampler2D _MainTex, _DitherTex;
float4 _DitherTex_TexelSize;
float4 _Color;
float _FadeDistance, _FadeSmooth;
struct Input
{
float2 uv_MainTex;
float4 screenPos;
float3 worldPos;
};
// Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
// See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
// #pragma instancing_options assumeuniformscaling
UNITY_INSTANCING_BUFFER_START(Props)
// put more per-instance properties here
UNITY_INSTANCING_BUFFER_END(Props)
void surf (Input IN, inout SurfaceOutputStandard o) {
// Albedo comes from a texture tinted by color
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
// Metallic and smoothness come from slider variables
o.Metallic = _Metallic;
o.Smoothness = _Glossiness;
o.Alpha = c.a;
// sample the texture
fixed3 vec = IN.worldPos.xyz - _WorldSpaceCameraPos;
float dis = vec.x*vec.x + vec.y*vec.y + vec.z*vec.z;
float fadeDis = _FadeDistance * _FadeDistance;
float fade = _FadeSmooth * _FadeSmooth;
float fadeSmooth = fadeDis + fade;
float2 screenPos = IN.screenPos.xy / IN.screenPos.w;
float2 ditherCoordinate = screenPos * _ScreenParams.xy * _DitherTex_TexelSize.xy;
float ditherValue = tex2D(_DitherTex, ditherCoordinate).r;
if(dis < fadeDis) {
clip(-1);
}
else if (dis < fadeSmooth) {
float v = (1-(fadeSmooth-dis)/fade);
float d = v * c.a - ditherValue;
clip(d);
c.a = d;
}
else {
float d = c.a - ditherValue;
clip(d);
c.a = d;
}
//o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}

View File

@@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: aa14134e6108b06409c88340f5573714
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,81 +0,0 @@
%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: Clip_Material_1
m_Shader: {fileID: 4800000, guid: 8634eab98f82cd4499699cbc2190acf1, type: 3}
m_ShaderKeywords:
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:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _FadeDistance: 60
- _FadeSmooth: 7.6
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _BackFaceColor: {r: 0.08627451, g: 0.3803922, b: 0.08235294, a: 1}
- _Color: {r: 0.20000002, g: 0.24313727, b: 0.3019608, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _FadeColor: {r: 0.121568635, g: 0.4784314, b: 0.09019608, a: 1}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: e5d667f7053dde3488569c31e919ed15
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,81 +0,0 @@
%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: Clip_Material_2
m_Shader: {fileID: 4800000, guid: 8634eab98f82cd4499699cbc2190acf1, type: 3}
m_ShaderKeywords:
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:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _FadeDistance: 10
- _FadeSmooth: 1.17
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _BackFaceColor: {r: 0, g: 0, b: 0, a: 1}
- _Color: {r: 0.5568628, g: 0.53333336, b: 0.4666667, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _FadeColor: {r: 0.7725491, g: 0.7372549, b: 0.64705884, a: 1}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: dd5c6c710c2688640a02ca8bb8598015
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,81 +0,0 @@
%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: Clip_Material_3
m_Shader: {fileID: 4800000, guid: 1403bcce49d7b7643abd13849ba8da2e, type: 3}
m_ShaderKeywords:
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:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _FadeDistance: 59
- _FadeSmooth: 8.2
- _GlossMapScale: 1
- _Glossiness: 0.37
- _GlossyReflections: 1
- _Metallic: 0.712
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _BackFaceColor: {r: 0, g: 0, b: 0, a: 1}
- _Color: {r: 1, g: 0.98764145, b: 0, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _FadeColor: {r: 1, g: 0, b: 0, a: 1}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: b8283e148ad316f40bca20bbdf89f5fe
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,159 +0,0 @@
Shader "DBV/Kristo/UnlitClip"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_Color ("Main color", Color) = (1,1,1,1)
_BackFaceColor ("Inside color", Color) = (1,1,1,1)
_FadeColor ("Rim color", Color) = (1,1,1,1)
_FadeDistance ("Fade distance", Float) = 10
_FadeSmooth ("Fade smooth distance", Float) = 1
_DitherTex ("Texture", 2D) = "grey" {}
}
SubShader {
Tags {
"RenderType"="Opaque"
}
LOD 100
Pass {
Cull Back
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_fog// make fog work
#include "UnityCG.cginc"
struct appdata {
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float4 screenPos : TEXCOORD1;
};
struct v2f {
float2 uv : TEXCOORD0;
UNITY_FOG_COORDS(1)
float4 vertex : SV_POSITION;
float4 worldSpace : TEXCOORD1;
float4 screenPos : TEXCOORD2;
};
sampler2D _MainTex, _DitherTex;
float4 _DitherTex_TexelSize;
float4 _MainTex_ST;
float4 _FadeColor, _BackFaceColor, _Color;
float _FadeDistance, _FadeSmooth;
v2f vert (appdata v) {
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
o.worldSpace = mul(unity_ObjectToWorld, v.vertex);
o.screenPos = ComputeScreenPos(o.vertex);
UNITY_TRANSFER_FOG(o,o.vertex);
return o;
}
fixed4 frag (v2f i) : SV_Target {
// sample the texture
fixed4 col = tex2D(_MainTex, i.uv) * _Color;
fixed3 vec = i.worldSpace.xyz - _WorldSpaceCameraPos;
float dis = vec.x*vec.x + vec.y*vec.y + vec.z*vec.z;
float fadeDis = _FadeDistance * _FadeDistance;
float fade = _FadeSmooth * _FadeSmooth;
float fadeSmooth = fadeDis + fade;
if(dis < fadeDis) {
col = 0;
clip(-1);
}
else if (dis < fadeSmooth) {
float v = (1-(fadeSmooth-dis)/fade);
//Do dither fade
//https://www.ronja-tutorials.com/2019/05/11/dithering.html
float2 screenPos = i.screenPos.xy / i.screenPos.w;
float2 ditherCoordinate = screenPos * _ScreenParams.xy * _DitherTex_TexelSize.xy;
float ditherValue = tex2D(_DitherTex, ditherCoordinate).r;
clip(v - ditherValue);
col = col * v + (1-v) * _FadeColor;
}
else{
//col.rgb *= i.worldSpace.xyz;
}
// apply fog
UNITY_APPLY_FOG(i.fogCoord, col);
return col;
}
ENDCG
}
Pass {
Cull Front
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_fog// make fog work
#include "UnityCG.cginc"
struct appdata {
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float4 screenPos : TEXCOORD1;
};
struct v2f {
float2 uv : TEXCOORD0;
UNITY_FOG_COORDS(1)
float4 vertex : SV_POSITION;
float4 worldSpace : TEXCOORD1;
float4 screenPos : TEXCOORD2;
};
float4 _BackFaceColor;
float _FadeDistance, _FadeSmooth;
sampler2D _DitherTex;
float4 _DitherTex_TexelSize;
v2f vert (appdata v) {
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.worldSpace = mul(unity_ObjectToWorld, v.vertex);
return o;
}
fixed4 frag (v2f i) : SV_Target {
fixed3 vec = i.worldSpace.xyz - _WorldSpaceCameraPos;
float dis = vec.x*vec.x + vec.y*vec.y + vec.z*vec.z;
float fadeDis = _FadeDistance * _FadeDistance;
float fade = _FadeSmooth * _FadeSmooth;
float fadeSmooth = fadeDis + fade;
if(dis < fadeDis) {
clip(-1);
}
else if (dis < fadeSmooth) {
float v = (1-(fadeSmooth-dis)/fade);
//Do dither fade
//https://www.ronja-tutorials.com/2019/05/11/dithering.html
float2 screenPos = i.screenPos.xy / i.screenPos.w;
float2 ditherCoordinate = screenPos * _ScreenParams.xy * _DitherTex_TexelSize.xy;
float ditherValue = tex2D(_DitherTex, ditherCoordinate).r;
clip(v - ditherValue);
}
return _BackFaceColor;
}
ENDCG
}
}
}

View File

@@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 8634eab98f82cd4499699cbc2190acf1
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 7cadabe6dcac7d64488529b0ffc56ce8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: fd2e51a1201e9294f89c28dd4a5de2de
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: ece97ec1882fb054ebace17485b43dad
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,25 +0,0 @@
#pragma kernel Converter
struct grassCell {
uint grassElementIndexes[512];//map to grass elements
};
StructuredBuffer<grassCell> grassCellBuffer;
StructuredBuffer<uint> grassCellIndexBuffer;
AppendStructuredBuffer<uint> outGrassBuffer;
[numthreads(8,8,8)]
void Converter (uint callIndex : SV_GroupIndex, uint3 groupID : SV_GroupID) {
uint realIndex = groupID.x + groupID.y + groupID.z;
uint cellIndex = grassCellIndexBuffer[realIndex];
grassCell cell = grassCellBuffer[ cellIndex ];
int elementIndex = callIndex;//Correct
uint objIndex = cell.grassElementIndexes[elementIndex];
if(objIndex != 0) outGrassBuffer.Append(objIndex);
}
//So the error seems to have been the usement of the wrong ID... but there must have been something else as well

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 1fd24d1f469889243b1b12e2b668be27
ComputeShaderImporter:
externalObjects: {}
currentAPIMask: 4
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,146 +0,0 @@
#pragma kernel CSCullIndividual
#pragma kernel CSCullCell
struct GrassElement {
float3 position;
float rotation;
float size;
float colorBlend;//0-1
};
struct grassCell {
uint grassElementIndexes[512];//map to grass elements
};
//struct grassOcclusionCell {
// uint grassCellIndex;
// uint visibleCellIndexes[2048];//Map to occlusion cells
// };
//General
uint grassCount;
float2 distanceBounts;//Start, end
Texture2D<float4> ditherTex;
int ditherTexSizeX;
float ditherSize;
//Input
StructuredBuffer<GrassElement> grassBuffer;
//Frustrum culling
float3 cameraPos;
float4x3 cameraFrustumNormals;
//settings
int doOcclusion;
//Cells
uint grassCellCount;
uint grassCellSize;
StructuredBuffer<grassCell> grassCellBuffer;
//Occlusion culling
//StructuredBuffer<grassOcclusionCell> grassOcclusionBuffer;
//Output
AppendStructuredBuffer<uint> outGrassBuffer;
AppendStructuredBuffer<uint> outCellIndexBuffer;
bool Is3DDither (float dist, float2 pos) {
float distAmount = 1 - (dist-distanceBounts.x)/(distanceBounts.y-distanceBounts.x);//0-1
float2 relativePos = pos/ditherSize;
float2 positivePos = float2(relativePos.x*sign(relativePos.x),relativePos.y*sign(relativePos.y));
float2 repeatingPos = float2(fmod(positivePos.x,ditherTexSizeX),fmod(positivePos.y,ditherTexSizeX));
float dit = ditherTex[repeatingPos].x;
return distAmount - dit > 0;
}
[numthreads(16,16,4)]
void CSCullIndividual (uint index : SV_GroupIndex, uint3 group : SV_GroupID) {//This only does frustrum culling
//1. get index
uint realIndex = index + 1024 * group.x;//id.x + id.y group.x + id.z group.x * group.y
//2. index valid?
if(realIndex < grassCount) {
GrassElement data = grassBuffer[realIndex];
float3 pos = data.position;
float3 posFromCamera = pos - cameraPos;
float scale = data.size;
//3. frustrum culling
if( (dot(cameraFrustumNormals[0], posFromCamera) > -scale) &&
(dot(cameraFrustumNormals[1], posFromCamera) > -scale) &&
(dot(cameraFrustumNormals[2], posFromCamera) > -scale) &&
(dot(cameraFrustumNormals[3], posFromCamera) > -scale) ){
//3D dither culling (includes dist culling)
float dist = length(posFromCamera);
if(Is3DDither(dist,pos.xz)) {
outGrassBuffer.Append(realIndex);
}
}
}
}
[numthreads(8,8,1)]
void CSCullCell (uint index : SV_GroupIndex, uint3 group : SV_GroupID) {//This does frustrum and occlusion culling on cells
//1. get index
uint realIndex = index + 8*8*group.x;
//2. index valid?
if(realIndex < grassCellCount) {
//outGrassBuffer.Append(realIndex);
//outCellIndexBuffer.Append(realIndex);
grassCell cell = grassCellBuffer[realIndex];
//for(int i=0;i<512;i++) {
// int k = cell.grassElementIndexes[i];
// if(k != 0)outGrassBuffer.Append(k);
// }
//Doing frustrum check with ranodom element from cell
float3 pos = grassBuffer[cell.grassElementIndexes[0]].position;
float3 posFromCamera = pos - cameraPos;
float scale = grassCellSize;
//3. frustrum culling
if( (dot(cameraFrustumNormals[0], posFromCamera) > -scale) &&
(dot(cameraFrustumNormals[1], posFromCamera) > -scale) &&
(dot(cameraFrustumNormals[2], posFromCamera) > -scale) &&
(dot(cameraFrustumNormals[3], posFromCamera) > -scale) ){
if(length(posFromCamera) <= distanceBounts.y) {//Dist check
if(doOcclusion == 1) {
//TODO see if this chunk is visible from current chunk
//TODO if yes then append chunk grass indexes
}
else {
outCellIndexBuffer.Append(realIndex);
}
}
}
}
}
//group -> thread
//SV_GroupThreadID = current threads num.xyz
//SV_GroupIndex = num.x * num.y * num.z;
//SV_GroupID = current gorup indices
/* This works for some reason
[numthreads(8,8,8)]
void Converter (uint callIndex : SV_GroupIndex, uint3 groupID : SV_GroupID) {
uint realIndex = groupID.x + groupID.y + groupID.z;
uint cellIndex = grassCellIndexBuffer[realIndex];
grassCell cell = grassCellBuffer[ cellIndex ];
int elementIndex = callIndex;//Correct
uint objIndex = cell.grassElementIndexes[elementIndex];
if(objIndex != 0) outGrassBuffer.Append(objIndex);
}
*/

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 7ceab07ca6d762d41baf41ab2a390c25
ComputeShaderImporter:
externalObjects: {}
currentAPIMask: 4
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 4c66346fab7980a4f929c61d7510c130
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 7cb3135d9c7fc794e907765b9aef86f8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,54 +0,0 @@
#pragma kernel ConvertTrianglesToDotsKernel
struct TriangleInput {
float3 p1;
float3 p2;
float3 p3;
};
StructuredBuffer<TriangleInput> triangles;
RWStructuredBuffer<float3> positionOutputs;
float maxDotAmount = 0.225;
float seed = 1.32523252;
int pointCountPerTriangle = 10;
float pointsPerUnit = 1;
float rand(float3 co){
return (frac(sin(dot(co ,float3(12.9898,78.233,45.5432))) * 43758.5453));
}
float triangleArea (float3 a, float3 b, float3 c) {
//for simplicitys sake ignoring the y dimension and finding area of 2D triangle
return (a.x*(b.z-c.z) + b.x*(c.z-a.z) + c.x*(a.z-b.z))/2.0;
}
float3 randomPointOnTriangle (float3 a, float3 b, float3 c, float index) {
float r1 = rand(index*b*seed);
float r0 = r1 + rand(index*c*seed) * (1-r1);//bigger
return float3(r1 * a.x + (r0-r1)*b.x + (1-r0)*c.x,
r1 * a.y + (r0-r1)*b.y + (1-r0)*c.y,
r1 * a.z + (r0-r1)*b.z + (1-r0)*c.z
);
}
[numthreads(16,1,1)]
void ConvertTrianglesToDotsKernel (uint3 id : SV_DispatchThreadID)
{
TriangleInput tri = triangles[id.x];
int startIndex = id.x*pointCountPerTriangle;
//based on triangle size get point amount
float points = min(triangleArea(tri.p1,tri.p2,tri.p3)*pointsPerUnit,pointCountPerTriangle);
for (int i = 0; i < pointCountPerTriangle; ++i) {
if(i < points) {
positionOutputs[startIndex + i] = randomPointOnTriangle(tri.p1,tri.p2,tri.p3, saturate((float)i/(float)points) );//tri.p1 * saturate(1 - (float)i/(float)points) + tri.p2 * saturate((float)i/(float)points);
}
else {
positionOutputs[startIndex + i] = float3(0,0,0);
}
}
}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 0b019a8b66e1a35458a71c2297608a26
ComputeShaderImporter:
externalObjects: {}
currentAPIMask: 4
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 9f51fb5d6fd8a2940b27ac89529b4f07
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: a490d5ae78d2b40408e40c7a94adc9f6
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 2e128af5fc364d04cbe70030007a473e
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 6cd2d0a79ec5af7428b2aaf3f2062554
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,25 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "DBV_GrassData", menuName = "Delta/Kristo/Grass_Data")]
public class GrassPositionScriptableObject : ScriptableObject {
[HideInInspector]
public List<Vector3> points = new List<Vector3>();
public struct cell {
public int[] arrayOfPointIndexes;
}
public struct occlusionCell {
public int cellIndex;
public int[] arrayOfVisibleOcclusionCellIndexes;
}
[HideInInspector]
public List<cell> cells = new List<cell>();
[HideInInspector]
public List<occlusionCell> occlusionCells = new List<occlusionCell>();
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 1bbb7ddcdfb501845bff224521ebbcca
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,594 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GrassLoader : MonoBehaviour {
public static GrassLoader instance;
void Awake () {
instance = this;
}
[Header("Requiered variables")]
public Mesh grassMesh;
public Mesh boxMesh;
public Material instancedGrassMaterial;
public Material instancedConsumeGrassMaterial;
public GrassPositionScriptableObject grassStorage;
public ComputeShader cullShader;
public ComputeShader convertArrayShader;
[Header("Tilemap (Occlusion culling)")]
public Vector3 bottomLeftCorner;
public float cellSideLengh = 1f;
public float totalLength = 100f;
[Header("3D culling")]
public Vector2 distanceBounds;
public Texture2D ditherTexture;
public float ditherSize;
[Header("Manual controls")]
public bool update;
public bool updateData;
public bool bakeCells;
public bool bakeOcclusion;
[Header("Testing")]
public bool debugTilemap1;
public bool debugTilemap2;
public bool debugTilemap3;
public bool debugTilemap4;
public bool showTilemap;
[Space]
public bool doCells;
public bool doCulling;
public bool doOcclusionCulling;
//[Header("Testing")]
//public bool update = false;
//data types
struct grassElement {
public Vector3 position;
public float rotation;
public float size;
public float colorBlend;//0-1
public grassElement (Vector3 position, float rotation, float size, float colorBlend) {
this.position = position;
this.rotation = rotation;
this.size = size;
this.colorBlend = colorBlend;
}
//Total size of is 4*3 + 3*4 = 24
}
struct grassCell {
public uint[] grassElementIndexes;//map to grass elements
public grassCell (uint[] grassElementIndexes) {
this.grassElementIndexes = grassElementIndexes;
}
public grassCell(grassCell x) {
grassElementIndexes = new uint[x.grassElementIndexes.Length];
for(int i = 0;i < x.grassElementIndexes.Length;i++){
grassElementIndexes[i] = x.grassElementIndexes[i] * 1;
}
}
//Total size = 4*length = must be calculated
}
struct grassOcclusionCell {
public uint grassCellIndex;
public uint[] visibleCellIndexes;//Map to occlusion cells
public grassOcclusionCell (uint grassCellIndex, uint[] visibleCellIndexes) {
this.grassCellIndex = grassCellIndex;
this.visibleCellIndexes = visibleCellIndexes;
}
//Total size = 4 + 4*length = must be calculated
}
//buffers
uint[] arguments = new uint[5] {0,0,0,0,0};
//main
ComputeBuffer grassBuffer;
ComputeBuffer argumentsBuffer;
ComputeBuffer allArgumentsBuffer;
//culling
ComputeBuffer workBuffer;//Append/Consume buffer for grass elements
ComputeBuffer grassCellBuffer;
ComputeBuffer cellWorkBuffer;
ComputeBuffer convertSizeBuffer;
public bool isOn = true;
int elementCount = 0;
int cellCount = 0;
bool startupDone;
grassElement[] grassElements;
Camera cam;
public void BakeCells () {
if(grassElements == null) UpdateMainBuffers();
bakeCells = false;
//Maps points into cells
// 0. Create tilemap
var tilemap = new Dictionary<int,List<int>>();
int cellsCount = Mathf.CeilToInt(totalLength/cellSideLengh);
for(int x = 0;x < cellsCount;x++) for(int y = 0;y < cellsCount;y++) tilemap.Add(x + y*cellsCount,new List<int>());
// 1. Set grassObjects into tiles
for(int i = 0;i < elementCount;i++) tilemap[GetTileIndex(grassElements[i].position)].Add(i);
//Debug
if(debugTilemap1) for(int x = 0;x < cellsCount;x++){
for(int y = 0;y < cellsCount;y++){
var pos = bottomLeftCorner + (x * Vector3.forward + y * Vector3.right)*cellSideLengh + Vector3.one * cellSideLengh/2f;
int i = GetTileIndex(pos);
if(tilemap.ContainsKey(i)) foreach(var k in tilemap[i]) Debug.DrawLine(grassElements[k].position + Vector3.right* 0.2f, pos,Color.green,100f);
}
}
// 2. Cull empty tiles
var removables = new Queue<int>();
foreach(var x in tilemap) if(x.Value.Count == 0) removables.Enqueue(x.Key);
foreach(var x in removables) tilemap.Remove(x);
//Debug
if(debugTilemap2) for(int x = 0;x < cellsCount;x++){
for(int y = 0;y < cellsCount;y++){
var pos = bottomLeftCorner + (x * Vector3.forward + y * Vector3.right)*cellSideLengh + Vector3.one * cellSideLengh/2f + Vector3.up;
int i = GetTileIndex(pos);
if(tilemap.ContainsKey(i)) foreach(var k in tilemap[i]) {Debug.DrawLine(grassElements[k].position + Vector3.right* 0.2f, pos,Color.magenta,100f); Debug.DrawRay(pos, Vector3.up,Color.magenta,100f);}
}
}
// 3. Get cell average grass count - not needed anymore
//float total = 0; float count = 0;
//foreach(var x in tilemap) { total += x.Value.Count; count++; }
//int mean = (int)(total/count);
//TODO 4. Convert tiles into cells of 512 elements (512 bc byte limit is 2048 and 1 index = 4 bytes so 512*4 = 2048)
var cells = new List<grassCell>();
var cellIdTilemap = new Dictionary<int,List<int>>();
foreach(var x in tilemap) {
//foreach entry convert indexes into how many cells are needed
var tileCellIDs = new List<int>();
var cellGrassIndexes = x.Value;
int leftToProcess = cellGrassIndexes.Count;
while(leftToProcess > 0) {
//Create new cell
var grassIndexArray = new uint[512];
for(int i = 0;i < grassIndexArray.Length;i++) {
if(cellGrassIndexes.Count > 0) {
grassIndexArray[i] = (uint)(cellGrassIndexes[0]);
cellGrassIndexes.RemoveAt(0);
leftToProcess--;
}
else grassIndexArray[i] = 0;
}
cells.Add( new grassCell(grassIndexArray) );
//Remember id
tileCellIDs.Add(cells.Count-1);
}
//Save cell ids so they can be used in occlusion culling
cellIdTilemap.Add(x.Key,tileCellIDs);
}
//Debug, foreach cell show which cells they map to by each cells connections
if(debugTilemap3) for(int x = 0;x < cellsCount;x++){
for(int y = 0;y < cellsCount;y++){
var pos = bottomLeftCorner + (x * Vector3.forward + y * Vector3.right)*cellSideLengh + Vector3.one * cellSideLengh/2f + Vector3.up * 2f;
int i = GetTileIndex(pos);
if(cellIdTilemap.ContainsKey(i)) {
//foreach cell get center
foreach(var cellIndex in cellIdTilemap[i]) {
var cell = cells[cellIndex];
Vector3 center = Vector3.zero;
float count = 0;
foreach(var grassIndex in cell.grassElementIndexes) {
if(grassIndex > 0) {center += grassElements[grassIndex].position; count++; Debug.DrawLine(grassElements[grassIndex].position, pos,Color.white,100f);}
}
Debug.DrawLine(center / count, pos,Color.blue,100f);
}
}
}
}
// 5. Convert cells into array (bc array in a struct is not bittable...)
cellCount = cells.Count;
var convertedArray = new uint[cellCount * 512];
for(int i = 0;i < cellCount;i++){
var c = cells[i];
for(int j = 0;j < 512;j++) { convertedArray[j + i * 512] = c.grassElementIndexes[j]; if(debugTilemap4) Debug.DrawRay(grassElements[c.grassElementIndexes[j]].position, Vector3.up,Color.magenta,100f); }
}
//Wipe old buffers
if(grassCellBuffer != null) grassCellBuffer.Release();
if(cellWorkBuffer != null) cellWorkBuffer.Release();
if(convertSizeBuffer != null) convertSizeBuffer.Release();
//Create new buffers
grassCellBuffer = new ComputeBuffer(cellCount, 2048);
cellWorkBuffer = new ComputeBuffer(cellCount, 4, ComputeBufferType.Append);
convertSizeBuffer = new ComputeBuffer(1, 12, ComputeBufferType.IndirectArguments);
//Upload data
grassCellBuffer.SetData(convertedArray);
cellWorkBuffer.SetCounterValue(0);
convertSizeBuffer.SetData(new uint[]{1,1,1});
//Send buffers to shaders
cullShader.SetBuffer(1, "grassBuffer", grassBuffer);
cullShader.SetBuffer(1, "grassCellBuffer", grassCellBuffer);
cullShader.SetBuffer(1, "outCellIndexBuffer", cellWorkBuffer);
//cullShader.SetBuffer(1, "outGrassBuffer", workBuffer);
convertArrayShader.SetBuffer(0, "grassCellBuffer", grassCellBuffer);
convertArrayShader.SetBuffer(0, "outGrassBuffer", workBuffer);
convertArrayShader.SetBuffer(0, "grassCellIndexBuffer", cellWorkBuffer);
//Set buffer values
cullShader.SetInt("grassCellCount", cellCount);
cullShader.SetInt("grassCellSize", Mathf.CeilToInt(cellSideLengh));
cullShader.SetVector("distanceBounts", distanceBounds);
cullShader.SetTexture(0, "ditherTex", ditherTexture);
cullShader.SetTexture(1, "ditherTex", ditherTexture);
cullShader.SetFloat("ditherTexSizeX", ditherTexture.width);
cullShader.SetFloat("ditherSize", ditherSize);
Debug.Log("GRASS: Created " + cellCount.ToString() + " cells");
}
public void BakeOcclusionCells () {
/*
bakeOcclusion = false;
//Creates occlusion cells
//OCCLUSION GENERATION (from created cell structs)
// 1. Create target low and full objects
var grassCollider = new GameObject();
grassCollider.transform.name = "TEMP_GRASS_COLLIDER";
grassCollider.AddComponent(typeof(BoxCollider));
var gMeshFilter = grassCollider.AddComponent(typeof(MeshFilter)) as MeshFilter;
var gMeshRenderer = grassCollider.AddComponent(typeof(MeshRenderer)) as MeshRenderer;
gMeshFilter.mesh = boxMesh;
grassCollider.transform.localScale = new Vector3(cellSideLengh,0.5f,cellSideLengh);
var fallableCollider = new GameObject();
fallableCollider.transform.name = "TEMP_FALLABLE_COLLIDER";
fallableCollider.AddComponent(typeof(BoxCollider));
var fMeshFilter = fallableCollider.AddComponent(typeof(MeshFilter)) as MeshFilter;
var fMeshRenderer = fallableCollider.AddComponent(typeof(MeshRenderer)) as MeshRenderer;
fMeshFilter.mesh = boxMesh;
fallableCollider.transform.localScale = new Vector3(cellSideLengh,20f,cellSideLengh);
// 2. Foreach cell try to see each other cell, if not already marked visible
//Create full tilemap of all possible places where camera might be
var fullTilemap = new HashSet<int>();
for(int x = 0;x < cellCount;x++){
for(int y = 0;y < cellCount;y++){
var pos = bottomLeftCorner + (x * Vector3.forward + y * Vector3.right)*cellSideLengh;
if(Physics.Raycast(pos + Vector3.up*100f, -Vector3.up, Mathf.Infinity)) fullTilemap.Add(GetTileIndex(pos));
}
}
var occlusionCells = new Dictionary<int,List<int>>();
foreach(var x in tilemap) occlusionCells.Add(x.Key,new List<int>());
foreach(var x in fullTilemap) if(!occlusionCells.ContainsKey(x)) occlusionCells.Add(x,new List<int>());
void PositionColliderAtPostion (Vector3 pos, Transform collider) {
RaycastHit hit;
if(Physics.Raycast(pos + Vector3.up*100f, -Vector3.up, out hit, Mathf.Infinity)) {
collider.position = new Vector3(pos.x,hit.point.y + collider.localScale.y/2f,pos.z);
}
else collider.position = new Vector3(pos.x,0,pos.z);
}
bool DoRaycastTest (Vector3 from, Vector3 to, string targetName) {
//Will shoot rays 1. from the bottom of from, then from middle and then from top, if hit then returns true, else false
bool ShootRays (Vector3 pos) {
RaycastHit hit;
for(int i = 0;i < 5;i++){
var start = pos + new Vector3(Random.Range(0,1f),Random.Range(0,.5f),Random.Range(0,1f));
var target = to + new Vector3(Random.Range(0,1f),Random.Range(0,.5f),Random.Range(0,1f));
if( Physics.Raycast(start, target-start, out hit, Mathf.Infinity) ) if(hit.transform.name == targetName) return true;
}
return false;
}
if(ShootRays(from)) return true;
if(ShootRays(from + Vector3.up * 2f)) return true;
if(ShootRays(from + Vector3.up * 4f)) return true;
return false;
}
void TestVisibilityBetweenCells (int i, int j) {
//0. see if already done
var oI = occlusionCells[i];
var oJ = occlusionCells[j];
if(!oI.Contains(j)) {
//1. Get both positions
var posI = bottomLeftCorner + (i % cellCount) * Vector3.forward * cellSideLengh + Mathf.FloorToInt(i/cellCount) * Vector3.right * cellSideLengh;
var posJ = bottomLeftCorner + (j % cellCount) * Vector3.forward * cellSideLengh + Mathf.FloorToInt(j/cellCount) * Vector3.right * cellSideLengh;
//2. Try visibility form i -> j
PositionColliderAtPostion(posJ, grassCollider.transform);
if(DoRaycastTest(posI, posJ, "TEMP_GRASS_COLLIDER")) {
//3. If possible then register both as possible
oI.Add(j);
oJ.Add(i);
}
}
}
int k = 0;
float t = fullTilemap.Count * tilemap.Count;
foreach(var x in fullTilemap) foreach(var y in tilemap) if(x != y.Key) {TestVisibilityBetweenCells(x,y.Key); k++; if(k%30000==0) {yield return 0;Debug.Log((k/t).ToString() + "% done");} } //Do all possible tests
Destroy(grassCollider);
Destroy(fallableCollider);
//Debug show connections
//TODO 3. Get cell average seeable length.
//TODO 4. Convert all cells into structs, if more seeables then create more structs per cell
//TODO Give cell and occulsion data to cullShader
//1. Create walkable area
//2. Foreach cell in walkable area find all grass cells that it sees
//3. Save data to storage
*/
}
public void Setup () {
cam = Camera.main;
//arguments buffer
argumentsBuffer = new ComputeBuffer(1, arguments.Length * sizeof(uint), ComputeBufferType.IndirectArguments);
allArgumentsBuffer = new ComputeBuffer(1, arguments.Length * sizeof(uint), ComputeBufferType.IndirectArguments);
//Main buffer
UpdateMainBuffers();
//Cells
BakeCells();
//Occlusion
//BakeOcclusionCells();
}
void DebugWorkBufferCount () {
var tempBuffer = new ComputeBuffer(1, sizeof(uint), ComputeBufferType.IndirectArguments);
uint[] x = new uint[1];
ComputeBuffer.CopyCount(workBuffer,tempBuffer,0);
tempBuffer.GetData(x);
var s = "";
foreach(var k in x) s += " " + k.ToString();
Debug.Log(s);
tempBuffer.Release();
}
void DebugWorkCellBufferCount () {
var tempBuffer = new ComputeBuffer(1, sizeof(uint), ComputeBufferType.IndirectArguments);
uint[] x = new uint[1];
ComputeBuffer.CopyCount(cellWorkBuffer,tempBuffer,0);
tempBuffer.GetData(x);
var s = "";
foreach(var k in x) s += " " + k.ToString();
Debug.Log(s);
tempBuffer.Release();
}
public void Run () {
if(!startupDone) return;//Wait for startup do complete
//0. manual update
if(update) UpdateMainBuffers();
if(bakeCells) BakeCells();
//1. UpdateCullBuffer
if(doCulling) UpdateCullBuffer();
//Draw
if(isOn) Graphics.DrawMeshInstancedIndirect(grassMesh, 0, doCulling?instancedConsumeGrassMaterial:instancedGrassMaterial, new Bounds(Vector3.zero, new Vector3(1000.0f, 1000.0f, 1000.0f)), doCulling?argumentsBuffer:allArgumentsBuffer);
//Testing
if(showTilemap) {
int cellsCount = Mathf.CeilToInt(totalLength/cellSideLengh);
for(int x = 0;x < cellsCount;x++){
for(int y = 0;y < cellsCount;y++){
var pos = bottomLeftCorner + (x * Vector3.forward + y * Vector3.right)*cellSideLengh;
Debug.DrawRay(pos, Vector3.up * 5f,Color.blue);
}
}
}
}
void UpdateCullBuffer () {
//1. Update frustrum culling information
var cam = Camera.main;
var mat = cam.projectionMatrix * cam.worldToCameraMatrix;
var normals = new Vector3[4];
var normalsMatrix = new float[12];
Vector3 temp;
//left
temp.x = mat.m30 + mat.m00;
temp.y = mat.m31 + mat.m01;
temp.z = mat.m32 + mat.m02;
normals[0] = temp;
//right
temp.x = mat.m30 - mat.m00;
temp.y = mat.m31 - mat.m01;
temp.z = mat.m32 - mat.m02;
normals[1] = temp;
//bottom
temp.x = mat.m30 + mat.m10;
temp.y = mat.m31 + mat.m11;
temp.z = mat.m32 + mat.m12;
normals[2] = temp;
//top
temp.x = mat.m30 - mat.m10;
temp.y = mat.m31 - mat.m11;
temp.z = mat.m32 - mat.m12;
normals[3] = temp;
for (int i = 0; i < 4; i++){
//Debug.DrawRay(camera.transform.position, _planes[i].normal * 10f, Color.yellow);
normalsMatrix[i + 0] = normals[i].x;
normalsMatrix[i + 4] = normals[i].y;
normalsMatrix[i + 8] = normals[i].z;
}
cullShader.SetFloats("cameraPos", cam.transform.position.x, cam.transform.position.y, cam.transform.position.z);
cullShader.SetInt("doOcclusion",doOcclusionCulling?1:0);
cullShader.SetFloats("cameraFrustumNormals", normalsMatrix);
//Reset
if(cellWorkBuffer != null) cellWorkBuffer.SetCounterValue(0);
workBuffer.SetCounterValue(0);
//2. Dispatch culler
if(doCells && cellCount > 0 && cellWorkBuffer != null) {
//1. Get cell indexes
int batchCount = Mathf.CeilToInt(cellCount/64f);
cullShader.Dispatch(1,batchCount,1,1);
//2. Get object indexes
//convertSizeBuffer.SetData(new uint[] {1,1,1});
ComputeBuffer.CopyCount(cellWorkBuffer,convertSizeBuffer,0);
convertArrayShader.DispatchIndirect(0,convertSizeBuffer);
}
else {
int batchCount = Mathf.CeilToInt(elementCount/1024f);
cullShader.Dispatch(0,batchCount,1,1);
}
//3. Copy work count -> arguments
ComputeBuffer.CopyCount(workBuffer,argumentsBuffer,4);
}
int GetTileIndex (Vector3 pos) {
int cellsCount = Mathf.CeilToInt(totalLength/cellSideLengh);
//1. relative pos
var p = pos - bottomLeftCorner;
//2. safety
if(p.x < 0 || p.x > totalLength || p.z < 0 || p.z > totalLength) return 0;
//3. get index
return Mathf.CeilToInt(p.x/cellSideLengh) + cellsCount * Mathf.CeilToInt(p.z/cellSideLengh);
}
void UpdateMainBuffers () {
startupDone = false;
update = false;
//Debug.Log("Updating main");
elementCount = grassStorage.points.Count;
//Reset buffers
if(workBuffer != null) workBuffer.Release();
if(grassBuffer != null) grassBuffer.Release();
grassBuffer = new ComputeBuffer(elementCount, 24);
workBuffer = new ComputeBuffer(elementCount, 4, ComputeBufferType.Append);
workBuffer.SetCounterValue(0);//effectivly this clears the buffer
//Create grass elements from data
grassElements = new grassElement[elementCount];
for(int i = 0;i < elementCount;i++){
grassElements[i] = new grassElement(
grassStorage.points[i],
Random.Range(0f,360f),
Random.Range(0.9f,1f),
Random.Range(0,1f)
);
//Debug.DrawRay(grassStorage.points[i] + Vector3.right* 0.2f, Vector3.up * 10f,Color.yellow,100f);
}
Debug.Log("GRASS: Working with a total of " + grassElements.Length.ToString() + " grass objects");
//Save data to buffer
grassBuffer.SetData(grassElements);
distanceBounds = new Vector2(Mathf.Min(distanceBounds.y, distanceBounds.x),Mathf.Max(distanceBounds.y, distanceBounds.x)) ;
//Set buffers
cullShader.SetInt("grassCount", elementCount);
cullShader.SetFloat("maxDistance", distanceBounds.y);
cullShader.SetBuffer(0, "grassBuffer", grassBuffer);
cullShader.SetBuffer(0, "outGrassBuffer", workBuffer);
instancedConsumeGrassMaterial.SetBuffer("grassBuffer", grassBuffer);
instancedConsumeGrassMaterial.SetBuffer("inGrassBuffer", workBuffer);
instancedGrassMaterial.SetBuffer("grassBuffer", grassBuffer);
instancedGrassMaterial.SetFloat("fadeStartDist", distanceBounds.x - cellSideLengh);
instancedGrassMaterial.SetFloat("fadeEndDist", distanceBounds.y - cellSideLengh);
//Set arguments
arguments[0] = (grassMesh != null) ? (uint)grassMesh.GetIndexCount(0) : 0;
arguments[1] = (uint)elementCount;
argumentsBuffer.SetData(arguments);
allArgumentsBuffer.SetData(arguments);
if(doCulling) UpdateCullBuffer();
startupDone = true;
}
void OnDisable() {
if(grassBuffer != null) grassBuffer.Release(); grassBuffer = null;
if(argumentsBuffer != null) argumentsBuffer.Release(); argumentsBuffer = null;
if(allArgumentsBuffer != null) allArgumentsBuffer.Release(); allArgumentsBuffer = null;
if(workBuffer != null) workBuffer.Release(); workBuffer = null;
if(grassCellBuffer != null) grassCellBuffer.Release(); grassCellBuffer = null;
if(cellWorkBuffer != null) cellWorkBuffer.Release(); cellWorkBuffer = null;
if(convertSizeBuffer != null) convertSizeBuffer.Release(); convertSizeBuffer = null;
}
void Start () {
Setup();
}
void Update () {
Run();
}
}
/*
TODOS
1. Occlusion
- Switch to quads instead of traingles for grass
- Try shape that is more similar to cutout
- Add Wind
- Second billboard shader
- Billboard switch range
- Standard cull two outputs
- Cell cull two outputs
- Cell cull second converter
- Free camera
- Cell optimizations
- Distance dither cull? (optional)
2. Fallable particles (Rain, snow)
- Plan
2.1 Rain drop splashes
3. Volumetric fog with moving 3D noise and godrays?
4. Rain puddles, shininess
*/

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: ecba1f8646b67e34bb6e21651aedb9b0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 10474e839531b834d943ec7230f72af3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,96 +0,0 @@
%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: GrassConsumeInstancedMaterial
m_Shader: {fileID: 4800000, guid: d423e3e229bf71743b583d87c24d1a0f, type: 3}
m_ShaderKeywords:
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}
- _DitherTex:
m_Texture: {fileID: 2800000, guid: 4acb113475018874bbbc58f460e0f640, type: 3}
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: 2800000, guid: 527cea5a6b017984894d91563b2bdefb, type: 3}
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}
- _WindTex:
m_Texture: {fileID: 2800000, guid: 5e187697202a0ca4f80836a911eb0633, type: 3}
m_Scale: {x: 100, y: 100}
m_Offset: {x: 55345, y: 35235236}
m_Floats:
- _AlphaCutoff: 0.666
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.206
- _GlossyReflections: 1
- _Height: 1
- _Metallic: 0.392
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _Size: 0.25
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _WindAmount: 3.34
- _WindSize: 0.01
- _WindSpeed: 0.05
- _ZWrite: 1
- fadeEndDist: 100
- fadeStartDist: 90
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _ColorA: {r: 0.078097194, g: 0.6132076, b: 0.09535255, a: 1}
- _ColorB: {r: 0.17318603, g: 0.3679245, b: 0.03297436, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _windOffset: {r: -0.5, g: 0, b: 0, a: 0}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 8b643e93bd7e02d41b00c7333021a78a
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,111 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-6438856212723395819
MonoBehaviour:
m_ObjectHideFlags: 11
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: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 4
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: GrassGround
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
m_ShaderKeywords: _NORMALMAP _OCCLUSIONMAP _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 2000
stringTagMap:
RenderType: Opaque
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 2800000, guid: 1b00fbcbdd1b477489caa310eeeb9ce3, type: 3}
m_Scale: {x: 20, y: 20}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 2800000, guid: bc20a819849c6fd42b95aa9e2913ea40, type: 3}
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: 20, y: 20}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 1b00fbcbdd1b477489caa310eeeb9ce3, type: 3}
m_Scale: {x: 20, y: 20}
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: 2800000, guid: a71a28c7c2debb640a3fbb8037a1a556, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 2800000, guid: 0066ce0e7c2e06f489981174b1d9f975, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _AlphaClip: 0
- _Blend: 0
- _BumpScale: 1
- _Cull: 2
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0.6
- _GlossyReflections: 1
- _Metallic: 1
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.0135
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0
- _SmoothnessTextureChannel: 1
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Surface: 0
- _UVSec: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 0, g: 0.4150943, b: 0.022040365, a: 1}
- _Color: {r: 0, g: 0.41509432, b: 0.022040365, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 44f124f3f0705a742929361bf31ef6db
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,81 +0,0 @@
%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: GrassInstancedMaterial
m_Shader: {fileID: 4800000, guid: 02f353f6dc231064c9224e1bde0fd751, type: 3}
m_ShaderKeywords:
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: 2800000, guid: 527cea5a6b017984894d91563b2bdefb, type: 3}
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:
- _AlphaCutoff: 0.666
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 1
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _Size: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _ColorA: {r: 0.49910027, g: 0.6698113, b: 0.38229796, a: 1}
- _ColorB: {r: 0.3647059, g: 0.47450984, b: 0.19607845, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 891c69aeb607f0c49b71b7000efa4ceb
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,101 +0,0 @@
fileFormatVersion: 2
guid: 4b7270406110eb348824f607a798034a
ModelImporter:
serializedVersion: 20101
internalIDToNameTable: []
externalObjects: {}
materials:
materialImportMode: 1
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
fileIdsGeneration: 1
swapUVChannels: 0
generateSecondaryUV: 1
useFileUnits: 1
keepQuads: 0
weldVertices: 1
bakeAxisConversion: 0
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
minBoneWeight: 0.001
meshOptimizationFlags: -1
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15
secondaryUVHardAngle: 88
secondaryUVMarginMethod: 0
secondaryUVMinLightmapResolution: 40
secondaryUVMinObjectScale: 1
secondaryUVPackMargin: 64
useFileScale: 1
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
referencedClips: []
importAnimation: 1
humanDescription:
serializedVersion: 3
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
globalScale: 1
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 2
humanoidOversampling: 1
avatarSetup: 0
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,103 +0,0 @@
fileFormatVersion: 2
guid: 527cea5a6b017984894d91563b2bdefb
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 1
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.1
mipMapFadeDistanceStart: 0
mipMapFadeDistanceEnd: 2
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 2
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: 4
textureCompression: 2
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: 4
textureCompression: 2
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,101 +0,0 @@
fileFormatVersion: 2
guid: 37a17204eeb420948a913b69143253af
ModelImporter:
serializedVersion: 20101
internalIDToNameTable: []
externalObjects: {}
materials:
materialImportMode: 0
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
fileIdsGeneration: 1
swapUVChannels: 0
generateSecondaryUV: 1
useFileUnits: 1
keepQuads: 0
weldVertices: 1
bakeAxisConversion: 0
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
minBoneWeight: 0.001
meshOptimizationFlags: -1
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15
secondaryUVHardAngle: 88
secondaryUVMarginMethod: 0
secondaryUVMinLightmapResolution: 40
secondaryUVMinObjectScale: 1
secondaryUVPackMargin: 64
useFileScale: 1
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
referencedClips: []
importAnimation: 1
humanDescription:
serializedVersion: 3
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
globalScale: 1
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 2
humanoidOversampling: 1
avatarSetup: 0
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,101 +0,0 @@
fileFormatVersion: 2
guid: d6c88ec8475424a43829ad6ffc6245a6
ModelImporter:
serializedVersion: 20101
internalIDToNameTable: []
externalObjects: {}
materials:
materialImportMode: 1
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
fileIdsGeneration: 1
swapUVChannels: 0
generateSecondaryUV: 1
useFileUnits: 1
keepQuads: 0
weldVertices: 1
bakeAxisConversion: 0
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
minBoneWeight: 0.001
meshOptimizationFlags: -1
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15
secondaryUVHardAngle: 88
secondaryUVMarginMethod: 0
secondaryUVMinLightmapResolution: 40
secondaryUVMinObjectScale: 1
secondaryUVPackMargin: 64
useFileScale: 1
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
referencedClips: []
importAnimation: 1
humanDescription:
serializedVersion: 3
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
globalScale: 1
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 2
humanoidOversampling: 1
avatarSetup: 0
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 837be2f6219051c479b1f6bd722b4a04
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,78 +0,0 @@
Shader "DBV/Kristo/FastGrass2.0"
{
Properties
{
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Texture", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
[Space]
_AlphaCutoff ("Alpha cutoff", Range(0,1)) = 0.05
[Space]
_WindTexture ("Wind texture", 2D) = "white" {}
_WindSpeed ("Wind direction", Vector) = (1,1,1,1)
_HeightStart ("Height start", Float) = 0.05
_WindStrength ("Wind strength", Float) = 1
_WindTimeSpeed ("Wind speed", Float) = 1
}
SubShader
{
Tags { "RenderType"="Transparent" }
LOD 200
Cull Off
ZWrite Off
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Standard vertex:vert noshadowmask nodynlightmap nodirlightmap nolightmap noshadow
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
sampler2D _MainTex,_WindTexture;
struct Input {
float2 uv_MainTex;
};
half _Glossiness;
half _Metallic;
fixed4 _Color;
float _AlphaCutoff, _HeightStart, _WindStrength, _WindTimeSpeed;
float4 _WindSpeed;
// Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
// See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
// #pragma instancing_options assumeuniformscaling
UNITY_INSTANCING_BUFFER_START(Props)
// put more per-instance properties here
UNITY_INSTANCING_BUFFER_END(Props)
void vert (inout appdata_full v) {
// get vertex world position
float4 worldPos = mul(v.vertex, unity_ObjectToWorld);
float2 samplePos = worldPos.xz;
samplePos += _Time.x * _WindSpeed.xz;
float windAmount = tex2Dlod(_WindTexture, float4(samplePos, 0, 0));
float heightAmount = v.vertex.z > _HeightStart;//v.vertex.y - _HeightStart;
v.vertex.y += sin(_WindTimeSpeed*windAmount)*_WindStrength * heightAmount;
v.vertex.x += cos(_WindTimeSpeed*windAmount)*_WindStrength * heightAmount;
}
void surf (Input IN, inout SurfaceOutputStandard o)
{
// Albedo comes from a texture tinted by color
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
// Metallic and smoothness come from slider variables
o.Metallic = _Metallic;
o.Smoothness = _Glossiness;
clip(c.a-_AlphaCutoff);
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}

View File

@@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: db7b361255b6374438781f932dd1e8e0
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,334 +0,0 @@
// Used Unitys "Standard geometry shader example" as a base to get unitys standard lighting and stuff w/ a custom geometry stage since surface shaders dont allow this
//and when writing from the ground up lighting has to be done by hand
// https://github.com/keijiro/StandardGeometryShader
#include "UnityCG.cginc"
#include "UnityGBuffer.cginc"
#include "UnityStandardUtils.cginc"
// Cube map shadow caster; Used to render point light shadows on platforms
// that lacks depth cube map support.
#if defined(SHADOWS_CUBE) && !defined(SHADOWS_CUBE_IN_DEPTH_TEX)
#define PASS_CUBE_SHADOWCASTER
#endif
// Shader uniforms
half4 _Color;
sampler2D _MainTex;
float4 _MainTex_ST;
half _Glossiness;
half _Metallic;
sampler2D _BumpMap;
float _BumpScale;
sampler2D _OcclusionMap;
float _OcclusionStrength;
float _LocalTime;
// Vertex input attributes
struct Attributes {
float4 position : POSITION;
float3 normal : NORMAL;
float4 tangent : TANGENT;
float2 texcoord : TEXCOORD;
};
// Fragment varyings
struct Varyings {
float4 position : SV_POSITION;
#if defined(PASS_CUBE_SHADOWCASTER)
// Cube map shadow caster pass
float3 shadow : TEXCOORD0;
#elif defined(UNITY_PASS_SHADOWCASTER)
// Default shadow caster pass
#else
// GBuffer construction pass
float3 normal : NORMAL;
float2 texcoord : TEXCOORD0;
float4 tspace0 : TEXCOORD1;
float4 tspace1 : TEXCOORD2;
float4 tspace2 : TEXCOORD3;
half3 ambient : TEXCOORD4;
#endif
};
//
// Vertex stage
//
Attributes Vertex(Attributes input) {
// Only do object space to world space transform.
input.position = mul(unity_ObjectToWorld, input.position);
input.normal = UnityObjectToWorldNormal(input.normal);
input.tangent.xyz = UnityObjectToWorldDir(input.tangent.xyz);
input.texcoord = TRANSFORM_TEX(input.texcoord, _MainTex);
return input;
}
//
// Geometry stage
//
Varyings VertexOutput(float3 wpos, half3 wnrm, half4 wtan, float2 uv) {
Varyings o;
#if defined(PASS_CUBE_SHADOWCASTER)
// Cube map shadow caster pass: Transfer the shadow vector.
o.position = UnityWorldToClipPos(float4(wpos, 1));
o.shadow = wpos - _LightPositionRange.xyz;
#elif defined(UNITY_PASS_SHADOWCASTER)
// Default shadow caster pass: Apply the shadow bias.
float scos = dot(wnrm, normalize(UnityWorldSpaceLightDir(wpos)));
wpos -= wnrm * unity_LightShadowBias.z * sqrt(1 - scos * scos);
o.position = UnityApplyLinearShadowBias(UnityWorldToClipPos(float4(wpos, 1)));
#else
// GBuffer construction pass
half3 bi = cross(wnrm, wtan) * wtan.w * unity_WorldTransformParams.w;
o.position = UnityWorldToClipPos(float4(wpos, 1));
o.normal = wnrm;
o.texcoord = uv;
o.tspace0 = float4(wtan.x, bi.x, wnrm.x, wpos.x);
o.tspace1 = float4(wtan.y, bi.y, wnrm.y, wpos.y);
o.tspace2 = float4(wtan.z, bi.z, wnrm.z, wpos.z);
o.ambient = ShadeSHPerVertex(wnrm, 0);
#endif
return o;
}
float3 ConstructNormal(float3 v1, float3 v2, float3 v3) {
return normalize(cross(v2 - v1, v3 - v1));
}
float rand(float3 co){
return frac(sin(dot(co.xyz, float3(12.9898, 78.233, 53.539))) * 43758.5453);
}
float3x3 AngleAxis3x3(float angle, float3 axis){
float c, s;
sincos(angle, s, c);
float t = 1 - c;
float x = axis.x;
float y = axis.y;
float z = axis.z;
return float3x3(
t * x * x + c, t * x * y - s * z, t * x * z + s * y,
t * x * y + s * z, t * y * y + c, t * y * z - s * x,
t * x * z - s * y, t * y * z + s * x, t * z * z + c
);
}
float _BladeHeight, _BladeHeightRandom, _BladeWidth, _BladeWidthRandom, _BendRotationRandom;
int _Test;
[instance(5)]
[maxvertexcount(42)]
void Geometry( triangle Attributes input[3], uint pid : SV_PrimitiveID, inout TriangleStream<Varyings> outStream, uint InstanceID : SV_GSInstanceID) {
//Vertex inputs;
//
//float2 uv0 = input[0].texcoord;
//float2 uv1 = input[1].texcoord;
//float2 uv2 = input[2].texcoord;
float3 pos = input[0].position;
float3 vNormal = input[0].normal;
float4 vTangent = input[0].tangent;
float3 vBinormal = cross (vNormal,vTangent)*vTangent.w;
float height = (rand(pos.zyx) * 2 - 1) * _BladeHeightRandom + _BladeHeight;
float width = (rand(pos.xzy) * 2 - 1) * _BladeWidthRandom + _BladeWidth;
float3x3 tangentToLocal = float3x3(
vTangent.x, vBinormal.x, vNormal.x,
vTangent.y, vBinormal.y, vNormal.y,
vTangent.z, vBinormal.z, vNormal.z
);
//TODO add geometry instancing
//TODO create nodes based on world pos
//TODO find out if need to remember geometry instancing index to create mor tris
//TODO keep track of how many verts used
//Add node
//float3 wn = ConstructNormal(wp3, wp4, wp5);
//outStream.Append(VertexOutput(pos + mul(transformationMatrix, float3( width, 0, 0 )),half3(0,1,0),float4(1,1,0,0), float2(1.25,0) ));
//outStream.Append(VertexOutput(pos + mul(transformationMatrix, float3(-width, 0, 0 )),half3(0,1,0),float4(1,1,0,0), float2(-0.25,0) ));
//outStream.Append(VertexOutput(pos + mul(transformationMatrix, float3( 0 , 0, height)),half3(0,1,0),float4(1,1,0,0), float2(0.5,1.5) ));
//outStream.RestartStrip();
//outStream.Append(VertexOutput(pos + mul(transformationMatrix, float3(0, width, 0 )),half3(0,1,0),float4(1,1,0,0), float2(1.25,0) ));
//outStream.Append(VertexOutput(pos + mul(transformationMatrix, float3(0, -width, 0 )),half3(0,1,0),float4(1,1,0,0), float2(-0.25,0) ));
//outStream.Append(VertexOutput(pos + mul(transformationMatrix, float3(0, 0 , height)),half3(0,1,0),float4(1,1,0,0), float2(0.5,1.5) ));
//outStream.RestartStrip();
//Do triangle
float3 wp0 = input[0].position.xyz;
float3 wp1 = input[1].position.xyz;
float3 wp2 = input[2].position.xyz;
//1. Order points
float3 p1 = max(wp0,max(wp1,wp2));
float3 p2;
float3 p3 = min(wp0,min(wp1,wp2));
if (all(p1 >= wp0) && all(p3 <= wp0)) {p2 = wp0;}
else if(all(p1 >= wp1) && all(p3 <= wp1)) {p2 = wp1;}
else if(all(p1 >= wp2) && all(p3 <= wp2)) {p2 = wp2;}
//2. Get directions
float3 vec1 = p3-p1;
float3 vec2 = p2-p1;
float3 vec3 = p3-p2;
float dir1Len = length(vec1);
float dir2Len = length(vec2);
float dir3Len = length(vec3);
float3 dir1 = vec1 / dir1Len;
float3 dir2 = vec2 / dir2Len;
float3 dir3 = vec3 / dir3Len;
//3. Define values
float unit = 0.5;
float3 step1 = dir1 * unit;
float3 step2 = dir2 * unit * abs(vec2.x/vec1.x);
float3 step3 = dir3 * unit;
float3 current1 = p1;
float3 current2 = p1;
//4. loop
int unitsToX = abs(floor(vec1.x/unit));
for (int i = 0; i < unitsToX; ++i) {
current1 += step1;
current2 += step2;
int unitsToZ = abs(floor((current1.z-current2.z)/unit));
//1. create start and ends
float3 current = floor(current1);
for (int j = 0; j < unitsToZ; ++j) {//loop and create nodes
float3x3 facingRotationMatrix = AngleAxis3x3(rand(pos) * UNITY_TWO_PI, float3(0, 0, 1));
float3x3 bendRotationMatrix = AngleAxis3x3(rand(pos.zzx) * _BendRotationRandom * UNITY_PI * 0.5, float3(-1, 0, 0));
float3x3 transformationMatrix = mul(mul(tangentToLocal, facingRotationMatrix),bendRotationMatrix);
float k = i+j+1;
//-Creat node- START
outStream.Append(VertexOutput(current + mul(transformationMatrix, float3( width, 0, 0 )),half3(0,1,0),float4(1,1,0,0), float2(1.25,0) ));
outStream.Append(VertexOutput(current + mul(transformationMatrix, float3(-width, 0, 0 )),half3(0,1,0),float4(1,1,0,0), float2(-0.25,0) ));
outStream.Append(VertexOutput(current + mul(transformationMatrix, float3( 0 , 0, height*k)),half3(0,1,0),float4(1,1,0,0), float2(0.5,1.5) ));
outStream.RestartStrip();
outStream.Append(VertexOutput(current + mul(transformationMatrix, float3(0, width, 0 )),half3(0,1,0),float4(1,1,0,0), float2(1.25,0) ));
outStream.Append(VertexOutput(current + mul(transformationMatrix, float3(0, -width, 0 )),half3(0,1,0),float4(1,1,0,0), float2(-0.25,0) ));
outStream.Append(VertexOutput(current + mul(transformationMatrix, float3(0, 0 , height*k)),half3(0,1,0),float4(1,1,0,0), float2(0.5,1.5) ));
outStream.RestartStrip();
//-Create node- END
current.z += unit;
}
}
// Extrusion amount
//float ext = saturate(0.4 - cos(_LocalTime * UNITY_PI * 2) * 0.41);
//ext *= 1 + 0.3 * sin(pid * 832.37843 + _LocalTime * 88.76);
//
//// Extrusion points
//float3 offs = ConstructNormal(wp0, wp1, wp2) * ext;
//float3 wp3 = wp0 + offs;
//float3 wp4 = wp1 + offs;
//float3 wp5 = wp2 + offs;
//
//// Cap triangle
//float3 wn = ConstructNormal(wp3, wp4, wp5);
//float np = saturate(ext * 10);
//float3 wn0 = lerp(input[0].normal, wn, np);
//float3 wn1 = lerp(input[1].normal, wn, np);
//float3 wn2 = lerp(input[2].normal, wn, np);
//outStream.Append(VertexOutput(wp3, wn0, input[0].tangent, uv0));
//outStream.Append(VertexOutput(wp4, wn1, input[1].tangent, uv1));
//outStream.Append(VertexOutput(wp5, wn2, input[2].tangent, uv2));
//outStream.RestartStrip();
//
//// Side faces
//float4 wt = float4(normalize(wp3 - wp0), 1); // world space tangent
//wn = ConstructNormal(wp3, wp0, wp4);
//outStream.Append(VertexOutput(wp3, wn, wt, uv0));
//outStream.Append(VertexOutput(wp0, wn, wt, uv0));
//outStream.Append(VertexOutput(wp4, wn, wt, uv1));
//outStream.Append(VertexOutput(wp1, wn, wt, uv1));
//outStream.RestartStrip();
//
//wn = ConstructNormal(wp4, wp1, wp5);
//outStream.Append(VertexOutput(wp4, wn, wt, uv1));
//outStream.Append(VertexOutput(wp1, wn, wt, uv1));
//outStream.Append(VertexOutput(wp5, wn, wt, uv2));
//outStream.Append(VertexOutput(wp2, wn, wt, uv2));
//outStream.RestartStrip();
//
//wn = ConstructNormal(wp5, wp2, wp3);
//outStream.Append(VertexOutput(wp5, wn, wt, uv2));
//outStream.Append(VertexOutput(wp2, wn, wt, uv2));
//outStream.Append(VertexOutput(wp3, wn, wt, uv0));
//outStream.Append(VertexOutput(wp0, wn, wt, uv0));
//outStream.RestartStrip();
}
//
// Fragment phase
//
#if defined(PASS_CUBE_SHADOWCASTER)
// Cube map shadow caster pass
half4 Fragment(Varyings input) : SV_Target {
float depth = length(input.shadow) + unity_LightShadowBias.x;
return UnityEncodeCubeShadowDepth(depth * _LightPositionRange.w);
}
#elif defined(UNITY_PASS_SHADOWCASTER)
// Default shadow caster pass
half4 Fragment() : SV_Target { return 0; }
#else
float _AlphaCutoff;
// GBuffer construction pass
void Fragment( Varyings input, out half4 outGBuffer0 : SV_Target0, out half4 outGBuffer1 : SV_Target1, out half4 outGBuffer2 : SV_Target2, out half4 outEmission : SV_Target3) {
// Sample textures
float4 sample = tex2D(_MainTex, input.texcoord);
if(sample.a <= _AlphaCutoff) clip(-1);
half3 albedo = sample.rgb * _Color.rgb;
half4 normal = tex2D(_BumpMap, input.texcoord);
normal.xyz = UnpackScaleNormal(normal, _BumpScale);
half occ = tex2D(_OcclusionMap, input.texcoord).g;
occ = LerpOneTo(occ, _OcclusionStrength);
// PBS workflow conversion (metallic -> specular)
half3 c_diff, c_spec;
half refl10;
c_diff = DiffuseAndSpecularFromMetallic(
albedo, _Metallic, // input
c_spec, refl10 // output
);
// Tangent space conversion (tangent space normal -> world space normal)
float3 wn = normalize(float3( dot(input.tspace0.xyz, normal), dot(input.tspace1.xyz, normal), dot(input.tspace2.xyz, normal) ));
// Update the GBuffer.
UnityStandardData data;
data.diffuseColor = c_diff;
data.occlusion = occ;
data.specularColor = c_spec;
data.smoothness = _Glossiness;
data.normalWorld = wn;
UnityStandardDataToGbuffer(data, outGBuffer0, outGBuffer1, outGBuffer2);
// Calculate ambient lighting and output to the emission buffer.
float3 wp = float3(input.tspace0.w, input.tspace1.w, input.tspace2.w);
half3 sh = ShadeSHPerPixel(data.normalWorld, input.ambient, wp);
outEmission = half4(sh * c_diff, 1) * occ;
}
#endif

View File

@@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 1828c58b5b8ba824296cee46b4d55d78
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,86 +0,0 @@
%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: GrassMaterial
m_Shader: {fileID: 4800000, guid: db7b361255b6374438781f932dd1e8e0, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 1
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: 2800000, guid: 527cea5a6b017984894d91563b2bdefb, type: 3}
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}
- _WindTexture:
m_Texture: {fileID: 2800000, guid: 5e187697202a0ca4f80836a911eb0633, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _AlphaCutoff: 0.948
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 1
- _GlossyReflections: 1
- _HeightStart: 0.86
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _WindStrength: 0.5
- _WindTimeSpeed: 0.02
- _ZWrite: 1
m_Colors:
- _Color: {r: 0.8343865, g: 0.8584906, b: 0.75725347, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _WindSpeed: {r: 100, g: 100, b: 1, a: 1}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 7703a0bcaa149214693ccf4e5154e464
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

Some files were not shown because too many files have changed in this diff Show More