Readd missing import files
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c85433c80946b034d9a350eddeeaff63
|
||||
folderAsset: yes
|
||||
timeCreated: 1437325789
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 69c44a94b5f81554f96eaa9cc5db83d9
|
||||
folderAsset: yes
|
||||
timeCreated: 1532283795
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+11709
File diff suppressed because it is too large
Load Diff
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9d3370edc4a7463459f45975fadf905a
|
||||
timeCreated: 1532283798
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 100100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+11676
File diff suppressed because it is too large
Load Diff
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 72ccf1dc9782edc429184ebff3a7c009
|
||||
timeCreated: 1532283798
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 100100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6523489fe63c6ee4fa216c255a549f16
|
||||
folderAsset: yes
|
||||
timeCreated: 1532381073
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d4d78aa286cbb7244ac3afbb8ea00b21
|
||||
folderAsset: yes
|
||||
timeCreated: 1559255767
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 45059fbebc46ffa4c8c6354982415231, type: 3}
|
||||
m_Name: 1 Very Low
|
||||
m_EditorClassIdentifier:
|
||||
qualitySettings:
|
||||
bottomCloudHeight: 4000
|
||||
topCloudHeight: 9000
|
||||
raymarchSteps: 100
|
||||
stepsInDepthModificator: 0.7
|
||||
transmissionToExit: 0.1
|
||||
cloudsRenderResolution: 2
|
||||
reprojectionPixelSize: 2
|
||||
lodDistance: 1
|
||||
baseNoiseUV: 15
|
||||
detailNoiseUV: 30
|
||||
detailQuality: 0
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b10a3bd47ef3e9646adbcfa29c9ebb24
|
||||
timeCreated: 1559252519
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 45059fbebc46ffa4c8c6354982415231, type: 3}
|
||||
m_Name: 10 VR_High
|
||||
m_EditorClassIdentifier:
|
||||
qualitySettings:
|
||||
bottomCloudHeight: 5000
|
||||
topCloudHeight: 9000
|
||||
raymarchSteps: 125
|
||||
stepsInDepthModificator: 0.75
|
||||
cloudsRenderResolution: 2
|
||||
reprojectionPixelSize: 0
|
||||
bilateralUpsampling: 0
|
||||
lodDistance: 1
|
||||
baseNoiseUV: 15
|
||||
detailNoiseUV: 30
|
||||
detailQuality: 0
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5645e9ade0cb43a4d90fd7bcadb4da94
|
||||
timeCreated: 1559488849
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,26 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 45059fbebc46ffa4c8c6354982415231, type: 3}
|
||||
m_Name: 2 Low
|
||||
m_EditorClassIdentifier:
|
||||
qualitySettings:
|
||||
bottomCloudHeight: 4000
|
||||
topCloudHeight: 9000
|
||||
raymarchSteps: 128
|
||||
stepsInDepthModificator: 0.7
|
||||
transmissionToExit: 0.1
|
||||
cloudsRenderResolution: 3
|
||||
reprojectionPixelSize: 0
|
||||
lodDistance: 1
|
||||
baseNoiseUV: 15
|
||||
detailNoiseUV: 35
|
||||
useCurlNoise: 0
|
||||
detailQuality: 0
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9b1a0dc137fb16841b5c458d1556c627
|
||||
timeCreated: 1559252519
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 45059fbebc46ffa4c8c6354982415231, type: 3}
|
||||
m_Name: 3 Medium
|
||||
m_EditorClassIdentifier:
|
||||
qualitySettings:
|
||||
bottomCloudHeight: 4000
|
||||
topCloudHeight: 10000
|
||||
raymarchSteps: 256
|
||||
stepsInDepthModificator: 0.7
|
||||
transmissionToExit: 0.15
|
||||
cloudsRenderResolution: 1
|
||||
reprojectionPixelSize: 2
|
||||
lodDistance: 0.35
|
||||
baseNoiseUV: 15
|
||||
detailNoiseUV: 50
|
||||
useCurlNoise: 0
|
||||
baseQuality: 0
|
||||
detailQuality: 0
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a836f7605a4cd2b46977d5caf63945fc
|
||||
timeCreated: 1559252519
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,28 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 45059fbebc46ffa4c8c6354982415231, type: 3}
|
||||
m_Name: 4 High
|
||||
m_EditorClassIdentifier:
|
||||
qualitySettings:
|
||||
bottomCloudHeight: 4000
|
||||
topCloudHeight: 12000
|
||||
raymarchSteps: 170
|
||||
stepsInDepthModificator: 0.7
|
||||
transmissionToExit: 0.15
|
||||
cloudsRenderResolution: 1
|
||||
reprojectionPixelSize: 1
|
||||
lodDistance: 0.6
|
||||
baseNoiseUV: 15
|
||||
detailNoiseUV: 45
|
||||
useCurlNoise: 0
|
||||
baseQuality: 0
|
||||
detailQuality: 0
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 42e176a2e271b5b47a8b86082069cac9
|
||||
timeCreated: 1559252519
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 45059fbebc46ffa4c8c6354982415231, type: 3}
|
||||
m_Name: 5 Ultra
|
||||
m_EditorClassIdentifier:
|
||||
qualitySettings:
|
||||
bottomCloudHeight: 4000
|
||||
topCloudHeight: 12000
|
||||
raymarchSteps: 200
|
||||
stepsInDepthModificator: 0.7
|
||||
transmissionToExit: 0.15
|
||||
cloudsRenderResolution: 1
|
||||
reprojectionPixelSize: 2
|
||||
lodDistance: 0.5
|
||||
baseNoiseUV: 15
|
||||
detailNoiseUV: 50
|
||||
useCurlNoise: 1
|
||||
baseQuality: 1
|
||||
detailQuality: 1
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8f28bec83c119f944831d65e9d05d79e
|
||||
timeCreated: 1559252519
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 45059fbebc46ffa4c8c6354982415231, type: 3}
|
||||
m_Name: 6 Insane
|
||||
m_EditorClassIdentifier:
|
||||
qualitySettings:
|
||||
bottomCloudHeight: 4000
|
||||
topCloudHeight: 12000
|
||||
raymarchSteps: 256
|
||||
stepsInDepthModificator: 0.75
|
||||
transmissionToExit: 0.075
|
||||
cloudsRenderResolution: 1
|
||||
reprojectionPixelSize: 0
|
||||
lodDistance: 0.5
|
||||
baseNoiseUV: 18
|
||||
detailNoiseUV: 55.6
|
||||
useCurlNoise: 1
|
||||
baseQuality: 1
|
||||
detailQuality: 1
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 88e3b239fe167354abe43a2af25e545c
|
||||
timeCreated: 1559253386
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 45059fbebc46ffa4c8c6354982415231, type: 3}
|
||||
m_Name: 7 Baking
|
||||
m_EditorClassIdentifier:
|
||||
qualitySettings:
|
||||
bottomCloudHeight: 4000
|
||||
topCloudHeight: 12000
|
||||
raymarchSteps: 256
|
||||
stepsInDepthModificator: 1
|
||||
transmissionToExit: 0.001
|
||||
cloudsRenderResolution: 1
|
||||
reprojectionPixelSize: 0
|
||||
lodDistance: 0
|
||||
baseNoiseUV: 15
|
||||
detailNoiseUV: 50
|
||||
useCurlNoise: 1
|
||||
baseQuality: 1
|
||||
detailQuality: 1
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4b6681deff9238948be5e20192934b6e
|
||||
timeCreated: 1559253386
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 45059fbebc46ffa4c8c6354982415231, type: 3}
|
||||
m_Name: 8 VR_Low
|
||||
m_EditorClassIdentifier:
|
||||
qualitySettings:
|
||||
bottomCloudHeight: 5000
|
||||
topCloudHeight: 9000
|
||||
raymarchSteps: 100
|
||||
stepsInDepthModificator: 0.7
|
||||
cloudsRenderResolution: 3
|
||||
reprojectionPixelSize: 0
|
||||
bilateralUpsampling: 0
|
||||
lodDistance: 1
|
||||
baseNoiseUV: 12
|
||||
detailNoiseUV: 15
|
||||
detailQuality: 0
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 004a8fe2b55475a49a656741a4d34eff
|
||||
timeCreated: 1559488849
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 45059fbebc46ffa4c8c6354982415231, type: 3}
|
||||
m_Name: 9 VR_Medium
|
||||
m_EditorClassIdentifier:
|
||||
qualitySettings:
|
||||
bottomCloudHeight: 5000
|
||||
topCloudHeight: 9000
|
||||
raymarchSteps: 100
|
||||
stepsInDepthModificator: 0.7
|
||||
cloudsRenderResolution: 1
|
||||
reprojectionPixelSize: 1
|
||||
bilateralUpsampling: 0
|
||||
lodDistance: 1
|
||||
baseNoiseUV: 12
|
||||
detailNoiseUV: 25
|
||||
detailQuality: 0
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ecdd5bc980eef614fb9a2325ec2c21fa
|
||||
timeCreated: 1559488849
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 45059fbebc46ffa4c8c6354982415231, type: 3}
|
||||
m_Name: ReflectionProbe
|
||||
m_EditorClassIdentifier:
|
||||
qualitySettings:
|
||||
bottomCloudHeight: 4000
|
||||
topCloudHeight: 11000
|
||||
raymarchSteps: 150
|
||||
stepsInDepthModificator: 0.75
|
||||
transmissionToExit: 0.2
|
||||
cloudsRenderResolution: 8
|
||||
reprojectionPixelSize: 0
|
||||
lodDistance: 1
|
||||
baseNoiseUV: 15
|
||||
detailNoiseUV: 35
|
||||
useCurlNoise: 0
|
||||
baseQuality: 0
|
||||
detailQuality: 0
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dd96ee074d8e2954fbab9072fa28b851
|
||||
timeCreated: 1585014370
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+1976
File diff suppressed because it is too large
Load Diff
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 94ffe4588b85ed542b2608df93952ec5
|
||||
timeCreated: 1507077366
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+1949
File diff suppressed because it is too large
Load Diff
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 123c203b6412a434ba1f50ccc42730dd
|
||||
timeCreated: 1513976537
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b90dbf57ad0916d4db054dd051487db8
|
||||
folderAsset: yes
|
||||
timeCreated: 1532383042
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+171
@@ -0,0 +1,171 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: ad9e871a73fc09d488bc058f3b382b35, type: 3}
|
||||
m_Name: Heavy Clouds VR
|
||||
m_EditorClassIdentifier:
|
||||
version: 1.9.0
|
||||
Name: Heavy Clouds VR
|
||||
Spring: 1
|
||||
possibiltyInSpring: 38.9
|
||||
Summer: 1
|
||||
possibiltyInSummer: 49.3
|
||||
Autumn: 1
|
||||
possibiltyInAutumn: 41.8
|
||||
winter: 1
|
||||
possibiltyInWinter: 54.5
|
||||
cloudsConfig:
|
||||
ambientSkyColorIntensity: 1
|
||||
scatteringCoef: 0.75
|
||||
edgeDarkness: 0.5
|
||||
baseErosionIntensity: 0
|
||||
detailErosionIntensity: 0.5
|
||||
density: 4
|
||||
lightStepModifier: 0.15
|
||||
lightVariance: 0
|
||||
coverage: 0.2
|
||||
lightAbsorbtion: 0.1
|
||||
coverageType: 1
|
||||
raymarchingScale: 1
|
||||
cloudType: 1
|
||||
cirrusAlpha: 0
|
||||
cirrusCoverage: 0
|
||||
cirrusColorPow: 2.17
|
||||
flatAlpha: 1.208
|
||||
flatCoverage: 0.522
|
||||
flatSoftness: 0.193
|
||||
flatBrightness: 1
|
||||
flatColorPow: 2.23
|
||||
particleLayer1Alpha: 0.507
|
||||
particleLayer1Brightness: 1
|
||||
particleLayer1ColorPow: 2.12
|
||||
particleLayer2Alpha: 0.441
|
||||
particleLayer2Brightness: 0.651
|
||||
particleLayer2ColorPow: 2
|
||||
particleCloudsOverwrite: 0
|
||||
fogStartDistance: 0
|
||||
fogDistance: 0
|
||||
fogDensity: 0.00015
|
||||
weatherSkyMod:
|
||||
serializedVersion: 2
|
||||
key0: {r: 1, g: 1, b: 1, a: 0}
|
||||
key1: {r: 1, g: 1, b: 1, a: 0}
|
||||
key2: {r: 0, g: 0, b: 0, a: 0}
|
||||
key3: {r: 0, g: 0, b: 0, a: 0}
|
||||
key4: {r: 0, g: 0, b: 0, a: 0}
|
||||
key5: {r: 0, g: 0, b: 0, a: 0}
|
||||
key6: {r: 0, g: 0, b: 0, a: 0}
|
||||
key7: {r: 0, g: 0, b: 0, a: 0}
|
||||
ctime0: 0
|
||||
ctime1: 65535
|
||||
ctime2: 0
|
||||
ctime3: 0
|
||||
ctime4: 0
|
||||
ctime5: 0
|
||||
ctime6: 0
|
||||
ctime7: 0
|
||||
atime0: 0
|
||||
atime1: 65535
|
||||
atime2: 0
|
||||
atime3: 0
|
||||
atime4: 0
|
||||
atime5: 0
|
||||
atime6: 0
|
||||
atime7: 0
|
||||
m_Mode: 0
|
||||
m_NumColorKeys: 2
|
||||
m_NumAlphaKeys: 2
|
||||
weatherLightMod:
|
||||
serializedVersion: 2
|
||||
key0: {r: 1, g: 1, b: 1, a: 0}
|
||||
key1: {r: 1, g: 1, b: 1, a: 0}
|
||||
key2: {r: 0, g: 0, b: 0, a: 0}
|
||||
key3: {r: 0, g: 0, b: 0, a: 0}
|
||||
key4: {r: 0, g: 0, b: 0, a: 0}
|
||||
key5: {r: 0, g: 0, b: 0, a: 0}
|
||||
key6: {r: 0, g: 0, b: 0, a: 0}
|
||||
key7: {r: 0, g: 0, b: 0, a: 0}
|
||||
ctime0: 0
|
||||
ctime1: 65535
|
||||
ctime2: 0
|
||||
ctime3: 0
|
||||
ctime4: 0
|
||||
ctime5: 0
|
||||
ctime6: 0
|
||||
ctime7: 0
|
||||
atime0: 0
|
||||
atime1: 65535
|
||||
atime2: 0
|
||||
atime3: 0
|
||||
atime4: 0
|
||||
atime5: 0
|
||||
atime6: 0
|
||||
atime7: 0
|
||||
m_Mode: 0
|
||||
m_NumColorKeys: 2
|
||||
m_NumAlphaKeys: 2
|
||||
weatherFogMod:
|
||||
serializedVersion: 2
|
||||
key0: {r: 0, g: 0, b: 0, a: 0.9411765}
|
||||
key1: {r: 0, g: 0, b: 0, a: 0.88235295}
|
||||
key2: {r: 0.68235296, g: 0.7058824, b: 0.88235295, a: 0}
|
||||
key3: {r: 0.42352942, g: 0.54901963, b: 0.7490196, a: 0.7058824}
|
||||
key4: {r: 0, g: 0, b: 0, a: 0}
|
||||
key5: {r: 0, g: 0, b: 0, a: 0}
|
||||
key6: {r: 0, g: 0, b: 0, a: 0}
|
||||
key7: {r: 0, g: 0, b: 0, a: 0}
|
||||
ctime0: 0
|
||||
ctime1: 36979
|
||||
ctime2: 38407
|
||||
ctime3: 65535
|
||||
ctime4: 0
|
||||
ctime5: 0
|
||||
ctime6: 0
|
||||
ctime7: 0
|
||||
atime0: 0
|
||||
atime1: 34409
|
||||
atime2: 36979
|
||||
atime3: 65535
|
||||
atime4: 0
|
||||
atime5: 0
|
||||
atime6: 0
|
||||
atime7: 0
|
||||
m_Mode: 0
|
||||
m_NumColorKeys: 4
|
||||
m_NumAlphaKeys: 4
|
||||
volumeLightIntensity: 0.5
|
||||
shadowIntensityMod: 0
|
||||
heightFogDensity: 1
|
||||
SkyFogHeight: 2
|
||||
skyFogStart: 0
|
||||
SkyFogIntensity: 0.942
|
||||
FogScatteringIntensity: 1.1
|
||||
fogSunBlocking: 1
|
||||
moonIntensity: 1
|
||||
effectSystems: []
|
||||
WindStrenght: 0.275
|
||||
wetnessLevel: 0
|
||||
snowLevel: 0
|
||||
temperatureLevel: 0
|
||||
isLightningStorm: 0
|
||||
lightningInterval: 10
|
||||
auroraIntensity: 0
|
||||
weatherSFX: {fileID: 0}
|
||||
SpringDayAmbient: {fileID: 8300000, guid: 9e4f9b704d4c6a545863111b7ab9bb51, type: 3}
|
||||
SpringNightAmbient: {fileID: 8300000, guid: 421815712ee5317449eeef6d06fac4a3, type: 3}
|
||||
SummerDayAmbient: {fileID: 8300000, guid: 9e4f9b704d4c6a545863111b7ab9bb51, type: 3}
|
||||
SummerNightAmbient: {fileID: 8300000, guid: 421815712ee5317449eeef6d06fac4a3, type: 3}
|
||||
AutumnDayAmbient: {fileID: 8300000, guid: 9e4f9b704d4c6a545863111b7ab9bb51, type: 3}
|
||||
AutumnNightAmbient: {fileID: 8300000, guid: 421815712ee5317449eeef6d06fac4a3, type: 3}
|
||||
WinterDayAmbient: {fileID: 0}
|
||||
WinterNightAmbient: {fileID: 0}
|
||||
blurDistance: 5000
|
||||
blurIntensity: 0.75
|
||||
blurSkyIntensity: 1.67
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8567a24be2d49cc4e81501f58f768074
|
||||
timeCreated: 1498052985
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+176
@@ -0,0 +1,176 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: ad9e871a73fc09d488bc058f3b382b35, type: 3}
|
||||
m_Name: Less Clouds VR
|
||||
m_EditorClassIdentifier:
|
||||
version: 1.9.0
|
||||
Name: Less Clouds VR
|
||||
Spring: 1
|
||||
possibiltyInSpring: 38.9
|
||||
Summer: 1
|
||||
possibiltyInSummer: 49.3
|
||||
Autumn: 1
|
||||
possibiltyInAutumn: 41.8
|
||||
winter: 1
|
||||
possibiltyInWinter: 54.5
|
||||
cloudsConfig:
|
||||
ambientSkyColorIntensity: 1
|
||||
scatteringCoef: 1
|
||||
edgeDarkness: 0.5
|
||||
baseErosionIntensity: 0.398
|
||||
detailErosionIntensity: 0.562
|
||||
density: 4
|
||||
lightStepModifier: 0.05
|
||||
lightVariance: 0
|
||||
coverage: 0
|
||||
lightAbsorbtion: 0.2
|
||||
coverageType: 1
|
||||
raymarchingScale: 1
|
||||
cloudType: 0.528
|
||||
cirrusAlpha: 1
|
||||
cirrusCoverage: 0
|
||||
cirrusColorPow: 2.17
|
||||
flatCloudsDensity: 2.5
|
||||
flatCloudsAbsorbtion: 2.5
|
||||
flatCloudsDirectLightIntensity: 15
|
||||
flatCloudsAmbientLightIntensity: 1
|
||||
flatCloudsHGPhase: 0.9
|
||||
flatCoverage: 0.287
|
||||
particleLayer1Alpha: 1
|
||||
particleLayer1Brightness: 0.75
|
||||
particleLayer1ColorPow: 2
|
||||
particleLayer2Alpha: 0
|
||||
particleLayer2Brightness: 0.75
|
||||
particleLayer2ColorPow: 2
|
||||
particleCloudsOverwrite: 0
|
||||
fogStartDistance: 0
|
||||
fogDistance: 0
|
||||
fogDensity: 0.00001
|
||||
weatherSkyMod:
|
||||
serializedVersion: 2
|
||||
key0: {r: 1, g: 1, b: 1, a: 0}
|
||||
key1: {r: 1, g: 1, b: 1, a: 0}
|
||||
key2: {r: 0, g: 0, b: 0, a: 0}
|
||||
key3: {r: 0, g: 0, b: 0, a: 0}
|
||||
key4: {r: 0, g: 0, b: 0, a: 0}
|
||||
key5: {r: 0, g: 0, b: 0, a: 0}
|
||||
key6: {r: 0, g: 0, b: 0, a: 0}
|
||||
key7: {r: 0, g: 0, b: 0, a: 0}
|
||||
ctime0: 0
|
||||
ctime1: 65535
|
||||
ctime2: 0
|
||||
ctime3: 0
|
||||
ctime4: 0
|
||||
ctime5: 0
|
||||
ctime6: 0
|
||||
ctime7: 0
|
||||
atime0: 0
|
||||
atime1: 65535
|
||||
atime2: 0
|
||||
atime3: 0
|
||||
atime4: 0
|
||||
atime5: 0
|
||||
atime6: 0
|
||||
atime7: 0
|
||||
m_Mode: 0
|
||||
m_NumColorKeys: 2
|
||||
m_NumAlphaKeys: 2
|
||||
weatherLightMod:
|
||||
serializedVersion: 2
|
||||
key0: {r: 1, g: 1, b: 1, a: 0}
|
||||
key1: {r: 1, g: 1, b: 1, a: 0}
|
||||
key2: {r: 0, g: 0, b: 0, a: 0}
|
||||
key3: {r: 0, g: 0, b: 0, a: 0}
|
||||
key4: {r: 0, g: 0, b: 0, a: 0}
|
||||
key5: {r: 0, g: 0, b: 0, a: 0}
|
||||
key6: {r: 0, g: 0, b: 0, a: 0}
|
||||
key7: {r: 0, g: 0, b: 0, a: 0}
|
||||
ctime0: 0
|
||||
ctime1: 65535
|
||||
ctime2: 0
|
||||
ctime3: 0
|
||||
ctime4: 0
|
||||
ctime5: 0
|
||||
ctime6: 0
|
||||
ctime7: 0
|
||||
atime0: 0
|
||||
atime1: 65535
|
||||
atime2: 0
|
||||
atime3: 0
|
||||
atime4: 0
|
||||
atime5: 0
|
||||
atime6: 0
|
||||
atime7: 0
|
||||
m_Mode: 0
|
||||
m_NumColorKeys: 2
|
||||
m_NumAlphaKeys: 2
|
||||
weatherFogMod:
|
||||
serializedVersion: 2
|
||||
key0: {r: 0, g: 0, b: 0, a: 0.9411765}
|
||||
key1: {r: 0, g: 0, b: 0, a: 0.88235295}
|
||||
key2: {r: 0.68235296, g: 0.7058824, b: 0.88235295, a: 0}
|
||||
key3: {r: 0.42352942, g: 0.54901963, b: 0.7490196, a: 0.7058824}
|
||||
key4: {r: 0, g: 0, b: 0, a: 0}
|
||||
key5: {r: 0, g: 0, b: 0, a: 0}
|
||||
key6: {r: 0, g: 0, b: 0, a: 0}
|
||||
key7: {r: 0, g: 0, b: 0, a: 0}
|
||||
ctime0: 0
|
||||
ctime1: 36979
|
||||
ctime2: 38407
|
||||
ctime3: 65535
|
||||
ctime4: 0
|
||||
ctime5: 0
|
||||
ctime6: 0
|
||||
ctime7: 0
|
||||
atime0: 0
|
||||
atime1: 34409
|
||||
atime2: 36979
|
||||
atime3: 65535
|
||||
atime4: 0
|
||||
atime5: 0
|
||||
atime6: 0
|
||||
atime7: 0
|
||||
m_Mode: 0
|
||||
m_NumColorKeys: 4
|
||||
m_NumAlphaKeys: 4
|
||||
volumeLightIntensity: 0.5
|
||||
shadowIntensityMod: 0
|
||||
heightFogDensity: 1
|
||||
SkyFogHeight: 1.94
|
||||
skyFogStart: 0
|
||||
SkyFogIntensity: 1
|
||||
FogScatteringIntensity: 1.1
|
||||
fogSunBlocking: 1
|
||||
moonIntensity: 1
|
||||
effectSystems: []
|
||||
WindStrenght: 0.275
|
||||
wetnessLevel: 0
|
||||
snowLevel: 0
|
||||
temperatureLevel: 0
|
||||
isLightningStorm: 0
|
||||
lightningInterval: 10
|
||||
auroraIntensity: 0
|
||||
weatherSFX: {fileID: 0}
|
||||
SpringDayAmbient: {fileID: 8300000, guid: 9e4f9b704d4c6a545863111b7ab9bb51, type: 3}
|
||||
SpringNightAmbient: {fileID: 8300000, guid: 421815712ee5317449eeef6d06fac4a3, type: 3}
|
||||
SummerDayAmbient: {fileID: 8300000, guid: 9e4f9b704d4c6a545863111b7ab9bb51, type: 3}
|
||||
SummerNightAmbient: {fileID: 8300000, guid: 421815712ee5317449eeef6d06fac4a3, type: 3}
|
||||
AutumnDayAmbient: {fileID: 8300000, guid: 9e4f9b704d4c6a545863111b7ab9bb51, type: 3}
|
||||
AutumnNightAmbient: {fileID: 8300000, guid: 421815712ee5317449eeef6d06fac4a3, type: 3}
|
||||
WinterDayAmbient: {fileID: 0}
|
||||
WinterNightAmbient: {fileID: 0}
|
||||
blurDistance: 100
|
||||
blurIntensity: 0.3
|
||||
blurSkyIntensity: 1
|
||||
sceneExposureMod: 1
|
||||
skyExposureMod: 1
|
||||
lightIntensityMod: 1
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2701d2741cd69904eadda7e9244d89d5
|
||||
timeCreated: 1498052985
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+179
@@ -0,0 +1,179 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: ad9e871a73fc09d488bc058f3b382b35, type: 3}
|
||||
m_Name: Rain VR
|
||||
m_EditorClassIdentifier:
|
||||
version: 1.9.0
|
||||
Name: Rain VR
|
||||
Spring: 1
|
||||
possibiltyInSpring: 100
|
||||
Summer: 1
|
||||
possibiltyInSummer: 52
|
||||
Autumn: 1
|
||||
possibiltyInAutumn: 100
|
||||
winter: 0
|
||||
possibiltyInWinter: 100
|
||||
cloudsConfig:
|
||||
ambientSkyColorIntensity: 1.25
|
||||
scatteringCoef: 0.5
|
||||
edgeDarkness: 0.724
|
||||
baseErosionIntensity: 0
|
||||
detailErosionIntensity: 0.486
|
||||
density: 4
|
||||
lightStepModifier: 0.7
|
||||
lightVariance: 0
|
||||
coverage: 0.768
|
||||
lightAbsorbtion: 0
|
||||
coverageType: 0
|
||||
raymarchingScale: 1
|
||||
cloudType: 1
|
||||
cirrusAlpha: 0
|
||||
cirrusCoverage: 0
|
||||
cirrusColorPow: 1
|
||||
flatCloudsDensity: 2.5
|
||||
flatCloudsAbsorbtion: 2.5
|
||||
flatCloudsDirectLightIntensity: 15
|
||||
flatCloudsAmbientLightIntensity: 1
|
||||
flatCloudsHGPhase: 0.9
|
||||
flatCoverage: 0.886
|
||||
particleLayer1Alpha: 0.755
|
||||
particleLayer1Brightness: 0.631
|
||||
particleLayer1ColorPow: 2
|
||||
particleLayer2Alpha: 0.334
|
||||
particleLayer2Brightness: 0.542
|
||||
particleLayer2ColorPow: 2
|
||||
particleCloudsOverwrite: 0
|
||||
fogStartDistance: 0
|
||||
fogDistance: 0
|
||||
fogDensity: 0.0003
|
||||
weatherSkyMod:
|
||||
serializedVersion: 2
|
||||
key0: {r: 0, g: 0, b: 0, a: 0}
|
||||
key1: {r: 0, g: 0, b: 0, a: 0}
|
||||
key2: {r: 0.5058824, g: 0.5058824, b: 0.5058824, a: 1}
|
||||
key3: {r: 0.5058824, g: 0.5058824, b: 0.5058824, a: 1}
|
||||
key4: {r: 0, g: 0, b: 0, a: 0}
|
||||
key5: {r: 0, g: 0, b: 0, a: 0}
|
||||
key6: {r: 0, g: 0, b: 0, a: 0}
|
||||
key7: {r: 0, g: 0, b: 0, a: 0}
|
||||
ctime0: 0
|
||||
ctime1: 29491
|
||||
ctime2: 32768
|
||||
ctime3: 65535
|
||||
ctime4: 0
|
||||
ctime5: 0
|
||||
ctime6: 0
|
||||
ctime7: 0
|
||||
atime0: 0
|
||||
atime1: 30554
|
||||
atime2: 32768
|
||||
atime3: 65535
|
||||
atime4: 65535
|
||||
atime5: 0
|
||||
atime6: 0
|
||||
atime7: 0
|
||||
m_Mode: 0
|
||||
m_NumColorKeys: 4
|
||||
m_NumAlphaKeys: 4
|
||||
weatherLightMod:
|
||||
serializedVersion: 2
|
||||
key0: {r: 0, g: 0, b: 0, a: 0}
|
||||
key1: {r: 0, g: 0, b: 0, a: 0.050980393}
|
||||
key2: {r: 0.43137255, g: 0.43137255, b: 0.43137255, a: 0.7647059}
|
||||
key3: {r: 0.42352942, g: 0.42352942, b: 0.42352942, a: 0.91764706}
|
||||
key4: {r: 0, g: 0, b: 0, a: 0}
|
||||
key5: {r: 0, g: 0, b: 0, a: 0}
|
||||
key6: {r: 0, g: 0, b: 0, a: 0}
|
||||
key7: {r: 0, g: 0, b: 0, a: 0}
|
||||
ctime0: 0
|
||||
ctime1: 29491
|
||||
ctime2: 32768
|
||||
ctime3: 65535
|
||||
ctime4: 0
|
||||
ctime5: 0
|
||||
ctime6: 0
|
||||
ctime7: 0
|
||||
atime0: 0
|
||||
atime1: 29491
|
||||
atime2: 32768
|
||||
atime3: 65535
|
||||
atime4: 0
|
||||
atime5: 0
|
||||
atime6: 0
|
||||
atime7: 0
|
||||
m_Mode: 0
|
||||
m_NumColorKeys: 4
|
||||
m_NumAlphaKeys: 4
|
||||
weatherFogMod:
|
||||
serializedVersion: 2
|
||||
key0: {r: 0, g: 0, b: 0, a: 0}
|
||||
key1: {r: 0, g: 0, b: 0, a: 0}
|
||||
key2: {r: 0.09019608, g: 0.09019608, b: 0.09019608, a: 0.9254902}
|
||||
key3: {r: 0.12156863, g: 0.12156863, b: 0.12156863, a: 0.9529412}
|
||||
key4: {r: 0.12156863, g: 0.12156863, b: 0.12156863, a: 0}
|
||||
key5: {r: 0, g: 0, b: 0, a: 0}
|
||||
key6: {r: 0, g: 0, b: 0, a: 0}
|
||||
key7: {r: 0, g: 0, b: 0, a: 0}
|
||||
ctime0: 0
|
||||
ctime1: 30412
|
||||
ctime2: 33981
|
||||
ctime3: 65535
|
||||
ctime4: 65535
|
||||
ctime5: 0
|
||||
ctime6: 0
|
||||
ctime7: 0
|
||||
atime0: 0
|
||||
atime1: 29491
|
||||
atime2: 32839
|
||||
atime3: 65535
|
||||
atime4: 0
|
||||
atime5: 0
|
||||
atime6: 0
|
||||
atime7: 0
|
||||
m_Mode: 0
|
||||
m_NumColorKeys: 4
|
||||
m_NumAlphaKeys: 4
|
||||
volumeLightIntensity: 0.5
|
||||
shadowIntensityMod: 0
|
||||
heightFogDensity: 1.95
|
||||
SkyFogHeight: 0.56
|
||||
skyFogStart: 0
|
||||
SkyFogIntensity: 1
|
||||
FogScatteringIntensity: 1
|
||||
fogSunBlocking: 0
|
||||
moonIntensity: 1
|
||||
effectSystems:
|
||||
- prefab: {fileID: 1000010755747430, guid: 1b83b884d3cfa9e4ab51583cd8d35bd2, type: 3}
|
||||
localPositionOffset: {x: 0, y: 25, z: 0}
|
||||
localRotationOffset: {x: -90, y: 0, z: -180}
|
||||
WindStrenght: 0.5
|
||||
wetnessLevel: 0.458
|
||||
snowLevel: 0
|
||||
temperatureLevel: 0
|
||||
isLightningStorm: 0
|
||||
lightningInterval: 10
|
||||
auroraIntensity: 0
|
||||
weatherSFX: {fileID: 8300000, guid: 66895ba947937d141b5575c203607545, type: 3}
|
||||
SpringDayAmbient: {fileID: 0}
|
||||
SpringNightAmbient: {fileID: 0}
|
||||
SummerDayAmbient: {fileID: 0}
|
||||
SummerNightAmbient: {fileID: 0}
|
||||
AutumnDayAmbient: {fileID: 0}
|
||||
AutumnNightAmbient: {fileID: 0}
|
||||
WinterDayAmbient: {fileID: 0}
|
||||
WinterNightAmbient: {fileID: 0}
|
||||
blurDistance: 100
|
||||
blurIntensity: 1
|
||||
blurSkyIntensity: 1
|
||||
sceneExposureMod: 1
|
||||
skyExposureMod: 1
|
||||
lightIntensityMod: 1
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d88275fa49b2b4b4dafcfe762f0f8b40
|
||||
timeCreated: 1498009914
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+182
@@ -0,0 +1,182 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: ad9e871a73fc09d488bc058f3b382b35, type: 3}
|
||||
m_Name: Snow VR
|
||||
m_EditorClassIdentifier:
|
||||
version: 1.9.0
|
||||
Name: Snow VR
|
||||
Spring: 0
|
||||
possibiltyInSpring: 50
|
||||
Summer: 0
|
||||
possibiltyInSummer: 50
|
||||
Autumn: 0
|
||||
possibiltyInAutumn: 50
|
||||
winter: 1
|
||||
possibiltyInWinter: 80.2
|
||||
cloudsConfig:
|
||||
ambientSkyColorIntensity: 1.25
|
||||
scatteringCoef: 1
|
||||
edgeDarkness: 0.5
|
||||
baseErosionIntensity: 0
|
||||
detailErosionIntensity: 0.4
|
||||
density: 4
|
||||
lightStepModifier: 0.7
|
||||
lightVariance: 0
|
||||
coverage: 0.562
|
||||
lightAbsorbtion: 0.1
|
||||
coverageType: 1
|
||||
raymarchingScale: 1
|
||||
cloudType: 1
|
||||
cirrusAlpha: 0
|
||||
cirrusCoverage: 0
|
||||
cirrusColorPow: 1
|
||||
flatCloudsDensity: 2.5
|
||||
flatCloudsAbsorbtion: 2.5
|
||||
flatCloudsDirectLightIntensity: 15
|
||||
flatCloudsAmbientLightIntensity: 1
|
||||
flatCloudsHGPhase: 0.9
|
||||
flatCoverage: 0.409
|
||||
particleLayer1Alpha: 0
|
||||
particleLayer1Brightness: 0.75
|
||||
particleLayer1ColorPow: 2
|
||||
particleLayer2Alpha: 0
|
||||
particleLayer2Brightness: 0.75
|
||||
particleLayer2ColorPow: 2
|
||||
particleCloudsOverwrite: 0
|
||||
fogStartDistance: 0
|
||||
fogDistance: 1000
|
||||
fogDensity: 0.001
|
||||
weatherSkyMod:
|
||||
serializedVersion: 2
|
||||
key0: {r: 1, g: 1, b: 1, a: 0}
|
||||
key1: {r: 1, g: 1, b: 1, a: 0}
|
||||
key2: {r: 0, g: 0, b: 0, a: 0}
|
||||
key3: {r: 0, g: 0, b: 0, a: 0}
|
||||
key4: {r: 0, g: 0, b: 0, a: 0}
|
||||
key5: {r: 0, g: 0, b: 0, a: 0}
|
||||
key6: {r: 0, g: 0, b: 0, a: 0}
|
||||
key7: {r: 0, g: 0, b: 0, a: 0}
|
||||
ctime0: 0
|
||||
ctime1: 65535
|
||||
ctime2: 0
|
||||
ctime3: 0
|
||||
ctime4: 0
|
||||
ctime5: 0
|
||||
ctime6: 0
|
||||
ctime7: 0
|
||||
atime0: 0
|
||||
atime1: 65535
|
||||
atime2: 0
|
||||
atime3: 0
|
||||
atime4: 0
|
||||
atime5: 0
|
||||
atime6: 0
|
||||
atime7: 0
|
||||
m_Mode: 0
|
||||
m_NumColorKeys: 2
|
||||
m_NumAlphaKeys: 2
|
||||
weatherLightMod:
|
||||
serializedVersion: 2
|
||||
key0: {r: 1, g: 1, b: 1, a: 0}
|
||||
key1: {r: 1, g: 1, b: 1, a: 0}
|
||||
key2: {r: 0, g: 0, b: 0, a: 0}
|
||||
key3: {r: 0, g: 0, b: 0, a: 0}
|
||||
key4: {r: 0, g: 0, b: 0, a: 0}
|
||||
key5: {r: 0, g: 0, b: 0, a: 0}
|
||||
key6: {r: 0, g: 0, b: 0, a: 0}
|
||||
key7: {r: 0, g: 0, b: 0, a: 0}
|
||||
ctime0: 0
|
||||
ctime1: 65535
|
||||
ctime2: 0
|
||||
ctime3: 0
|
||||
ctime4: 0
|
||||
ctime5: 0
|
||||
ctime6: 0
|
||||
ctime7: 0
|
||||
atime0: 0
|
||||
atime1: 65535
|
||||
atime2: 0
|
||||
atime3: 0
|
||||
atime4: 0
|
||||
atime5: 0
|
||||
atime6: 0
|
||||
atime7: 0
|
||||
m_Mode: 0
|
||||
m_NumColorKeys: 2
|
||||
m_NumAlphaKeys: 2
|
||||
weatherFogMod:
|
||||
serializedVersion: 2
|
||||
key0: {r: 1, g: 1, b: 1, a: 0}
|
||||
key1: {r: 1, g: 1, b: 1, a: 0}
|
||||
key2: {r: 0.68235296, g: 0.7058824, b: 0.88235295, a: 0}
|
||||
key3: {r: 0.42352942, g: 0.54901963, b: 0.7490196, a: 0.7058824}
|
||||
key4: {r: 0, g: 0, b: 0, a: 0}
|
||||
key5: {r: 0, g: 0, b: 0, a: 0}
|
||||
key6: {r: 0, g: 0, b: 0, a: 0}
|
||||
key7: {r: 0, g: 0, b: 0, a: 0}
|
||||
ctime0: 0
|
||||
ctime1: 65535
|
||||
ctime2: 34695
|
||||
ctime3: 65535
|
||||
ctime4: 0
|
||||
ctime5: 0
|
||||
ctime6: 0
|
||||
ctime7: 0
|
||||
atime0: 0
|
||||
atime1: 65535
|
||||
atime2: 33981
|
||||
atime3: 65535
|
||||
atime4: 0
|
||||
atime5: 0
|
||||
atime6: 0
|
||||
atime7: 0
|
||||
m_Mode: 0
|
||||
m_NumColorKeys: 2
|
||||
m_NumAlphaKeys: 2
|
||||
volumeLightIntensity: 0.5
|
||||
shadowIntensityMod: 0
|
||||
heightFogDensity: 0.65
|
||||
SkyFogHeight: 1.8
|
||||
skyFogStart: 0
|
||||
SkyFogIntensity: 1
|
||||
FogScatteringIntensity: 1.12
|
||||
fogSunBlocking: 0.25
|
||||
moonIntensity: 1
|
||||
effectSystems:
|
||||
- prefab: {fileID: 1000011163096958, guid: 0075ab175ecc30447ac1888d39fc1a88, type: 3}
|
||||
localPositionOffset: {x: 0, y: 15, z: 0}
|
||||
localRotationOffset: {x: -90, y: 0, z: -180}
|
||||
- prefab: {fileID: 1000013790200260, guid: aa9bc6ee504541646a4c291d9cc84c12, type: 3}
|
||||
localPositionOffset: {x: 0, y: 10, z: 0}
|
||||
localRotationOffset: {x: -90, y: 0, z: -180}
|
||||
WindStrenght: 0.16
|
||||
wetnessLevel: 0
|
||||
snowLevel: 0.508
|
||||
temperatureLevel: 0
|
||||
isLightningStorm: 0
|
||||
lightningInterval: 10
|
||||
auroraIntensity: 0
|
||||
weatherSFX: {fileID: 0}
|
||||
SpringDayAmbient: {fileID: 0}
|
||||
SpringNightAmbient: {fileID: 0}
|
||||
SummerDayAmbient: {fileID: 0}
|
||||
SummerNightAmbient: {fileID: 0}
|
||||
AutumnDayAmbient: {fileID: 0}
|
||||
AutumnNightAmbient: {fileID: 0}
|
||||
WinterDayAmbient: {fileID: 0}
|
||||
WinterNightAmbient: {fileID: 0}
|
||||
blurDistance: 100
|
||||
blurIntensity: 1
|
||||
blurSkyIntensity: 1
|
||||
sceneExposureMod: 1
|
||||
skyExposureMod: 1
|
||||
lightIntensityMod: 1
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2a0fdb02912e6fa46afc635c63c371b6
|
||||
timeCreated: 1498062042
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+178
@@ -0,0 +1,178 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: ad9e871a73fc09d488bc058f3b382b35, type: 3}
|
||||
m_Name: Storm VR
|
||||
m_EditorClassIdentifier:
|
||||
version: 1.9.0
|
||||
Name: Storm VR
|
||||
Spring: 1
|
||||
possibiltyInSpring: 100
|
||||
Summer: 1
|
||||
possibiltyInSummer: 52
|
||||
Autumn: 1
|
||||
possibiltyInAutumn: 100
|
||||
winter: 0
|
||||
possibiltyInWinter: 100
|
||||
cloudsConfig:
|
||||
ambientSkyColorIntensity: 1.089
|
||||
scatteringCoef: 0.746
|
||||
edgeDarkness: 0.4
|
||||
baseErosionIntensity: 0.128
|
||||
detailErosionIntensity: 0.58
|
||||
density: 4
|
||||
lightStepModifier: 1.051
|
||||
lightVariance: 0.5
|
||||
coverage: 0.839
|
||||
lightAbsorbtion: 0
|
||||
coverageType: 0
|
||||
raymarchingScale: 1
|
||||
cloudType: 1
|
||||
cirrusAlpha: 0
|
||||
cirrusCoverage: 0
|
||||
cirrusColorPow: 1
|
||||
flatCloudsDensity: 2.5
|
||||
flatCloudsAbsorbtion: 2.5
|
||||
flatCloudsDirectLightIntensity: 15
|
||||
flatCloudsAmbientLightIntensity: 1
|
||||
flatCloudsHGPhase: 0.9
|
||||
flatCoverage: 0.893
|
||||
particleLayer1Alpha: 0.445
|
||||
particleLayer1Brightness: 0.559
|
||||
particleLayer1ColorPow: 2
|
||||
particleLayer2Alpha: 0.263
|
||||
particleLayer2Brightness: 0.386
|
||||
particleLayer2ColorPow: 2
|
||||
particleCloudsOverwrite: 0
|
||||
fogStartDistance: 0
|
||||
fogDistance: 0
|
||||
fogDensity: 0.0005
|
||||
weatherSkyMod:
|
||||
serializedVersion: 2
|
||||
key0: {r: 0, g: 0, b: 0, a: 1}
|
||||
key1: {r: 0, g: 0, b: 0, a: 1}
|
||||
key2: {r: 0.1764706, g: 0.1764706, b: 0.1764706, a: 0.9647059}
|
||||
key3: {r: 0.32156864, g: 0.32156864, b: 0.32156864, a: 0.90588236}
|
||||
key4: {r: 0, g: 0, b: 0, a: 0}
|
||||
key5: {r: 0, g: 0, b: 0, a: 0}
|
||||
key6: {r: 0, g: 0, b: 0, a: 0}
|
||||
key7: {r: 0, g: 0, b: 0, a: 0}
|
||||
ctime0: 0
|
||||
ctime1: 30412
|
||||
ctime2: 34695
|
||||
ctime3: 65535
|
||||
ctime4: 0
|
||||
ctime5: 0
|
||||
ctime6: 0
|
||||
ctime7: 0
|
||||
atime0: 0
|
||||
atime1: 29491
|
||||
atime2: 32839
|
||||
atime3: 65535
|
||||
atime4: 65535
|
||||
atime5: 0
|
||||
atime6: 0
|
||||
atime7: 0
|
||||
m_Mode: 0
|
||||
m_NumColorKeys: 4
|
||||
m_NumAlphaKeys: 4
|
||||
weatherLightMod:
|
||||
serializedVersion: 2
|
||||
key0: {r: 0, g: 0, b: 0, a: 0}
|
||||
key1: {r: 0, g: 0, b: 0, a: 0.050980393}
|
||||
key2: {r: 0.29803923, g: 0.29803923, b: 0.29803923, a: 0.7647059}
|
||||
key3: {r: 0.30588236, g: 0.30588236, b: 0.30588236, a: 0.91764706}
|
||||
key4: {r: 0, g: 0, b: 0, a: 0}
|
||||
key5: {r: 0, g: 0, b: 0, a: 0}
|
||||
key6: {r: 0, g: 0, b: 0, a: 0}
|
||||
key7: {r: 0, g: 0, b: 0, a: 0}
|
||||
ctime0: 0
|
||||
ctime1: 29491
|
||||
ctime2: 32768
|
||||
ctime3: 65535
|
||||
ctime4: 0
|
||||
ctime5: 0
|
||||
ctime6: 0
|
||||
ctime7: 0
|
||||
atime0: 0
|
||||
atime1: 29491
|
||||
atime2: 32768
|
||||
atime3: 65535
|
||||
atime4: 0
|
||||
atime5: 0
|
||||
atime6: 0
|
||||
atime7: 0
|
||||
m_Mode: 0
|
||||
m_NumColorKeys: 4
|
||||
m_NumAlphaKeys: 4
|
||||
weatherFogMod:
|
||||
serializedVersion: 2
|
||||
key0: {r: 0, g: 0, b: 0, a: 1}
|
||||
key1: {r: 0, g: 0, b: 0, a: 1}
|
||||
key2: {r: 0.14901961, g: 0.14901961, b: 0.14901961, a: 0.9254902}
|
||||
key3: {r: 0.14901961, g: 0.14901961, b: 0.14901961, a: 0.9490196}
|
||||
key4: {r: 0, g: 0, b: 0, a: 0}
|
||||
key5: {r: 0, g: 0, b: 0, a: 0}
|
||||
key6: {r: 0, g: 0, b: 0, a: 0}
|
||||
key7: {r: 0, g: 0, b: 0, a: 0}
|
||||
ctime0: 0
|
||||
ctime1: 30412
|
||||
ctime2: 34695
|
||||
ctime3: 65535
|
||||
ctime4: 0
|
||||
ctime5: 0
|
||||
ctime6: 0
|
||||
ctime7: 0
|
||||
atime0: 0
|
||||
atime1: 29491
|
||||
atime2: 32839
|
||||
atime3: 65535
|
||||
atime4: 0
|
||||
atime5: 0
|
||||
atime6: 0
|
||||
atime7: 0
|
||||
m_Mode: 0
|
||||
m_NumColorKeys: 4
|
||||
m_NumAlphaKeys: 4
|
||||
volumeLightIntensity: 0.25
|
||||
shadowIntensityMod: 0
|
||||
heightFogDensity: 2.1
|
||||
SkyFogHeight: 0.116
|
||||
skyFogStart: 0
|
||||
SkyFogIntensity: 0.438
|
||||
FogScatteringIntensity: 1
|
||||
fogSunBlocking: 0
|
||||
moonIntensity: 1
|
||||
effectSystems:
|
||||
- prefab: {fileID: 1000010755747430, guid: 1b83b884d3cfa9e4ab51583cd8d35bd2, type: 2}
|
||||
localPositionOffset: {x: 0, y: 25, z: 0}
|
||||
localRotationOffset: {x: -90, y: 0, z: -180}
|
||||
WindStrenght: 0.635
|
||||
wetnessLevel: 1
|
||||
snowLevel: 0
|
||||
temperatureLevel: 0
|
||||
isLightningStorm: 1
|
||||
lightningInterval: 9.2
|
||||
auroraIntensity: 0
|
||||
weatherSFX: {fileID: 8300000, guid: f31058b86e6160c4ab736a2b8c210219, type: 3}
|
||||
SpringDayAmbient: {fileID: 0}
|
||||
SpringNightAmbient: {fileID: 0}
|
||||
SummerDayAmbient: {fileID: 0}
|
||||
SummerNightAmbient: {fileID: 0}
|
||||
AutumnDayAmbient: {fileID: 0}
|
||||
AutumnNightAmbient: {fileID: 0}
|
||||
WinterDayAmbient: {fileID: 0}
|
||||
WinterNightAmbient: {fileID: 0}
|
||||
blurDistance: 100
|
||||
blurIntensity: 1
|
||||
blurSkyIntensity: 1
|
||||
sceneExposureMod: 1
|
||||
skyExposureMod: 1
|
||||
lightIntensityMod: 1
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 92531ea40a8375348a39759b0a957c86
|
||||
timeCreated: 1498009914
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9b848a555f20f4b4f9478ea3ff0162b3
|
||||
folderAsset: yes
|
||||
timeCreated: 1459178233
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0cf0f92b1d837c840a8e65f0820fc6c4
|
||||
folderAsset: yes
|
||||
timeCreated: 1491611329
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6f044755d5080b04c9c3599d43809e31
|
||||
folderAsset: yes
|
||||
timeCreated: 1506387979
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+334
@@ -0,0 +1,334 @@
|
||||
// MODIFIED FOR ENVIRO POST PROCESSING
|
||||
//
|
||||
// Kino/Bloom v2 - Bloom filter for Unity
|
||||
//
|
||||
// Copyright (C) 2015, 2016 Keijiro Takahashi
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
// Mobile: use RGBM instead of float/half RGB
|
||||
#define USE_RGBM defined(SHADER_API_MOBILE)
|
||||
|
||||
UNITY_DECLARE_SCREENSPACE_TEXTURE(_MainTex);
|
||||
UNITY_DECLARE_SCREENSPACE_TEXTURE(_BaseTex);
|
||||
float2 _MainTex_TexelSize;
|
||||
float2 _BaseTex_TexelSize;
|
||||
half4 _MainTex_ST;
|
||||
half4 _BaseTex_ST;
|
||||
|
||||
float _PrefilterOffs;
|
||||
half _Threshold;
|
||||
half3 _Curve;
|
||||
float _SampleScale;
|
||||
half _Intensity;
|
||||
|
||||
UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
|
||||
sampler2D _DistTex;
|
||||
float _Distance;
|
||||
float _Radius;
|
||||
float _SkyBlurring;
|
||||
|
||||
float4x4 _LeftWorldFromView;
|
||||
float4x4 _RightWorldFromView;
|
||||
float4x4 _LeftViewFromScreen;
|
||||
float4x4 _RightViewFromScreen;
|
||||
|
||||
// Brightness function
|
||||
half Brightness(half3 c)
|
||||
{
|
||||
return max(max(c.r, c.g), c.b);
|
||||
}
|
||||
|
||||
// 3-tap median filter
|
||||
half3 Median(half3 a, half3 b, half3 c)
|
||||
{
|
||||
return a + b + c - min(min(a, b), c) - max(max(a, b), c);
|
||||
}
|
||||
|
||||
// Clamp HDR value within a safe range
|
||||
half3 SafeHDR(half3 c) { return min(c, 65000); }
|
||||
half4 SafeHDR(half4 c) { return min(c, 65000); }
|
||||
|
||||
// RGBM encoding/decoding
|
||||
half4 EncodeHDR(float3 rgb)
|
||||
{
|
||||
#if USE_RGBM
|
||||
rgb *= 1.0 / 8;
|
||||
float m = max(max(rgb.r, rgb.g), max(rgb.b, 1e-6));
|
||||
m = ceil(m * 255) / 255;
|
||||
return half4(rgb / m, m);
|
||||
#else
|
||||
return half4(rgb, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
float3 DecodeHDR(half4 rgba)
|
||||
{
|
||||
#if USE_RGBM
|
||||
return rgba.rgb * rgba.a * 8;
|
||||
#else
|
||||
return rgba.rgb;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Downsample with a 4x4 box filter
|
||||
half3 DownsampleFilter(float2 uv)
|
||||
{
|
||||
float4 d = _MainTex_TexelSize.xyxy * float4(-1, -1, +1, +1);
|
||||
|
||||
half3 s;
|
||||
s = DecodeHDR(UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv + d.xy));
|
||||
s += DecodeHDR(UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv + d.zy));
|
||||
s += DecodeHDR(UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv + d.xw));
|
||||
s += DecodeHDR(UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv + d.zw));
|
||||
|
||||
return s * (1.0 / 4);
|
||||
}
|
||||
|
||||
// Downsample with a 4x4 box filter + anti-flicker filter
|
||||
half3 DownsampleAntiFlickerFilter(float2 uv)
|
||||
{
|
||||
float4 d = _MainTex_TexelSize.xyxy * float4(-1, -1, +1, +1);
|
||||
|
||||
half3 s1 = DecodeHDR(UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv + d.xy));
|
||||
half3 s2 = DecodeHDR(UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv + d.zy));
|
||||
half3 s3 = DecodeHDR(UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv + d.xw));
|
||||
half3 s4 = DecodeHDR(UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv + d.zw));
|
||||
|
||||
// Karis's luma weighted average (using brightness instead of luma)
|
||||
half s1w = 1 / (Brightness(s1) + 1);
|
||||
half s2w = 1 / (Brightness(s2) + 1);
|
||||
half s3w = 1 / (Brightness(s3) + 1);
|
||||
half s4w = 1 / (Brightness(s4) + 1);
|
||||
half one_div_wsum = 1 / (s1w + s2w + s3w + s4w);
|
||||
|
||||
return (s1 * s1w + s2 * s2w + s3 * s3w + s4 * s4w) * one_div_wsum;
|
||||
}
|
||||
|
||||
half3 UpsampleFilter(float2 uv)
|
||||
{
|
||||
#if HIGH_QUALITY
|
||||
// 9-tap bilinear upsampler (tent filter)
|
||||
float4 d = _MainTex_TexelSize.xyxy * float4(1, 1, -1, 0) * _SampleScale;
|
||||
|
||||
half3 s;
|
||||
s = DecodeHDR(UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv - d.xy));
|
||||
s += DecodeHDR(UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv - d.wy)) * 2;
|
||||
s += DecodeHDR(UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv - d.zy));
|
||||
|
||||
s += DecodeHDR(UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv + d.zw)) * 2;
|
||||
s += DecodeHDR(UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv)) * 4;
|
||||
s += DecodeHDR(UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv + d.xw)) * 2;
|
||||
|
||||
s += DecodeHDR(UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv + d.zy));
|
||||
s += DecodeHDR(UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv + d.wy)) * 2;
|
||||
s += DecodeHDR(UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv + d.xy));
|
||||
|
||||
return s * (1.0 / 16);
|
||||
#else
|
||||
// 4-tap bilinear upsampler
|
||||
float4 d = _MainTex_TexelSize.xyxy * float4(-1, -1, +1, +1) * (_SampleScale * 0.5);
|
||||
|
||||
half3 s;
|
||||
s = DecodeHDR(UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv + d.xy));
|
||||
s += DecodeHDR(UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv + d.zy));
|
||||
s += DecodeHDR(UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv + d.xw));
|
||||
s += DecodeHDR(UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv + d.zw));
|
||||
|
||||
return s * (1.0 / 4);
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
// Vertex shader
|
||||
//
|
||||
|
||||
v2f_img vert(appdata_img v)
|
||||
{
|
||||
v2f_img o;
|
||||
UNITY_SETUP_INSTANCE_ID(v); //Insert
|
||||
UNITY_INITIALIZE_OUTPUT(v2f_img, o); //Insert
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); //Insert
|
||||
//o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.pos = v.vertex * float4(2, 2, 1, 1) + float4(-1, -1, 0, 0);
|
||||
o.uv = UnityStereoScreenSpaceUVAdjust(v.texcoord, _MainTex_ST);
|
||||
#if UNITY_UV_STARTS_AT_TOP
|
||||
if (_MainTex_TexelSize.y > 0.0)
|
||||
o.uv.y = 1 - o.uv.y;
|
||||
#endif
|
||||
return o;
|
||||
}
|
||||
|
||||
struct v2f_multitex
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uvMain : TEXCOORD0;
|
||||
float2 uvBase : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
v2f_multitex vert_multitex(appdata_img v)
|
||||
{
|
||||
v2f_multitex o;
|
||||
UNITY_SETUP_INSTANCE_ID(v); //Insert
|
||||
UNITY_INITIALIZE_OUTPUT(v2f_multitex, o); //Insert
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); //Insert
|
||||
//o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.pos = v.vertex * float4(2, 2, 1, 1) + float4(-1, -1, 0, 0);
|
||||
o.uvMain = UnityStereoScreenSpaceUVAdjust(v.texcoord, _MainTex_ST);
|
||||
o.uvBase = UnityStereoScreenSpaceUVAdjust(v.texcoord, _BaseTex_ST);
|
||||
#if UNITY_UV_STARTS_AT_TOP
|
||||
if (_BaseTex_TexelSize.y > 0.0)
|
||||
o.uvBase.y = 1.0 - v.texcoord.y;
|
||||
if (_MainTex_TexelSize.y > 0.0)
|
||||
o.uvMain.y = 1 - o.uvMain.y;
|
||||
#endif
|
||||
return o;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// fragment shader
|
||||
//
|
||||
|
||||
|
||||
half AdjustDepth(half d, half2 uv)
|
||||
{
|
||||
float4x4 proj, eyeToWorld;
|
||||
|
||||
if (unity_StereoEyeIndex == 0)
|
||||
{
|
||||
proj = _LeftViewFromScreen;
|
||||
eyeToWorld = _LeftWorldFromView;
|
||||
}
|
||||
else
|
||||
{
|
||||
proj = _RightViewFromScreen;
|
||||
eyeToWorld = _RightWorldFromView;
|
||||
}
|
||||
|
||||
float2 uvClip = uv * 2.0 - 1.0;
|
||||
float4 clipPos = float4(uvClip, d, 1.0);
|
||||
float4 viewPos = mul(proj, clipPos); // inverse projection by clip position
|
||||
viewPos /= viewPos.w; // perspective division
|
||||
float4 wsPos = float4(mul(eyeToWorld, viewPos).xyz, 1);
|
||||
float4 wsDir = wsPos - float4(_WorldSpaceCameraPos, 0);
|
||||
float3 viewDir = normalize(wsDir);
|
||||
|
||||
if (d < 0.99999)
|
||||
{
|
||||
d = clamp(d * ((_ProjectionParams.z - _ProjectionParams.y) / _Distance), 0, 1);
|
||||
d = tex2D(_DistTex, half2(d, 0.5));
|
||||
}
|
||||
else
|
||||
{
|
||||
d = 1 - saturate(_SkyBlurring * viewDir.y);
|
||||
d = (clamp(d, 0, 1));
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
half4 frag_prefilter(v2f_img i) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
float2 uv = i.uv + _MainTex_TexelSize.xy * _PrefilterOffs;
|
||||
|
||||
#if ANTI_FLICKER
|
||||
float3 d = _MainTex_TexelSize.xyx * float3(1, 1, 0);
|
||||
half4 s0 = SafeHDR(UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv));
|
||||
half3 s1 = SafeHDR(UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv - d.xz).rgb);
|
||||
half3 s2 = SafeHDR(UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv + d.xz).rgb);
|
||||
half3 s3 = SafeHDR(UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv - d.zy).rgb);
|
||||
half3 s4 = SafeHDR(UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv + d.zy).rgb);
|
||||
half3 m = Median(Median(s0.rgb, s1, s2), s3, s4);
|
||||
#else
|
||||
half4 s0 = SafeHDR(UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv));
|
||||
half3 m = s0.rgb;
|
||||
#endif
|
||||
|
||||
#if UNITY_COLORSPACE_GAMMA
|
||||
m = GammaToLinearSpace(m);
|
||||
#endif
|
||||
// Pixel brightness
|
||||
half br = Brightness(m);
|
||||
|
||||
// Under-threshold part: quadratic curve
|
||||
half rq = clamp(br - _Curve.x, 0, _Curve.y);
|
||||
rq = _Curve.z * rq * rq;
|
||||
|
||||
// Combine and apply the brightness response curve.
|
||||
m *= max(rq, br - _Threshold) / max(br, 1e-5);
|
||||
|
||||
// Adjust Depth Texture for fullscreen blurring
|
||||
half depth = Linear01Depth(SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, i.uv).r);
|
||||
depth = AdjustDepth(depth, i.uv);
|
||||
|
||||
return EncodeHDR(m * depth);
|
||||
}
|
||||
|
||||
half4 frag_downsample1(v2f_img i) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
#if ANTI_FLICKER
|
||||
return EncodeHDR(DownsampleAntiFlickerFilter(i.uv));
|
||||
#else
|
||||
return EncodeHDR(DownsampleFilter(i.uv));
|
||||
#endif
|
||||
}
|
||||
|
||||
half4 frag_downsample2(v2f_img i) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
return EncodeHDR(DownsampleFilter(i.uv));
|
||||
}
|
||||
|
||||
half4 frag_upsample(v2f_multitex i) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
half3 base = DecodeHDR(UNITY_SAMPLE_SCREENSPACE_TEXTURE(_BaseTex, i.uvBase));
|
||||
half3 blur = UpsampleFilter(i.uvMain);
|
||||
|
||||
return EncodeHDR(base + blur);
|
||||
}
|
||||
|
||||
half4 frag_upsample_final(v2f_multitex i) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
half4 base = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_BaseTex, i.uvBase);
|
||||
|
||||
half3 blur = UpsampleFilter(UnityStereoTransformScreenSpaceTex(i.uvMain));
|
||||
#if UNITY_COLORSPACE_GAMMA
|
||||
// base.rgb = GammaToLinearSpace(base.rgb);
|
||||
#endif
|
||||
half3 cout = base.rgb + blur * _Intensity;
|
||||
#if UNITY_COLORSPACE_GAMMA
|
||||
cout = LinearToGammaSpace(cout);
|
||||
#endif
|
||||
|
||||
// Adjust Depth Texture for fullscreen blurring
|
||||
//half depth = Linear01Depth(tex2D(_CameraDepthTexture, i.uvBase).r);
|
||||
|
||||
half depth = Linear01Depth(SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, i.uvBase).r);
|
||||
depth = AdjustDepth(depth, i.uvBase);
|
||||
|
||||
return lerp(base, half4(blur,1) * (1 / _Radius), clamp(depth ,0,_Intensity));
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3747da2d4df0600489ee1a20c7758494
|
||||
timeCreated: 1481683313
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+362
@@ -0,0 +1,362 @@
|
||||
|
||||
float3 interpolation_c2( float3 x ) { return x * x * x * (x * (x * 6.0 - 15.0) + 10.0); }
|
||||
|
||||
float3 mod(float3 x, float3 y)
|
||||
{
|
||||
return x - y * floor(x / y);
|
||||
}
|
||||
|
||||
float4 mod(float4 x, float4 y)
|
||||
{
|
||||
return x - y * floor(x / y);
|
||||
}
|
||||
|
||||
float3 mod289(float3 x)
|
||||
{
|
||||
return x - floor(x / 289.0) * 289.0;
|
||||
}
|
||||
|
||||
float4 mod289(float4 x)
|
||||
{
|
||||
return x - floor(x * (1.0 / 289.0)) * 289.0;
|
||||
}
|
||||
|
||||
float4 permute(float4 x)
|
||||
{
|
||||
return mod289(((x*34.0) + 1.0)*x);
|
||||
}
|
||||
|
||||
float3 fade(float3 t) {
|
||||
return t*t*t*(t*(t*6.0 - 15.0) + 10.0);
|
||||
}
|
||||
|
||||
float4 taylorInvSqrt(float4 r)
|
||||
{
|
||||
return 1.79284291400159 - 0.85373472095314 * r;
|
||||
}
|
||||
|
||||
float2 fade(float2 t) {
|
||||
return t*t*t*(t*(t*6.0 - 15.0) + 10.0);
|
||||
}
|
||||
|
||||
////
|
||||
|
||||
float Falloff_Xsq_C2(float xsq) { xsq = 1.0 - xsq; return xsq*xsq*xsq; } // ( 1.0 - x*x )^3. NOTE: 2nd derivative is 0.0 at x=1.0, but non-zero at x=0.0
|
||||
float4 Falloff_Xsq_C2(float4 xsq) { xsq = 1.0 - xsq; return xsq*xsq*xsq; }
|
||||
float2 Interpolation_C2(float2 x) { return x * x * x * (x * (x * 6.0 - 15.0) + 10.0); }
|
||||
|
||||
|
||||
void FAST32_hash_2D(float2 gridcell, out float4 hash_0, out float4 hash_1) // generates 2 random numbers for each of the 4 cell corners
|
||||
{
|
||||
// gridcell is assumed to be an integer coordinate
|
||||
const float2 OFFSET = float2(26.0, 161.0);
|
||||
const float DOMAIN = 71.0;
|
||||
const float2 SOMELARGEFLOATS = float2(951.135664, 642.949883);
|
||||
float4 P = float4(gridcell.xy, gridcell.xy + 1.0);
|
||||
P = P - floor(P * (1.0 / DOMAIN)) * DOMAIN;
|
||||
P += OFFSET.xyxy;
|
||||
P *= P;
|
||||
P = P.xzxz * P.yyww;
|
||||
hash_0 = frac(P * (1.0 / SOMELARGEFLOATS.x));
|
||||
hash_1 = frac(P * (1.0 / SOMELARGEFLOATS.y));
|
||||
}
|
||||
|
||||
float4 FAST32_hash_2D(float2 gridcell) // generates a random number for each of the 4 cell corners
|
||||
{
|
||||
// gridcell is assumed to be an integer coordinate
|
||||
const float2 OFFSET = float2(26.0, 161.0);
|
||||
const float DOMAIN = 71.0;
|
||||
const float SOMELARGEFLOAT = 951.135664;
|
||||
float4 P = float4(gridcell.xy, gridcell.xy + 1.0);
|
||||
P = P - floor(P * (1.0 / DOMAIN)) * DOMAIN; // truncate the domain
|
||||
P += OFFSET.xyxy; // offset to interesting part of the noise
|
||||
P *= P; // calculate and return the hash
|
||||
return frac(P.xzxz * P.yyww * (1.0 / SOMELARGEFLOAT));
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Perlin Noise 2D ( gradient noise )
|
||||
// Return value range of -1.0->1.0
|
||||
// http://briansharpe.files.wordpress.com/2011/11/perlinsample.jpg
|
||||
//
|
||||
float Perlin2D(float2 P)
|
||||
{
|
||||
// establish our grid cell and unit position
|
||||
float2 Pi = floor(P);
|
||||
float4 Pf_Pfmin1 = P.xyxy - float4(Pi, Pi + 1.0);
|
||||
|
||||
#if CLASSICPERLIN
|
||||
//
|
||||
// classic noise looks much better than improved noise in 2D, and with an efficent hash function runs at about the same speed.
|
||||
// requires 2 random numbers per point.
|
||||
//
|
||||
|
||||
// calculate the hash.
|
||||
// ( various hashing methods listed in order of speed )
|
||||
float4 hash_x, hash_y;
|
||||
FAST32_hash_2D(Pi, hash_x, hash_y);
|
||||
//SGPP_hash_2D( Pi, hash_x, hash_y );
|
||||
|
||||
// calculate the gradient results
|
||||
float4 grad_x = hash_x - 0.49999;
|
||||
float4 grad_y = hash_y - 0.49999;
|
||||
float4 grad_results = rsqrt(grad_x * grad_x + grad_y * grad_y) * (grad_x * Pf_Pfmin1.xzxz + grad_y * Pf_Pfmin1.yyww);
|
||||
|
||||
#if CLASSICPERLIN
|
||||
// Classic Perlin Interpolation
|
||||
grad_results *= 1.4142135623730950488016887242097; // (optionally) scale things to a strict -1.0->1.0 range *= 1.0/sqrt(0.5)
|
||||
float2 blend = Interpolation_C2(Pf_Pfmin1.xy);
|
||||
float4 blend2 = float4(blend, float2(1.0 - blend));
|
||||
return dot(grad_results, blend2.zxzx * blend2.wwyy);
|
||||
#else
|
||||
// Classic Perlin Surflet
|
||||
// http://briansharpe.wordpress.com/2012/03/09/modifications-to-classic-perlin-noise/
|
||||
grad_results *= 2.3703703703703703703703703703704; // (optionally) scale things to a strict -1.0->1.0 range *= 1.0/cube(0.75)
|
||||
float4 vecs_len_sq = Pf_Pfmin1 * Pf_Pfmin1;
|
||||
vecs_len_sq = vecs_len_sq.xzxz + vecs_len_sq.yyww;
|
||||
return dot(Falloff_Xsq_C2(min(float4(1.0), vecs_len_sq)), grad_results);
|
||||
#endif
|
||||
|
||||
#else
|
||||
//
|
||||
// 2D improved perlin noise.
|
||||
// requires 1 random value per point.
|
||||
// does not look as good as classic in 2D due to only a small number of possible cell types. But can run a lot faster than classic perlin noise if the hash function is slow
|
||||
//
|
||||
|
||||
// calculate the hash.
|
||||
// ( various hashing methods listed in order of speed )
|
||||
float4 hash = FAST32_hash_2D(Pi);
|
||||
//vec4 hash = BBS_hash_2D( Pi );
|
||||
//vec4 hash = SGPP_hash_2D( Pi );
|
||||
//vec4 hash = BBS_hash_hq_2D( Pi );
|
||||
|
||||
//
|
||||
// evaulate the gradients
|
||||
// choose between the 4 diagonal gradients. ( slightly slower than choosing the axis gradients, but shows less grid artifacts )
|
||||
// NOTE: diagonals give us a nice strict -1.0->1.0 range without additional scaling
|
||||
// [1.0,1.0] [-1.0,1.0] [1.0,-1.0] [-1.0,-1.0]
|
||||
//
|
||||
hash -= 0.5;
|
||||
float4 grad_results = Pf_Pfmin1.xzxz * sign(hash) + Pf_Pfmin1.yyww * sign(abs(hash) - 0.25);
|
||||
|
||||
// blend the results and return
|
||||
float2 blend = Interpolation_C2(Pf_Pfmin1.xy);
|
||||
float4 blend2 = float4(blend, float2(1.0 - blend));
|
||||
return dot(grad_results, blend2.zxzx * blend2.wwyy);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
// convert a 0.0->1.0 sample to a -1.0->1.0 sample weighted towards the extremes
|
||||
float4 Cellular_weight_samples(float4 samples)
|
||||
{
|
||||
samples = samples * 2.0 - 1.0;
|
||||
//return (1.0 - samples * samples) * sign(samples); // square
|
||||
return (samples * samples * samples) - sign(samples); // cubic (even more variance)
|
||||
}
|
||||
|
||||
float Cellular2D(float2 P)
|
||||
{
|
||||
// establish our grid cell and unit position
|
||||
float2 Pi = floor(P);
|
||||
float2 Pf = P - Pi;
|
||||
|
||||
// calculate the hash.
|
||||
// ( various hashing methods listed in order of speed )
|
||||
float4 hash_x, hash_y;
|
||||
FAST32_hash_2D(Pi, hash_x, hash_y);
|
||||
//SGPP_hash_2D( Pi, hash_x, hash_y );
|
||||
|
||||
// generate the 4 random points
|
||||
#if WORLEY_1
|
||||
// restrict the random point offset to eliminate artifacts
|
||||
// we'll improve the variance of the noise by pushing the points to the extremes of the jitter window
|
||||
const float JITTER_WINDOW = 0.25; // 0.25 will guarentee no artifacts. 0.25 is the intersection on x of graphs f(x)=( (0.5+(0.5-x))^2 + (0.5-x)^2 ) and f(x)=( (0.5+x)^2 + x^2 )
|
||||
hash_x = Cellular_weight_samples(hash_x) * JITTER_WINDOW + float4(0.0, 1.0, 0.0, 1.0);
|
||||
hash_y = Cellular_weight_samples(hash_y) * JITTER_WINDOW + float4(0.0, 0.0, 1.0, 1.0);
|
||||
#else
|
||||
// non-weighted jitter window. jitter window of 0.4 will give results similar to Stefans original implementation
|
||||
// nicer looking, faster, but has minor artifacts. ( discontinuities in signal )
|
||||
const float JITTER_WINDOW = 0.4;
|
||||
hash_x = hash_x * JITTER_WINDOW * 2.0 + float4(-JITTER_WINDOW, 1.0 - JITTER_WINDOW, -JITTER_WINDOW, 1.0 - JITTER_WINDOW);
|
||||
hash_y = hash_y * JITTER_WINDOW * 2.0 + float4(-JITTER_WINDOW, -JITTER_WINDOW, 1.0 - JITTER_WINDOW, 1.0 - JITTER_WINDOW);
|
||||
#endif
|
||||
|
||||
// return the closest squared distance
|
||||
float4 dx = Pf.xxxx - hash_x;
|
||||
float4 dy = Pf.yyyy - hash_y;
|
||||
float4 d = dx * dx + dy * dy;
|
||||
d.xy = min(d.xy, d.zw);
|
||||
return min(d.x, d.y) * (1.0 / 1.125); // scale return value from 0.0->1.125 to 0.0->1.0 ( 0.75^2 * 2.0 == 1.125 )
|
||||
}
|
||||
|
||||
|
||||
|
||||
float CalculateWorley3oct(float2 p, float p1, float p2, float p3) {
|
||||
float2 xy = p * p1;
|
||||
float2 xy2 = p * p2;
|
||||
float2 xy3 = p * p3;
|
||||
|
||||
float worley_value1 = Cellular2D(xy).r;
|
||||
float worley_value2 = Cellular2D(xy2).r;
|
||||
float worley_value3 = Cellular2D(xy3).r;
|
||||
|
||||
worley_value1 = worley_value1;
|
||||
worley_value2 = worley_value2;
|
||||
worley_value3 = worley_value3;
|
||||
|
||||
float worley_value = worley_value1 * 3;
|
||||
worley_value = worley_value + worley_value2 * 1.5;
|
||||
worley_value = worley_value + worley_value3 * 1.5;
|
||||
|
||||
return saturate(1 - worley_value);
|
||||
}
|
||||
|
||||
float CalculateWorley1(float2 p, float p1) {
|
||||
float2 xy = p * p1;
|
||||
float worley_value1 = Cellular2D(xy).r;
|
||||
worley_value1 = worley_value1;
|
||||
return saturate(1 - worley_value1);
|
||||
}
|
||||
|
||||
|
||||
float CalculatePerlin5(float2 p)
|
||||
{
|
||||
|
||||
float2 xy = p;
|
||||
float amplitude_factor = 0.5;
|
||||
float frequency_factor = 2.0;
|
||||
|
||||
float a = 1.0;
|
||||
float perlin_value = 0.0;
|
||||
perlin_value += a * Perlin2D(xy).r; a *= amplitude_factor; xy *= (frequency_factor + 0.12);
|
||||
perlin_value -= a * Perlin2D(xy).r; a *= amplitude_factor; xy *= (frequency_factor + 0.03);
|
||||
perlin_value -= a * Perlin2D(xy).r; a *= amplitude_factor; xy *= (frequency_factor + 0.01);
|
||||
perlin_value -= a * Perlin2D(xy).r; a *= amplitude_factor; xy *= (frequency_factor + 0.01);
|
||||
perlin_value += a * Perlin2D(xy).r;
|
||||
|
||||
return perlin_value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Classic Perlin noise, periodic variant
|
||||
float penoise(float2 P, float2 rep)
|
||||
{
|
||||
float4 Pi = floor(P.xyxy) + float4(0.0, 0.0, 1.0, 1.0);
|
||||
float4 Pf = frac(P.xyxy) - float4(0.0, 0.0, 1.0, 1.0);
|
||||
Pi = mod(Pi, rep.xyxy); // To create noise with explicit period
|
||||
Pi = mod289(Pi); // To avoid truncation effects in permutation
|
||||
float4 ix = Pi.xzxz;
|
||||
float4 iy = Pi.yyww;
|
||||
float4 fx = Pf.xzxz;
|
||||
float4 fy = Pf.yyww;
|
||||
|
||||
float4 i = permute(permute(ix) + iy);
|
||||
|
||||
float4 gx = frac(i * (1.0 / 41.0)) * 2.0 - 1.0;
|
||||
float4 gy = abs(gx) - 0.5;
|
||||
float4 tx = floor(gx + 0.5);
|
||||
gx = gx - tx;
|
||||
|
||||
float2 g00 = float2(gx.x, gy.x);
|
||||
float2 g10 = float2(gx.y, gy.y);
|
||||
float2 g01 = float2(gx.z, gy.z);
|
||||
float2 g11 = float2(gx.w, gy.w);
|
||||
|
||||
float4 norm = taylorInvSqrt(float4(dot(g00, g00), dot(g01, g01), dot(g10, g10), dot(g11, g11)));
|
||||
g00 *= norm.x;
|
||||
g01 *= norm.y;
|
||||
g10 *= norm.z;
|
||||
g11 *= norm.w;
|
||||
|
||||
float n00 = dot(g00, float2(fx.x, fy.x));
|
||||
float n10 = dot(g10, float2(fx.y, fy.y));
|
||||
float n01 = dot(g01, float2(fx.z, fy.z));
|
||||
float n11 = dot(g11, float2(fx.w, fy.w));
|
||||
|
||||
float2 fade_xy = fade(Pf.xy);
|
||||
float2 n_x = lerp(float2(n00, n01), float2(n10, n11), fade_xy.x);
|
||||
float n_xy = lerp(n_x.x, n_x.y, fade_xy.y);
|
||||
return 2.3 * n_xy;
|
||||
}
|
||||
|
||||
float CalculatePerlinTileing5(float2 p, float2 rep)
|
||||
{
|
||||
|
||||
float2 xy = p;
|
||||
float amplitude_factor = 0.5;
|
||||
float frequency_factor = 1.0;
|
||||
|
||||
float a = 1.0;
|
||||
float perlin_value = 0.0;
|
||||
perlin_value += a * penoise(xy, rep).r; a *= amplitude_factor; xy *= (frequency_factor + 1);
|
||||
perlin_value -= a * penoise(xy, rep).r; a *= amplitude_factor; xy *= (frequency_factor + 1);
|
||||
perlin_value -= a * penoise(xy, rep).r; a *= amplitude_factor; xy *= (frequency_factor + 1);
|
||||
perlin_value -= a * penoise(xy, rep).r; a *= amplitude_factor; xy *= (frequency_factor + 1);
|
||||
perlin_value += a * penoise(xy, rep).r;
|
||||
|
||||
return perlin_value;
|
||||
}
|
||||
|
||||
float CalculatePerlinTileing5OLD(float2 p, float2 rep)
|
||||
{
|
||||
|
||||
float2 xy = p;
|
||||
float amplitude_factor = 0.5;
|
||||
float frequency_factor = 2.0;
|
||||
|
||||
float a = 1.0;
|
||||
float perlin_value = 0.0;
|
||||
perlin_value += a * penoise(xy, rep).r; a *= amplitude_factor; xy *= (frequency_factor + 0.12);
|
||||
perlin_value -= a * penoise(xy, rep).r; a *= amplitude_factor; xy *= (frequency_factor + 0.03);
|
||||
perlin_value -= a * penoise(xy, rep).r; a *= amplitude_factor; xy *= (frequency_factor + 0.01);
|
||||
perlin_value -= a * penoise(xy, rep).r; a *= amplitude_factor; xy *= (frequency_factor + 0.01);
|
||||
perlin_value += a * penoise(xy, rep).r;
|
||||
|
||||
return perlin_value;
|
||||
}
|
||||
|
||||
|
||||
/* float CalculatePerlinTileing(float2 p, float2 rep)
|
||||
{
|
||||
float perlin_value = 0.0;
|
||||
//float2 period = rep;
|
||||
float2 xy = p;
|
||||
float w = 1.0;
|
||||
float s = 1.0;
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
float2 coord = p * s;
|
||||
float2 period = s * 2.0;
|
||||
|
||||
perlin_value += penoise(coord, period) * w;
|
||||
|
||||
w *= 0.5;
|
||||
s *= 0.25;
|
||||
period *= s;
|
||||
}
|
||||
|
||||
return perlin_value;
|
||||
}
|
||||
*/
|
||||
|
||||
float CalculatePerlinTileing(float2 p, float2 rep)
|
||||
{
|
||||
|
||||
float2 xy = p;
|
||||
float amplitude_factor = 0.5;
|
||||
float frequency_factor = 1.0;
|
||||
|
||||
float a = 1.0;
|
||||
float perlin_value = 0.0;
|
||||
perlin_value += a * penoise(xy, rep).r; a *= amplitude_factor; xy *= (frequency_factor + 1);
|
||||
perlin_value += a * penoise(xy, rep).r; a *= amplitude_factor; xy *= (frequency_factor + 1);
|
||||
perlin_value += a * penoise(xy, rep).r; a *= amplitude_factor; xy *= (frequency_factor + 2);
|
||||
perlin_value -= a * penoise(xy, rep).r;
|
||||
|
||||
return perlin_value;
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7722318409d51394d9a6aea87de37263
|
||||
timeCreated: 1505167667
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+350
@@ -0,0 +1,350 @@
|
||||
UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
|
||||
uniform float4x4 _InverseProjection;
|
||||
uniform float4x4 _InverseRotation;
|
||||
uniform float4x4 _InverseProjection_SP;
|
||||
uniform float4x4 _InverseRotation_SP;
|
||||
uniform sampler2D _MainTex;
|
||||
uniform float4 _MainTex_TexelSize;
|
||||
uniform sampler3D _Noise;
|
||||
uniform sampler3D _DetailNoise;
|
||||
uniform sampler2D _WeatherMap;
|
||||
uniform sampler2D _CurlNoise;
|
||||
uniform float4 _CloudsParameter;
|
||||
uniform float4 _Steps;
|
||||
uniform float4 _CloudsLighting; //x = ExtinctionCoef, y = HgPhaseFactor, z = Silver_intensity, w = Silver_spread
|
||||
uniform float4 _CloudsLightingExtended; // x = EdgeDarkness, y = AmbientSkyColorIntensity, z = _Tonemapping, w = _CloudsExposure
|
||||
uniform float4 _CloudsErosionIntensity; //x = Base, y = Detail
|
||||
uniform float _BaseNoiseUV;
|
||||
uniform float _DetailNoiseUV;
|
||||
uniform float4 _CloudDensityScale;
|
||||
uniform float _LightIntensity;
|
||||
uniform float _AmbientSkyColorIntensity;
|
||||
uniform float4 _CloudsCoverageSettings; //x = _GlobalCoverage, y = Bottom Coverage Mod, z = Top coverage mod, w = Clouds Up Morph Intensity
|
||||
uniform float _GlobalCoverage;
|
||||
uniform float4 _LightColor;
|
||||
uniform float4 _MoonLightColor;
|
||||
uniform float4 _AmbientLightColor;
|
||||
uniform float4 _CloudsAnimation;
|
||||
uniform float3 _LightDir;
|
||||
uniform float _stepsInDepth;
|
||||
uniform float _LODDistance;
|
||||
uniform float _gameTime;
|
||||
uniform float3 _CameraPosition;
|
||||
////
|
||||
uniform float4 _Randomness;
|
||||
////
|
||||
|
||||
const float env_inf = 1e10;
|
||||
|
||||
uint intersectRaySphere(
|
||||
float3 rayOrigin,
|
||||
float3 rayDir, // must be normalized
|
||||
float3 sphereCenter,
|
||||
float sphereRadius,
|
||||
out float2 t)
|
||||
{
|
||||
float3 l = rayOrigin - sphereCenter;
|
||||
float a = 1.0f; // dot(rayDir, rayDir) where rayDir is normalized
|
||||
float b = 2.0f * dot(rayDir, l);
|
||||
float c = dot(l, l) - sphereRadius * sphereRadius;
|
||||
float discriminate = b * b - 4.0f * a * c;
|
||||
if (discriminate < 0.0f)
|
||||
{
|
||||
t.x = t.y = 0.0f;
|
||||
return 0u;
|
||||
}
|
||||
else if (abs(discriminate) - 0.00005f <= 0.0f)
|
||||
{
|
||||
t.x = t.y = -0.5f * b / a;
|
||||
return 1u;
|
||||
}
|
||||
else
|
||||
{
|
||||
float q = b > 0.0f ? -0.5f * (b + sqrt(discriminate)) : -0.5f * (b - sqrt(discriminate));
|
||||
float h1 = q / a;
|
||||
float h2 = c / q;
|
||||
t.x = min(h1, h2);
|
||||
t.y = max(h1, h2);
|
||||
if (t.x < 0.0f)
|
||||
{
|
||||
t.x = t.y;
|
||||
if (t.x < 0.0f)
|
||||
{
|
||||
return 0u;
|
||||
}
|
||||
return 1u;
|
||||
}
|
||||
return 2u;
|
||||
}
|
||||
}
|
||||
|
||||
float rand(float2 co) {
|
||||
float a = 12.9898;
|
||||
float b = 78.233;
|
||||
float c = 43758.5453;
|
||||
float dt = dot(co.xy, float2(a, b));
|
||||
float sn = fmod(dt, 3.14);
|
||||
|
||||
return 2.0 * frac(sin(sn) * c) - 1.0;
|
||||
}
|
||||
|
||||
float2 ResolveInside(float3 cameraPos, float3 cameraDir, float maxDistance)
|
||||
{
|
||||
const float3 up = float3(0, 1, 0);
|
||||
|
||||
maxDistance = min(_CloudsParameter.w, maxDistance);
|
||||
|
||||
float bottom = (_CloudsParameter.x - cameraPos.y);
|
||||
float top = ((_CloudsParameter.x + _CloudsParameter.y) - cameraPos.y);
|
||||
|
||||
float horizon = dot(cameraDir, up);
|
||||
float bottomDist = max(0, bottom / horizon);
|
||||
float topDist = max(0, top / horizon);
|
||||
|
||||
float startDist = min(bottomDist, topDist);
|
||||
float endDist = max(bottomDist, topDist);
|
||||
|
||||
startDist = min(maxDistance, startDist);
|
||||
endDist = min(maxDistance, endDist);
|
||||
|
||||
return float2(startDist, endDist);
|
||||
}
|
||||
|
||||
// Realtime Volumetric Rendering Course Notes by Patapom (page 15)
|
||||
float exponential_integral(float z) {
|
||||
return 0.5772156649015328606065 + log(1e-4 + abs(z)) + z * (1.0 + z * (0.25 + z * ((1.0 / 18.0) + z * ((1.0 / 96.0) + z * (1.0 / 600.0))))); // For x!=0
|
||||
}
|
||||
|
||||
// Realtime Volumetric Rendering Course Notes by Patapom (page 15)
|
||||
float3 CalculateAmbientLighting(float altitude, float extinction_coeff, float3 skyColor)
|
||||
{
|
||||
float ambient_term = 0.6 * saturate(1.0 - altitude);
|
||||
float3 isotropic_scattering_top = (skyColor.rgb * 0.25) * max(0.0, exp(ambient_term) - ambient_term * exponential_integral(ambient_term));
|
||||
|
||||
ambient_term = -extinction_coeff * altitude;
|
||||
float3 isotropic_scattering_bottom = skyColor.rgb * 1.0 * max(0.0, exp(ambient_term) - ambient_term * exponential_integral(ambient_term)) * 1.5;
|
||||
|
||||
isotropic_scattering_top *= saturate(altitude);
|
||||
|
||||
return (isotropic_scattering_top)+(isotropic_scattering_bottom);
|
||||
}
|
||||
|
||||
float HenryGreenstein(float cosTheta, float g) {
|
||||
|
||||
float k = 3.0 / (8.0 * 3.1415926f) * (1.0 - g * g) / (2.0 + g * g);
|
||||
return k * (1.0 + cosTheta * cosTheta) / pow(abs(1.0 + g * g - 2.0 * g * cosTheta), 1.5);
|
||||
}
|
||||
|
||||
float Remap(float org_val, float org_min, float org_max, float new_min, float new_max)
|
||||
{
|
||||
return new_min + saturate(((org_val - org_min) / (org_max - org_min))*(new_max - new_min));
|
||||
}
|
||||
|
||||
float4 GetHeightGradient(float cloudType)
|
||||
{
|
||||
const float4 CloudGradient1 = float4(0.0, 0.05, 0.1, 0.25);
|
||||
const float4 CloudGradient2 = float4(0.0, 0.05, 0.4, 0.8);
|
||||
const float4 CloudGradient3 = float4(0.0, 0.05, 0.6, 1.0);
|
||||
|
||||
float a = 1.0 - saturate(cloudType * 2.0);
|
||||
float b = 1.0 - abs(cloudType - 0.5) * 2.0;
|
||||
float c = saturate(cloudType - 0.5) * 2.0;
|
||||
|
||||
return CloudGradient1 * a + CloudGradient2 * b + CloudGradient3 * c;
|
||||
}
|
||||
|
||||
float GradientStep(float a, float4 gradient)
|
||||
{
|
||||
return smoothstep(gradient.x, gradient.y, a) - smoothstep(gradient.z, gradient.w, a);
|
||||
}
|
||||
|
||||
float3 GetWeather(float3 pos)
|
||||
{
|
||||
float2 uv = pos.xz * 0.00001 + 0.5;
|
||||
return tex2Dlod(_WeatherMap, float4(uv, 0.0, 0.0));
|
||||
}
|
||||
|
||||
float GetSamplingHeight(float3 pos, float3 center)
|
||||
{
|
||||
return (length(pos - center) - (_CloudsParameter.w + _CloudsParameter.x)) * _CloudsParameter.z;
|
||||
}
|
||||
|
||||
float3 ScreenSpaceDither(float2 vScreenPos, float lum)
|
||||
{
|
||||
float d = dot(float2(131.0, 312.0), vScreenPos.xy + _Time.y);
|
||||
float3 vDither = float3(d, d, d);
|
||||
vDither.rgb = frac(vDither.rgb / float3(103.0, 71.0, 97.0)) - float3(0.5, 0.5, 0.5);
|
||||
return (vDither.rgb / 15.0) * 1.0 * lum;
|
||||
}
|
||||
|
||||
float GetRaymarchEnd(float sceneDepth, float3 dir)
|
||||
{
|
||||
float raymarchEnd = 0.0f;
|
||||
#if ENVIRO_DEPTHBLENDING
|
||||
if (sceneDepth == 1.0f)
|
||||
{
|
||||
raymarchEnd = 1e7;
|
||||
}
|
||||
else
|
||||
{
|
||||
raymarchEnd = length(dir);
|
||||
// raymarchEnd -= _ProjectionParams.y;
|
||||
}
|
||||
#else
|
||||
raymarchEnd = 1e8;
|
||||
#endif
|
||||
return raymarchEnd;
|
||||
}
|
||||
|
||||
float set_range_clamped(float value, float low, float high) {
|
||||
float ranged_value = clamp(value, low, high);
|
||||
ranged_value = (ranged_value - low) / (high - low);
|
||||
return saturate(ranged_value);
|
||||
}
|
||||
|
||||
float get_fade_term(float3 sample_pos) {
|
||||
float distance = length(sample_pos.xy);
|
||||
return saturate((distance - 5000) / 20000.0);
|
||||
}
|
||||
|
||||
float get_altitude_scalar(float cloud_type) {
|
||||
return lerp(8.0, 2.0, cloud_type);
|
||||
}
|
||||
|
||||
float HeightAlter(float percent_height, float weather) {
|
||||
float cloud_anvil_amount = 0.5;
|
||||
float global_coverage = 0.5;
|
||||
// Round bottom a bit
|
||||
float ret_val = saturate(Remap(percent_height, 0.0, 0.07, 0.0, 1.0));
|
||||
// Round top a lot
|
||||
float stop_height = saturate(weather + 0.12);
|
||||
ret_val *= saturate(Remap(percent_height, stop_height * 0.2, stop_height, 1.0, 0.0));
|
||||
// Apply anvil ( cumulonimbus /" giant storm" clouds)
|
||||
ret_val = pow(ret_val, saturate(Remap(percent_height, 0.65, 0.95, 1.0, (1 - cloud_anvil_amount * global_coverage))));
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
float DensityAlter(float percent_height) {
|
||||
float cloud_anvil_amount = 1.0;
|
||||
// Have density be generally increasing over height
|
||||
float ret_val = percent_height;
|
||||
// Reduce density at base
|
||||
ret_val *= saturate(Remap(percent_height, 0.0, 0.2, 0.0, 1.0));
|
||||
ret_val *= 2;
|
||||
// Reduce density for the anvil ( cumulonimbus clouds)
|
||||
ret_val *= lerp(1, saturate(Remap(pow(percent_height, 0.5) , 0.4, 0.95, 1.0, 0.2)), cloud_anvil_amount);
|
||||
// Reduce density at top to make better transition
|
||||
ret_val *= saturate(Remap(percent_height, 0.9, 1.0, 1.0, 0.0));
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
// Sample Cloud Density
|
||||
float CalculateCloudDensity(float3 pos, float3 PlanetCenter, float3 weather, float mip, float dist, bool details)
|
||||
{
|
||||
const float baseFreq = 1e-5;
|
||||
|
||||
// Get Height fraction
|
||||
float height = GetSamplingHeight(pos, PlanetCenter);
|
||||
|
||||
// wind settings
|
||||
float cloud_top_offset = 20.0;
|
||||
float3 wind_direction = float3(_CloudsAnimation.z, 0.0, _CloudsAnimation.w);
|
||||
|
||||
// skew in wind direction
|
||||
pos += height * wind_direction * cloud_top_offset;
|
||||
|
||||
float mip1 = mip + (1-dist) * (3.5 * _LODDistance);
|
||||
|
||||
float4 coord = float4(pos * baseFreq * _BaseNoiseUV, mip1);
|
||||
// Animate Wind
|
||||
coord.xyz += float3(_CloudsAnimation.x, _CloudsErosionIntensity.w, _CloudsAnimation.y);
|
||||
|
||||
float4 baseNoise = 0;
|
||||
|
||||
baseNoise = tex3Dlod(_Noise, coord);
|
||||
|
||||
float low_freq_fBm = (baseNoise.g * 0.625) + (baseNoise.b * 0.25) + (baseNoise.a * 0.125);
|
||||
float base_cloud = Remap(baseNoise.r, -(1.0 - low_freq_fBm) * _CloudsErosionIntensity.x, 1.0, 0.0, 1.0);
|
||||
|
||||
float heightGradient = GradientStep(height, GetHeightGradient(weather.b));
|
||||
|
||||
base_cloud *= heightGradient;
|
||||
|
||||
float cloud_coverage = saturate(1 - weather.r);
|
||||
|
||||
float densAlter = DensityAlter(1-height);
|
||||
cloud_coverage = pow(cloud_coverage, densAlter);
|
||||
|
||||
//cloud_coverage = pow(cloud_coverage, Remap(height, 0.7, 0.8, 1.0, lerp(1.0, 0.5, 1.0)));
|
||||
|
||||
float cloudDensity = Remap(base_cloud, cloud_coverage, 1.0, 0.0, 1.0);
|
||||
|
||||
cloudDensity *= saturate(1-cloud_coverage);
|
||||
|
||||
//DETAIL
|
||||
[branch]
|
||||
if (details)
|
||||
{
|
||||
float mip2 = mip + (1-dist) * (_LODDistance);
|
||||
coord = float4(pos * baseFreq * _DetailNoiseUV, mip2);
|
||||
#ifdef ENVIRO_CURLNOISE
|
||||
float2 curl_noise = tex2Dlod(_CurlNoise, float4 (coord.xy * 1.25, 0.0, 1.0)).rg;
|
||||
coord.xy += curl_noise.rg * (1 - height);
|
||||
#endif
|
||||
coord.xyz += float3(_CloudsAnimation.x, _CloudsErosionIntensity.w, _CloudsAnimation.y);
|
||||
float3 detailNoise = tex3Dlod(_DetailNoise, coord).rgb;
|
||||
float high_freq_fBm = (detailNoise.r * 0.625) + (detailNoise.g * 0.25) + (detailNoise.b * 0.125);
|
||||
float high_freq_noise_modifier = lerp(high_freq_fBm, 1.0f - high_freq_fBm, saturate((height) * 20));
|
||||
cloudDensity = Remap(cloudDensity, high_freq_noise_modifier * _CloudsErosionIntensity.y, 1.0, 0.0, 1.0);
|
||||
}
|
||||
|
||||
return cloudDensity;
|
||||
}
|
||||
|
||||
|
||||
// Lighting Energy Function
|
||||
float GetLightEnergy(float3 p, float height_fraction, float dl, float ds_loded, float phase_probability, float cos_angle, float step_size, float brightness, float3 weather)
|
||||
{
|
||||
brightness *= 300 * weather.g;
|
||||
float sc = lerp(dl * 0.25, _CloudsCoverageSettings.y, 0.75);
|
||||
float s1 = lerp(_CloudsErosionIntensity.z * 0.75, _CloudsErosionIntensity.z, cos_angle);
|
||||
float prim_att = exp(-s1 * dl);
|
||||
float sec_att = exp(-s1 * sc) * 0.7;
|
||||
float attenuation_probability = max(Remap(cos_angle, 0.5, 1.0, sec_att, sec_att * 0.25), prim_att) ;
|
||||
float vertical_probability = pow(Remap(height_fraction, 0.07, 0.3, 0.1, 1.0), 0.8);
|
||||
float depth = _CloudsLightingExtended.x * pow(lerp(0.25, ds_loded * 1.5, Remap(height_fraction,0.0,1.0,0.5,1.0)), Remap(height_fraction, 0.1, 1.0, 0.5, 0.75));
|
||||
float in_scatter = depth;
|
||||
in_scatter = 0.05 + saturate(in_scatter);
|
||||
in_scatter = saturate(lerp(in_scatter, 0.45, cos_angle - 0.1));
|
||||
|
||||
float light_energy = attenuation_probability * in_scatter * vertical_probability * phase_probability * brightness;
|
||||
return light_energy;
|
||||
}
|
||||
|
||||
|
||||
static const float shadowSampleDistance[6] = {0.0, 0.5, 1.0, 1.5, 2.0, 6.0};
|
||||
static const float LightingInfluence[6] = { { 1.0f },{ 2.0f },{ 3.0f },{ 4.0f },{ 6.0f },{ 8.0f } };
|
||||
|
||||
// Lighting Sample Function
|
||||
float GetDensityAlongRay(float3 pos, float3 PlanetCenter, float3 LightDirection, float3 weather, float dist)
|
||||
{
|
||||
float opticalDepth = 0.0;
|
||||
|
||||
[loop]
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
|
||||
float3 samplePoint = pos + LightDirection * shadowSampleDistance[i] * (512 * _CloudDensityScale.y);
|
||||
|
||||
float mip_offset = i * 0.5;
|
||||
|
||||
//if (opticalDepth < 0.3)
|
||||
opticalDepth += CalculateCloudDensity(samplePoint, PlanetCenter, weather, mip_offset, dist, true) * LightingInfluence[i];
|
||||
//else
|
||||
// opticalDepth += CalculateCloudDensity(samplePoint, PlanetCenter, weather, mip_offset, dist, false) * LightingInfluence[i];
|
||||
|
||||
}
|
||||
|
||||
return opticalDepth;
|
||||
}
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 862b7616dff96e04b9925de1aed57e51
|
||||
timeCreated: 1505167667
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+342
@@ -0,0 +1,342 @@
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityDeferredLibrary.cginc"
|
||||
|
||||
half4 _MainTex_ST;
|
||||
half4 _CameraDepthTexture_ST;
|
||||
sampler3D _NoiseTexture;
|
||||
sampler2D _DitherTexture;
|
||||
|
||||
float4x4 _WorldViewProj;
|
||||
float4x4 _WorldViewProj_SP;
|
||||
float4x4 _MyLightMatrix0;
|
||||
float4x4 _MyWorld2Shadow;
|
||||
|
||||
float4x4 _LeftWorldFromView;
|
||||
float4x4 _RightWorldFromView;
|
||||
float4x4 _LeftViewFromScreen;
|
||||
float4x4 _RightViewFromScreen;
|
||||
|
||||
float3 _CameraForward;
|
||||
// x: scattering coef, y: extinction coef, z: range w: skybox extinction coef
|
||||
float4 _VolumetricLight;
|
||||
// x: 1 - g^2, y: 1 + g^2, z: 2*g, w: 1/4pi
|
||||
float4 _MieG;
|
||||
float _MaxRayLength;
|
||||
int _SampleCount;
|
||||
// x: scale, y: intensity, z: intensity offset
|
||||
float4 _NoiseData;
|
||||
// x: x velocity, y: z velocity
|
||||
float4 _NoiseVelocity;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
inline fixed4 GetCascadeWeights_SplitSpheres(float3 wpos)
|
||||
{
|
||||
float3 fromCenter0 = wpos.xyz - unity_ShadowSplitSpheres[0].xyz;
|
||||
float3 fromCenter1 = wpos.xyz - unity_ShadowSplitSpheres[1].xyz;
|
||||
float3 fromCenter2 = wpos.xyz - unity_ShadowSplitSpheres[2].xyz;
|
||||
float3 fromCenter3 = wpos.xyz - unity_ShadowSplitSpheres[3].xyz;
|
||||
float4 distances2 = float4(dot(fromCenter0, fromCenter0), dot(fromCenter1, fromCenter1), dot(fromCenter2, fromCenter2), dot(fromCenter3, fromCenter3));
|
||||
|
||||
fixed4 weights = float4(distances2 < unity_ShadowSplitSqRadii);
|
||||
weights.yzw = saturate(weights.yzw - weights.xyz);
|
||||
return weights;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
inline float4 GetCascadeShadowCoord(float4 wpos, fixed4 cascadeWeights)
|
||||
{
|
||||
float3 sc0 = mul(unity_WorldToShadow[0], wpos).xyz;
|
||||
float3 sc1 = mul(unity_WorldToShadow[1], wpos).xyz;
|
||||
float3 sc2 = mul(unity_WorldToShadow[2], wpos).xyz;
|
||||
float3 sc3 = mul(unity_WorldToShadow[3], wpos).xyz;
|
||||
|
||||
float4 shadowMapCoordinate = float4(sc0 * cascadeWeights[0] + sc1 * cascadeWeights[1] + sc2 * cascadeWeights[2] + sc3 * cascadeWeights[3], 1);
|
||||
#if defined(UNITY_REVERSED_Z)
|
||||
float noCascadeWeights = 1 - dot(cascadeWeights, float4(1, 1, 1, 1));
|
||||
shadowMapCoordinate.z += noCascadeWeights;
|
||||
#endif
|
||||
return shadowMapCoordinate;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
UNITY_DECLARE_SHADOWMAP(_CascadeShadowMapTexture);
|
||||
|
||||
float GetLightAttenuation(float3 wpos)
|
||||
{
|
||||
float atten = 0;
|
||||
#if defined (DIRECTIONAL) || defined (DIRECTIONAL_COOKIE)
|
||||
atten = 1;
|
||||
#if defined (SHADOWS_DEPTH)
|
||||
// sample cascade shadow map
|
||||
float4 cascadeWeights = GetCascadeWeights_SplitSpheres(wpos);
|
||||
bool inside = dot(cascadeWeights, float4(1, 1, 1, 1)) < 4;
|
||||
float4 samplePos = GetCascadeShadowCoord(float4(wpos, 1), cascadeWeights);
|
||||
|
||||
atten = inside ? UNITY_SAMPLE_SHADOW(_CascadeShadowMapTexture, samplePos.xyz) : 1.0f;
|
||||
atten = _LightShadowData.r + atten * (1 - _LightShadowData.r);
|
||||
#endif
|
||||
|
||||
#elif defined (SPOT)
|
||||
float3 tolight = _LightPos.xyz - wpos;
|
||||
half3 lightDir = normalize(tolight);
|
||||
|
||||
float4 uvCookie = mul(_MyLightMatrix0, float4(wpos, 1));
|
||||
// negative bias because http://aras-p.info/blog/2010/01/07/screenspace-vs-mip-mapping/
|
||||
atten = tex2Dbias(_LightTexture0, float4(uvCookie.xy / uvCookie.w, 0, -8)).w;
|
||||
atten *= uvCookie.w < 0;
|
||||
float att = dot(tolight, tolight) * _LightPos.w;
|
||||
atten *= tex2D(_LightTextureB0, att.rr).UNITY_ATTEN_CHANNEL;
|
||||
|
||||
#if defined(SHADOWS_DEPTH)
|
||||
float4 shadowCoord = mul(_MyWorld2Shadow, float4(wpos, 1));
|
||||
atten *= saturate(UnitySampleShadowmap(shadowCoord));
|
||||
#endif
|
||||
#elif defined (POINT) || defined (POINT_COOKIE)
|
||||
float3 tolight = wpos - _LightPos.xyz;
|
||||
half3 lightDir = -normalize(tolight);
|
||||
|
||||
float att = dot(tolight, tolight) * _LightPos.w;
|
||||
atten = tex2D(_LightTextureB0, att.rr).UNITY_ATTEN_CHANNEL;
|
||||
|
||||
atten *= UnityDeferredComputeShadow(tolight, 0, float2(0, 0));
|
||||
|
||||
#if defined (POINT_COOKIE)
|
||||
atten *= texCUBEbias(_LightTexture0, float4(mul(_MyLightMatrix0, half4(wpos, 1)).xyz, -8)).w;
|
||||
#endif //POINT_COOKIE
|
||||
#endif
|
||||
return atten;
|
||||
}
|
||||
|
||||
|
||||
float GetLightAttenuationDir(float3 wpos)
|
||||
{
|
||||
float atten = 1;
|
||||
|
||||
// sample cascade shadow map
|
||||
float4 cascadeWeights = GetCascadeWeights_SplitSpheres(wpos);
|
||||
bool inside = dot(cascadeWeights, float4(1, 1, 1, 1)) < 4;
|
||||
float4 samplePos = GetCascadeShadowCoord(float4(wpos, 1), cascadeWeights);
|
||||
|
||||
atten = inside ? UNITY_SAMPLE_SHADOW(_CascadeShadowMapTexture, samplePos.xyz) : 1.0f;
|
||||
atten = _LightShadowData.r + atten * (1 - _LightShadowData.r);
|
||||
return atten;
|
||||
}
|
||||
|
||||
void ApplyHeightFog(float3 wpos, inout float density)
|
||||
{
|
||||
//#ifdef HEIGHT_FOG
|
||||
density *= exp(-(wpos.y + 1) * 0.1);
|
||||
//#endif
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
float GetDensityFog(float3 wpos)
|
||||
{
|
||||
float density = 1;
|
||||
#ifdef NOISE
|
||||
float noise = tex3D(_NoiseTexture, frac(wpos * _NoiseData.x + float3(_Time.y * _NoiseVelocity.x, 0, _Time.y * _NoiseVelocity.y)));
|
||||
noise = saturate(noise - _NoiseData.z) * _NoiseData.y;
|
||||
density *= saturate(noise);
|
||||
#endif
|
||||
ApplyHeightFog(wpos, density);
|
||||
|
||||
return density;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
float MieScattering(float cosAngle, float4 g)
|
||||
{
|
||||
return g.w * (g.x / (pow(g.y - g.z * cosAngle, 1.5)));
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
float4 RayMarch(float2 screenPos, float3 rayStart, float3 rayDir, float rayLength)
|
||||
{
|
||||
#ifdef DITHER_4_4
|
||||
float2 interleavedPos = (fmod(floor(screenPos.xy), 4.0));
|
||||
#if UNITY_SINGLE_PASS_STEREO
|
||||
float4 scaleOffset = unity_StereoScaleOffset[unity_StereoEyeIndex];
|
||||
interleavedPos = (interleavedPos - scaleOffset.zw) / scaleOffset.xy;
|
||||
#endif
|
||||
float offset = tex2D(_DitherTexture, interleavedPos / 4.0 + float2(0.5 / 4.0, 0.5 / 4.0)).w;
|
||||
#else
|
||||
float2 interleavedPos = (fmod(floor(screenPos.xy), 8.0));
|
||||
#if UNITY_SINGLE_PASS_STEREO
|
||||
float4 scaleOffset = unity_StereoScaleOffset[unity_StereoEyeIndex];
|
||||
interleavedPos = (interleavedPos - scaleOffset.zw) / scaleOffset.xy;
|
||||
#endif
|
||||
float offset = tex2D(_DitherTexture, interleavedPos / 8.0 + float2(0.5 / 8.0, 0.5 / 8.0)).w;
|
||||
#endif
|
||||
|
||||
int stepCount = _SampleCount;
|
||||
|
||||
float stepSize = rayLength / stepCount;
|
||||
float3 step = rayDir * stepSize;
|
||||
|
||||
float3 currentPosition = rayStart + step * offset;
|
||||
|
||||
float4 vlight = 0;
|
||||
|
||||
float cosAngle;
|
||||
#if defined (DIRECTIONAL) || defined (DIRECTIONAL_COOKIE)
|
||||
float extinction = 0;
|
||||
cosAngle = dot(_LightDir.xyz, -rayDir);
|
||||
#else
|
||||
// we don't know about density between camera and light's volume, assume 0.5
|
||||
float extinction = length(_WorldSpaceCameraPos - currentPosition) * _VolumetricLight.y * 0.5;
|
||||
#endif
|
||||
|
||||
[loop]
|
||||
for (int i = 0; i < stepCount; ++i)
|
||||
{
|
||||
float density = 0;
|
||||
float atten = GetLightAttenuation(currentPosition);
|
||||
|
||||
density = GetDensityFog(currentPosition);
|
||||
|
||||
float scattering = _VolumetricLight.x * stepSize * density;
|
||||
extinction += _VolumetricLight.y * stepSize * density;// +scattering;
|
||||
|
||||
float4 light = atten * scattering * exp(-extinction);
|
||||
|
||||
#if !defined (DIRECTIONAL) && !defined (DIRECTIONAL_COOKIE)
|
||||
// phase functino for spot and point lights
|
||||
float3 tolight = normalize(currentPosition - _LightPos.xyz);
|
||||
cosAngle = dot(tolight, -rayDir);
|
||||
light *= MieScattering(cosAngle, _MieG);
|
||||
#endif
|
||||
vlight += light;
|
||||
currentPosition += step;
|
||||
}
|
||||
|
||||
#if defined (DIRECTIONAL) || defined (DIRECTIONAL_COOKIE)
|
||||
// apply phase function for dir light
|
||||
vlight *= MieScattering(cosAngle, _MieG);
|
||||
#endif
|
||||
|
||||
// apply light's color
|
||||
vlight *= _LightColor;
|
||||
|
||||
vlight = max(0, vlight);
|
||||
|
||||
#if defined (DIRECTIONAL) || defined (DIRECTIONAL_COOKIE) // use "proper" out-scattering/absorption for dir light
|
||||
vlight.w = exp(-extinction);
|
||||
#else
|
||||
vlight.w = 0;
|
||||
#endif
|
||||
return vlight;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/* float4 RayMarchDir(float2 screenPos, float3 rayStart, float3 rayDir, float rayLength)
|
||||
{
|
||||
#ifdef DITHER_4_4
|
||||
float2 interleavedPos = (fmod(floor(screenPos.xy), 4.0));
|
||||
#if UNITY_SINGLE_PASS_STEREO
|
||||
float4 scaleOffset = unity_StereoScaleOffset[unity_StereoEyeIndex];
|
||||
interleavedPos = (interleavedPos - scaleOffset.zw) / scaleOffset.xy;
|
||||
#endif
|
||||
float offset = tex2D(_DitherTexture, interleavedPos / 4.0 + float2(0.5 / 4.0, 0.5 / 4.0)).w;
|
||||
#else
|
||||
float2 interleavedPos = (fmod(floor(screenPos.xy), 8.0));
|
||||
#if UNITY_SINGLE_PASS_STEREO
|
||||
float4 scaleOffset = unity_StereoScaleOffset[unity_StereoEyeIndex];
|
||||
interleavedPos = (interleavedPos - scaleOffset.zw) / scaleOffset.xy;
|
||||
#endif
|
||||
float offset = tex2D(_DitherTexture, interleavedPos / 8.0 + float2(0.5 / 8.0, 0.5 / 8.0)).w;
|
||||
#endif
|
||||
|
||||
int stepCount = _SampleCount;
|
||||
|
||||
float stepSize = rayLength / stepCount;
|
||||
float3 step = rayDir * stepSize;
|
||||
|
||||
float3 currentPosition = rayStart + step * offset;
|
||||
|
||||
float4 vlight = 0;
|
||||
|
||||
float cosAngle;
|
||||
float extinction = 0;
|
||||
cosAngle = dot(_LightDir.xyz, -rayDir);
|
||||
|
||||
[loop]
|
||||
for (int i = 0; i < stepCount; ++i)
|
||||
{
|
||||
float atten = GetLightAttenuationDir(currentPosition);
|
||||
float density = GetDensityFog(currentPosition);
|
||||
|
||||
float scattering = _VolumetricLight.x * stepSize * density;
|
||||
extinction += _VolumetricLight.y * stepSize * density;// +scattering;
|
||||
|
||||
float4 light = atten * scattering * exp(-extinction);
|
||||
vlight += light;
|
||||
currentPosition += step;
|
||||
}
|
||||
|
||||
vlight *= MieScattering(cosAngle, _MieG);
|
||||
|
||||
// apply light's color
|
||||
vlight *= _LightColor;
|
||||
vlight = max(0, vlight);
|
||||
vlight.w = exp(-extinction);
|
||||
return vlight;
|
||||
}
|
||||
*/
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
float2 RayConeIntersect(in float3 f3ConeApex, in float3 f3ConeAxis, in float fCosAngle, in float3 f3RayStart, in float3 f3RayDir)
|
||||
{
|
||||
float inf = 10000;
|
||||
f3RayStart -= f3ConeApex;
|
||||
float a = dot(f3RayDir, f3ConeAxis);
|
||||
float b = dot(f3RayDir, f3RayDir);
|
||||
float c = dot(f3RayStart, f3ConeAxis);
|
||||
float d = dot(f3RayStart, f3RayDir);
|
||||
float e = dot(f3RayStart, f3RayStart);
|
||||
fCosAngle *= fCosAngle;
|
||||
float A = a*a - b*fCosAngle;
|
||||
float B = 2 * (c*a - d*fCosAngle);
|
||||
float C = c*c - e*fCosAngle;
|
||||
float D = B*B - 4 * A*C;
|
||||
|
||||
if (D > 0)
|
||||
{
|
||||
D = sqrt(D);
|
||||
float2 t = (-B + sign(A)*float2(-D, +D)) / (2 * A);
|
||||
bool2 b2IsCorrect = c + a * t > 0 && t > 0;
|
||||
t = t * b2IsCorrect + !b2IsCorrect * (inf);
|
||||
return t;
|
||||
}
|
||||
else // no intersection
|
||||
return inf;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
float RayPlaneIntersect(in float3 planeNormal, in float planeD, in float3 rayOrigin, in float3 rayDir)
|
||||
{
|
||||
float NdotD = dot(planeNormal, rayDir);
|
||||
float NdotO = dot(planeNormal, rayOrigin);
|
||||
|
||||
float t = -(NdotO + planeD) / NdotD;
|
||||
if (t < 0)
|
||||
t = 100000;
|
||||
return t;
|
||||
}
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 99c079f58f92c804197ee5a23e05164a
|
||||
timeCreated: 1505167667
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ab51d654b37dc5f49bbaa1eb3b15c3dd
|
||||
folderAsset: yes
|
||||
timeCreated: 1472350250
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+565
@@ -0,0 +1,565 @@
|
||||
// Upgrade NOTE: replaced 'defined UNITY2017_2_SP' with 'defined (UNITY2017_2_SP)'
|
||||
|
||||
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||
|
||||
// Copyright(c) 2016, Michal Skalsky
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
// may be used to endorse or promote products derived from this software without
|
||||
// specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
// OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
// TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
|
||||
Shader "Hidden/EnviroBilateralBlur"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex("Texture", any) = "" {}
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
// No culling or depth
|
||||
Cull Off ZWrite Off ZTest Always
|
||||
|
||||
CGINCLUDE
|
||||
|
||||
#pragma shader_feature UNITY2017_2_SP
|
||||
//--------------------------------------------------------------------------------------------
|
||||
// Downsample, bilateral blur and upsample config
|
||||
//--------------------------------------------------------------------------------------------
|
||||
// method used to downsample depth buffer: 0 = min; 1 = max; 2 = min/max in chessboard pattern
|
||||
#define DOWNSAMPLE_DEPTH_MODE 2
|
||||
#define UPSAMPLE_DEPTH_THRESHOLD 1.5f
|
||||
#define BLUR_DEPTH_FACTOR 0.5
|
||||
#define GAUSS_BLUR_DEVIATION 1.5
|
||||
#define FULL_RES_BLUR_KERNEL_SIZE 7
|
||||
#define HALF_RES_BLUR_KERNEL_SIZE 5
|
||||
#define QUARTER_RES_BLUR_KERNEL_SIZE 6
|
||||
//--------------------------------------------------------------------------------------------
|
||||
|
||||
#define PI 3.1415927f
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
UNITY_DECLARE_TEX2D(_CameraDepthTexture);
|
||||
UNITY_DECLARE_TEX2D(_HalfResDepthBuffer);
|
||||
UNITY_DECLARE_TEX2D(_QuarterResDepthBuffer);
|
||||
UNITY_DECLARE_TEX2D(_HalfResColor);
|
||||
UNITY_DECLARE_TEX2D(_QuarterResColor);
|
||||
UNITY_DECLARE_TEX2D(_MainTex);
|
||||
|
||||
float4 _CameraDepthTexture_TexelSize;
|
||||
float4 _HalfResDepthBuffer_TexelSize;
|
||||
float4 _QuarterResDepthBuffer_TexelSize;
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
};
|
||||
|
||||
struct v2fDownsample
|
||||
{
|
||||
#if SHADER_TARGET > 40
|
||||
float2 uv : TEXCOORD0;
|
||||
#else
|
||||
float2 uv00 : TEXCOORD0;
|
||||
float2 uv01 : TEXCOORD1;
|
||||
float2 uv10 : TEXCOORD2;
|
||||
float2 uv11 : TEXCOORD3;
|
||||
#endif
|
||||
float4 vertex : SV_POSITION;
|
||||
};
|
||||
|
||||
struct v2fUpsample
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float2 uv00 : TEXCOORD1;
|
||||
float2 uv01 : TEXCOORD2;
|
||||
float2 uv10 : TEXCOORD3;
|
||||
float2 uv11 : TEXCOORD4;
|
||||
float4 vertex : SV_POSITION;
|
||||
};
|
||||
|
||||
v2f vert(appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.uv;
|
||||
return o;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------
|
||||
// vertDownsampleDepth
|
||||
//-----------------------------------------------------------------------------------------
|
||||
v2fDownsample vertDownsampleDepth(appdata v, float2 texelSize)
|
||||
{
|
||||
v2fDownsample o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
#if SHADER_TARGET > 40
|
||||
o.uv = v.uv;
|
||||
#else
|
||||
o.uv00 = v.uv - 0.5 * texelSize.xy;
|
||||
o.uv10 = o.uv00 + float2(texelSize.x, 0);
|
||||
o.uv01 = o.uv00 + float2(0, texelSize.y);
|
||||
o.uv11 = o.uv00 + texelSize.xy;
|
||||
#endif
|
||||
return o;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------
|
||||
// vertUpsample
|
||||
//-----------------------------------------------------------------------------------------
|
||||
v2fUpsample vertUpsample(appdata v, float2 texelSize)
|
||||
{
|
||||
v2fUpsample o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.uv;
|
||||
|
||||
o.uv00 = v.uv - 0.5 * texelSize.xy;
|
||||
o.uv10 = o.uv00 + float2(texelSize.x, 0);
|
||||
o.uv01 = o.uv00 + float2(0, texelSize.y);
|
||||
o.uv11 = o.uv00 + texelSize.xy;
|
||||
return o;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------
|
||||
// BilateralUpsample
|
||||
//-----------------------------------------------------------------------------------------
|
||||
float4 BilateralUpsample(v2fUpsample input, Texture2D hiDepth, Texture2D loDepth, Texture2D loColor, SamplerState linearSampler, SamplerState pointSampler)
|
||||
{
|
||||
const float threshold = UPSAMPLE_DEPTH_THRESHOLD;
|
||||
float4 highResDepth = LinearEyeDepth(hiDepth.Sample(pointSampler, input.uv)).xxxx;
|
||||
float4 lowResDepth;
|
||||
|
||||
lowResDepth[0] = LinearEyeDepth(loDepth.Sample(pointSampler, input.uv00));
|
||||
lowResDepth[1] = LinearEyeDepth(loDepth.Sample(pointSampler, input.uv10));
|
||||
lowResDepth[2] = LinearEyeDepth(loDepth.Sample(pointSampler, input.uv01));
|
||||
lowResDepth[3] = LinearEyeDepth(loDepth.Sample(pointSampler, input.uv11));
|
||||
|
||||
float4 depthDiff = abs(lowResDepth - highResDepth);
|
||||
|
||||
float accumDiff = dot(depthDiff, float4(1, 1, 1, 1));
|
||||
|
||||
[branch]
|
||||
if (accumDiff < threshold) // small error, not an edge -> use bilinear filter
|
||||
{
|
||||
#if defined (UNITY2017_2_SP)
|
||||
return loColor.Sample(linearSampler, UnityStereoTransformScreenSpaceTex(input.uv));
|
||||
#else
|
||||
return loColor.Sample(linearSampler, input.uv);
|
||||
#endif
|
||||
}
|
||||
|
||||
// find nearest sample
|
||||
float minDepthDiff = depthDiff[0];
|
||||
float2 nearestUv = input.uv00;
|
||||
|
||||
if (depthDiff[1] < minDepthDiff)
|
||||
{
|
||||
nearestUv = input.uv10;
|
||||
minDepthDiff = depthDiff[1];
|
||||
}
|
||||
|
||||
if (depthDiff[2] < minDepthDiff)
|
||||
{
|
||||
nearestUv = input.uv01;
|
||||
minDepthDiff = depthDiff[2];
|
||||
}
|
||||
|
||||
if (depthDiff[3] < minDepthDiff)
|
||||
{
|
||||
nearestUv = input.uv11;
|
||||
minDepthDiff = depthDiff[3];
|
||||
}
|
||||
|
||||
#if defined (UNITY2017_2_SP)
|
||||
return loColor.Sample(pointSampler, UnityStereoTransformScreenSpaceTex(nearestUv));
|
||||
#else
|
||||
return loColor.Sample(pointSampler, nearestUv);
|
||||
#endif
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------
|
||||
// DownsampleDepth
|
||||
//-----------------------------------------------------------------------------------------
|
||||
float DownsampleDepth(v2fDownsample input, Texture2D depthTexture, SamplerState depthSampler)
|
||||
{
|
||||
#if SHADER_TARGET > 40
|
||||
float4 depth = depthTexture.Gather(depthSampler, input.uv);
|
||||
#else
|
||||
float4 depth;
|
||||
depth.x = depthTexture.Sample(depthSampler, input.uv00).x;
|
||||
depth.y = depthTexture.Sample(depthSampler, input.uv01).x;
|
||||
depth.z = depthTexture.Sample(depthSampler, input.uv10).x;
|
||||
depth.w = depthTexture.Sample(depthSampler, input.uv11).x;
|
||||
|
||||
#endif
|
||||
|
||||
#if DOWNSAMPLE_DEPTH_MODE == 0 // min depth
|
||||
return min(min(depth.x, depth.y), min(depth.z, depth.w));
|
||||
#elif DOWNSAMPLE_DEPTH_MODE == 1 // max depth
|
||||
return max(max(depth.x, depth.y), max(depth.z, depth.w));
|
||||
#elif DOWNSAMPLE_DEPTH_MODE == 2 // min/max depth in chessboard pattern
|
||||
|
||||
float minDepth = min(min(depth.x, depth.y), min(depth.z, depth.w));
|
||||
float maxDepth = max(max(depth.x, depth.y), max(depth.z, depth.w));
|
||||
|
||||
// chessboard pattern
|
||||
int2 position = input.vertex.xy % 2;
|
||||
int index = position.x + position.y;
|
||||
return index == 1 ? minDepth : maxDepth;
|
||||
#endif
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------
|
||||
// GaussianWeight
|
||||
//-----------------------------------------------------------------------------------------
|
||||
float GaussianWeight(float offset, float deviation)
|
||||
{
|
||||
float weight = 1.0f / sqrt(2.0f * PI * deviation * deviation);
|
||||
weight *= exp(-(offset * offset) / (2.0f * deviation * deviation));
|
||||
return weight;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------
|
||||
// BilateralBlur
|
||||
//-----------------------------------------------------------------------------------------
|
||||
float4 BilateralBlur(v2f input, int2 direction, Texture2D depth, SamplerState depthSampler, const int kernelRadius, float2 pixelSize)
|
||||
{
|
||||
//const float deviation = kernelRadius / 2.5;
|
||||
const float deviation = kernelRadius / GAUSS_BLUR_DEVIATION; // make it really strong
|
||||
|
||||
float2 uv = input.uv;
|
||||
float4 centerColor = _MainTex.Sample(sampler_MainTex, UnityStereoTransformScreenSpaceTex(uv));
|
||||
float3 color = centerColor.xyz;
|
||||
//return float4(color, 1);
|
||||
float centerDepth = (LinearEyeDepth(depth.Sample(depthSampler, UnityStereoTransformScreenSpaceTex(uv))));
|
||||
|
||||
float weightSum = 0;
|
||||
|
||||
// gaussian weight is computed from constants only -> will be computed in compile time
|
||||
float weight = GaussianWeight(0, deviation);
|
||||
color *= weight;
|
||||
weightSum += weight;
|
||||
|
||||
[unroll] for (int i = -kernelRadius; i < 0; i += 1)
|
||||
{
|
||||
float2 offset = (direction * i);
|
||||
float3 sampleColor = _MainTex.Sample(sampler_MainTex, UnityStereoTransformScreenSpaceTex(input.uv), offset);
|
||||
float sampleDepth = (LinearEyeDepth(depth.Sample(depthSampler, UnityStereoTransformScreenSpaceTex(input.uv), offset)));
|
||||
|
||||
float depthDiff = abs(centerDepth - sampleDepth);
|
||||
float dFactor = depthDiff * BLUR_DEPTH_FACTOR;
|
||||
float w = exp(-(dFactor * dFactor));
|
||||
|
||||
// gaussian weight is computed from constants only -> will be computed in compile time
|
||||
weight = GaussianWeight(i, deviation) * w;
|
||||
|
||||
color += weight * sampleColor;
|
||||
weightSum += weight;
|
||||
}
|
||||
|
||||
[unroll] for (int k = 1; k <= kernelRadius; k += 1)
|
||||
{
|
||||
float2 offset = (direction * k);
|
||||
float3 sampleColor = _MainTex.Sample(sampler_MainTex, UnityStereoTransformScreenSpaceTex(input.uv), offset);
|
||||
float sampleDepth = (LinearEyeDepth(depth.Sample(depthSampler, UnityStereoTransformScreenSpaceTex(input.uv), offset)));
|
||||
|
||||
float depthDiff = abs(centerDepth - sampleDepth);
|
||||
float dFactor = depthDiff * BLUR_DEPTH_FACTOR;
|
||||
float w = exp(-(dFactor * dFactor));
|
||||
|
||||
// gaussian weight is computed from constants only -> will be computed in compile time
|
||||
weight = GaussianWeight(k, deviation) * w;
|
||||
|
||||
color += weight * sampleColor;
|
||||
weightSum += weight;
|
||||
}
|
||||
|
||||
color /= weightSum;
|
||||
return float4(color, centerColor.w);
|
||||
}
|
||||
|
||||
ENDCG
|
||||
|
||||
// pass 0 - horizontal blur (hires)
|
||||
Pass
|
||||
{
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment horizontalFrag
|
||||
#pragma target 3.5
|
||||
#pragma exclude_renderers gles
|
||||
|
||||
|
||||
fixed4 horizontalFrag(v2f input) : SV_Target
|
||||
{
|
||||
return BilateralBlur(input, int2(1, 0), _CameraDepthTexture, sampler_CameraDepthTexture, FULL_RES_BLUR_KERNEL_SIZE, _CameraDepthTexture_TexelSize.xy);
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// pass 1 - vertical blur (hires)
|
||||
Pass
|
||||
{
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment verticalFrag
|
||||
#pragma target 3.5
|
||||
#pragma exclude_renderers gles
|
||||
|
||||
fixed4 verticalFrag(v2f input) : SV_Target
|
||||
{
|
||||
return BilateralBlur(input, int2(0, 1), _CameraDepthTexture, sampler_CameraDepthTexture, FULL_RES_BLUR_KERNEL_SIZE, _CameraDepthTexture_TexelSize);
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// pass 2 - horizontal blur (lores)
|
||||
Pass
|
||||
{
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment horizontalFrag
|
||||
#pragma target 3.5
|
||||
#pragma exclude_renderers gles
|
||||
|
||||
fixed4 horizontalFrag(v2f input) : SV_Target
|
||||
{
|
||||
return BilateralBlur(input, int2(1, 0), _HalfResDepthBuffer, sampler_HalfResDepthBuffer, HALF_RES_BLUR_KERNEL_SIZE, _HalfResDepthBuffer_TexelSize);
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// pass 3 - vertical blur (lores)
|
||||
Pass
|
||||
{
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment verticalFrag
|
||||
#pragma target 3.5
|
||||
#pragma exclude_renderers gles
|
||||
|
||||
fixed4 verticalFrag(v2f input) : SV_Target
|
||||
{
|
||||
return BilateralBlur(input, int2(0, 1), _HalfResDepthBuffer, sampler_HalfResDepthBuffer, HALF_RES_BLUR_KERNEL_SIZE, _HalfResDepthBuffer_TexelSize);
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// pass 4 - downsample depth to half
|
||||
Pass
|
||||
{
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vertHalfDepth
|
||||
#pragma fragment frag
|
||||
// #pragma target gl4.1
|
||||
#pragma target 3.5
|
||||
#pragma exclude_renderers gles
|
||||
|
||||
v2fDownsample vertHalfDepth(appdata v)
|
||||
{
|
||||
return vertDownsampleDepth(v, _CameraDepthTexture_TexelSize);
|
||||
}
|
||||
|
||||
float4 frag(v2fDownsample input) : SV_Target
|
||||
{
|
||||
float depth = DownsampleDepth(input, _CameraDepthTexture, sampler_CameraDepthTexture);
|
||||
return float4(depth,depth,depth,depth);
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// pass 5 - bilateral upsample
|
||||
Pass
|
||||
{
|
||||
|
||||
Blend One Zero
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vertUpsampleToFull
|
||||
#pragma fragment frag
|
||||
#pragma target 3.5
|
||||
#pragma exclude_renderers gles
|
||||
|
||||
v2fUpsample vertUpsampleToFull(appdata v)
|
||||
{
|
||||
return vertUpsample(v, _HalfResDepthBuffer_TexelSize);
|
||||
}
|
||||
float4 frag(v2fUpsample input) : SV_Target
|
||||
{
|
||||
return BilateralUpsample(input, _CameraDepthTexture, _HalfResDepthBuffer, _HalfResColor, sampler_HalfResColor, sampler_HalfResDepthBuffer);
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// pass 6 - downsample depth to quarter
|
||||
Pass
|
||||
{
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vertQuarterDepth
|
||||
#pragma fragment frag
|
||||
//#pragma target gl4.1
|
||||
#pragma target 3.5
|
||||
#pragma exclude_renderers gles
|
||||
|
||||
v2fDownsample vertQuarterDepth(appdata v)
|
||||
{
|
||||
return vertDownsampleDepth(v, _HalfResDepthBuffer_TexelSize);
|
||||
}
|
||||
|
||||
float4 frag(v2fDownsample input) : SV_Target
|
||||
{
|
||||
float depth = DownsampleDepth(input, _HalfResDepthBuffer, sampler_HalfResDepthBuffer);
|
||||
return float4(depth,depth,depth,depth);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// pass 7 - bilateral upsample quarter to full
|
||||
Pass
|
||||
{
|
||||
Blend One Zero
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vertUpsampleToFull
|
||||
#pragma fragment frag
|
||||
#pragma target 3.5
|
||||
#pragma exclude_renderers gles
|
||||
|
||||
v2fUpsample vertUpsampleToFull(appdata v)
|
||||
{
|
||||
return vertUpsample(v, _QuarterResDepthBuffer_TexelSize);
|
||||
}
|
||||
float4 frag(v2fUpsample input) : SV_Target
|
||||
{
|
||||
return BilateralUpsample(input, _CameraDepthTexture, _QuarterResDepthBuffer, _QuarterResColor, sampler_QuarterResColor, sampler_QuarterResDepthBuffer);
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// pass 8 - horizontal blur (quarter res)
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment horizontalFrag
|
||||
#pragma target 3.5
|
||||
#pragma exclude_renderers gles
|
||||
|
||||
fixed4 horizontalFrag(v2f input) : SV_Target
|
||||
{
|
||||
return BilateralBlur(input, int2(1, 0), _QuarterResDepthBuffer, sampler_QuarterResDepthBuffer, QUARTER_RES_BLUR_KERNEL_SIZE, _QuarterResDepthBuffer_TexelSize.xy);
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// pass 9 - vertical blur (quarter res)
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment verticalFrag
|
||||
#pragma target 3.5
|
||||
#pragma exclude_renderers gles
|
||||
|
||||
fixed4 verticalFrag(v2f input) : SV_Target
|
||||
{
|
||||
return BilateralBlur(input, int2(0, 1), _QuarterResDepthBuffer, sampler_QuarterResDepthBuffer, QUARTER_RES_BLUR_KERNEL_SIZE, _QuarterResDepthBuffer_TexelSize.xy);
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// pass 10 - downsample depth to half (fallback for DX10)
|
||||
Pass
|
||||
{
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vertHalfDepth
|
||||
#pragma fragment frag
|
||||
#pragma target 3.5
|
||||
#pragma exclude_renderers gles
|
||||
|
||||
v2fDownsample vertHalfDepth(appdata v)
|
||||
{
|
||||
return vertDownsampleDepth(v, _CameraDepthTexture_TexelSize);
|
||||
}
|
||||
|
||||
float4 frag(v2fDownsample input) : SV_Target
|
||||
{
|
||||
float depth = DownsampleDepth(input, _CameraDepthTexture, sampler_CameraDepthTexture);
|
||||
|
||||
return float4(depth,depth,depth,depth);
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// pass 11 - downsample depth to quarter (fallback for DX10)
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vertQuarterDepth
|
||||
#pragma fragment frag
|
||||
#pragma target 3.5
|
||||
#pragma exclude_renderers gles
|
||||
|
||||
v2fDownsample vertQuarterDepth(appdata v)
|
||||
{
|
||||
return vertDownsampleDepth(v, _HalfResDepthBuffer_TexelSize);
|
||||
}
|
||||
|
||||
float4 frag(v2fDownsample input) : SV_Target
|
||||
{
|
||||
float depth = DownsampleDepth(input, _HalfResDepthBuffer, sampler_HalfResDepthBuffer);
|
||||
|
||||
return float4(depth,depth,depth,depth);
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 307338a0d8294f440853ba6b3a56cf54
|
||||
timeCreated: 1459178236
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+142
@@ -0,0 +1,142 @@
|
||||
// MODIFIED FOR ENVIRO POST PROCESSING
|
||||
//
|
||||
// Kino/Bloom v2 - Bloom filter for Unity
|
||||
//
|
||||
// Copyright (C) 2015, 2016 Keijiro Takahashi
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
Shader "Hidden/EnviroDistanceBlur"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex("", any) = "" {}
|
||||
_BaseTex("", any) = "" {}
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
// 0: Prefilter
|
||||
Pass
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
CGPROGRAM
|
||||
#pragma multi_compile _ UNITY_COLORSPACE_GAMMA
|
||||
#include "../Core/EnviroBlurCore.cginc"
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag_prefilter
|
||||
#pragma target 3.0
|
||||
ENDCG
|
||||
}
|
||||
// 1: Prefilter with anti-flicker
|
||||
Pass
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
CGPROGRAM
|
||||
#define ANTI_FLICKER 1
|
||||
#pragma multi_compile _ UNITY_COLORSPACE_GAMMA
|
||||
#include "../Core/EnviroBlurCore.cginc"
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag_prefilter
|
||||
#pragma target 3.0
|
||||
ENDCG
|
||||
}
|
||||
// 2: First level downsampler
|
||||
Pass
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
CGPROGRAM
|
||||
#include "../Core/EnviroBlurCore.cginc"
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag_downsample1
|
||||
#pragma target 3.0
|
||||
ENDCG
|
||||
}
|
||||
// 3: First level downsampler with anti-flicker
|
||||
Pass
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
CGPROGRAM
|
||||
#define ANTI_FLICKER 1
|
||||
#include "../Core/EnviroBlurCore.cginc"
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag_downsample1
|
||||
#pragma target 3.0
|
||||
ENDCG
|
||||
}
|
||||
// 4: Second level downsampler
|
||||
Pass
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
CGPROGRAM
|
||||
#include "../Core/EnviroBlurCore.cginc"
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag_downsample2
|
||||
#pragma target 3.0
|
||||
ENDCG
|
||||
}
|
||||
// 5: Upsampler
|
||||
Pass
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
CGPROGRAM
|
||||
#include "../Core/EnviroBlurCore.cginc"
|
||||
#pragma vertex vert_multitex
|
||||
#pragma fragment frag_upsample
|
||||
#pragma target 3.0
|
||||
ENDCG
|
||||
}
|
||||
// 6: High quality upsampler
|
||||
Pass
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
CGPROGRAM
|
||||
#define HIGH_QUALITY 1
|
||||
#include "../Core/EnviroBlurCore.cginc"
|
||||
#pragma vertex vert_multitex
|
||||
#pragma fragment frag_upsample
|
||||
#pragma target 3.0
|
||||
ENDCG
|
||||
}
|
||||
// 7: Combiner
|
||||
Pass
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
CGPROGRAM
|
||||
#pragma multi_compile _ UNITY_COLORSPACE_GAMMA
|
||||
#include "../Core/EnviroBlurCore.cginc"
|
||||
#pragma vertex vert_multitex
|
||||
#pragma fragment frag_upsample_final
|
||||
#pragma target 3.0
|
||||
ENDCG
|
||||
}
|
||||
// 8: High quality combiner
|
||||
Pass
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
CGPROGRAM
|
||||
#define HIGH_QUALITY 1
|
||||
#pragma multi_compile _ UNITY_COLORSPACE_GAMMA
|
||||
#include "../Core/EnviroBlurCore.cginc"
|
||||
#pragma vertex vert_multitex
|
||||
#pragma fragment frag_upsample_final
|
||||
#pragma target 3.0
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1e01d888ba8d52d4283fc169b2717e27
|
||||
timeCreated: 1540850786
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+292
@@ -0,0 +1,292 @@
|
||||
|
||||
Shader "Enviro/Standard/EnviroFogRendering"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_EnviroVolumeLightingTex("Volume Lighting Tex", Any) = ""{}
|
||||
_MainTex("Source", Any) = "black"{}
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Pass
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off Fog { Mode Off }
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma target 3.0
|
||||
#pragma multi_compile __ ENVIROVOLUMELIGHT
|
||||
#pragma multi_compile __ ENVIRO_DEPTHBLENDING
|
||||
#pragma exclude_renderers gles
|
||||
|
||||
// Start: LuxWater
|
||||
#pragma multi_compile __ LUXWATER_DEFERREDFOG
|
||||
|
||||
#if defined(LUXWATER_DEFERREDFOG)
|
||||
sampler2D _UnderWaterMask;
|
||||
float4 _LuxUnderWaterDeferredFogParams; // x: IsInsideWatervolume?, y: BelowWaterSurface shift, z: EdgeBlend
|
||||
#endif
|
||||
// End: LuxWater
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "../Core/EnviroVolumeLightCore.cginc"
|
||||
#include "../../../../Core/Resources/Shaders/Core/EnviroFogCore.cginc"
|
||||
|
||||
//uniform sampler2D _MainTex;
|
||||
UNITY_DECLARE_SCREENSPACE_TEXTURE(_MainTex);
|
||||
uniform float4 _MainTex_TexelSize;
|
||||
uniform sampler3D _FogNoiseTexture;
|
||||
uniform float _DitheringIntensity;
|
||||
|
||||
#ifdef ENVIRO_DEPTHBLENDING
|
||||
uniform sampler2D _EnviroCloudsTex;
|
||||
#endif
|
||||
struct appdata_t
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float3 texcoord : TEXCOORD0;
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float3 texcoord : TEXCOORD0;
|
||||
float3 sky : TEXCOORD1;
|
||||
float4 uv : TEXCOORD2;
|
||||
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
v2f vert(appdata_img v)
|
||||
{
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v); //Insert
|
||||
UNITY_INITIALIZE_OUTPUT(v2f, o); //Insert
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); //Insert
|
||||
o.pos = v.vertex * float4(2, 2, 1, 1) + float4(-1, -1, 0, 0);
|
||||
o.uv.xy = v.texcoord.xy;
|
||||
#if UNITY_UV_STARTS_AT_TOP
|
||||
if (_MainTex_TexelSize.y > 0)
|
||||
o.uv.y = 1 - o.uv.y;
|
||||
#endif
|
||||
o.sky.x = saturate(_SunDir.y + 0.25);
|
||||
o.sky.y = saturate(clamp(1.0 - _SunDir.y, 0.0, 0.5));
|
||||
return o;
|
||||
}
|
||||
|
||||
float3 ScreenSpaceDither(float2 vScreenPos, float3 clr)
|
||||
{
|
||||
float d = dot(float2(131.0, 312.0), vScreenPos.xy + _Time.y);
|
||||
float3 vDither = float3(d, d, d);
|
||||
vDither.rgb = frac(vDither.rgb / float3(103.0, 71.0, 97.0)) - float3(0.5, 0.5, 0.5);
|
||||
return (vDither.rgb / 15.0) * _DitheringIntensity;
|
||||
}
|
||||
|
||||
// Linear height fog function
|
||||
float ComputeHalfSpaceWithNoise(float3 wsDir)
|
||||
{
|
||||
float3 wpos = _WorldSpaceCameraPos + wsDir;
|
||||
float FH = _HeightParams.x;
|
||||
float3 C = _WorldSpaceCameraPos;
|
||||
float3 V = wsDir;
|
||||
float3 P = wpos;
|
||||
float3 aV = (_HeightParams.w * _EnviroSkyFog.w) * V;
|
||||
float noise = tex3D(_FogNoiseTexture, frac(wpos * _FogNoiseData.x + float3(_Time.y * _FogNoiseVelocity.x, 0, _Time.y * _FogNoiseVelocity.y)));
|
||||
// float noise = tex3D(_FogNoiseTexture, wpos * 0.01);
|
||||
noise = saturate(noise - _FogNoiseData.z) * _FogNoiseData.y;
|
||||
aV *= noise;
|
||||
float FdotC = _HeightParams.y;
|
||||
float k = _HeightParams.z;
|
||||
float FdotP = P.y - FH;
|
||||
float FdotV = wsDir.y;
|
||||
float c1 = k * (FdotP + FdotC);
|
||||
float c2 = (1 - 2 * k) * FdotP;
|
||||
float g = min(c2, 0.0);
|
||||
g = -length(aV) * (c1 - g * g / abs(FdotV + 1.0e-5f));
|
||||
return g;
|
||||
}
|
||||
|
||||
float Remap(float org_val, float org_min, float org_max, float new_min, float new_max)
|
||||
{
|
||||
return new_min + saturate(((org_val - org_min) / (org_max - org_min))*(new_max - new_min));
|
||||
}
|
||||
|
||||
/// Main Fragment Shader
|
||||
fixed4 frag(v2f i) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
|
||||
float rawDepth = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, UnityStereoTransformScreenSpaceTex(i.uv));
|
||||
float dpth = Linear01Depth(rawDepth);
|
||||
|
||||
float4x4 proj, eyeToWorld;
|
||||
if (unity_StereoEyeIndex == 0)
|
||||
{
|
||||
proj = _LeftViewFromScreen;
|
||||
eyeToWorld = _LeftWorldFromView;
|
||||
}
|
||||
else
|
||||
{
|
||||
proj = _RightViewFromScreen;
|
||||
eyeToWorld = _RightWorldFromView;
|
||||
}
|
||||
|
||||
//bit of matrix math to take the screen space coord (u,v,depth) and transform to world space
|
||||
float2 uvClip = i.uv * 2.0 - 1.0;
|
||||
float clipDepth = rawDepth; // Fix for OpenGl Core thanks to Lars Bertram
|
||||
clipDepth = (UNITY_NEAR_CLIP_VALUE < 0) ? clipDepth * 2 - 1 : clipDepth;
|
||||
float4 clipPos = float4(uvClip, clipDepth, 1.0);
|
||||
float4 viewPos = mul(proj, clipPos); // inverse projection by clip position
|
||||
viewPos /= viewPos.w; // perspective division
|
||||
float4 wsPos = float4(mul(eyeToWorld, viewPos).xyz, 1);
|
||||
float4 wsDir = wsPos - float4(_WorldSpaceCameraPos, 0);
|
||||
float3 viewDir = normalize(wsDir);
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
half fogFac = 0;
|
||||
float4 finalFog = 0;
|
||||
float g = _DistanceParams.x;
|
||||
half gHeight = 0;
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//Scene
|
||||
if (dpth < 0.99)
|
||||
{
|
||||
// Calculate Distance Fog
|
||||
if (_EnviroParams.y > 0)
|
||||
{
|
||||
g += ComputeDistance(wsDir, dpth);
|
||||
g *= _distanceFogIntensity;
|
||||
}
|
||||
|
||||
if (_EnviroParams.z > 0)
|
||||
{
|
||||
gHeight = ComputeHalfSpaceWithNoise(wsDir) * (1 - dpth);
|
||||
}
|
||||
//gHeight = lerp(0.75, 1.0, dpth);
|
||||
|
||||
|
||||
// Add Height Fog
|
||||
g += gHeight;
|
||||
|
||||
// Compute fog amount
|
||||
fogFac = ComputeFogFactor(max(0.0, g));
|
||||
|
||||
|
||||
#ifdef ENVIRO_DEPTHBLENDING
|
||||
float4 clouds = tex2D(_EnviroCloudsTex, UnityStereoTransformScreenSpaceTex(i.uv));
|
||||
|
||||
if (clouds.a > 0.9)
|
||||
{
|
||||
|
||||
if (_EnviroParams.z > 0 && _SceneFogMode.w == 1)
|
||||
{
|
||||
gHeight = ComputeHalfSpace(wsDir);
|
||||
}
|
||||
|
||||
half fogFacSky = ComputeFogFactor(max(0.0, gHeight));
|
||||
float f = saturate(_EnviroSkyFog.x * (viewDir.y + _EnviroSkyFog.z));
|
||||
f = pow(f, _EnviroSkyFog.y);
|
||||
|
||||
fogFac = (clamp(f, 0, 1));
|
||||
|
||||
float skyLerp = Remap(_WorldSpaceCameraPos.y, 0, _SunParameters.w, 0, 1);
|
||||
fogFac = lerp(fogFac, 1, skyLerp);
|
||||
}
|
||||
//fogFac = 1;
|
||||
#endif
|
||||
|
||||
|
||||
fogFac = lerp(_maximumFogDensity, 1.0f, fogFac);
|
||||
finalFog = ComputeScatteringScene(viewDir, i.sky.xy);
|
||||
|
||||
}
|
||||
else //SKY
|
||||
{
|
||||
if (_EnviroParams.z > 0 && _SceneFogMode.w == 1)
|
||||
{
|
||||
gHeight = ComputeHalfSpace(wsDir);
|
||||
}
|
||||
|
||||
half fogFacSky = ComputeFogFactor(max(0.0, gHeight));
|
||||
float f = saturate(_EnviroSkyFog.x * (viewDir.y + _EnviroSkyFog.z));
|
||||
f = pow(f, _EnviroSkyFog.y);
|
||||
|
||||
fogFac = (clamp(f, 0, 1));
|
||||
|
||||
if (fogFac > fogFacSky)
|
||||
fogFac = fogFacSky;
|
||||
|
||||
float skyLerp = Remap(_WorldSpaceCameraPos.y, 0, _SunParameters.w, 0, 1);
|
||||
fogFac = lerp(fogFac, 1, skyLerp);
|
||||
float4 skyFog = ComputeScatteringScene(viewDir, i.sky.xy);
|
||||
|
||||
finalFog = skyFog;
|
||||
}
|
||||
|
||||
//Dithering
|
||||
finalFog.rgb = finalFog.rgb + ScreenSpaceDither(i.pos.xy, finalFog.rgb);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// Composing
|
||||
|
||||
// Start: LuxWater
|
||||
#if defined(LUXWATER_DEFERREDFOG)
|
||||
half4 fogMask = tex2D(_UnderWaterMask, UnityStereoTransformScreenSpaceTex(i.uv));
|
||||
float watersurfacefrombelow = DecodeFloatRG(fogMask.ba);
|
||||
|
||||
// Get distance and lower it a bit in order to handle edge blending artifacts (edge blended parts would not get ANY fog)
|
||||
float dist = (watersurfacefrombelow - dpth) + _LuxUnderWaterDeferredFogParams.y * _ProjectionParams.w;
|
||||
// Fade fog from above water to below water
|
||||
float fogFactor = saturate(1.0 + _ProjectionParams.z * _LuxUnderWaterDeferredFogParams.z * dist);
|
||||
// Clamp above result to where water is actually rendered
|
||||
fogFactor = (fogMask.r == 1) ? fogFactor : 1.0;
|
||||
// Mask fog on underwarter parts - only if we are inside a volume (bool... :( )
|
||||
if (_LuxUnderWaterDeferredFogParams.x) {
|
||||
fogFactor *= saturate(1.0 - fogMask.g * 8.0);
|
||||
if (dist < -_ProjectionParams.w * 4 && fogMask.r == 0 && fogMask.g < 1.0) {
|
||||
fogFactor = 1.0;
|
||||
}
|
||||
}
|
||||
// Tweak fog factor
|
||||
fogFac = lerp(1.0, fogFac, fogFactor);
|
||||
#endif
|
||||
// End: LuxWater
|
||||
|
||||
float4 final;
|
||||
float4 source = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, UnityStereoTransformScreenSpaceTex(i.uv));
|
||||
|
||||
#if defined (ENVIROVOLUMELIGHT)
|
||||
float4 volumeLighting = tex2D(_EnviroVolumeLightingTex, UnityStereoTransformScreenSpaceTex(i.uv));
|
||||
volumeLighting *= _EnviroParams.x;
|
||||
|
||||
if (_EnviroParams.w == 1)
|
||||
{
|
||||
volumeLighting.rgb = tonemapACES(volumeLighting.rgb, 1.0);
|
||||
}
|
||||
|
||||
// Start: LuxWater
|
||||
#if defined(LUXWATER_DEFERREDFOG)
|
||||
volumeLighting *= fogFactor;
|
||||
#endif
|
||||
// End: LuxWater
|
||||
final *= volumeLighting.w;
|
||||
|
||||
final = lerp (lerp(finalFog, finalFog + volumeLighting, _EnviroVolumeDensity), lerp(source, source + volumeLighting, _EnviroVolumeDensity), fogFac);
|
||||
#else
|
||||
final = lerp (finalFog, source, fogFac);
|
||||
#endif
|
||||
|
||||
return final;
|
||||
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
Fallback Off
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 78aa7501e8e951446b1be533c73e8de6
|
||||
timeCreated: 1459178236
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
|
||||
Shader "Enviro/Standard/EnviroFogRenderingDisabled"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_EnviroVolumeLightingTex("Volume Lighting Tex", Any) = ""{}
|
||||
_MainTex("Source", Any) = "black"{}
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Pass
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off Fog { Mode Off }
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma target 3.0
|
||||
#pragma multi_compile ENVIROVOLUMELIGHT
|
||||
#pragma exclude_renderers gles
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
UNITY_DECLARE_SCREENSPACE_TEXTURE(_MainTex);
|
||||
uniform sampler2D _EnviroVolumeLightingTex;
|
||||
uniform float4 _MainTex_TexelSize;
|
||||
uniform float4 _EnviroParams;
|
||||
uniform float _EnviroVolumeDensity;
|
||||
|
||||
struct appdata_t
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float3 texcoord : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float3 texcoord : TEXCOORD0;
|
||||
float3 sky : TEXCOORD1;
|
||||
float2 uv : TEXCOORD2;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
|
||||
v2f vert(appdata_img v)
|
||||
{
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v); //Insert
|
||||
UNITY_INITIALIZE_OUTPUT(v2f, o); //Insert
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); //Ins
|
||||
o.pos = v.vertex * float4(2, 2, 1, 1) + float4(-1, -1, 0, 0);
|
||||
o.uv.xy = v.texcoord.xy;
|
||||
#if UNITY_UV_STARTS_AT_TOP
|
||||
if (_MainTex_TexelSize.y > 0)
|
||||
o.uv.y = 1 - o.uv.y;
|
||||
#endif
|
||||
return o;
|
||||
}
|
||||
|
||||
half3 tonemapACES(half3 color, float Exposure)
|
||||
{
|
||||
color *= Exposure;
|
||||
|
||||
// See https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/
|
||||
const half a = 2.51;
|
||||
const half b = 0.03;
|
||||
const half c = 2.43;
|
||||
const half d = 0.59;
|
||||
const half e = 0.14;
|
||||
return saturate((color * (a * color + b)) / (color * (c * color + d) + e));
|
||||
}
|
||||
|
||||
fixed4 frag(v2f i) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
float4 source = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, UnityStereoTransformScreenSpaceTex(i.uv));
|
||||
|
||||
#if defined (ENVIROVOLUMELIGHT)
|
||||
float4 volumeLighting = tex2D(_EnviroVolumeLightingTex, UnityStereoTransformScreenSpaceTex(i.uv));
|
||||
volumeLighting *= _EnviroParams.x;
|
||||
if (_EnviroParams.w == 1)
|
||||
{
|
||||
volumeLighting.rgb = tonemapACES(volumeLighting.rgb, 1.0);
|
||||
}
|
||||
return lerp(source, source + volumeLighting, _EnviroVolumeDensity);
|
||||
#else
|
||||
return source;
|
||||
#endif
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
Fallback Off
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e5dbacd27b280d345a34f2ecef4d76fb
|
||||
timeCreated: 1459178236
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+205
@@ -0,0 +1,205 @@
|
||||
|
||||
Shader "Enviro/Standard/EnviroFogRenderingSimple"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_EnviroVolumeLightingTex("Volume Lighting Tex", Any) = ""{}
|
||||
_MainTex("Source", Any) = "black"{}
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Pass
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off Fog { Mode Off }
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma target 3.0
|
||||
#pragma multi_compile ENVIROVOLUMELIGHT
|
||||
#pragma exclude_renderers gles
|
||||
|
||||
// Start: LuxWater
|
||||
#pragma multi_compile __ LUXWATER_DEFERREDFOG
|
||||
|
||||
#if defined(LUXWATER_DEFERREDFOG)
|
||||
sampler2D _UnderWaterMask;
|
||||
float4 _LuxUnderWaterDeferredFogParams; // x: IsInsideWatervolume?, y: BelowWaterSurface shift, z: EdgeBlend
|
||||
#endif
|
||||
// End: LuxWater
|
||||
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "../Core/EnviroVolumeLightCore.cginc"
|
||||
#include "../../../../Core/Resources/Shaders/Core/EnviroFogCore.cginc"
|
||||
|
||||
UNITY_DECLARE_SCREENSPACE_TEXTURE(_MainTex);
|
||||
uniform float4 _MainTex_TexelSize;
|
||||
|
||||
struct appdata_t
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float3 texcoord : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float3 texcoord : TEXCOORD0;
|
||||
float3 sky : TEXCOORD1;
|
||||
float2 uv : TEXCOORD2;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
|
||||
v2f vert(appdata_img v)
|
||||
{
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v); //Insert
|
||||
UNITY_INITIALIZE_OUTPUT(v2f, o); //Insert
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); //Insert
|
||||
o.pos = v.vertex * float4(2, 2, 1, 1) + float4(-1, -1, 0, 0);
|
||||
o.uv.xy = v.texcoord.xy;
|
||||
#if UNITY_UV_STARTS_AT_TOP
|
||||
if (_MainTex_TexelSize.y > 0)
|
||||
o.uv.y = 1 - o.uv.y;
|
||||
#endif
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag(v2f i) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
|
||||
float rawDepth = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, UnityStereoTransformScreenSpaceTex(i.uv));
|
||||
float dpth = Linear01Depth(rawDepth);
|
||||
|
||||
|
||||
float4x4 proj, eyeToWorld;
|
||||
if (unity_StereoEyeIndex == 0)
|
||||
{
|
||||
proj = _LeftViewFromScreen;
|
||||
eyeToWorld = _LeftWorldFromView;
|
||||
}
|
||||
else
|
||||
{
|
||||
proj = _RightViewFromScreen;
|
||||
eyeToWorld = _RightWorldFromView;
|
||||
}
|
||||
|
||||
//bit of matrix math to take the screen space coord (u,v,depth) and transform to world space
|
||||
float2 uvClip = i.uv * 2.0 - 1.0;
|
||||
float clipDepth = rawDepth; // Fix for OpenGl Core thanks to Lars Bertram
|
||||
clipDepth = (UNITY_NEAR_CLIP_VALUE < 0) ? clipDepth * 2 - 1 : clipDepth;
|
||||
float4 clipPos = float4(uvClip, clipDepth, 1.0);
|
||||
float4 viewPos = mul(proj, clipPos); // inverse projection by clip position
|
||||
viewPos /= viewPos.w; // perspective division
|
||||
|
||||
float4 wsPos = float4(mul(eyeToWorld, viewPos).xyz, 1);
|
||||
float4 wsDir = wsPos - float4(_WorldSpaceCameraPos, 0);
|
||||
|
||||
float3 viewDir = normalize(wsDir);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
half fogFac = 0;
|
||||
float4 finalFog = unity_FogColor;
|
||||
float g = _DistanceParams.x;
|
||||
half gAdd = 0;
|
||||
|
||||
if (_EnviroParams.z > 0)
|
||||
{
|
||||
gAdd = ComputeHalfSpace (wsDir);
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//Scene
|
||||
if (dpth < 0.99999)
|
||||
{
|
||||
// Calculate Distance Fog
|
||||
if (_EnviroParams.y > 0)
|
||||
{
|
||||
g += ComputeDistance(wsDir, dpth);
|
||||
g *= _distanceFogIntensity;
|
||||
}
|
||||
|
||||
// AAdd Height Fog
|
||||
g += gAdd;
|
||||
|
||||
// Compute fog amount
|
||||
fogFac = ComputeFogFactor(max(0.0, g));
|
||||
fogFac = lerp(_maximumFogDensity, 1.0f, fogFac);
|
||||
}
|
||||
else //SKY
|
||||
{
|
||||
half fogFacSky = ComputeFogFactor(max(0.0, gAdd));
|
||||
float f = saturate(_EnviroSkyFog.x * (viewDir.y + _EnviroSkyFog.z));
|
||||
f = pow(f, _EnviroSkyFog.y);
|
||||
fogFac = (clamp(f, 0, 1));
|
||||
|
||||
if (fogFac > fogFacSky)
|
||||
fogFac = fogFacSky;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Start: LuxWater
|
||||
#if defined(LUXWATER_DEFERREDFOG)
|
||||
half4 fogMask = tex2D(_UnderWaterMask, UnityStereoTransformScreenSpaceTex(i.uv));
|
||||
float watersurfacefrombelow = DecodeFloatRG(fogMask.ba);
|
||||
|
||||
// Get distance and lower it a bit in order to handle edge blending artifacts (edge blended parts would not get ANY fog)
|
||||
float dist = (watersurfacefrombelow - dpth) + _LuxUnderWaterDeferredFogParams.y * _ProjectionParams.w;
|
||||
// Fade fog from above water to below water
|
||||
float fogFactor = saturate(1.0 + _ProjectionParams.z * _LuxUnderWaterDeferredFogParams.z * dist);
|
||||
// Clamp above result to where water is actually rendered
|
||||
fogFactor = (fogMask.r == 1) ? fogFactor : 1.0;
|
||||
// Mask fog on underwarter parts - only if we are inside a volume (bool... :( )
|
||||
if (_LuxUnderWaterDeferredFogParams.x) {
|
||||
fogFactor *= saturate(1.0 - fogMask.g * 8.0);
|
||||
if (dist < -_ProjectionParams.w * 4 && fogMask.r == 0 && fogMask.g < 1.0) {
|
||||
fogFactor = 1.0;
|
||||
}
|
||||
}
|
||||
// Tweak fog factor
|
||||
fogFac = lerp(1.0, fogFac, fogFactor);
|
||||
#endif
|
||||
// End: LuxWater
|
||||
|
||||
|
||||
|
||||
float4 final;
|
||||
float4 source = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, UnityStereoTransformScreenSpaceTex(i.uv));
|
||||
|
||||
#if defined (ENVIROVOLUMELIGHT)
|
||||
float4 volumeLighting = tex2D(_EnviroVolumeLightingTex, UnityStereoTransformScreenSpaceTex(i.uv));
|
||||
volumeLighting *= _EnviroParams.x;
|
||||
if (_EnviroParams.w == 1)
|
||||
{
|
||||
volumeLighting.rgb = tonemapACES(volumeLighting.rgb, 1.0);
|
||||
}
|
||||
// Start: LuxWater
|
||||
#if defined(LUXWATER_DEFERREDFOG)
|
||||
volumeLighting *= fogFactor;
|
||||
#endif
|
||||
// End: LuxWater
|
||||
final = lerp (lerp(finalFog, finalFog + volumeLighting, _EnviroVolumeDensity), lerp(source, source + volumeLighting, _EnviroVolumeDensity), fogFac);
|
||||
#else
|
||||
final = lerp (finalFog, source, fogFac);
|
||||
#endif
|
||||
|
||||
return final;
|
||||
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
Fallback Off
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 899fe52a053808b40b4f6517d18538bd
|
||||
timeCreated: 1459178236
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+454
@@ -0,0 +1,454 @@
|
||||
// Copyright(c) 2016, Michal Skalsky
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
// may be used to endorse or promote products derived from this software without
|
||||
// specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
// OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
// TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
//Modified for use with Enviro - Sky and Weather
|
||||
|
||||
|
||||
|
||||
Shader "Enviro/Standard/VolumeLight"
|
||||
{
|
||||
Properties
|
||||
{ _MainTex("Texture", any) = "" {}
|
||||
[HideInInspector]_ZTest ("ZTest", Float) = 0
|
||||
[HideInInspector]_LightColor("_LightColor", Color) = (1,1,1,1)
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType"="Opaque" }
|
||||
LOD 100
|
||||
|
||||
CGINCLUDE
|
||||
#if defined(SHADOWS_DEPTH) || defined(SHADOWS_CUBE)
|
||||
#define SHADOWS_NATIVE
|
||||
#endif
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityDeferredLibrary.cginc"
|
||||
#include "../Core/EnviroVolumeLightCore.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float4 uv : TEXCOORD0;
|
||||
float3 wpos : TEXCOORD1;
|
||||
float4 interpolatedRay : TEXCOORD2;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
v2f vert(appdata v)
|
||||
{
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v); //Insert
|
||||
UNITY_INITIALIZE_OUTPUT(v2f, o); //Insert
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); //Ins
|
||||
if (unity_StereoEyeIndex == 0)
|
||||
o.pos = mul(_WorldViewProj, v.vertex);
|
||||
else
|
||||
o.pos = mul(_WorldViewProj_SP, v.vertex);
|
||||
|
||||
o.uv = ComputeScreenPos(o.pos);
|
||||
o.wpos = mul(unity_ObjectToWorld, v.vertex);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
ENDCG
|
||||
// pass 0 - point light, camera inside
|
||||
Pass
|
||||
{
|
||||
ZTest Off
|
||||
Cull Front
|
||||
ZWrite Off
|
||||
Blend One One
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment fragPointInside
|
||||
#pragma target 3.5
|
||||
#pragma exclude_renderers d3d9 gles
|
||||
|
||||
#define UNITY_HDR_ON
|
||||
|
||||
#pragma shader_feature HEIGHT_FOG
|
||||
#pragma shader_feature NOISE
|
||||
#pragma shader_feature SHADOWS_CUBE
|
||||
#pragma shader_feature POINT_COOKIE
|
||||
#pragma shader_feature POINT
|
||||
|
||||
#ifdef SHADOWS_DEPTH
|
||||
#define SHADOWS_NATIVE
|
||||
#endif
|
||||
|
||||
|
||||
fixed4 fragPointInside(v2f i) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
float2 uv = i.uv.xy / i.uv.w;
|
||||
|
||||
// read depth and reconstruct world position
|
||||
float depth = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, UnityStereoScreenSpaceUVAdjust(uv,_CameraDepthTexture_ST));
|
||||
|
||||
float3 rayStart = _WorldSpaceCameraPos;
|
||||
float3 rayEnd = i.wpos;
|
||||
|
||||
float3 rayDir = (rayEnd - rayStart);
|
||||
float rayLength = length(rayDir);
|
||||
|
||||
rayDir /= rayLength;
|
||||
|
||||
float linearDepth = LinearEyeDepth(depth);
|
||||
float projectedDepth = linearDepth / dot(_CameraForward, rayDir);
|
||||
rayLength = min(rayLength, projectedDepth);
|
||||
|
||||
return RayMarch(i.pos.xy, rayStart, rayDir, rayLength);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// pass 1 - spot light, camera inside
|
||||
Pass
|
||||
{
|
||||
ZTest Off
|
||||
Cull Front
|
||||
ZWrite Off
|
||||
Blend One One
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment fragPointInside
|
||||
#pragma target 3.5
|
||||
#pragma exclude_renderers d3d9 gles
|
||||
|
||||
#define UNITY_HDR_ON
|
||||
|
||||
#pragma shader_feature HEIGHT_FOG
|
||||
#pragma shader_feature NOISE
|
||||
#pragma shader_feature SHADOWS_DEPTH
|
||||
#pragma shader_feature SPOT
|
||||
|
||||
#ifdef SHADOWS_DEPTH
|
||||
#define SHADOWS_NATIVE
|
||||
#endif
|
||||
|
||||
fixed4 fragPointInside(v2f i) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
float2 uv = i.uv.xy / i.uv.w;
|
||||
|
||||
// read depth and reconstruct world position
|
||||
float depth = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, UnityStereoScreenSpaceUVAdjust(uv,_CameraDepthTexture_ST));
|
||||
|
||||
float3 rayStart = _WorldSpaceCameraPos;
|
||||
float3 rayEnd = i.wpos;
|
||||
|
||||
float3 rayDir = (rayEnd - rayStart);
|
||||
float rayLength = length(rayDir);
|
||||
|
||||
rayDir /= rayLength;
|
||||
|
||||
float linearDepth = LinearEyeDepth(depth);
|
||||
float projectedDepth = linearDepth / dot(_CameraForward, rayDir);
|
||||
rayLength = min(rayLength, projectedDepth);
|
||||
|
||||
return RayMarch(i.pos.xy, rayStart, rayDir, rayLength);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// pass 2 - point light, camera outside
|
||||
Pass
|
||||
{
|
||||
//ZTest Off
|
||||
ZTest [_ZTest]
|
||||
Cull Back
|
||||
ZWrite Off
|
||||
Blend One One
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment fragPointOutside
|
||||
#pragma target 3.5
|
||||
#pragma exclude_renderers d3d9 gles
|
||||
|
||||
#define UNITY_HDR_ON
|
||||
|
||||
#pragma shader_feature HEIGHT_FOG
|
||||
#pragma shader_feature SHADOWS_CUBE
|
||||
#pragma shader_feature NOISE
|
||||
#pragma shader_feature POINT_COOKIE
|
||||
#pragma shader_feature POINT
|
||||
|
||||
fixed4 fragPointOutside(v2f i) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
float2 uv = i.uv.xy / i.uv.w;
|
||||
|
||||
// read depth and reconstruct world position
|
||||
float depth = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, UnityStereoScreenSpaceUVAdjust(uv,_CameraDepthTexture_ST));
|
||||
|
||||
float3 rayStart = _WorldSpaceCameraPos;
|
||||
float3 rayEnd = i.wpos;
|
||||
|
||||
float3 rayDir = (rayEnd - rayStart);
|
||||
float rayLength = length(rayDir);
|
||||
|
||||
rayDir /= rayLength;
|
||||
|
||||
float3 lightToCamera = _WorldSpaceCameraPos - _LightPos;
|
||||
|
||||
float b = dot(rayDir, lightToCamera);
|
||||
float c = dot(lightToCamera, lightToCamera) - (_VolumetricLight.z * _VolumetricLight.z);
|
||||
|
||||
float d = sqrt((b*b) - c);
|
||||
float start = -b - d;
|
||||
float end = -b + d;
|
||||
|
||||
float linearDepth = LinearEyeDepth(depth);
|
||||
float projectedDepth = linearDepth / dot(_CameraForward, rayDir);
|
||||
end = min(end, projectedDepth);
|
||||
|
||||
rayStart = rayStart + rayDir * start;
|
||||
rayLength = end - start;
|
||||
|
||||
return RayMarch(i.pos.xy, rayStart, rayDir, rayLength);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// pass 3 - spot light, camera outside
|
||||
Pass
|
||||
{
|
||||
//ZTest Off
|
||||
ZTest[_ZTest]
|
||||
Cull Back
|
||||
ZWrite Off
|
||||
Blend One One
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment fragSpotOutside
|
||||
#pragma target 3.5
|
||||
#pragma exclude_renderers d3d9 gles
|
||||
|
||||
#define UNITY_HDR_ON
|
||||
|
||||
#pragma shader_feature HEIGHT_FOG
|
||||
#pragma shader_feature SHADOWS_DEPTH
|
||||
#pragma shader_feature NOISE
|
||||
#pragma shader_feature SPOT
|
||||
|
||||
#ifdef SHADOWS_DEPTH
|
||||
#define SHADOWS_NATIVE
|
||||
#endif
|
||||
|
||||
float _CosAngle;
|
||||
float4 _ConeAxis;
|
||||
float4 _ConeApex;
|
||||
float _PlaneD;
|
||||
|
||||
fixed4 fragSpotOutside(v2f i) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
float2 uv = i.uv.xy / i.uv.w;
|
||||
|
||||
// read depth and reconstruct world position
|
||||
float depth = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, UnityStereoScreenSpaceUVAdjust(uv,_CameraDepthTexture_ST));
|
||||
|
||||
float3 rayStart = _WorldSpaceCameraPos;
|
||||
float3 rayEnd = i.wpos;
|
||||
|
||||
float3 rayDir = (rayEnd - rayStart);
|
||||
float rayLength = length(rayDir);
|
||||
|
||||
rayDir /= rayLength;
|
||||
|
||||
|
||||
// inside cone
|
||||
float3 r1 = rayEnd + rayDir * 0.001;
|
||||
|
||||
// plane intersection
|
||||
float planeCoord = RayPlaneIntersect(_ConeAxis, _PlaneD, r1, rayDir);
|
||||
// ray cone intersection
|
||||
float2 lineCoords = RayConeIntersect(_ConeApex, _ConeAxis, _CosAngle, r1, rayDir);
|
||||
|
||||
float linearDepth = LinearEyeDepth(depth);
|
||||
float projectedDepth = linearDepth / dot(_CameraForward, rayDir);
|
||||
|
||||
float z = (projectedDepth - rayLength);
|
||||
rayLength = min(planeCoord, min(lineCoords.x, lineCoords.y));
|
||||
rayLength = min(rayLength, z);
|
||||
|
||||
return RayMarch(i.pos.xy, rayEnd, rayDir, rayLength);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// pass 4 - directional light
|
||||
Pass
|
||||
{
|
||||
ZTest Off
|
||||
Cull Off
|
||||
ZWrite Off
|
||||
Blend One One, One Zero
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vertDir
|
||||
#pragma fragment fragDir
|
||||
#pragma target 3.5
|
||||
#pragma exclude_renderers d3d9 gles
|
||||
|
||||
#define UNITY_HDR_ON
|
||||
|
||||
#pragma shader_feature HEIGHT_FOG
|
||||
#pragma shader_feature NOISE
|
||||
#pragma shader_feature SHADOWS_DEPTH
|
||||
#pragma shader_feature DIRECTIONAL_COOKIE
|
||||
#pragma shader_feature DIRECTIONAL
|
||||
|
||||
#ifdef SHADOWS_DEPTH
|
||||
#define SHADOWS_NATIVE
|
||||
#endif
|
||||
|
||||
v2f vertDir(appdata_img v)
|
||||
{
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v); //Insert
|
||||
UNITY_INITIALIZE_OUTPUT(v2f, o); //Insert
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); //Ins
|
||||
o.pos = v.vertex * float4(2,2,1,1) + float4(-1,-1,0,0);
|
||||
o.uv.xy = v.texcoord.xy;
|
||||
#if UNITY_UV_STARTS_AT_TOP
|
||||
o.uv.y = 1.0f - o.uv.y; //blit flips the uv for some reason
|
||||
#endif
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 fragDir(v2f i) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
float2 uv = i.uv.xy;
|
||||
|
||||
float depth = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, UnityStereoScreenSpaceUVAdjust(uv, _CameraDepthTexture_ST));
|
||||
|
||||
float4x4 proj, eyeToWorld;
|
||||
if (unity_StereoEyeIndex == 0)
|
||||
{
|
||||
proj = _LeftViewFromScreen;
|
||||
eyeToWorld = _LeftWorldFromView;
|
||||
}
|
||||
else
|
||||
{
|
||||
proj = _RightViewFromScreen;
|
||||
eyeToWorld = _RightWorldFromView;
|
||||
}
|
||||
|
||||
//bit of matrix math to take the screen space coord (u,v,depth) and transform to world space
|
||||
float2 uvClip = i.uv * 2.0 - 1.0;
|
||||
float clipDepth = depth; // Fix for OpenGl Core thanks to Lars Bertram
|
||||
clipDepth = (UNITY_NEAR_CLIP_VALUE < 0) ? clipDepth * 2 - 1 : clipDepth;
|
||||
float4 clipPos = float4(uvClip, clipDepth, 1.0);
|
||||
float4 viewPos = mul(proj, clipPos); // inverse projection by clip position
|
||||
viewPos /= viewPos.w; // perspective division
|
||||
float3 wpos = mul(eyeToWorld, viewPos).xyz;
|
||||
|
||||
|
||||
//float3 wpos = i.interpolatedRay + _WorldSpaceCameraPos;
|
||||
|
||||
float linearDepth = Linear01Depth(depth);
|
||||
|
||||
float3 rayStart = _WorldSpaceCameraPos;
|
||||
float3 rayDir = wpos - _WorldSpaceCameraPos;
|
||||
|
||||
//Problem with VR?! Need more tests
|
||||
//rayDir *= linearDepth;
|
||||
|
||||
float rayLength = length(rayDir);
|
||||
rayDir /= rayLength;
|
||||
|
||||
rayLength = min(rayLength, _MaxRayLength);
|
||||
|
||||
float4 color = RayMarch(i.pos.xy, rayStart, rayDir, rayLength);
|
||||
|
||||
|
||||
if (linearDepth > 0.999999)
|
||||
{
|
||||
color.w = lerp(color.w, 1, _VolumetricLight.w);
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// pass 5 - black
|
||||
Pass
|
||||
{
|
||||
ZTest Off
|
||||
Cull Off
|
||||
ZWrite Off
|
||||
Blend One One, One Zero
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vertW
|
||||
#pragma fragment fragW
|
||||
#pragma target 3.5
|
||||
#pragma exclude_renderers d3d9 gles
|
||||
|
||||
#ifdef SHADOWS_DEPTH
|
||||
#define SHADOWS_NATIVE
|
||||
#endif
|
||||
|
||||
|
||||
v2f vertW(appdata_img i)
|
||||
{
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(i); //Insert
|
||||
UNITY_INITIALIZE_OUTPUT(v2f, o); //Insert
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); //Ins
|
||||
half index = i.vertex.z;
|
||||
i.vertex.z = 0.1;
|
||||
o.pos = UnityObjectToClipPos(i.vertex);
|
||||
o.uv.xy = i.texcoord.xy;
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 fragW(v2f i) : SV_Target
|
||||
{
|
||||
return float4(0,0,0,0);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d9f3d22da4b08c84eb26827873f2a233
|
||||
timeCreated: 1459178237
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,175 @@
|
||||
Shader "Enviro/Standard/Blit"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex("Base (RGB)", any) = "white" {}
|
||||
_CloudsTex("Clouds (RGB)", any) = "white" {}
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Pass
|
||||
{
|
||||
Cull Off
|
||||
ZWrite Off
|
||||
Ztest LEqual
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#pragma exclude_renderers gles
|
||||
#pragma multi_compile __ ENVIRO_DEPTHBLENDING
|
||||
|
||||
UNITY_DECLARE_SCREENSPACE_TEXTURE(_MainTex);
|
||||
uniform half4 _MainTex_ST;
|
||||
uniform half4 _MainTex_TexelSize;
|
||||
UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
|
||||
uniform half4 _CameraDepthTexture_ST;
|
||||
|
||||
uniform UNITY_DECLARE_SCREENSPACE_TEXTURE(_SubFrame);
|
||||
uniform half4 _SubFrame_ST;
|
||||
uniform UNITY_DECLARE_SCREENSPACE_TEXTURE(_PrevFrame);
|
||||
uniform half4 _PrevFrame_ST;
|
||||
|
||||
uniform float4x4 _Projection;
|
||||
uniform float4x4 _ProjectionSPVR;
|
||||
uniform float4x4 _InverseProjection;
|
||||
uniform float4x4 _InverseProjectionSPVR;
|
||||
|
||||
uniform float4x4 _InverseRotation;
|
||||
uniform float4x4 _InverseRotationSPVR;
|
||||
|
||||
uniform float4x4 _PreviousRotation;
|
||||
uniform float4x4 _PreviousRotationSPVR;
|
||||
|
||||
uniform float _FrameNumber;
|
||||
uniform float _ReprojectionPixelSize;
|
||||
|
||||
uniform float2 _SubFrameDimension;
|
||||
uniform float2 _FrameDimension;
|
||||
|
||||
|
||||
struct v2f {
|
||||
float4 position : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float2 uv1 : TEXCOORD1;
|
||||
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
v2f vert(appdata_img v)
|
||||
{
|
||||
v2f o;
|
||||
|
||||
UNITY_SETUP_INSTANCE_ID(v); //Insert
|
||||
UNITY_INITIALIZE_OUTPUT(v2f, o); //Insert
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); //Insert
|
||||
|
||||
o.position = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.texcoord;
|
||||
|
||||
#if UNITY_UV_STARTS_AT_TOP
|
||||
o.uv1 = v.texcoord.xy;
|
||||
if (_MainTex_TexelSize.y < 0)
|
||||
o.uv1.y = 1 - o.uv1.y;
|
||||
#endif
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 frag(v2f i) : COLOR
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
|
||||
#if UNITY_UV_STARTS_AT_TOP
|
||||
float4 main = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, UnityStereoScreenSpaceUVAdjust(i.uv1, _MainTex_ST));
|
||||
#else
|
||||
float4 main = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, UnityStereoScreenSpaceUVAdjust(i.uv, _MainTex_ST));
|
||||
#endif
|
||||
|
||||
float4 final = main;
|
||||
|
||||
|
||||
#ifndef ENVIRO_DEPTHBLENDING
|
||||
|
||||
#if UNITY_UV_STARTS_AT_TOP
|
||||
float depthSample = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, UnityStereoScreenSpaceUVAdjust(i.uv1.xy, _CameraDepthTexture_ST));
|
||||
#else
|
||||
float depthSample = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, UnityStereoScreenSpaceUVAdjust(i.uv.xy, _CameraDepthTexture_ST));
|
||||
#endif
|
||||
|
||||
depthSample = Linear01Depth(depthSample);
|
||||
|
||||
if (depthSample > 0.9999)
|
||||
{
|
||||
#endif
|
||||
|
||||
float2 uv = (floor(i.uv * _FrameDimension) + 0.5) / _FrameDimension;
|
||||
float2 uv2 = (floor(i.uv * _SubFrameDimension) + 0.5) / _SubFrameDimension;
|
||||
|
||||
float x = fmod(uv.x, _ReprojectionPixelSize);
|
||||
float y = fmod(uv.y, _ReprojectionPixelSize);
|
||||
float currentFrame = y * _ReprojectionPixelSize + x;
|
||||
|
||||
float4 cloud;
|
||||
|
||||
if (currentFrame == _FrameNumber)
|
||||
{
|
||||
cloud = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_SubFrame, UnityStereoScreenSpaceUVAdjust(uv2, _MainTex_ST));
|
||||
}
|
||||
else
|
||||
{
|
||||
float4 reprojection;
|
||||
float4 pos = float4(i.uv * 2.0 - 1.0, 1.0, 1.0);
|
||||
|
||||
#if UNITY_SINGLE_PASS_STEREO || ENVIRO_SINGLEPASSINSTANCED
|
||||
if (unity_StereoEyeIndex == 0)
|
||||
{
|
||||
pos = mul(_InverseProjection, pos);
|
||||
pos = pos / pos.w;
|
||||
pos.xyz = mul((float3x3)_InverseRotation, pos.xyz);
|
||||
pos.xyz = mul((float3x3)_PreviousRotation, pos.xyz);
|
||||
|
||||
reprojection = mul(_Projection, pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = mul(_InverseProjectionSPVR, pos);
|
||||
pos = pos / pos.w;
|
||||
pos.xyz = mul((float3x3)_InverseRotationSPVR, pos.xyz);
|
||||
pos.xyz = mul((float3x3)_PreviousRotationSPVR, pos.xyz);
|
||||
|
||||
reprojection = mul(_ProjectionSPVR, pos);
|
||||
}
|
||||
#else
|
||||
pos = mul(_InverseProjection, pos);
|
||||
pos = pos / pos.w;
|
||||
pos.xyz = mul((float3x3)_InverseRotation, pos.xyz);
|
||||
pos.xyz = mul((float3x3)_PreviousRotation, pos.xyz);
|
||||
|
||||
reprojection = mul(_Projection, pos);
|
||||
#endif
|
||||
|
||||
if (reprojection.y < 0.0 || reprojection.y > 1.0 || reprojection.x < 0.0 || reprojection.x > 1.0)
|
||||
{
|
||||
cloud = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_SubFrame, UnityStereoScreenSpaceUVAdjust(i.uv, _MainTex_ST));
|
||||
}
|
||||
else
|
||||
{
|
||||
cloud = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_PrevFrame, UnityStereoScreenSpaceUVAdjust(reprojection.xy, _MainTex_ST));
|
||||
}
|
||||
}
|
||||
|
||||
final = float4 (main * (1 - cloud.a) + cloud.rgb * cloud.a, 1.0);
|
||||
|
||||
#ifndef ENVIRO_DEPTHBLENDING
|
||||
}
|
||||
#endif
|
||||
return final;
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cb6002680e4d34e4f8df84689f672fcb
|
||||
timeCreated: 1506988736
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
Shader "Hidden/Enviro/Upsample"
|
||||
{
|
||||
SubShader
|
||||
{
|
||||
Pass
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off Fog{ Mode Off }
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
UNITY_DECLARE_SCREENSPACE_TEXTURE(_LowResTexture);
|
||||
UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthLowRes);
|
||||
UNITY_DECLARE_SCREENSPACE_TEXTURE(_MainTex);
|
||||
UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
|
||||
float2 _LowResPixelSize;
|
||||
float2 _LowResTextureSize;
|
||||
float _DepthMult;
|
||||
float _Threshold;
|
||||
float4 _MainTex_TexelSize;
|
||||
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float4 uv : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float2 uv00 : TEXCOORD1;
|
||||
float2 uv10 : TEXCOORD2;
|
||||
float2 uv01 : TEXCOORD3;
|
||||
float2 uv11 : TEXCOORD4;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
v2f vert(appdata v)
|
||||
{
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_OUTPUT(v2f, o);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = UnityStereoTransformScreenSpaceTex(v.uv);
|
||||
o.uv00 = v.uv - 0.5 * _LowResPixelSize;
|
||||
o.uv10 = o.uv00 + float2(_LowResPixelSize.x, 0.0);
|
||||
o.uv01 = o.uv00 + float2(0.0, _LowResPixelSize.y);
|
||||
o.uv11 = o.uv00 + _LowResPixelSize;
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 ClosestDepthFast(v2f i)
|
||||
{
|
||||
float z00 = DecodeFloatRGBA(UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthLowRes, i.uv00));
|
||||
float z10 = DecodeFloatRGBA(UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthLowRes, i.uv10));
|
||||
float z01 = DecodeFloatRGBA(UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthLowRes, i.uv01));
|
||||
float z11 = DecodeFloatRGBA(UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthLowRes, i.uv11));
|
||||
|
||||
float zfull = Linear01Depth(SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, i.uv));
|
||||
|
||||
float dist00 = abs(z00 - zfull);
|
||||
float dist10 = abs(z10 - zfull);
|
||||
float dist01 = abs(z01 - zfull);
|
||||
float dist11 = abs(z11 - zfull);
|
||||
|
||||
float3 uvd00 = float3(i.uv00, dist00);
|
||||
float3 uvd10 = float3(i.uv10, dist10);
|
||||
float3 uvd01 = float3(i.uv01, dist01);
|
||||
float3 uvd11 = float3(i.uv11, dist11);
|
||||
|
||||
float3 finalUV = lerp(uvd10, uvd00, saturate(99999 * (uvd10.z - uvd00.z)));
|
||||
finalUV = lerp(uvd01, finalUV, saturate(99999 * (uvd01.z - finalUV.z)));
|
||||
finalUV = lerp(uvd11, finalUV, saturate(99999 * (uvd11.z - finalUV.z)));
|
||||
|
||||
float maxDist = max(max(max(dist00, dist10), dist01), dist11) - _Threshold;
|
||||
|
||||
fixed r = saturate(maxDist * 99999);
|
||||
float2 uv = lerp(i.uv, finalUV.xy, r);
|
||||
return UNITY_SAMPLE_SCREENSPACE_TEXTURE(_LowResTexture, uv);
|
||||
}
|
||||
|
||||
fixed4 frag(v2f i) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
return ClosestDepthFast(i);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
Fallback Off
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6e6470b3792ea7f45a1ad88440d75c5a
|
||||
timeCreated: 1554514626
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
Shader "Hidden/Enviro/DepthDownsample"
|
||||
{
|
||||
|
||||
CGINCLUDE
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
|
||||
float2 _PixelSize;
|
||||
float4 _MainTex_TexelSize;
|
||||
|
||||
v2f vert(appdata_img v)
|
||||
{
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_OUTPUT(v2f, o);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.texcoord.xy;
|
||||
return o;
|
||||
}
|
||||
|
||||
half4 frag(v2f i) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
|
||||
float d = Linear01Depth(SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, i.uv));
|
||||
|
||||
if (d>0.99999)
|
||||
return half4(1,1,1,1);
|
||||
else
|
||||
return EncodeFloatRGBA(d);
|
||||
}
|
||||
|
||||
ENDCG
|
||||
|
||||
|
||||
Subshader
|
||||
{
|
||||
Pass
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
Fallback off
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 897d02806d3ff664f9e08ff9e5d23ba1
|
||||
timeCreated: 1554514794
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
Shader "Enviro/Standard/FlatCloudMap" {
|
||||
Properties{
|
||||
|
||||
}
|
||||
SubShader{
|
||||
Tags { "RenderType" = "Opaque" }
|
||||
LOD 200
|
||||
Pass {
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#pragma target 3.0
|
||||
#pragma exclude_renderers gles
|
||||
|
||||
uniform sampler2D _NoiseTex;
|
||||
uniform float _Softness = 0.2;
|
||||
uniform float _Coverage = 0.6;
|
||||
uniform float _Brightness = 1.0;
|
||||
uniform float _CloudScale = 2.5;
|
||||
uniform float2 _CloudAnimation;
|
||||
uniform int noiseOctaves = 8;
|
||||
uniform float _MorphingSpeed;
|
||||
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 Position : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 pos : TEXCOORD1;
|
||||
};
|
||||
|
||||
v2f vert(appdata_img v)
|
||||
{
|
||||
v2f o;
|
||||
UNITY_INITIALIZE_OUTPUT(v2f, o);
|
||||
o.Position = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.texcoord;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
float noise(float2 uv)
|
||||
{
|
||||
return tex2D(_NoiseTex, uv).r;
|
||||
}
|
||||
|
||||
float2 rotate(float2 uv)
|
||||
{
|
||||
float curlStrain = 3.0;
|
||||
uv = uv + noise(uv*0.2)*0.005;
|
||||
float rot = curlStrain;
|
||||
float sinRot = sin(rot);
|
||||
float cosRot = cos(rot);
|
||||
float2x2 rotMat = float2x2(cosRot, -sinRot, sinRot, cosRot);
|
||||
return mul(rotMat,uv);
|
||||
}
|
||||
|
||||
float fbm(float2 uv)
|
||||
{
|
||||
float rot = 1.57;
|
||||
float sinRot = sin(rot);
|
||||
float cosRot = cos(rot);
|
||||
float f = 0.0;
|
||||
float total = 0.0;
|
||||
float mul = 0.5;
|
||||
float2x2 rotMat = float2x2(cosRot, -sinRot, sinRot, cosRot);
|
||||
float timeScale = 10.0;
|
||||
|
||||
for (int i = 0; i < noiseOctaves; i++)
|
||||
{
|
||||
f += noise(uv + _Time.y * (_MorphingSpeed * 0.0001) * timeScale * (1.0 - mul)) * mul;
|
||||
total += mul;
|
||||
uv *= 3.0;
|
||||
uv = rotate(uv);
|
||||
mul *= 0.5;
|
||||
}
|
||||
return f / total;
|
||||
}
|
||||
|
||||
float4 frag(v2f i) : SV_Target
|
||||
{
|
||||
|
||||
float timeScale = 2.0;
|
||||
float2 uv = i.pos.xy / (20.0 * _CloudScale);
|
||||
|
||||
float bright = _Brightness;
|
||||
|
||||
float color1 = fbm(uv - 0.5 + -_CloudAnimation * 0.1);
|
||||
float color2 = fbm(uv - 10.5 + -_CloudAnimation * 0.2);
|
||||
|
||||
float clouds1 = smoothstep(1.0 - _Coverage, min((1.0 - _Coverage) + _Softness * 2.0, 1.0), color1);
|
||||
float clouds2 = smoothstep(1.0 - _Coverage, min((1.0 - _Coverage) + _Softness, 1.0), color2);
|
||||
|
||||
float cloudsFormComb = saturate(clouds1 + clouds2);
|
||||
|
||||
float4 skyCol = float4(1,1,1,0.0);
|
||||
float cloudCol = saturate(saturate(1.0 - pow(color1, 1.0) * 0.2) * bright);
|
||||
float cloudCol2 = saturate(saturate(1.0 - pow(color2, 1.0) * 0.5) * bright);
|
||||
|
||||
float4 clouds1Color = float4(cloudCol, cloudCol, cloudCol, cloudsFormComb);
|
||||
float4 clouds2Color = lerp(clouds1Color, float4(cloudCol2, cloudCol2, cloudCol2, cloudCol2), clouds2);
|
||||
float4 cloudColComb = lerp(clouds1Color, clouds2Color, saturate(clouds2 - clouds1));
|
||||
|
||||
float4 final = lerp(skyCol, cloudColComb, cloudsFormComb);
|
||||
|
||||
return float4(final.rgb, cloudsFormComb);
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
FallBack "Diffuse"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c1cfc743f76fac6449270514fc84b6f7
|
||||
timeCreated: 1507124107
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||
|
||||
Shader "Enviro/Standard/MoonShaderPhased"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Moon Texture", 2D) = "white" {}
|
||||
_Phase ("Moon Phase", float) = 0
|
||||
_Brightness ("Moon Brightness", Range(0.1,5)) = 0.5
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags
|
||||
{"Queue"="Transparent"
|
||||
"RenderType"="Transparent"
|
||||
"IgnoreProjector"="True"
|
||||
}
|
||||
|
||||
Fog
|
||||
{
|
||||
Mode Off
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Cull Back
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
sampler2D _MainTex;
|
||||
float4 _MainTex_ST;
|
||||
float _Phase;
|
||||
float _Brightness;
|
||||
|
||||
struct v2f {
|
||||
float4 position : POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 uv_MainTex : TEXCOORD0;
|
||||
float3 normal : TEXCOORD1;
|
||||
float3 viewdir : TEXCOORD2;
|
||||
};
|
||||
|
||||
float MoonPhaseFactor(float2 uv, float phase)
|
||||
{
|
||||
float alpha = 1.0;
|
||||
|
||||
float srefx = uv.x - 0.5;
|
||||
float refx = abs(uv.x - 0.5);
|
||||
float refy = abs(uv.y - 0.5);
|
||||
float refxfory = sqrt(0.25 - refy * refy);
|
||||
float xmin = -refxfory;
|
||||
float xmax = refxfory;
|
||||
float xmin1 = (xmax - xmin) * (phase / 2) + xmin;
|
||||
float xmin2 = (xmax - xmin) * phase + xmin;
|
||||
if (srefx < xmin1) {
|
||||
alpha = 0;
|
||||
} else if (srefx < xmin2 && xmin1 != xmin2) {
|
||||
alpha = (srefx - xmin1) / (xmin2 - xmin1);
|
||||
}
|
||||
return alpha;
|
||||
}
|
||||
|
||||
v2f vert(appdata_base v) {
|
||||
v2f o;
|
||||
|
||||
float phaseabs = abs(_Phase);
|
||||
float3 offset = 10 * float3(_Phase, -phaseabs, -phaseabs);
|
||||
|
||||
float3 normal = v.normal;
|
||||
float3 viewdir = normalize(ObjSpaceViewDir(v.vertex));
|
||||
|
||||
o.position = UnityObjectToClipPos(v.vertex);
|
||||
o.color.rgb = 1 - phaseabs;
|
||||
o.color.a = 1;
|
||||
o.uv_MainTex = TRANSFORM_TEX(v.texcoord, _MainTex);
|
||||
o.normal = v.normal;
|
||||
o.viewdir = normalize(viewdir + offset);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag(v2f i) : COLOR {
|
||||
fixed4 color = i.color;
|
||||
|
||||
float alpha = MoonPhaseFactor(i.uv_MainTex, abs(_Phase));
|
||||
fixed shading = max(0, dot(i.normal, i.viewdir));
|
||||
color.rgb *= pow(shading, 0.5);
|
||||
|
||||
// Moon texture
|
||||
fixed3 moontex = tex2D(_MainTex, i.uv_MainTex);
|
||||
color.rgb *= moontex.rgb * 2.5;
|
||||
|
||||
float lum = dot(color.rgb, float3(0.8, 0.8, 0.8));
|
||||
color.a = min(color.a, lum * alpha);
|
||||
color.rgb = saturate(1.0 - exp(-_Brightness * color.rgb));
|
||||
return color;
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7a0acf2dae5705a47b6458d7c791cace
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
+419
@@ -0,0 +1,419 @@
|
||||
Shader "Enviro/Standard/RaymarchClouds"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Cull Off ZWrite Off ZTest Always
|
||||
|
||||
Tags{ "RenderType" = "Opaque" }
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma target 3.0
|
||||
#pragma exclude_renderers gles d3d9
|
||||
#pragma multi_compile __ UNITY_COLORSPACE_GAMMA
|
||||
#pragma multi_compile __ ENVIRO_DEPTHBLENDING
|
||||
#pragma multi_compile __ ENVIRO_CURLNOISE
|
||||
#pragma multi_compile __ ENVIRO_HALTONOFFSET
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "../../../Core/Resources/Shaders/Core/EnviroFogCore.cginc"
|
||||
#include "Core/EnviroVolumeCloudsCore.cginc"
|
||||
|
||||
uniform half4 _MainTex_ST;
|
||||
float4x4 _LeftWorldFromView;
|
||||
float4x4 _RightWorldFromView;
|
||||
float4x4 _LeftViewFromScreen;
|
||||
float4x4 _RightViewFromScreen;
|
||||
|
||||
#ifdef ENVIRO_HALTONOFFSET
|
||||
float _RaymarchOffset;
|
||||
float4 _TexelSize;
|
||||
#else
|
||||
#define BAYER_FACTOR (1.0/16.0)
|
||||
const float bayerFilter[16] =
|
||||
{
|
||||
0.0*(1.0 / 16.0) ,
|
||||
8.0*(1.0 / 16.0),
|
||||
2.0*(1.0 / 16.0),
|
||||
10.0*(1.0 / 16.0),
|
||||
12.0*(1.0 / 16.0),
|
||||
4.0*(1.0 / 16.0),
|
||||
14.0*(1.0 / 16.0),
|
||||
6.0*(1.0 / 16.0),
|
||||
3.0*(1.0 / 16.0),
|
||||
11.0*(1.0 / 16.0),
|
||||
1.0*(1.0 / 16.0),
|
||||
9.0*(1.0 / 16.0),
|
||||
15.0*(1.0 / 16.0),
|
||||
7.0*(1.0 / 16.0),
|
||||
13.0*(1.0 / 16.0),
|
||||
5.0*(1.0 / 16.0)
|
||||
};
|
||||
#endif
|
||||
float3 ScreenSpaceDither(float2 vScreenPos, float3 clr)
|
||||
{
|
||||
float d = dot(float2(131.0, 312.0), vScreenPos.xy + _Time.y);
|
||||
float3 vDither = float3(d, d, d);
|
||||
vDither.rgb = frac(vDither.rgb / float3(103.0, 71.0, 97.0)) - float3(0.5, 0.5, 0.5);
|
||||
return (vDither.rgb / 15.0) * 1.0 * Luminance(clr);
|
||||
}
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 position : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float3 sky : TEXCOORD1;
|
||||
float4 screenPos : TEXCOORD2;
|
||||
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
|
||||
v2f vert(appdata_img v)
|
||||
{
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_OUTPUT(v2f, o);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
o.position = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.texcoord;
|
||||
o.sky.x = saturate(_SunDir.y + 0.25);
|
||||
o.sky.y = saturate(clamp(1.0 - _SunDir.y, 0.0, 0.5));
|
||||
o.screenPos = ComputeScreenPos(o.position);
|
||||
return o;
|
||||
}
|
||||
|
||||
|
||||
float4 frag(v2f i) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
|
||||
|
||||
//return lerp(float4(1, 1, 1, 1), float4(0, 0, 0, 0), unity_StereoEyeIndex);
|
||||
|
||||
|
||||
float4 cameraRay = float4(i.uv * 2.0 - 1.0, 1.0, 1.0);
|
||||
//World Space
|
||||
float3 EyePosition = _CameraPosition;
|
||||
float3 EyePositionDepth = _WorldSpaceCameraPos;
|
||||
//Workaround for large scale games where player position will be resetted.
|
||||
//float3 EyePosition = float3(0.0,_CameraPosition.y, 0.0);
|
||||
|
||||
float2 sPos = i.position.xy;
|
||||
|
||||
float3 ray = 0;
|
||||
|
||||
//#if UNITY_SINGLE_PASS_STEREO
|
||||
if (unity_StereoEyeIndex == 0)
|
||||
{
|
||||
cameraRay = mul(_InverseProjection, cameraRay);
|
||||
cameraRay = cameraRay / cameraRay.w;
|
||||
ray = normalize(mul((float3x3)_InverseRotation, cameraRay.xyz));
|
||||
}
|
||||
else
|
||||
{
|
||||
cameraRay = mul(_InverseProjection_SP, cameraRay);
|
||||
cameraRay = cameraRay / cameraRay.w;
|
||||
ray = normalize(mul((float3x3)_InverseRotation_SP, cameraRay.xyz));
|
||||
}
|
||||
//#else
|
||||
// cameraRay = mul(_InverseProjection, cameraRay);
|
||||
// cameraRay = cameraRay / cameraRay.w;
|
||||
// ray = normalize(mul((float3x3)_InverseRotation, cameraRay.xyz));
|
||||
//#endif
|
||||
|
||||
float rawDepth = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, UnityStereoTransformScreenSpaceTex(i.uv));
|
||||
bool depthPresent = rawDepth > 0.0;
|
||||
float dpth = Linear01Depth(rawDepth);
|
||||
|
||||
#ifdef ENVIRO_DEPTHBLENDING
|
||||
float4x4 proj, eyeToWorld;
|
||||
|
||||
if (unity_StereoEyeIndex == 0)
|
||||
{
|
||||
proj = _LeftViewFromScreen;
|
||||
eyeToWorld = _LeftWorldFromView;
|
||||
}
|
||||
else
|
||||
{
|
||||
proj = _RightViewFromScreen;
|
||||
eyeToWorld = _RightWorldFromView;
|
||||
}
|
||||
|
||||
//bit of matrix math to take the screen space coord (u,v,depth) and transform to world space
|
||||
float2 uvClip = i.uv * 2.0 - 1.0;
|
||||
float clipDepth = rawDepth; // Fix for OpenGl Core thanks to Lars Bertram
|
||||
clipDepth = (UNITY_NEAR_CLIP_VALUE < 0) ? clipDepth * 2 - 1 : clipDepth;
|
||||
float4 clipPos = float4(uvClip, clipDepth, 1.0);
|
||||
float4 viewPos = mul(proj, clipPos); // inverse projection by clip position
|
||||
viewPos /= viewPos.w; // perspective division
|
||||
float4 wsPos = float4(mul(eyeToWorld, viewPos).xyz, 1);
|
||||
float4 wsDir = wsPos - float4(EyePosition, 0);
|
||||
float3 viewDir = normalize(wsDir);
|
||||
#endif
|
||||
|
||||
float4 sky = ComputeScatteringClouds(ray, i.sky.xy, _gameTime);
|
||||
float4 color = float4(0,0,0,1);
|
||||
|
||||
float3 LightDirection = _LightDir;
|
||||
float3 LightColor = _LightColor.rgb;
|
||||
|
||||
//Switch to Moon Light Color
|
||||
if (_CloudDensityScale.w < _CloudDensityScale.z)
|
||||
LightColor = _MoonLightColor.rgb;
|
||||
|
||||
float pRad = _CloudsParameter.w;
|
||||
float3 pCent = float3(EyePosition.x, -pRad, EyePosition.z);
|
||||
|
||||
float3 startPos;
|
||||
float3 endPos;
|
||||
|
||||
// find nearest inner shell point
|
||||
float2 ih = 0.0f;
|
||||
uint innerShellHits = intersectRaySphere(
|
||||
EyePosition,
|
||||
ray,
|
||||
pCent,
|
||||
pRad + _CloudsParameter.x,
|
||||
ih);
|
||||
|
||||
// find nearest outer shell point
|
||||
float2 oh = 0.0f;
|
||||
uint outerShellHits = intersectRaySphere(
|
||||
EyePosition,
|
||||
ray,
|
||||
pCent,
|
||||
pRad + _CloudsParameter.y,
|
||||
oh);
|
||||
|
||||
// world space ray intersections
|
||||
float3 innerShellHit = EyePositionDepth + (ray * ih.x);
|
||||
float3 outerShellHit = EyePositionDepth + (ray * oh.x);
|
||||
|
||||
float2 hitDistance;
|
||||
// eye radius from planet center
|
||||
float ch = length(EyePosition - pCent) - _CloudsParameter.w;
|
||||
|
||||
if (ch < _CloudsParameter.x)
|
||||
{
|
||||
|
||||
#ifdef ENVIRO_DEPTHBLENDING
|
||||
// exit if there's something in front of the start of the cloud volume
|
||||
if ((depthPresent && (distance(wsPos, EyePositionDepth) < distance(innerShellHit, EyePositionDepth))) || ray.y < -0.05) // shell hits are guaranteed, but the ground may be occluding cloud layer
|
||||
{
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
#else
|
||||
|
||||
if (ray.y < -0.02)
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
#endif
|
||||
|
||||
endPos = outerShellHit;
|
||||
|
||||
hitDistance = float2(ih.x, oh.x);
|
||||
}
|
||||
else if (ch > _CloudsParameter.y)
|
||||
{
|
||||
float3 firstShellHit = outerShellHit;
|
||||
float3 secondShellHit = outerShellHits == 2u && innerShellHits == 0u ? EyePosition + (ray * oh.y) : innerShellHit;
|
||||
|
||||
#ifdef ENVIRO_DEPTHBLENDING
|
||||
if (outerShellHits == 0u || depthPresent && (distance(wsPos, EyePositionDepth) <= distance(firstShellHit, EyePositionDepth)))
|
||||
{
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
#endif
|
||||
|
||||
endPos = secondShellHit;
|
||||
|
||||
float hit2 = outerShellHits == 2u && innerShellHits == 0u ? oh.y : ih.x;
|
||||
hitDistance = float2(oh.x, hit2);
|
||||
|
||||
}
|
||||
else // between shells
|
||||
{
|
||||
float3 shellHit = innerShellHits > 0u ? innerShellHit : outerShellHit;
|
||||
float hit = innerShellHits > 0u ? ih.x : oh.x;
|
||||
float height = Remap(EyePosition.y, _CloudsParameter.x, _CloudsParameter.y, 0, 1);
|
||||
hitDistance = ResolveInside(EyePosition.xyz, ray, lerp(25000, 100000, height));
|
||||
|
||||
#ifdef ENVIRO_DEPTHBLENDING
|
||||
if (depthPresent && (distance(wsPos, EyePositionDepth) < distance(shellHit, EyePositionDepth)))
|
||||
{
|
||||
shellHit = wsPos;
|
||||
hitDistance.y = (wsPos - EyePositionDepth) / viewDir;
|
||||
}
|
||||
#endif
|
||||
endPos = shellHit;
|
||||
|
||||
//float reducedDistance = 500 * (1.0 + 0.0) / (1 * lerp(1.0, 0.015, smoothstep(-0.2, -0.6, 0.1)));
|
||||
//hit = min(hit, 0.0 + reducedDistance);
|
||||
//hitDistance = float2(0.0, hit);
|
||||
}
|
||||
|
||||
hitDistance.x = max(0.0, hitDistance.x);
|
||||
///
|
||||
|
||||
int steps = (int)lerp(_Steps.x, _Steps.x, ray.y);
|
||||
float rayStepLength = (1 * (hitDistance.y - hitDistance.x) / steps);
|
||||
float3 rayStep = ray * rayStepLength;
|
||||
|
||||
#ifdef ENVIRO_HALTONOFFSET
|
||||
const float bayerOffsets[3][3] = {
|
||||
{ 0, 7, 3 },
|
||||
{ 6, 5, 2 },
|
||||
{ 4, 1, 8 }
|
||||
};
|
||||
|
||||
float2 screenPos = i.screenPos.xy / i.screenPos.w;
|
||||
int2 texelID = int2(fmod(screenPos / _TexelSize, 3.0)); //Calculate a texel id to index bayer matrix.
|
||||
|
||||
float bayerOffset = (bayerOffsets[texelID.x][texelID.y]) / 9.0f; //bayeroffset between[0,1)
|
||||
float offset = -fmod(_RaymarchOffset + bayerOffset, 1.0f); //final offset combined. The value will be multiplied by sample step in GetDensity.
|
||||
|
||||
float3 pos = (EyePosition + (hitDistance.x + offset * rayStepLength) * ray);
|
||||
rayStepLength = rayStepLength * offset;
|
||||
|
||||
#else
|
||||
float3 pos = (EyePosition + (hitDistance.x + rayStepLength) * ray);
|
||||
uint a = uint(i.uv.x) % 4;
|
||||
uint b = uint(i.uv.y) % 4;
|
||||
pos += bayerFilter[a * 4 + b] * rayStep;
|
||||
#endif
|
||||
|
||||
float cloud_test = 0.0;
|
||||
int zero_density_sample_count = 0;
|
||||
float sampled_density_previous = -1.0;
|
||||
float ds = 0.0;
|
||||
float trans = 1.0;
|
||||
float intensity = 0.0;
|
||||
float alpha = 1.0;
|
||||
float eyeToEnd = distance(EyePosition, endPos);
|
||||
float lod = saturate((0.5 - Remap(eyeToEnd, 0, _CloudsParameter.w * 0.1, 0, 1.25) ) * 1.25);
|
||||
float inScatteringAngle = dot(normalize(ray), normalize(LightDirection));
|
||||
|
||||
#ifndef ENVIRO_DEPTHBLENDING
|
||||
// Reduce steps when rendering behind objects.
|
||||
if (dpth < 1)
|
||||
steps *= _stepsInDepth;
|
||||
#else
|
||||
#endif
|
||||
//Raymarching
|
||||
[loop]
|
||||
for (int i = 0; i < steps; i++)
|
||||
{
|
||||
|
||||
#ifdef ENVIRO_HALTONOFFSET
|
||||
pos += rayStep;
|
||||
#endif
|
||||
//Calculate projection height
|
||||
float height = GetSamplingHeight(pos, pCent);
|
||||
|
||||
//Get out of expensive raymarching
|
||||
if (alpha <= 0.01 || height > 1.0 || height < 0.0 || _CloudsCoverageSettings.x <= -0.9)
|
||||
break;
|
||||
|
||||
// Get Weather Data
|
||||
float3 weather = GetWeather(pos);
|
||||
|
||||
if (cloud_test > 0.0)
|
||||
{
|
||||
float sampled_density = CalculateCloudDensity(pos, pCent, weather, 0, lod, true);
|
||||
|
||||
if (sampled_density == 0.0 && sampled_density_previous == 0.0)
|
||||
{
|
||||
zero_density_sample_count++;
|
||||
}
|
||||
|
||||
if (zero_density_sample_count < 11 && sampled_density != 0.0)
|
||||
{
|
||||
float dl = GetDensityAlongRay(pos, pCent, LightDirection, weather, lod);
|
||||
ds += saturate(sampled_density);
|
||||
|
||||
float extinction = _CloudDensityScale.x * sampled_density;
|
||||
float transmittance = exp(-extinction );
|
||||
|
||||
float hg = max(HenryGreenstein(inScatteringAngle, _CloudsLighting.y) * 0.5, _CloudsLighting.z * 2 * HenryGreenstein(inScatteringAngle, 0.99 - _CloudsLighting.w));
|
||||
float luminance = GetLightEnergy(pos, height, dl, ds, hg, inScatteringAngle, rayStepLength, _CloudsLighting.x, weather);
|
||||
|
||||
float integScatt = (luminance - luminance * transmittance);
|
||||
|
||||
intensity += trans * integScatt;
|
||||
trans *= transmittance;
|
||||
alpha *= max(trans, 0.0);
|
||||
|
||||
float3 sunLight = pow(LightColor, 2) * _LightIntensity;
|
||||
sunLight.rgb = sunLight.rgb * intensity * saturate(alpha);
|
||||
color.rgb += sunLight.rgb;
|
||||
|
||||
if (alpha <= _CloudsCoverageSettings.z)
|
||||
alpha = 0.0;
|
||||
}
|
||||
// if not, then set cloud_test to zero so that we go back to the cheap sample case
|
||||
else
|
||||
{
|
||||
cloud_test = 0.0;
|
||||
zero_density_sample_count = 0;
|
||||
}
|
||||
|
||||
sampled_density_previous = sampled_density;
|
||||
}
|
||||
else
|
||||
{
|
||||
// sample density the cheap way, only using the low frequency noise
|
||||
cloud_test = CalculateCloudDensity(pos, pCent, weather, 0, lod, false);
|
||||
|
||||
if (cloud_test == 0.0)
|
||||
{
|
||||
pos += rayStep * 2;
|
||||
}
|
||||
else //take a step back and capture area we skipped.
|
||||
{
|
||||
pos -= rayStep;
|
||||
}
|
||||
}
|
||||
#ifndef ENVIRO_HALTONOFFSET
|
||||
pos += rayStep;
|
||||
#endif
|
||||
}
|
||||
|
||||
color.a = saturate(1 - alpha);
|
||||
|
||||
// Ambient Lighting
|
||||
float3 ambientColor = (sky.rgb * _AmbientLightColor.rgb);
|
||||
color = color + float4(ambientColor * _AmbientSkyColorIntensity * _CloudsLightingExtended.y, 0) * saturate(1 - (color));
|
||||
|
||||
//Tonemapping
|
||||
if (_CloudsLightingExtended.z == 0)
|
||||
{
|
||||
color.rgb = tonemapACES(color.rgb, _CloudsLightingExtended.w);
|
||||
}
|
||||
|
||||
//Dithering
|
||||
color.rgb += ScreenSpaceDither(sPos, color.rgb);
|
||||
|
||||
|
||||
#if defined(UNITY_COLORSPACE_GAMMA)
|
||||
color.rgb = LinearToGammaSpace(color.rgb);
|
||||
#endif
|
||||
return color;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e7d19434a8599346833ad990a557ac5
|
||||
timeCreated: 1472025985
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||
|
||||
Shader "Enviro/Standard/ShadowCookie"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Texture", 2D) = "white" {}
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
// No culling or depth
|
||||
Cull Off ZWrite Off ZTest Always
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma target 2.0
|
||||
#include "UnityCG.cginc"
|
||||
#pragma exclude_renderers gles
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
};
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.uv;
|
||||
return o;
|
||||
}
|
||||
|
||||
uniform sampler2D _MainTex;
|
||||
uniform float _shadowIntensity;
|
||||
uniform int _shadowMode;
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
fixed4 col = 1 - (tex2D(_MainTex, i.uv) * _shadowIntensity);
|
||||
return float4(col.r,col.r,col.r,col.r);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 46afaaf9d09758a48b16c30a783221a8
|
||||
timeCreated: 1512200192
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+469
@@ -0,0 +1,469 @@
|
||||
|
||||
Shader "Enviro/Standard/Skybox"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_Stars("Stars Cubemap", Cube) = "black" {}
|
||||
_StarsTwinklingNoise("Stars Noise", Cube) = "black" {}
|
||||
_Galaxy("Galaxy Cubemap", Cube) = "black" {}
|
||||
_SatTex("Satellites Tex", 2D) = "black" {}
|
||||
_MoonTex("Moon Tex", 2D) = "black" {}
|
||||
_GlowTex("Glow Tex", 2D) = "black" {}
|
||||
_Aurora_Layer_1("Aurora Layer 1", 2D) = "black" {}
|
||||
_Aurora_Layer_2("Aurora Layer 2", 2D) = "black" {}
|
||||
_Aurora_Colorshift("Aurora Color Shift", 2D) = "black" {}
|
||||
//_Background("Background Cubemap", Cube) = "black" {}
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags{ "Queue" = "Background" "RenderType" = "Background" "PreviewType" = "Skybox" }
|
||||
Cull Off
|
||||
Fog{ Mode Off }
|
||||
ZWrite Off
|
||||
|
||||
Pass
|
||||
{
|
||||
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile __ UNITY_COLORSPACE_GAMMA
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
uniform float3 _Br;
|
||||
uniform float3 _Bm;
|
||||
uniform float3 _mieG;
|
||||
uniform float _SunIntensity;
|
||||
uniform float _Tonemapping;
|
||||
uniform float _SkyExposure;
|
||||
uniform float _SkyLuminance;
|
||||
uniform float _scatteringPower;
|
||||
uniform float _SunDiskSize;
|
||||
uniform float _SunDiskIntensity;
|
||||
uniform float _StarsIntensity;
|
||||
uniform float4 _scatteringColor;
|
||||
uniform float4 _sunDiskColor;
|
||||
uniform samplerCUBE _Stars;
|
||||
uniform samplerCUBE _StarsTwinklingNoise;
|
||||
uniform float4x4 _StarsMatrix;
|
||||
uniform float4x4 _StarsTwinklingMatrix;
|
||||
uniform float _SkyColorPower;
|
||||
uniform float3 _SunDir;
|
||||
uniform float3 _MoonDir;
|
||||
uniform float4 _weatherSkyMod;
|
||||
uniform float4 _moonGlowColor;
|
||||
uniform sampler2D _MoonTex;
|
||||
uniform sampler2D _GlowTex;
|
||||
uniform sampler2D _SatTex;
|
||||
uniform float4 _MoonColor;
|
||||
uniform float4 _moonParams;
|
||||
uniform float _GalaxyIntensity;
|
||||
uniform samplerCUBE _Galaxy;
|
||||
uniform int _blackGround;
|
||||
uniform float _StarsTwinkling;
|
||||
uniform float _DitheringIntensity;
|
||||
|
||||
//uniform samplerCUBE _Background;
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float3 texcoord : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 Position : SV_POSITION;
|
||||
float4 moonPos : TEXCOORD0;
|
||||
float4 sky : TEXCOORD1;
|
||||
float night : TEXCOORD2;
|
||||
float3 texcoord : TEXCOORD3;
|
||||
float3 starPos : TEXCOORD4;
|
||||
float4 screenUV : TEXCOORD5;
|
||||
float3 starsTwinklingPos : TEXCOORD6;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
v2f vert(appdata v)
|
||||
{
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_OUTPUT(v2f, o);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
o.Position = UnityObjectToClipPos(v.vertex);
|
||||
float3 viewDir = normalize(v.texcoord + float3(0.0,0.1,0.0));
|
||||
|
||||
o.sky.x = saturate(_SunDir.y + 0.25);
|
||||
o.sky.y = saturate(clamp(1.0 - _SunDir.y, 0.0, 0.5));
|
||||
o.sky.z = saturate(dot(-_MoonDir.xyz,viewDir));
|
||||
|
||||
float3 r = normalize(cross(_MoonDir.xyz, float3(0, -1, 0)));
|
||||
float3 u = cross(_MoonDir.xyz,r);
|
||||
o.moonPos.xy = float2(dot(r, v.vertex.xyz), dot(u, v.vertex.xyz)) * (21.0 - _moonParams.x) + 0.5;
|
||||
o.moonPos.zw = float2(dot(r, v.vertex.xyz), dot(u, v.vertex.xyz)) * (21.0 - _moonParams.y) + 0.5;
|
||||
|
||||
o.starPos = mul((float3x3)_StarsMatrix,v.vertex.xyz);
|
||||
o.starsTwinklingPos = mul((float3x3)_StarsTwinklingMatrix, v.vertex.xyz);
|
||||
o.night = pow(max(0.0,viewDir.y),1.25);
|
||||
o.texcoord = v.texcoord;
|
||||
o.screenUV = ComputeScreenPos(o.Position);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
float MoonPhaseFactor(float2 uv, float phase)
|
||||
{
|
||||
float alpha = 1.0;
|
||||
|
||||
|
||||
float srefx = uv.x - 0.5;
|
||||
float refx = abs(uv.x - 0.5);
|
||||
|
||||
if (phase > 0)
|
||||
{
|
||||
srefx = (1 - uv.x) - 0.5;
|
||||
refx = abs((1 - uv.x) - 0.5);
|
||||
}
|
||||
|
||||
phase = abs(_moonParams.w);
|
||||
float refy = abs(uv.y - 0.5);
|
||||
float refxfory = sqrt(0.25 - refy * refy);
|
||||
float xmin = -refxfory;
|
||||
float xmax = refxfory;
|
||||
float xmin1 = (xmax - xmin) * (phase / 2) + xmin;
|
||||
float xmin2 = (xmax - xmin) * phase + xmin;
|
||||
|
||||
if (srefx < xmin1)
|
||||
{
|
||||
alpha = 0;
|
||||
}
|
||||
else if (srefx < xmin2 && xmin1 != xmin2)
|
||||
{
|
||||
alpha = (srefx - xmin1) / (xmin2 - xmin1);
|
||||
}
|
||||
|
||||
return alpha;
|
||||
}
|
||||
|
||||
float3 ScreenSpaceDither(float2 vScreenPos, float3 clr)
|
||||
{
|
||||
float d = dot(float2(131.0, 312.0), vScreenPos.xy + _Time.y);
|
||||
float3 vDither = float3(d, d, d);
|
||||
vDither.rgb = frac(vDither.rgb / float3(103.0, 71.0, 97.0)) - float3(0.5, 0.5, 0.5);
|
||||
return (vDither.rgb / 15.0) * _DitheringIntensity;
|
||||
}
|
||||
|
||||
half3 tonemapACES(half3 color, float Exposure)
|
||||
{
|
||||
color *= Exposure;
|
||||
|
||||
// See https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/
|
||||
const half a = 2.51;
|
||||
const half b = 0.03;
|
||||
const half c = 2.43;
|
||||
const half d = 0.59;
|
||||
const half e = 0.14;
|
||||
return saturate((color * (a * color + b)) / (color * (c * color + d) + e));
|
||||
}
|
||||
|
||||
float4 frag(v2f i) : SV_Target
|
||||
{
|
||||
float2 screenPosition = (i.screenUV.xy / i.screenUV.w);
|
||||
float3 viewDir = normalize(i.texcoord);
|
||||
float cosTheta = dot(viewDir,_SunDir);
|
||||
viewDir = normalize(i.texcoord + float3(0.0,0.1,0.0));
|
||||
float zen = acos(saturate(viewDir.y));
|
||||
float alb = (cos(zen) + 0.5 * pow(93.885 - ((zen * 180.0) / 3.141592), -0.253));
|
||||
float3 fex = exp(-(_Br * (4 / alb) + _Bm * (1.25 / alb)));
|
||||
float rayPhase = 2.5 + pow(cosTheta,1);
|
||||
float miePhase = _mieG.x / pow(_mieG.y - _mieG.z * cosTheta, 1);
|
||||
float3 BrTheta = 0.059683 * _Br * rayPhase;
|
||||
float3 BmTheta = 0.079577 * _Bm * miePhase;
|
||||
float3 BrmTheta = (BrTheta + BmTheta * 2.0) / ((_Bm + _Br) * 0.75);
|
||||
float3 scattering = BrmTheta * _SunIntensity * (1.0 - fex);
|
||||
float3 sunClr = lerp(fex, _sunDiskColor.rgb, 0.75) * _SunDiskIntensity;
|
||||
float3 sunDisk = (min(2, pow((1 - cosTheta) * (_SunDiskSize * 100), -2)) * sunClr) * (_sunDiskColor * 10);
|
||||
|
||||
float4 moonSampler = tex2D(_MoonTex, i.moonPos.xy);
|
||||
float alpha = MoonPhaseFactor(i.moonPos.xy, _moonParams.w);
|
||||
float3 moonArea = clamp(moonSampler * 10, 0, 1)* i.sky.z;
|
||||
moonSampler = lerp(float4(0,0,0,0),moonSampler,alpha);
|
||||
moonSampler = (moonSampler * _MoonColor) * 2;
|
||||
|
||||
float4 moonGlow = tex2D(_GlowTex, i.moonPos.zw) * i.sky.z;
|
||||
|
||||
float3 skyFinalize = saturate((pow(1.0 - fex, 2.0) * 0.234) * (1 - i.sky.x)) * _SkyLuminance;
|
||||
skyFinalize = saturate(lerp(float3(0.01,0.01,0.01), skyFinalize, saturate(dot(viewDir.y + 0.3, float3(0,1,0)))) * (1 - fex));
|
||||
//skyFinalize = saturate(lerp(float3(0.1,0.1,0.1), skyFinalize, saturate(dot(viewDir.y + 0.3, float3(0,1,0)))) * (1 - fex));
|
||||
|
||||
|
||||
float fadeStar = i.night * _StarsIntensity * 75;
|
||||
float3 starsMap = texCUBE(_Stars, i.starPos.xyz);
|
||||
|
||||
if (_StarsTwinkling > 0)
|
||||
{
|
||||
float3 starsTwinklingMap = texCUBE(_StarsTwinklingNoise, i.starsTwinklingPos.xyz);
|
||||
starsMap = starsMap * starsTwinklingMap;
|
||||
}
|
||||
|
||||
float starsBehindMoon = 1 - clamp((moonArea * 5), 0, 1);
|
||||
float3 stars = pow(clamp((starsMap * fadeStar) * starsBehindMoon,0,4),2);
|
||||
|
||||
float3 galaxyMap = texCUBE(_Galaxy, i.starPos.xyz);
|
||||
float3 galaxy = galaxyMap * starsBehindMoon * (i.night * _GalaxyIntensity);
|
||||
|
||||
scattering *= saturate((lerp(float3(_scatteringPower, _scatteringPower, _scatteringPower), pow(2000.0f * BrmTheta * fex, 0.75f), i.sky.y) * 0.05));
|
||||
scattering *= (_SkyLuminance * _scatteringColor.rgb) * pow((1 - fex), 2) * i.sky.x;
|
||||
|
||||
if (viewDir.y - 0.08 < 0)
|
||||
sunDisk = float3(0,0,0);
|
||||
|
||||
float3 skyScattering = (scattering + sunDisk) + (skyFinalize + galaxy + stars);
|
||||
float4 satSampler = tex2D(_SatTex, screenPosition);
|
||||
|
||||
skyScattering = satSampler.rgb + skyScattering * (1 - satSampler.a);
|
||||
skyScattering += (moonSampler.rgb * i.sky.z) + ((moonGlow.xyz * _moonGlowColor) * _moonParams.z) * (1 - moonSampler.a);
|
||||
|
||||
//Tonemapping
|
||||
if (_Tonemapping == 1)
|
||||
{
|
||||
skyScattering.rgb = tonemapACES(skyScattering.rgb, _SkyExposure);
|
||||
}
|
||||
|
||||
skyScattering = pow(skyScattering,_SkyColorPower);
|
||||
|
||||
//half4 background = texCUBE(_Background, i.texcoord);
|
||||
//skyScattering = skyScattering * (1 - background.a) + background.rgb * background.a;
|
||||
|
||||
skyScattering = lerp(skyScattering, (lerp(skyScattering,_weatherSkyMod.rgb,_weatherSkyMod.a)),_weatherSkyMod.a);
|
||||
|
||||
#if defined(UNITY_COLORSPACE_GAMMA)
|
||||
skyScattering = LinearToGammaSpace(skyScattering);
|
||||
#endif
|
||||
|
||||
if (viewDir.y + 0.1 < 0 && _blackGround > 0)
|
||||
skyScattering = 0;
|
||||
|
||||
float3 final = float3(0, 0, 0);
|
||||
|
||||
//Dithering
|
||||
final = skyScattering + ScreenSpaceDither(i.Position.xy, final.rgb);
|
||||
|
||||
return float4(final , 1);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
|
||||
|
||||
//AURORA
|
||||
Pass
|
||||
{
|
||||
Blend One One
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile __ ENVIRO_AURORA
|
||||
#include "UnityCG.cginc"
|
||||
#pragma exclude_renderers gles
|
||||
|
||||
|
||||
sampler2D _Aurora_Layer_1;
|
||||
sampler2D _Aurora_Layer_2;
|
||||
sampler2D _Aurora_Colorshift;
|
||||
|
||||
float4 _AuroraColor;
|
||||
float _AuroraIntensity;
|
||||
float _AuroraBrightness;
|
||||
float _AuroraContrast;
|
||||
float _AuroraHeight;
|
||||
float _AuroraScale;
|
||||
float _AuroraSpeed;
|
||||
float _AuroraSteps;
|
||||
|
||||
float4 _Aurora_Tiling_Layer1;
|
||||
float4 _Aurora_Tiling_Layer2;
|
||||
float4 _Aurora_Tiling_ColorShift;
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
float3 worldPos : TEXCOORD0;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
v2f vert(appdata_full v)
|
||||
{
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v); //Insert
|
||||
UNITY_INITIALIZE_OUTPUT(v2f, o); //Insert
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); //Insert
|
||||
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.worldPos = mul(unity_ObjectToWorld, v.vertex).xyz;
|
||||
return o;
|
||||
}
|
||||
|
||||
float randomNoise(float3 co) {
|
||||
return frac(sin(dot(co.xyz ,float3(17.2486,32.76149, 368.71564))) * 32168.47512);
|
||||
}
|
||||
|
||||
half4 SampleAurora(float3 uv) {
|
||||
|
||||
float2 uv_1 = uv.xy * _Aurora_Tiling_Layer1.xy + (_Aurora_Tiling_Layer1.zw * _AuroraSpeed * _Time.y);
|
||||
|
||||
half4 aurora = tex2Dlod(_Aurora_Layer_1, float4(uv_1.xy,0,0));
|
||||
|
||||
float2 uv_2 = uv_1 * _Aurora_Tiling_Layer2.xy + (_Aurora_Tiling_Layer2.zw * _AuroraSpeed * _Time.y);
|
||||
half4 aurora2 = tex2Dlod(_Aurora_Layer_2, float4(uv_2.xy,0,0));
|
||||
aurora += (aurora2 - 0.5) * 0.5;
|
||||
|
||||
aurora.w = aurora.w * 0.8 + 0.05;
|
||||
|
||||
float3 uv_3 = float3(uv.xy * _Aurora_Tiling_ColorShift.xy + (_Aurora_Tiling_ColorShift.zw * _AuroraSpeed * _Time.y), 0.0);
|
||||
half4 cloudColor = tex2Dlod(_Aurora_Colorshift, float4(uv_3.xy,0,0));
|
||||
|
||||
half contrastMask = 1.0 - saturate(aurora.a);
|
||||
contrastMask = pow(contrastMask, _AuroraContrast);
|
||||
aurora.rgb *= lerp(half3(0,0,0), _AuroraColor.rgb * cloudColor.rgb * _AuroraBrightness, contrastMask);
|
||||
|
||||
half cloudSub = 1.0 - uv.z;
|
||||
aurora.a = aurora.a - cloudSub * cloudSub;
|
||||
aurora.a = saturate(aurora.a * _AuroraIntensity);
|
||||
aurora.rgb *= aurora.a;
|
||||
|
||||
return aurora;
|
||||
}
|
||||
|
||||
fixed4 frag(v2f i) : SV_Target
|
||||
{
|
||||
#if defined(ENVIRO_AURORA)
|
||||
|
||||
if (_AuroraIntensity < 0.05)
|
||||
return float4(0,0,0,0);
|
||||
|
||||
float3 viewDir = normalize(i.worldPos - _WorldSpaceCameraPos);
|
||||
|
||||
float viewFalloff = 1.0 - saturate(dot(viewDir, float3(0,1,0)));
|
||||
|
||||
if (viewDir.y < 0 || viewDir.y > 1)
|
||||
return half4(0, 0, 0, 0);
|
||||
|
||||
float3 traceDir = normalize(viewDir + float3(0, viewFalloff * 0.2 ,0));
|
||||
|
||||
float3 worldPos = _WorldSpaceCameraPos + traceDir * ((_AuroraHeight - _WorldSpaceCameraPos.y) / max(traceDir.y, 0.01));
|
||||
float3 uv = float3(worldPos.xz * 0.01 * _AuroraScale, 0);
|
||||
|
||||
half3 uvStep = half3(traceDir.xz * -1.0 * (1.0 / traceDir.y), 1.0) * (1.0 / _AuroraSteps);
|
||||
uv += uvStep * randomNoise(i.worldPos + _SinTime.w);
|
||||
|
||||
half4 finalColor = half4(0,0,0,0);
|
||||
|
||||
[loop]
|
||||
for (int i = 0; i < _AuroraSteps; i++)
|
||||
{
|
||||
if (finalColor.a > 1)
|
||||
break;
|
||||
|
||||
uv += uvStep;
|
||||
finalColor += SampleAurora(uv) * (1.0 - finalColor.a);
|
||||
}
|
||||
|
||||
finalColor *= viewDir.y;
|
||||
|
||||
return finalColor;
|
||||
#else
|
||||
return half4(0, 0, 0, 0);
|
||||
#endif
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
//Cirrus Clouds
|
||||
Pass
|
||||
{
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
uniform sampler2D _CloudMap;
|
||||
uniform float _CloudAlpha;
|
||||
uniform float _CloudCoverage;
|
||||
uniform float _CloudAltitude;
|
||||
uniform float4 _CloudColor;
|
||||
uniform float _CloudColorPower;
|
||||
uniform float2 _CloudCirrusAnimation;
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 Position : SV_POSITION;
|
||||
float4 uv : TEXCOORD0;
|
||||
float3 worldPos : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
v2f vert(appdata v)
|
||||
{
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v); //Insert
|
||||
UNITY_INITIALIZE_OUTPUT(v2f, o); //Insert
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); //Insert
|
||||
|
||||
o.Position = UnityObjectToClipPos(v.vertex);
|
||||
o.worldPos = normalize(v.vertex).xyz;
|
||||
float3 viewDir = normalize(o.worldPos + float3(0,1,0));
|
||||
o.worldPos.y *= 1 - dot(viewDir.y + _CloudAltitude, float3(0,-0.15,0));
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 frag(v2f i) : SV_Target
|
||||
{
|
||||
float3 uvs = normalize(i.worldPos);
|
||||
|
||||
float4 uv1;
|
||||
float4 uv2;
|
||||
|
||||
uv1.xy = (uvs.xz * 0.2) + _CloudCirrusAnimation;
|
||||
uv2.xy = (uvs.xz * 0.4) + _CloudCirrusAnimation;
|
||||
|
||||
float4 clouds1 = tex2D(_CloudMap, uv1.xy);
|
||||
float4 clouds2 = tex2D(_CloudMap, uv2.xy);
|
||||
|
||||
float color1 = pow(clouds1.g + clouds2.g, 0.1);
|
||||
float color2 = pow(clouds2.b * clouds1.r, 0.2);
|
||||
|
||||
float4 finalClouds = lerp(clouds1, clouds2, color1 * color2);
|
||||
float cloudExtinction = pow(uvs.y , 2);
|
||||
|
||||
|
||||
finalClouds.a *= _CloudAlpha;
|
||||
finalClouds.a *= cloudExtinction;
|
||||
|
||||
if (uvs.y < 0)
|
||||
finalClouds.a = 0;
|
||||
|
||||
finalClouds.rgb = finalClouds.a * pow(_CloudColor,_CloudColorPower);
|
||||
finalClouds.rgb = pow(finalClouds.rgb,1 - _CloudCoverage);
|
||||
|
||||
return finalClouds;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
///CIRRUS END
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9207df900c02ffe42bf6f6b07842dd9c
|
||||
timeCreated: 1468137264
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+602
@@ -0,0 +1,602 @@
|
||||
Shader "Enviro/Standard/SkyboxFlatClouds"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_Stars("Stars Cubemap", Cube) = "black" {}
|
||||
_StarsTwinklingNoise("Stars Noise", Cube) = "black" {}
|
||||
_Galaxy("Galaxy Cubemap", Cube) = "black" {}
|
||||
_SatTex("Satellites Tex", 2D) = "black" {}
|
||||
_MoonTex("Moon Tex", 2D) = "black" {}
|
||||
_GlowTex("Glow Tex", 2D) = "black" {}
|
||||
_DitheringTex("Dithering Tex", 2D) = "black" {}
|
||||
_FlatCloudsBaseTexture("Base Map", 2D) = "black" {}
|
||||
_FlatCloudsDetailTexture("Detail Map", 2D) = "black" {}
|
||||
_Aurora_Layer_1("Aurora Layer 1", 2D) = "black" {}
|
||||
_Aurora_Layer_2("Aurora Layer 2", 2D) = "black" {}
|
||||
_Aurora_Colorshift("Aurora Color Shift", 2D) = "black" {}
|
||||
|
||||
//_Background("Background Cubemap", Cube) = "black" {}
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags{ "Queue" = "Background" "RenderType" = "Background" "PreviewType" = "Skybox" }
|
||||
Cull Off
|
||||
Fog{ Mode Off }
|
||||
ZWrite Off
|
||||
|
||||
Pass
|
||||
{
|
||||
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile __ UNITY_COLORSPACE_GAMMA
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
uniform float3 _Br;
|
||||
uniform float3 _Bm;
|
||||
uniform float3 _mieG;
|
||||
uniform float _SunIntensity;
|
||||
uniform float _Tonemapping;
|
||||
uniform float _SkyExposure;
|
||||
uniform float _SkyLuminance;
|
||||
uniform float _scatteringPower;
|
||||
uniform float _SunDiskSize;
|
||||
uniform float _SunDiskIntensity;
|
||||
uniform float _StarsIntensity;
|
||||
uniform float4 _scatteringColor;
|
||||
uniform float4 _sunDiskColor;
|
||||
uniform samplerCUBE _Stars;
|
||||
uniform samplerCUBE _StarsTwinklingNoise;
|
||||
uniform float4x4 _StarsMatrix;
|
||||
uniform float4x4 _StarsTwinklingMatrix;
|
||||
uniform float _SkyColorPower;
|
||||
uniform float3 _SunDir;
|
||||
uniform float3 _MoonDir;
|
||||
uniform float4 _weatherSkyMod;
|
||||
uniform float4 _moonGlowColor;
|
||||
uniform sampler2D _MoonTex;
|
||||
uniform sampler2D _GlowTex;
|
||||
uniform sampler2D _SatTex;
|
||||
uniform float4 _MoonColor;
|
||||
uniform float4 _moonParams; // _MoonSize, _GlowSize, _GlowIntensity, _MoonPhase
|
||||
uniform float _GalaxyIntensity;
|
||||
uniform samplerCUBE _Galaxy;
|
||||
uniform int _blackGround;
|
||||
uniform float _StarsTwinkling;
|
||||
uniform float _DitheringIntensity;
|
||||
|
||||
//uniform samplerCUBE _Background;
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float3 texcoord : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 Position : SV_POSITION;
|
||||
float4 moonPos : TEXCOORD0;
|
||||
float4 sky : TEXCOORD1;
|
||||
float night : TEXCOORD2;
|
||||
float3 texcoord : TEXCOORD3;
|
||||
float3 starPos : TEXCOORD4;
|
||||
float4 screenUV : TEXCOORD5;
|
||||
float3 starsTwinklingPos : TEXCOORD6;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
v2f vert(appdata v)
|
||||
{
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v); //Insert
|
||||
UNITY_INITIALIZE_OUTPUT(v2f, o); //Insert
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); //Insert
|
||||
o.Position = UnityObjectToClipPos(v.vertex);
|
||||
float3 viewDir = normalize(v.texcoord + float3(0.0,0.1,0.0));
|
||||
o.sky.x = saturate(_SunDir.y + 0.25);
|
||||
o.sky.y = saturate(clamp(1.0 - _SunDir.y, 0.0, 0.5));
|
||||
o.sky.z = saturate(dot(-_MoonDir.xyz,viewDir));
|
||||
|
||||
float3 r = normalize(cross(_MoonDir.xyz, float3(0, -1, 0)));
|
||||
float3 u = cross(_MoonDir.xyz, r);
|
||||
o.moonPos.xy = float2(dot(r, v.vertex.xyz), dot(u, v.vertex.xyz)) * (21.0 - _moonParams.x) + 0.5;
|
||||
o.moonPos.zw = float2(dot(r, v.vertex.xyz), dot(u, v.vertex.xyz)) * (21.0 - _moonParams.y) + 0.5;
|
||||
|
||||
o.starPos = mul((float3x3)_StarsMatrix,v.vertex.xyz);
|
||||
o.starsTwinklingPos = mul((float3x3)_StarsTwinklingMatrix, v.vertex.xyz);
|
||||
o.night = pow(max(0.0,viewDir.y),1.25);
|
||||
o.texcoord = v.texcoord;
|
||||
o.screenUV = ComputeScreenPos(o.Position);
|
||||
return o;
|
||||
}
|
||||
|
||||
float MoonPhaseFactor(float2 uv, float phase)
|
||||
{
|
||||
float alpha = 1.0;
|
||||
|
||||
|
||||
float srefx = uv.x - 0.5;
|
||||
float refx = abs(uv.x - 0.5);
|
||||
|
||||
if (phase > 0)
|
||||
{
|
||||
srefx = (1 - uv.x) - 0.5;
|
||||
refx = abs((1 - uv.x) - 0.5);
|
||||
}
|
||||
|
||||
phase = abs(_moonParams.w);
|
||||
float refy = abs(uv.y - 0.5);
|
||||
float refxfory = sqrt(0.25 - refy * refy);
|
||||
float xmin = -refxfory;
|
||||
float xmax = refxfory;
|
||||
float xmin1 = (xmax - xmin) * (phase / 2) + xmin;
|
||||
float xmin2 = (xmax - xmin) * phase + xmin;
|
||||
|
||||
if (srefx < xmin1)
|
||||
{
|
||||
alpha = 0;
|
||||
}
|
||||
else if (srefx < xmin2 && xmin1 != xmin2)
|
||||
{
|
||||
alpha = (srefx - xmin1) / (xmin2 - xmin1);
|
||||
}
|
||||
|
||||
return alpha;
|
||||
}
|
||||
|
||||
float3 ScreenSpaceDither(float2 vScreenPos, float3 clr)
|
||||
{
|
||||
float d = dot(float2(131.0, 312.0), vScreenPos.xy + _Time.y);
|
||||
float3 vDither = float3(d, d, d);
|
||||
vDither.rgb = frac(vDither.rgb / float3(103.0, 71.0, 97.0)) - float3(0.5, 0.5, 0.5);
|
||||
return (vDither.rgb / 15.0) * _DitheringIntensity;
|
||||
}
|
||||
half3 tonemapACES(half3 color, float Exposure)
|
||||
{
|
||||
color *= Exposure;
|
||||
|
||||
// See https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/
|
||||
const half a = 2.51;
|
||||
const half b = 0.03;
|
||||
const half c = 2.43;
|
||||
const half d = 0.59;
|
||||
const half e = 0.14;
|
||||
return saturate((color * (a * color + b)) / (color * (c * color + d) + e));
|
||||
}
|
||||
float4 frag(v2f i) : SV_Target
|
||||
{
|
||||
float2 screenPosition = (i.screenUV.xy / i.screenUV.w);
|
||||
float3 viewDir = normalize(i.texcoord);
|
||||
float cosTheta = dot(viewDir,_SunDir);
|
||||
viewDir = normalize(i.texcoord + float3(0.0,0.1,0.0));
|
||||
float zen = acos(saturate(viewDir.y));
|
||||
float alb = (cos(zen) + 0.5 * pow(93.885 - ((zen * 180.0) / 3.141592), -0.253));
|
||||
float3 fex = exp(-(_Br * (4 / alb) + _Bm * (1.25 / alb)));
|
||||
float rayPhase = 2.5 + pow(cosTheta,1);
|
||||
float miePhase = _mieG.x / pow(_mieG.y - _mieG.z * cosTheta, 1);
|
||||
float3 BrTheta = 0.059683 * _Br * rayPhase;
|
||||
float3 BmTheta = 0.079577 * _Bm * miePhase;
|
||||
float3 BrmTheta = (BrTheta + BmTheta * 2.0) / ((_Bm + _Br) * 0.75);
|
||||
float3 scattering = BrmTheta * _SunIntensity * (1.0 - fex);
|
||||
float3 sunClr = lerp(fex, _sunDiskColor.rgb, 0.75) * _SunDiskIntensity;
|
||||
float3 sunDisk = (min(2, pow((1 - cosTheta) * (_SunDiskSize * 100), -2)) * sunClr) * (_sunDiskColor * 10);
|
||||
|
||||
float4 moonSampler = tex2D(_MoonTex, i.moonPos.xy);
|
||||
float alpha = MoonPhaseFactor(i.moonPos.xy, _moonParams.w);
|
||||
float3 moonArea = clamp(moonSampler * 10, 0, 1) * i.sky.z;
|
||||
moonSampler = lerp(float4(0,0,0,0),moonSampler,alpha);
|
||||
moonSampler = (moonSampler * _MoonColor) * 2;
|
||||
|
||||
//float3 moonBright = saturate((float3(1,1,1)) * pow(dot(viewDir, -_MoonDir), (21.0 - _MoonSize) * 10) * i.night);
|
||||
float4 moonGlow = tex2D(_GlowTex, i.moonPos.zw) * i.sky.z;
|
||||
float3 skyFinalize = saturate((pow(1.0 - fex, 2.0) * 0.234) * (1 - i.sky.x)) * _SkyLuminance;
|
||||
skyFinalize = saturate(lerp(float3(0.1,0.1,0.1), skyFinalize, saturate(dot(viewDir.y + 0.3, float3(0,1,0)))) * (1 - fex));
|
||||
float fadeStar = i.night * _StarsIntensity * 75;
|
||||
float3 starsMap = texCUBE(_Stars, i.starPos.xyz);
|
||||
if (_StarsTwinkling > 0)
|
||||
{
|
||||
float3 starsTwinklingMap = texCUBE(_StarsTwinklingNoise, i.starsTwinklingPos.xyz);
|
||||
starsMap = starsMap * starsTwinklingMap;
|
||||
}
|
||||
float starsBehindMoon = 1 - clamp((moonArea * 5), 0, 1);
|
||||
float3 stars = pow(clamp((starsMap * fadeStar) * starsBehindMoon, 0, 4), 2);
|
||||
float3 galaxyMap = texCUBE(_Galaxy, i.starPos.xyz);
|
||||
float3 galaxy = galaxyMap * starsBehindMoon * (i.night * _GalaxyIntensity);
|
||||
scattering *= saturate((lerp(float3(_scatteringPower, _scatteringPower, _scatteringPower), pow(2000.0f * BrmTheta * fex, 0.75f), i.sky.y) * 0.05));
|
||||
scattering *= (_SkyLuminance * _scatteringColor.rgb) * pow((1 - fex), 2) * i.sky.x;
|
||||
|
||||
if (viewDir.y - 0.08 < 0)
|
||||
sunDisk = float3(0,0,0);
|
||||
|
||||
float3 skyScattering = (scattering + sunDisk) + (skyFinalize + galaxy + stars);
|
||||
float4 satSampler = tex2D(_SatTex, screenPosition);
|
||||
skyScattering = satSampler.rgb + skyScattering * (1 - satSampler.a);
|
||||
skyScattering += (moonSampler.rgb * i.sky.z) + ((moonGlow.xyz * _moonGlowColor) * _moonParams.z) * (1 - moonSampler.a);
|
||||
|
||||
//Tonemapping
|
||||
if (_Tonemapping == 1)
|
||||
{
|
||||
skyScattering.rgb = tonemapACES(skyScattering.rgb, _SkyExposure);
|
||||
}
|
||||
|
||||
skyScattering = pow(skyScattering,_SkyColorPower);
|
||||
|
||||
//half4 background = texCUBE(_Background, i.texcoord);
|
||||
//skyScattering = skyScattering * (1 - background.a) + background.rgb * background.a;
|
||||
|
||||
skyScattering = lerp(skyScattering, (lerp(skyScattering,_weatherSkyMod.rgb,_weatherSkyMod.a)),_weatherSkyMod.a);
|
||||
|
||||
#if defined(UNITY_COLORSPACE_GAMMA)
|
||||
skyScattering = pow(skyScattering,0.454545);
|
||||
#endif
|
||||
|
||||
if (viewDir.y+0.1 < 0 && _blackGround > 0)
|
||||
skyScattering = 0;
|
||||
|
||||
float3 final = float3(0, 0, 0);
|
||||
|
||||
//Dithering
|
||||
final = skyScattering + ScreenSpaceDither(i.Position.xy, final.rgb);
|
||||
|
||||
return float4(final, 1);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//AURORA
|
||||
Pass
|
||||
{
|
||||
Blend One One
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile __ ENVIRO_AURORA
|
||||
#include "UnityCG.cginc"
|
||||
#pragma exclude_renderers gles
|
||||
|
||||
|
||||
sampler2D _Aurora_Layer_1;
|
||||
sampler2D _Aurora_Layer_2;
|
||||
sampler2D _Aurora_Colorshift;
|
||||
|
||||
float4 _AuroraColor;
|
||||
float _AuroraIntensity;
|
||||
float _AuroraBrightness;
|
||||
float _AuroraContrast;
|
||||
float _AuroraHeight;
|
||||
float _AuroraScale;
|
||||
float _AuroraSpeed;
|
||||
float _AuroraSteps;
|
||||
|
||||
float4 _Aurora_Tiling_Layer1;
|
||||
float4 _Aurora_Tiling_Layer2;
|
||||
float4 _Aurora_Tiling_ColorShift;
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
float3 worldPos : TEXCOORD0;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
v2f vert(appdata_full v)
|
||||
{
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v); //Insert
|
||||
UNITY_INITIALIZE_OUTPUT(v2f, o); //Insert
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); //Insert
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.worldPos = mul(unity_ObjectToWorld, v.vertex).xyz;
|
||||
return o;
|
||||
}
|
||||
|
||||
float randomNoise(float3 co) {
|
||||
return frac(sin(dot(co.xyz ,float3(17.2486,32.76149, 368.71564))) * 32168.47512);
|
||||
}
|
||||
|
||||
half4 SampleAurora(float3 uv) {
|
||||
|
||||
float2 uv_1 = uv.xy * _Aurora_Tiling_Layer1.xy + (_Aurora_Tiling_Layer1.zw * _AuroraSpeed * _Time.y);
|
||||
|
||||
half4 aurora = tex2Dlod(_Aurora_Layer_1, float4(uv_1.xy,0,0));
|
||||
|
||||
float2 uv_2 = uv_1 * _Aurora_Tiling_Layer2.xy + (_Aurora_Tiling_Layer2.zw * _AuroraSpeed * _Time.y);
|
||||
half4 aurora2 = tex2Dlod(_Aurora_Layer_2, float4(uv_2.xy,0,0));
|
||||
aurora += (aurora2 - 0.5) * 0.5;
|
||||
|
||||
aurora.w = aurora.w * 0.8 + 0.05;
|
||||
|
||||
float3 uv_3 = float3(uv.xy * _Aurora_Tiling_ColorShift.xy + (_Aurora_Tiling_ColorShift.zw * _AuroraSpeed * _Time.y), 0.0);
|
||||
half4 cloudColor = tex2Dlod(_Aurora_Colorshift, float4(uv_3.xy,0,0));
|
||||
|
||||
half contrastMask = 1.0 - saturate(aurora.a);
|
||||
contrastMask = pow(contrastMask, _AuroraContrast);
|
||||
aurora.rgb *= lerp(half3(0,0,0), _AuroraColor.rgb * cloudColor.rgb * _AuroraBrightness, contrastMask);
|
||||
|
||||
half cloudSub = 1.0 - uv.z;
|
||||
aurora.a = aurora.a - cloudSub * cloudSub;
|
||||
aurora.a = saturate(aurora.a * _AuroraIntensity);
|
||||
aurora.rgb *= aurora.a;
|
||||
|
||||
return aurora;
|
||||
}
|
||||
|
||||
fixed4 frag(v2f i) : SV_Target
|
||||
{
|
||||
#if defined(ENVIRO_AURORA)
|
||||
|
||||
if (_AuroraIntensity < 0.05)
|
||||
return float4(0,0,0,0);
|
||||
|
||||
float3 viewDir = normalize(i.worldPos - _WorldSpaceCameraPos);
|
||||
|
||||
float viewFalloff = 1.0 - saturate(dot(viewDir, float3(0,1,0)));
|
||||
|
||||
if (viewDir.y < 0 || viewDir.y > 1)
|
||||
return half4(0, 0, 0, 0);
|
||||
|
||||
float3 traceDir = normalize(viewDir + float3(0, viewFalloff * 0.2 ,0));
|
||||
|
||||
float3 worldPos = _WorldSpaceCameraPos + traceDir * ((_AuroraHeight - _WorldSpaceCameraPos.y) / max(traceDir.y, 0.01));
|
||||
float3 uv = float3(worldPos.xz * 0.01 * _AuroraScale, 0);
|
||||
|
||||
half3 uvStep = half3(traceDir.xz * -1.0 * (1.0 / traceDir.y), 1.0) * (1.0 / _AuroraSteps);
|
||||
uv += uvStep * randomNoise(i.worldPos + _SinTime.w);
|
||||
|
||||
half4 finalColor = half4(0,0,0,0);
|
||||
|
||||
[loop]
|
||||
for (int i = 0; i < _AuroraSteps; i++)
|
||||
{
|
||||
if (finalColor.a > 1)
|
||||
break;
|
||||
|
||||
uv += uvStep;
|
||||
finalColor += SampleAurora(uv) * (1.0 - finalColor.a);
|
||||
}
|
||||
|
||||
finalColor *= viewDir.y;
|
||||
|
||||
return finalColor;
|
||||
#else
|
||||
return half4(0, 0, 0, 0);
|
||||
#endif
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------
|
||||
Pass
|
||||
{
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
uniform sampler2D _CloudMap;
|
||||
uniform float _CloudAlpha;
|
||||
uniform float _CloudCoverage;
|
||||
uniform float _CloudAltitude;
|
||||
uniform float4 _CloudColor;
|
||||
uniform float _CloudColorPower;
|
||||
uniform float2 _CloudCirrusAnimation;
|
||||
uniform float _Tonemapping;
|
||||
|
||||
struct appdata {
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 Position : SV_POSITION;
|
||||
float4 uv : TEXCOORD0;
|
||||
float3 worldPos : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
half3 tonemapACES(half3 color, float Exposure)
|
||||
{
|
||||
color *= Exposure;
|
||||
|
||||
// See https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/
|
||||
const half a = 2.51;
|
||||
const half b = 0.03;
|
||||
const half c = 2.43;
|
||||
const half d = 0.59;
|
||||
const half e = 0.14;
|
||||
return saturate((color * (a * color + b)) / (color * (c * color + d) + e));
|
||||
}
|
||||
|
||||
v2f vert(appdata v)
|
||||
{
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v); //Insert
|
||||
UNITY_INITIALIZE_OUTPUT(v2f, o); //Insert
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); //Insert
|
||||
o.Position = UnityObjectToClipPos(v.vertex);
|
||||
o.worldPos = normalize(v.vertex).xyz;
|
||||
float3 viewDir = normalize(o.worldPos + float3(0,1,0));
|
||||
o.worldPos.y *= 1 - dot(viewDir.y + _CloudAltitude, float3(0,-0.15,0));
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 frag(v2f i) : SV_Target
|
||||
{
|
||||
float3 uvs = normalize(i.worldPos);
|
||||
float2 uv1 = (uvs.xz * 0.2) + _CloudCirrusAnimation;
|
||||
float2 uv2 = (uvs.xz * 0.4) + _CloudCirrusAnimation;
|
||||
float4 clouds1 = tex2D(_CloudMap, uv1.xy);
|
||||
float4 clouds2 = tex2D(_CloudMap, uv2.xy);
|
||||
float color1 = pow(clouds1.g + clouds2.g, 0.1);
|
||||
float color2 = pow(clouds2.b * clouds1.r, 0.2);
|
||||
float4 finalClouds = lerp(clouds1, clouds2, color1 * color2);
|
||||
float cloudExtinction = pow(uvs.y , 2);
|
||||
finalClouds.a *= _CloudAlpha;
|
||||
finalClouds.a *= cloudExtinction;
|
||||
if (uvs.y < 0)
|
||||
finalClouds.a = 0;
|
||||
finalClouds.rgb = finalClouds.a * pow(_CloudColor,2);
|
||||
|
||||
finalClouds.rgb = pow(finalClouds.rgb ,1 - _CloudCoverage);
|
||||
finalClouds.rgb *= _CloudColorPower;
|
||||
|
||||
if (_Tonemapping == 1)
|
||||
{
|
||||
finalClouds.rgb = tonemapACES(finalClouds.rgb, 1);
|
||||
}
|
||||
|
||||
return finalClouds;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------
|
||||
//Flat Clouds
|
||||
Pass
|
||||
{
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
uniform sampler2D _FlatCloudsBaseTexture;
|
||||
uniform sampler2D _FlatCloudsDetailTexture;
|
||||
uniform float4 _FlatCloudsAnimation;
|
||||
uniform float3 _FlatCloudsLightDirection;
|
||||
uniform float3 _FlatCloudsLightColor;
|
||||
uniform float3 _FlatCloudsAmbientColor;
|
||||
uniform float4 _FlatCloudsLightingParams; // x = LightIntensity, y = AmbientIntensity, z = Absorbtion, w = HgPhase
|
||||
uniform float4 _FlatCloudsParams; // x = Coverage, y = Density, z = Altitude, w = tonemapping
|
||||
uniform float4 _FlatCloudsTiling; // x = Base, y = Detail
|
||||
uniform float _CloudsExposure;
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 Position : SV_POSITION;
|
||||
float4 uv : TEXCOORD0;
|
||||
float3 worldPos : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
v2f vert(appdata_base v)
|
||||
{
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_OUTPUT(v2f, o);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
o.Position = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = normalize(v.vertex).xyzw;
|
||||
float3 viewDir = normalize(o.uv + float3(0, 1, 0));
|
||||
o.uv.y *= 1 - dot(viewDir.y + _FlatCloudsParams.z, float3(0, -0.2, 0));
|
||||
o.worldPos = mul(unity_ObjectToWorld, v.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
float Remap(float org_val, float org_min, float org_max, float new_min, float new_max)
|
||||
{
|
||||
return new_min + saturate(((org_val - org_min) / (org_max - org_min))*(new_max - new_min));
|
||||
}
|
||||
|
||||
float HenryGreenstein(float cosTheta, float g)
|
||||
{
|
||||
float k = 3.0 / (8.0 * 3.1415926f) * (1.0 - g * g) / (2.0 + g * g);
|
||||
return k * (1.0 + cosTheta * cosTheta) / pow(abs(1.0 + g * g - 2.0 * g * cosTheta), 1.5);
|
||||
}
|
||||
half3 tonemapACES(half3 color, float Exposure)
|
||||
{
|
||||
color *= Exposure;
|
||||
|
||||
// See https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/
|
||||
const half a = 2.51;
|
||||
const half b = 0.03;
|
||||
const half c = 2.43;
|
||||
const half d = 0.59;
|
||||
const half e = 0.14;
|
||||
return saturate((color * (a * color + b)) / (color * (c * color + d) + e));
|
||||
}
|
||||
|
||||
float CalculateCloudDensity(float2 posBase, float2 posDetail, float coverage)
|
||||
{
|
||||
float4 baseNoise = tex2D(_FlatCloudsBaseTexture, posBase);
|
||||
float low_freq_fBm = (baseNoise.g * 0.625) + (baseNoise.b * 0.25) + (baseNoise.a * 0.125);
|
||||
float base_cloud = Remap(baseNoise.r, -(1.0 - low_freq_fBm), 1.0, 0.0, 1.0) * coverage;
|
||||
|
||||
float4 detailNoise = tex2D(_FlatCloudsDetailTexture, posDetail * 2);
|
||||
float high_freq_fBm = (detailNoise.r * 0.625) + (detailNoise.g * 0.25) + (detailNoise.b * 0.125);
|
||||
float density = Remap(base_cloud, 1.0 - high_freq_fBm * 0.5, 1.0, 0.0, 1.0);
|
||||
|
||||
density *= pow(high_freq_fBm, 0.4);
|
||||
density *= _FlatCloudsParams.y;
|
||||
|
||||
return density;
|
||||
}
|
||||
|
||||
half4 frag(v2f i) : SV_Target
|
||||
{
|
||||
half4 col = 0;
|
||||
float3 uvs = normalize(i.uv);
|
||||
|
||||
float4 uv1;
|
||||
uv1.xy = (uvs.xz * _FlatCloudsTiling.x) + _FlatCloudsAnimation.xy;
|
||||
uv1.zw = (uvs.xz * _FlatCloudsTiling.y) + _FlatCloudsAnimation.zw;
|
||||
|
||||
float cloudExtinction = pow(uvs.y, 2);
|
||||
half density = CalculateCloudDensity(uv1.xy, uv1.zw, _FlatCloudsParams.x);
|
||||
|
||||
//Lighting
|
||||
fixed absorbtion = exp2(-1 * (density * _FlatCloudsLightingParams.z));
|
||||
float3 viewDir = normalize(i.worldPos - _WorldSpaceCameraPos);
|
||||
float inscatterAngle = dot(normalize(_FlatCloudsLightDirection), -viewDir);
|
||||
fixed hg = HenryGreenstein(inscatterAngle, _FlatCloudsLightingParams.w) * 2 * absorbtion;
|
||||
fixed lighting = density * (absorbtion + hg);
|
||||
float3 lightColor = pow(_FlatCloudsLightColor, 2) * (_FlatCloudsLightingParams.x );
|
||||
col.rgb = lightColor * lighting;
|
||||
col.rgb = col.rgb + (_FlatCloudsAmbientColor * _FlatCloudsLightingParams.y);
|
||||
|
||||
//Tonemapping
|
||||
if (_FlatCloudsParams.w == 1)
|
||||
col.rgb = tonemapACES(col.rgb, _CloudsExposure);
|
||||
|
||||
|
||||
col.a = saturate(density * cloudExtinction);
|
||||
|
||||
if (uvs.y < 0)
|
||||
col.a = 0;
|
||||
|
||||
return col;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c197b0132b688e242908e7cebabca5eb
|
||||
timeCreated: 1468137264
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+554
@@ -0,0 +1,554 @@
|
||||
Shader "Enviro/Standard/SkyboxSimple"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_SkyColor ("Sky Color", Color) = (0, 0, 0, 0)
|
||||
_HorizonColor ("Horizon Color", Color) = (0, 0, 0, 0)
|
||||
_HorizonBackColor("Horizon Back Color", Color) = (0, 0, 0, 0)
|
||||
_SunColor ("Sun Color", Color) = (0, 0, 0, 0)
|
||||
_Stars ("StarsMap", Cube) = "white" {}
|
||||
_StarsTwinklingNoise("Stars Noise", Cube) = "black" {}
|
||||
_Galaxy("Galaxy Cubemap", Cube) = "black" {}
|
||||
_MoonTex("Moon Tex", 2D) = "black" {}
|
||||
_GlowTex("Glow Tex", 2D) = "black" {}
|
||||
_Aurora_Layer_1("Aurora Layer 1", 2D) = "black" {}
|
||||
_Aurora_Layer_2("Aurora Layer 2", 2D) = "black" {}
|
||||
_Aurora_Colorshift("Aurora Color Shift", 2D) = "black" {}
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Lod 300
|
||||
Tags { "Queue"="Background" "RenderType"="Background" "PreviewType"="Skybox" "IgnoreProjector"="True" }
|
||||
|
||||
Pass
|
||||
{
|
||||
Cull Back
|
||||
ZWrite Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#pragma target 3.0
|
||||
|
||||
uniform half4 _SkyColor;
|
||||
uniform half4 _HorizonColor;
|
||||
uniform half4 _HorizonBackColor;
|
||||
uniform half4 _GroundColor;
|
||||
uniform half4 _SunColor;
|
||||
|
||||
|
||||
uniform samplerCUBE _Stars;
|
||||
uniform float4x4 _StarsMatrix;
|
||||
uniform samplerCUBE _StarsTwinklingNoise;
|
||||
uniform float4x4 _StarsTwinklingMatrix;
|
||||
uniform float _StarsTwinkling;
|
||||
uniform half _StarsIntensity;
|
||||
uniform half _SunDiskSizeSimple;
|
||||
uniform float4 _weatherSkyMod;
|
||||
uniform float4 _moonParams;
|
||||
uniform float4 _MoonColor;
|
||||
uniform float4 _moonGlowColor;
|
||||
uniform float3 _SunDir;
|
||||
uniform float3 _MoonDir;
|
||||
uniform sampler2D _MoonTex;
|
||||
uniform sampler2D _GlowTex;
|
||||
uniform float _GalaxyIntensity;
|
||||
uniform samplerCUBE _Galaxy;
|
||||
|
||||
struct VertexInput
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
|
||||
struct v2f {
|
||||
float4 position : POSITION;
|
||||
float4 WorldPosition : TEXCOORD0;
|
||||
half3 vertex : TEXCOORD1;
|
||||
float3 starPos : TEXCOORD2;
|
||||
float3 starsTwinklingPos : TEXCOORD3;
|
||||
float4 moonPos : TEXCOORD4;
|
||||
float4 sky : TEXCOORD5;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
v2f vert(VertexInput v) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v); //Insert
|
||||
UNITY_INITIALIZE_OUTPUT(v2f, o); //Insert
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); //Insert
|
||||
o.position = UnityObjectToClipPos(v.vertex);
|
||||
o.WorldPosition = normalize(mul((float4x4)unity_ObjectToWorld, v.vertex)).xyzw;
|
||||
o.starPos = mul((float3x3)_StarsMatrix,v.vertex.xyz);
|
||||
o.starsTwinklingPos = mul((float3x3)_StarsTwinklingMatrix, v.vertex.xyz);
|
||||
float3 r = normalize(cross(_MoonDir.xyz, float3(0, -1, 0)));
|
||||
float3 u = cross(_MoonDir.xyz, r);
|
||||
o.moonPos.xy = float2(dot(r, v.vertex.xyz), dot(u, v.vertex.xyz)) * (21.0 - _moonParams.x) + 0.5;
|
||||
o.moonPos.zw = float2(dot(r, v.vertex.xyz), dot(u, v.vertex.xyz)) * (21.0 - _moonParams.y) + 0.5;
|
||||
|
||||
o.sky.x = saturate(_SunDir.y + 0.25);
|
||||
o.sky.y = saturate(clamp(1.0 - _SunDir.y, 0.0, 0.5));
|
||||
o.sky.z = saturate(dot(-_MoonDir.xyz, v.texcoord));
|
||||
|
||||
o.vertex = -v.vertex;
|
||||
return o;
|
||||
}
|
||||
|
||||
half getMiePhase(half eyeCos, half eyeCos2, half y)
|
||||
{
|
||||
half temp = 1.0 + 0.9801 - 2.0 * (-0.990) * eyeCos;
|
||||
temp = pow(temp, pow(_SunDiskSizeSimple, 0.65) * 10);
|
||||
temp = max(temp, 1.0e-4); // prevent division by zero, esp. in half precision
|
||||
temp = 1.5 * ((1.0 - 0.9801) / (2.0 + 0.9801)) * (1.0 + eyeCos2) / temp;
|
||||
//#if defined(UNITY_COLORSPACE_GAMMA) && SKYBOX_COLOR_IN_TARGET_COLOR_SPACE
|
||||
// temp = pow(temp, .454545);
|
||||
//#endif
|
||||
return temp;
|
||||
}
|
||||
|
||||
float MoonPhaseFactor(float2 uv, float phase)
|
||||
{
|
||||
float alpha = 1.0;
|
||||
|
||||
|
||||
float srefx = uv.x - 0.5;
|
||||
float refx = abs(uv.x - 0.5);
|
||||
|
||||
if (phase > 0)
|
||||
{
|
||||
srefx = (1 - uv.x) - 0.5;
|
||||
refx = abs((1 - uv.x) - 0.5);
|
||||
}
|
||||
|
||||
phase = abs(_moonParams.w);
|
||||
float refy = abs(uv.y - 0.5);
|
||||
float refxfory = sqrt(0.25 - refy * refy);
|
||||
float xmin = -refxfory;
|
||||
float xmax = refxfory;
|
||||
float xmin1 = (xmax - xmin) * (phase / 2) + xmin;
|
||||
float xmin2 = (xmax - xmin) * phase + xmin;
|
||||
|
||||
if (srefx < xmin1)
|
||||
{
|
||||
alpha = 0;
|
||||
}
|
||||
else if (srefx < xmin2 && xmin1 != xmin2)
|
||||
{
|
||||
alpha = (srefx - xmin1) / (xmin2 - xmin1);
|
||||
}
|
||||
|
||||
return alpha;
|
||||
}
|
||||
|
||||
float Remap(float org_val, float org_min, float org_max, float new_min, float new_max)
|
||||
{
|
||||
return new_min + saturate(((org_val - org_min) / (org_max - org_min))*(new_max - new_min));
|
||||
}
|
||||
|
||||
float4 frag(v2f i) : COLOR
|
||||
{
|
||||
half3 ray = normalize(mul((float3x3)unity_ObjectToWorld, i.vertex));
|
||||
half y = ray.y / 0.02;
|
||||
float3 skyColor = float3(0, 0, 0);
|
||||
|
||||
|
||||
float3 viewDir = normalize(i.WorldPosition + float3(0, 0.2, 0));
|
||||
float3 viewDir2 = normalize(i.WorldPosition + float3(0, 0.1, 0));
|
||||
|
||||
float cosTheta = saturate(dot(normalize(i.WorldPosition), _SunDir));
|
||||
|
||||
float fade = pow(max(0.0, viewDir.y), 1.25);
|
||||
|
||||
//Stars
|
||||
float3 starsMap = texCUBE(_Stars, i.starPos.xyz);
|
||||
if (_StarsTwinkling > 0)
|
||||
{
|
||||
float3 starsTwinklingMap = texCUBE(_StarsTwinklingNoise, i.starsTwinklingPos.xyz);
|
||||
starsMap = starsMap * starsTwinklingMap * 50 * _StarsIntensity * fade;
|
||||
}
|
||||
|
||||
//Galaxy
|
||||
float3 galaxyMap = texCUBE(_Galaxy, i.starPos.xyz);
|
||||
float3 galaxy = galaxyMap * _GalaxyIntensity * fade;
|
||||
|
||||
//Moon
|
||||
float4 moonSampler = tex2D(_MoonTex, i.moonPos.xy);
|
||||
float4 moonGlow = tex2D(_GlowTex, i.moonPos.zw) * i.sky.z;
|
||||
float alpha = MoonPhaseFactor(i.moonPos.xy, _moonParams.w);
|
||||
float3 moonArea = clamp(moonSampler * 10, 0, 1) * i.sky.z;
|
||||
moonSampler = lerp(float4(0, 0, 0, 0), moonSampler, alpha);
|
||||
moonSampler = (moonSampler * _MoonColor) * 2;
|
||||
float starsBehindMoon = 1 - clamp((moonArea * 5), 0, 1);
|
||||
|
||||
float3 nightSky = (starsMap + galaxy) * starsBehindMoon;
|
||||
|
||||
//Sky Colors
|
||||
float3 horizonColor = lerp(_HorizonBackColor.rgb, _HorizonColor.rgb, cosTheta);
|
||||
|
||||
|
||||
skyColor = lerp(horizonColor,_SkyColor.rgb,smoothstep(dot(viewDir.y, float3(0,3,0)),0,0.3));
|
||||
|
||||
|
||||
if (y < 50.0 && y > 5.0)
|
||||
skyColor = horizonColor;
|
||||
|
||||
skyColor = skyColor + nightSky;
|
||||
|
||||
//Add moon
|
||||
skyColor += ((moonSampler.rgb * i.sky.z) + ((moonGlow.xyz * _moonGlowColor) * _moonParams.z) * (1 - moonSampler.a));
|
||||
|
||||
//Sun Disc
|
||||
half eyeCos = dot(_SunDir, ray);
|
||||
half eyeCos2 = eyeCos * eyeCos;
|
||||
half mie = getMiePhase(eyeCos, eyeCos2, y);
|
||||
skyColor += mie * _SunColor.rgb;
|
||||
|
||||
float ground = Remap(viewDir2.y, -0.15, 0, 0, 1);
|
||||
//Ground Color
|
||||
skyColor = lerp(skyColor * _GroundColor.rgb, skyColor, saturate(ground));
|
||||
|
||||
//Weather Color Mod
|
||||
skyColor = lerp(skyColor, (lerp(skyColor, _weatherSkyMod.rgb, _weatherSkyMod.a)), _weatherSkyMod.a);
|
||||
|
||||
return float4(skyColor,1);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
|
||||
//AURORA
|
||||
Pass
|
||||
{
|
||||
Blend One One
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile __ ENVIRO_AURORA
|
||||
#include "UnityCG.cginc"
|
||||
#pragma exclude_renderers gles
|
||||
|
||||
|
||||
sampler2D _Aurora_Layer_1;
|
||||
sampler2D _Aurora_Layer_2;
|
||||
sampler2D _Aurora_Colorshift;
|
||||
|
||||
float4 _AuroraColor;
|
||||
float _AuroraIntensity;
|
||||
float _AuroraBrightness;
|
||||
float _AuroraContrast;
|
||||
float _AuroraHeight;
|
||||
float _AuroraScale;
|
||||
float _AuroraSpeed;
|
||||
float _AuroraSteps;
|
||||
|
||||
float4 _Aurora_Tiling_Layer1;
|
||||
float4 _Aurora_Tiling_Layer2;
|
||||
float4 _Aurora_Tiling_ColorShift;
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
float3 worldPos : TEXCOORD0;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
v2f vert(appdata_full v)
|
||||
{
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v); //Insert
|
||||
UNITY_INITIALIZE_OUTPUT(v2f, o); //Insert
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); //Insert
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.worldPos = mul(unity_ObjectToWorld, v.vertex).xyz;
|
||||
return o;
|
||||
}
|
||||
|
||||
float randomNoise(float3 co) {
|
||||
return frac(sin(dot(co.xyz ,float3(17.2486,32.76149, 368.71564))) * 32168.47512);
|
||||
}
|
||||
|
||||
half4 SampleAurora(float3 uv) {
|
||||
|
||||
float2 uv_1 = uv.xy * _Aurora_Tiling_Layer1.xy + (_Aurora_Tiling_Layer1.zw * _AuroraSpeed * _Time.y);
|
||||
|
||||
half4 aurora = tex2Dlod(_Aurora_Layer_1, float4(uv_1.xy,0,0));
|
||||
|
||||
float2 uv_2 = uv_1 * _Aurora_Tiling_Layer2.xy + (_Aurora_Tiling_Layer2.zw * _AuroraSpeed * _Time.y);
|
||||
half4 aurora2 = tex2Dlod(_Aurora_Layer_2, float4(uv_2.xy,0,0));
|
||||
aurora += (aurora2 - 0.5) * 0.5;
|
||||
|
||||
aurora.w = aurora.w * 0.8 + 0.05;
|
||||
|
||||
float3 uv_3 = float3(uv.xy * _Aurora_Tiling_ColorShift.xy + (_Aurora_Tiling_ColorShift.zw * _AuroraSpeed * _Time.y), 0.0);
|
||||
half4 cloudColor = tex2Dlod(_Aurora_Colorshift, float4(uv_3.xy,0,0));
|
||||
|
||||
half contrastMask = 1.0 - saturate(aurora.a);
|
||||
contrastMask = pow(contrastMask, _AuroraContrast);
|
||||
aurora.rgb *= lerp(half3(0,0,0), _AuroraColor.rgb * cloudColor.rgb * _AuroraBrightness, contrastMask);
|
||||
|
||||
half cloudSub = 1.0 - uv.z;
|
||||
aurora.a = aurora.a - cloudSub * cloudSub;
|
||||
aurora.a = saturate(aurora.a * _AuroraIntensity);
|
||||
aurora.rgb *= aurora.a;
|
||||
|
||||
return aurora;
|
||||
}
|
||||
|
||||
fixed4 frag(v2f i) : SV_Target
|
||||
{
|
||||
#if defined(ENVIRO_AURORA)
|
||||
|
||||
if (_AuroraIntensity < 0.05)
|
||||
return float4(0,0,0,0);
|
||||
|
||||
float3 viewDir = normalize(i.worldPos - _WorldSpaceCameraPos);
|
||||
|
||||
float viewFalloff = 1.0 - saturate(dot(viewDir, float3(0,1,0)));
|
||||
|
||||
if (viewDir.y < 0 || viewDir.y > 1)
|
||||
return half4(0, 0, 0, 0);
|
||||
|
||||
float3 traceDir = normalize(viewDir + float3(0, viewFalloff * 0.2 ,0));
|
||||
|
||||
float3 worldPos = _WorldSpaceCameraPos + traceDir * ((_AuroraHeight - _WorldSpaceCameraPos.y) / max(traceDir.y, 0.01));
|
||||
float3 uv = float3(worldPos.xz * 0.01 * _AuroraScale, 0);
|
||||
|
||||
half3 uvStep = half3(traceDir.xz * -1.0 * (1.0 / traceDir.y), 1.0) * (1.0 / _AuroraSteps);
|
||||
uv += uvStep * randomNoise(i.worldPos + _SinTime.w);
|
||||
|
||||
half4 finalColor = half4(0,0,0,0);
|
||||
|
||||
[loop]
|
||||
for (int i = 0; i < _AuroraSteps; i++)
|
||||
{
|
||||
if (finalColor.a > 1)
|
||||
break;
|
||||
|
||||
uv += uvStep;
|
||||
finalColor += SampleAurora(uv) * (1.0 - finalColor.a);
|
||||
}
|
||||
|
||||
finalColor *= viewDir.y;
|
||||
|
||||
return finalColor;
|
||||
#else
|
||||
return half4(0, 0, 0, 0);
|
||||
#endif
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
|
||||
//Cirrus Clouds
|
||||
Pass
|
||||
{
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
|
||||
CGPROGRAM
|
||||
#pragma target 2.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
uniform sampler2D _CloudMap;
|
||||
uniform float _CloudAlpha;
|
||||
uniform float _CloudCoverage;
|
||||
uniform float _CloudAltitude;
|
||||
uniform float4 _CloudColor;
|
||||
uniform float _CloudColorPower;
|
||||
uniform float2 _CloudAnimation;
|
||||
|
||||
struct appdata {
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 Position : SV_POSITION;
|
||||
float4 uv : TEXCOORD0;
|
||||
float3 worldPos : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
v2f vert(appdata v)
|
||||
{
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v); //Insert
|
||||
UNITY_INITIALIZE_OUTPUT(v2f, o); //Insert
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); //Insert
|
||||
o.Position = UnityObjectToClipPos(v.vertex);
|
||||
o.worldPos = normalize(v.vertex).xyz;
|
||||
float3 viewDir = normalize(o.worldPos + float3(0,1,0));
|
||||
o.worldPos.y *= 1 - dot(viewDir.y + _CloudAltitude, float3(0,-0.15,0));
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 frag(v2f i) : SV_Target
|
||||
{
|
||||
float3 uvs = normalize(i.worldPos);
|
||||
|
||||
float4 uv1;
|
||||
float4 uv2;
|
||||
|
||||
uv1.xy = (uvs.xz * 0.2) + _CloudAnimation;
|
||||
uv2.xy = (uvs.xz * 0.4) + _CloudAnimation;
|
||||
|
||||
float4 clouds1 = tex2D(_CloudMap, uv1.xy);
|
||||
float4 clouds2 = tex2D(_CloudMap, uv2.xy);
|
||||
|
||||
float color1 = pow(clouds1.g + clouds2.g, 0.1);
|
||||
float color2 = pow(clouds2.b * clouds1.r, 0.2);
|
||||
|
||||
float4 finalClouds = lerp(clouds1, clouds2, color1 * color2);
|
||||
float cloudExtinction = pow(uvs.y , 2);
|
||||
|
||||
|
||||
finalClouds.a *= _CloudAlpha;
|
||||
finalClouds.a *= cloudExtinction;
|
||||
|
||||
if (uvs.y < 0)
|
||||
finalClouds.a = 0;
|
||||
|
||||
finalClouds.rgb = finalClouds.a * pow(_CloudColor,_CloudColorPower);
|
||||
finalClouds.rgb = pow(finalClouds.rgb,1 - _CloudCoverage);
|
||||
|
||||
return finalClouds;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
uniform sampler2D _FlatCloudsBaseTexture;
|
||||
uniform sampler2D _FlatCloudsDetailTexture;
|
||||
uniform float4 _FlatCloudsAnimation;
|
||||
uniform float3 _FlatCloudsLightDirection;
|
||||
uniform float3 _FlatCloudsLightColor;
|
||||
uniform float3 _FlatCloudsAmbientColor;
|
||||
uniform float4 _FlatCloudsLightingParams; // x = LightIntensity, y = AmbientIntensity, z = Absorbtion, w = HgPhase
|
||||
uniform float4 _FlatCloudsParams; // x = Coverage, y = Density, z = Altitude, w = tonemapping
|
||||
uniform float4 _FlatCloudsTiling; // x = Base, y = Detail
|
||||
uniform float _CloudsExposure;
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 Position : SV_POSITION;
|
||||
float4 uv : TEXCOORD0;
|
||||
float3 worldPos : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
v2f vert(appdata_base v)
|
||||
{
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_OUTPUT(v2f, o);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
o.Position = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = normalize(v.vertex).xyzw;
|
||||
float3 viewDir = normalize(o.uv + float3(0, 1, 0));
|
||||
o.uv.y *= 1 - dot(viewDir.y + _FlatCloudsParams.z, float3(0, -0.2, 0));
|
||||
o.worldPos = mul(unity_ObjectToWorld, v.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
float Remap(float org_val, float org_min, float org_max, float new_min, float new_max)
|
||||
{
|
||||
return new_min + saturate(((org_val - org_min) / (org_max - org_min))*(new_max - new_min));
|
||||
}
|
||||
|
||||
float HenryGreenstein(float cosTheta, float g)
|
||||
{
|
||||
float k = 3.0 / (8.0 * 3.1415926f) * (1.0 - g * g) / (2.0 + g * g);
|
||||
return k * (1.0 + cosTheta * cosTheta) / pow(abs(1.0 + g * g - 2.0 * g * cosTheta), 1.5);
|
||||
}
|
||||
half3 tonemapACES(half3 color, float Exposure)
|
||||
{
|
||||
color *= Exposure;
|
||||
|
||||
// See https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/
|
||||
const half a = 2.51;
|
||||
const half b = 0.03;
|
||||
const half c = 2.43;
|
||||
const half d = 0.59;
|
||||
const half e = 0.14;
|
||||
return saturate((color * (a * color + b)) / (color * (c * color + d) + e));
|
||||
}
|
||||
|
||||
float CalculateCloudDensity(float2 posBase, float2 posDetail, float coverage)
|
||||
{
|
||||
float4 baseNoise = tex2D(_FlatCloudsBaseTexture, posBase);
|
||||
float low_freq_fBm = (baseNoise.g * 0.625) + (baseNoise.b * 0.25) + (baseNoise.a * 0.125);
|
||||
float base_cloud = Remap(baseNoise.r, -(1.0 - low_freq_fBm), 1.0, 0.0, 1.0) * coverage;
|
||||
|
||||
float4 detailNoise = tex2D(_FlatCloudsDetailTexture, posDetail * 2);
|
||||
float high_freq_fBm = (detailNoise.r * 0.625) + (detailNoise.g * 0.25) + (detailNoise.b * 0.125);
|
||||
float density = Remap(base_cloud, 1.0 - high_freq_fBm * 0.5, 1.0, 0.0, 1.0);
|
||||
|
||||
density *= pow(high_freq_fBm, 0.4);
|
||||
density *= _FlatCloudsParams.y;
|
||||
|
||||
return density;
|
||||
}
|
||||
|
||||
half4 frag(v2f i) : SV_Target
|
||||
{
|
||||
half4 col = 0;
|
||||
float3 uvs = normalize(i.uv);
|
||||
|
||||
float4 uv1;
|
||||
uv1.xy = (uvs.xz * _FlatCloudsTiling.x) + _FlatCloudsAnimation.xy;
|
||||
uv1.zw = (uvs.xz * _FlatCloudsTiling.y) + _FlatCloudsAnimation.zw;
|
||||
|
||||
float cloudExtinction = pow(uvs.y, 2);
|
||||
half density = CalculateCloudDensity(uv1.xy, uv1.zw, _FlatCloudsParams.x);
|
||||
|
||||
//Lighting
|
||||
fixed absorbtion = exp2(-1 * (density * _FlatCloudsLightingParams.z));
|
||||
float3 viewDir = normalize(i.worldPos - _WorldSpaceCameraPos);
|
||||
float inscatterAngle = dot(normalize(_FlatCloudsLightDirection), -viewDir);
|
||||
fixed hg = HenryGreenstein(inscatterAngle, _FlatCloudsLightingParams.w) * 2 * absorbtion;
|
||||
fixed lighting = density * (absorbtion + hg);
|
||||
float3 lightColor = pow(_FlatCloudsLightColor, 2) * (_FlatCloudsLightingParams.x);
|
||||
col.rgb = lightColor * lighting;
|
||||
col.rgb = col.rgb + (_FlatCloudsAmbientColor * _FlatCloudsLightingParams.y);
|
||||
|
||||
//Tonemapping
|
||||
if (_FlatCloudsParams.w == 1)
|
||||
col.rgb = tonemapACES(col.rgb, _CloudsExposure);
|
||||
|
||||
|
||||
col.a = saturate(density * cloudExtinction);
|
||||
|
||||
if (uvs.y < 0)
|
||||
col.a = 0;
|
||||
|
||||
return col;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
}
|
||||
FallBack "None"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e6e0603052e7ce47b1d8c48aa9ee67e
|
||||
timeCreated: 1503929340
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+125
@@ -0,0 +1,125 @@
|
||||
Shader "Enviro/Standard/WeatherMap" {
|
||||
Properties {
|
||||
_Coverage ("Coverage", Range(0,1)) = 0.5
|
||||
_Tiling ("Tiling", Range(1,100)) = 10
|
||||
}
|
||||
SubShader {
|
||||
Tags { "RenderType"="Opaque" }
|
||||
LOD 200
|
||||
Pass {
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "/Core/EnviroNoiseCore.cginc"
|
||||
#pragma target 3.0
|
||||
#pragma exclude_renderers gles
|
||||
|
||||
|
||||
#define CLASSICPERLIN
|
||||
|
||||
sampler2D _MainTex;
|
||||
|
||||
struct VertexInput {
|
||||
half4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct VertexOutput {
|
||||
float4 position : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
VertexOutput vert (VertexInput v) {
|
||||
VertexOutput o;
|
||||
o.position = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.uv;
|
||||
return o;
|
||||
}
|
||||
|
||||
float4x4 world_view_proj;
|
||||
|
||||
float _Coverage;
|
||||
float _CloudsType;
|
||||
float _CoverageType;
|
||||
int _Tiling;
|
||||
float2 _WindDir;
|
||||
float2 _Location;
|
||||
float _AnimSpeedScale;
|
||||
float4 _LightingVariance;
|
||||
|
||||
float set_range(float value, float low, float high) {
|
||||
return saturate((value - low)/(high - low));
|
||||
}
|
||||
|
||||
float remap(float value, float original_min, float original_max, float new_min, float new_max)
|
||||
{
|
||||
return new_min + saturate(((value - original_min) / (original_max - original_min)) * (new_max - new_min));
|
||||
}
|
||||
|
||||
float dilate_perlin_worley(float p, float w, float x) {
|
||||
float curve = 0.75;
|
||||
if (x < 0.5) {
|
||||
x = x / 0.5;
|
||||
float n = p + w * x;
|
||||
return n * lerp(1, 0.5, pow(x, curve));
|
||||
}
|
||||
else {
|
||||
x = (x - 0.5) / 0.5;
|
||||
float n = w + p * (1.0 - x);
|
||||
return n * lerp(0.5, 1.0, pow(x, 1.0 / curve));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
float4 frag(VertexInput input) : SV_Target
|
||||
{
|
||||
float2 xy_offset = _WindDir * 10 * _AnimSpeedScale;
|
||||
float2 xy_offset1 = xy_offset;
|
||||
float2 xy_offset2 = xy_offset + float2(50,100);
|
||||
float2 xy_offset3 = xy_offset + float2(100, 50);
|
||||
float2 xy_offset4 = xy_offset + float2(100, 500);
|
||||
|
||||
float2 sampling_pos0 = float2(input.uv + xy_offset1 + _Location) * _Tiling;
|
||||
float2 sampling_pos01 = float2(input.uv + xy_offset4 + _Location) * _Tiling;
|
||||
float2 sampling_pos02 = float2(input.uv + xy_offset2 + _Location) * 2 * _Tiling;
|
||||
float2 sampling_pos03 = float2(input.uv + xy_offset3 + _Location) * _LightingVariance.y * _Tiling;
|
||||
|
||||
float perlinT1 = saturate(CalculatePerlinTileing5(sampling_pos0.xy,float2(_Tiling, _Tiling)));
|
||||
float perlinT2 = saturate(CalculatePerlinTileing5(sampling_pos01.xy, float2(_Tiling, _Tiling)));
|
||||
float perlinT3 = saturate(CalculatePerlinTileing5(sampling_pos02.xy, float2(_Tiling, _Tiling)));
|
||||
|
||||
float perlinT = perlinT1 + saturate(perlinT2 - perlinT1);
|
||||
float worleyT = CalculateWorley3oct(sampling_pos0.xy, 1.5, 2, 2.5);
|
||||
|
||||
//float worley2 = saturate( pow( CalculateWorley1(sampling_pos0.xy, 5),0.5));
|
||||
|
||||
float perlin_worleyCov = dilate_perlin_worley(perlinT3, worleyT, 0.6);
|
||||
|
||||
float perlin_worley = dilate_perlin_worley(perlinT, perlin_worleyCov, _CoverageType);
|
||||
|
||||
float worleyFull = saturate((CalculateWorley1(sampling_pos01.xy, 4) - perlin_worley));
|
||||
|
||||
//float perlin_worleyFull = dilate_perlin_worley(perlinT3, worleyFull, 0.75);
|
||||
float coverage = perlin_worley + (_Coverage * worleyFull);
|
||||
//float coverage = perlin_worley * worley2 + (_Coverage * worleyFull);
|
||||
|
||||
if (_Coverage < 0)
|
||||
coverage += _Coverage;
|
||||
|
||||
float type = (coverage + (_Coverage - perlin_worley) * (1-_CloudsType)) * _CloudsType;
|
||||
/////
|
||||
|
||||
//Clouds Lighting Variance
|
||||
float perlinT4 = saturate(CalculatePerlinTileing5(sampling_pos03.xy, float2(_Tiling, _Tiling)));
|
||||
|
||||
perlinT4 = clamp(perlinT4, _LightingVariance.x, 1);
|
||||
|
||||
return float4(coverage, perlinT4, type, 0);
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
FallBack "Diffuse"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8c0c433dbcbd62f4d8cf13545909d440
|
||||
timeCreated: 1507124107
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Binary file not shown.
+93
@@ -0,0 +1,93 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cd6e898ed9788da48ac517f37841cea8
|
||||
timeCreated: 1549557083
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName:
|
||||
8900000: generatedCubemap
|
||||
serializedVersion: 4
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 1
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -1
|
||||
wrapMode: -1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 2
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
- buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
- buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
- buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because one or more lines are too long
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: edb3b4aefdbff4647b7b517b92300d0f
|
||||
timeCreated: 1556108163
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 11700000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+33
File diff suppressed because one or more lines are too long
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: db78cd4c8da398549b079500e10b0064
|
||||
timeCreated: 1556134488
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 11700000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+33
File diff suppressed because one or more lines are too long
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5435894e539d47c40bca029243c32534
|
||||
timeCreated: 1556134731
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 11700000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+33
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user