Stop tracking Library folder

This commit is contained in:
SHOUTING_PIRATE
2025-09-09 16:43:30 +01:00
commit 04e85b0385
4850 changed files with 1722363 additions and 0 deletions

View File

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

View File

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

View File

@@ -0,0 +1,188 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 3
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: WaterBasicDaytime
m_Shader: {fileID: 4800000, guid: 9dccc8e8f0da4494991c26ef59019551, type: 3}
m_ShaderKeywords: []
m_CustomRenderQueue: -1
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 2800000, guid: c2ef94ff9d11915d1100a04b44295342, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _BumpMap
second:
m_Texture: {fileID: 2800000, guid: a53cf5449d11a15d1100a04b44295342, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _ReflectionTex
second:
m_Texture: {fileID: 8400000, guid: 21bb33409d118354d000dcabe39e7c39, type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _ColorControlCube
second:
m_Texture: {fileID: 8900000, guid: 98c330f39d11745ad0004adb8d76c639, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _ColorControl
second:
m_Texture: {fileID: 2800000, guid: 047330f39d11745ad0004adb8d76c639, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _WavesTex
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _BumpMap2
second:
m_Texture: {fileID: 2800000, guid: 279fb0a19d11d4a6d00051fa8d76c639, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _ColorGradient
second:
m_Texture: {fileID: 2800000, guid: 8403d3349d112ba4d000be1be39e7c39, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
data:
first:
name: _Shininess
second: 1
data:
first:
name: _WaveScale
second: .0702830181
data:
first:
name: _Highlight
second: 33.2075462
data:
first:
name: _bScale
second: .0700000003
data:
first:
name: _BumpPeturb
second: 82.07547
data:
first:
name: _BumpPeturb2
second: .745283008
data:
first:
name: _bTwirl
second: .0500000007
data:
first:
name: _distort
second: .100000001
m_Colors:
data:
first:
name: _Color
second: {r: 0, g: 0, b: 0, a: 1}
data:
first:
name: _MainTex_ST
second: {r: 1, g: 1, b: 0, a: 0}
data:
first:
name: _SpecColor
second: {r: 0, g: 0, b: 0, a: .400000006}
data:
first:
name: _BumpMap_ST
second: {r: 1, g: 1, b: 0, a: 0}
data:
first:
name: WaveSpeed
second: {r: 9, g: 4.5, b: -8, a: -3.5}
data:
first:
name: _horizonColor
second: {r: 0, g: .125133663, b: .191176474, a: 0}
data:
first:
name: _ColorControl_ST
second: {r: 1, g: 1, b: 0, a: 0}
data:
first:
name: _ColorControlCube_ST
second: {r: 1, g: 1, b: 0, a: 0}
data:
first:
name: BumpParm
second: {r: 1, g: 1, b: 1, a: 1}
data:
first:
name: _EdgeColor
second: {r: 0, g: .100000001, b: 0, a: .100000001}
data:
first:
name: _RefTex_0
second: {r: -1517.37024, g: -23.9408531, b: -3154.91675, a: 2715.94165}
data:
first:
name: _RefTex_1
second: {r: 356.584351, g: -313.125671, b: -962.84906, a: 2791.50659}
data:
first:
name: _RefTex_2
second: {r: 4.95644999, g: -.187056601, b: -13.3834057, a: 20.1233597}
data:
first:
name: _RefTex_3
second: {r: 4.95595503, g: -.18703793, b: -13.3820696, a: 20.2213535}
data:
first:
name: horizonColor
second: {r: .61500001, g: .796000004, b: .875999987, a: 1}
data:
first:
name: uvParams
second: {r: 10, g: .0199999996, b: .0299999993, a: 0}
data:
first:
name: waveDirX
second: {r: -2.5, g: 0, b: 7, a: 8}
data:
first:
name: waveDirY
second: {r: 0, g: 1.5, b: -7, a: 1}
data:
first:
name: waveHeights
second: {r: .800000012, g: 1, b: .100000001, a: .0500000007}
data:
first:
name: _WaveSpeed
second: {r: 1, g: -1, b: -1, a: 1}
--- !u!1002 &2100001
EditorExtensionImpl:
serializedVersion: 6

View File

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

View File

@@ -0,0 +1,192 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 3
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: WaterBasicNighttime
m_Shader: {fileID: 4800000, guid: 9dccc8e8f0da4494991c26ef59019551, type: 3}
m_ShaderKeywords: []
m_CustomRenderQueue: -1
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 2800000, guid: c2ef94ff9d11915d1100a04b44295342, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _BumpMap
second:
m_Texture: {fileID: 2800000, guid: a53cf5449d11a15d1100a04b44295342, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _ReflectionTex
second:
m_Texture: {fileID: 8400000, guid: 21bb33409d118354d000dcabe39e7c39, type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _WavesTex
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _ColorControlCube
second:
m_Texture: {fileID: 8900000, guid: 006a5f739d1105f6a000538a2aef8c59, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _ColorControl
second:
m_Texture: {fileID: 2800000, guid: 8403d3349d112ba4d000be1be39e7c39, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _BumpMap2
second:
m_Texture: {fileID: 2800000, guid: 279fb0a19d11d4a6d00051fa8d76c639, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _ColorGradient
second:
m_Texture: {fileID: 2800000, guid: 8403d3349d112ba4d000be1be39e7c39, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
data:
first:
name: _Shininess
second: 1
data:
first:
name: _WaveScale
second: .0702830181
data:
first:
name: _Highlight
second: 33.2075462
data:
first:
name: _bScale
second: .0629245341
data:
first:
name: _BumpPeturb
second: 82.07547
data:
first:
name: _BumpPeturb2
second: .745283008
data:
first:
name: _bTwirl
second: .0500000007
data:
first:
name: _distort
second: .100000001
data:
first:
name: _BumpStrength
second: .100000001
m_Colors:
data:
first:
name: _Color
second: {r: .700785816, g: .481223762, b: .474296182, a: 1}
data:
first:
name: _MainTex_ST
second: {r: 1, g: 1, b: 0, a: 0}
data:
first:
name: _SpecColor
second: {r: 0, g: 0, b: 0, a: .400000006}
data:
first:
name: _BumpMap_ST
second: {r: 1, g: 1, b: 0, a: 0}
data:
first:
name: WaveSpeed
second: {r: 9.68770027, g: 4.81898165, b: -7.91322803, a: 2.87029743}
data:
first:
name: _horizonColor
second: {r: .148485541, g: .282429248, b: .379949659, a: 0}
data:
first:
name: _ColorControl_ST
second: {r: 1, g: 1, b: 0, a: 0}
data:
first:
name: _ColorControlCube_ST
second: {r: 1, g: 1, b: 0, a: 0}
data:
first:
name: BumpParm
second: {r: 1, g: 1, b: -1, a: -1}
data:
first:
name: _EdgeColor
second: {r: 0, g: .100000001, b: 0, a: .100000001}
data:
first:
name: _RefTex_0
second: {r: -1517.37024, g: -23.9408531, b: -3154.91675, a: 2715.94165}
data:
first:
name: _RefTex_1
second: {r: 356.584351, g: -313.125671, b: -962.84906, a: 2791.50659}
data:
first:
name: _RefTex_2
second: {r: 4.95644999, g: -.187056601, b: -13.3834057, a: 20.1233597}
data:
first:
name: _RefTex_3
second: {r: 4.95595503, g: -.18703793, b: -13.3820696, a: 20.2213535}
data:
first:
name: horizonColor
second: {r: .61500001, g: .796000004, b: .875999987, a: 1}
data:
first:
name: uvParams
second: {r: 10, g: .0199999996, b: .0299999993, a: 0}
data:
first:
name: waveDirX
second: {r: -2.5, g: 0, b: 7, a: 8}
data:
first:
name: waveDirY
second: {r: 0, g: 1.5, b: -7, a: 1}
data:
first:
name: waveHeights
second: {r: .800000012, g: 1, b: .100000001, a: .0500000007}
data:
first:
name: _WaveSpeed
second: {r: 1, g: -1, b: -1, a: 1}
--- !u!1002 &2100001
EditorExtensionImpl:
serializedVersion: 6

View File

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

View File

@@ -0,0 +1,31 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 3
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: WaterDefault
m_Shader: {fileID: 7, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: []
m_CustomRenderQueue: -1
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 2800000, guid: c2ef94ff9d11915d1100a04b44295342, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats: {}
m_Colors:
data:
first:
name: _Color
second: {r: .5, g: .5, b: .5, a: 1}
--- !u!1002 &2100001
EditorExtensionImpl:
serializedVersion: 6

View File

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

View File

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

View File

@@ -0,0 +1,73 @@
fileFormatVersion: 2
guid: ce8d79c79d11b8f9d00076e98d76c639
ModelImporter:
serializedVersion: 18
fileIDToRecycleName:
100000: //RootNode
400000: //RootNode
2300000: //RootNode
3300000: //RootNode
4300000: pPlane1
4300002: nurbsToPoly1
4300004: pCylinder1
4300006: waterPlaneMesh
4300008: WaterBasicPlane
4300010: WaterSimplePlane
11100000: //RootNode
materials:
importMaterials: 0
materialName: 1
materialSearch: 2
animations:
legacyGenerateAnimations: 0
bakeSimulation: 0
optimizeGameObjects: 0
motionNodeName:
pivotNodeName:
animationCompression: 1
animationRotationError: .5
animationPositionError: .5
animationScaleError: .5
animationWrapMode: 0
extraExposedTransformPaths: []
clipAnimations: []
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
importBlendShapes: 1
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 0
optimizeMeshForGPU: 1
weldVertices: 1
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15
secondaryUVHardAngle: 88
secondaryUVPackMargin: 4
useFileScale: 0
tangentSpace:
normalSmoothAngle: 60
splitTangentsAcrossUV: 0
normalImportMode: 0
tangentImportMode: 1
importAnimation: 1
copyAvatar: 0
humanDescription:
human: []
skeleton: []
armTwist: .5
foreArmTwist: .5
upperLegTwist: .5
legTwist: .5
armStretch: .0500000007
legStretch: .0500000007
feetSpacing: 0
rootMotionBoneName:
lastHumanDescriptionAvatarSource: {instanceID: 0}
animationType: 1
additionalBone: 0
userData:
assetBundleName:

View File

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

View File

@@ -0,0 +1,92 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &100000
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 400000}
- component: {fileID: 3300000}
- component: {fileID: 2300000}
- component: {fileID: 11400000}
m_Layer: 4
m_Name: WaterBasicDaytime
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &400000
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100000}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &3300000
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100000}
m_Mesh: {fileID: 4300008, guid: ce8d79c79d11b8f9d00076e98d76c639, type: 3}
--- !u!23 &2300000
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100000}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 52b7d70b1de7c4ce09662b77c14d9fda, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100000}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0d2f50a8e0bb841a5aaa90ae55db8849, type: 3}
m_Name:
m_EditorClassIdentifier:

View File

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

View File

@@ -0,0 +1,92 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &100000
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 400000}
- component: {fileID: 3300000}
- component: {fileID: 2300000}
- component: {fileID: 11400000}
m_Layer: 4
m_Name: WaterBasicNightime
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &400000
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100000}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -3.1033, y: 10.314, z: -40.59}
m_LocalScale: {x: 16, y: 1, z: 16}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &3300000
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100000}
m_Mesh: {fileID: 4300008, guid: ce8d79c79d11b8f9d00076e98d76c639, type: 3}
--- !u!23 &2300000
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100000}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: c55afdc4a8a3b4890b07cc7d176510bb, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100000}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0d2f50a8e0bb841a5aaa90ae55db8849, type: 3}
m_Name:
m_EditorClassIdentifier:

View File

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

View File

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

View File

@@ -0,0 +1,32 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.Water
{
[ExecuteInEditMode]
public class WaterBasic : MonoBehaviour
{
void Update()
{
Renderer r = GetComponent<Renderer>();
if (!r)
{
return;
}
Material mat = r.sharedMaterial;
if (!mat)
{
return;
}
Vector4 waveSpeed = mat.GetVector("WaveSpeed");
float waveScale = mat.GetFloat("_WaveScale");
float t = Time.time / 20.0f;
Vector4 offset4 = waveSpeed * (t * waveScale);
Vector4 offsetClamped = new Vector4(Mathf.Repeat(offset4.x, 1.0f), Mathf.Repeat(offset4.y, 1.0f),
Mathf.Repeat(offset4.z, 1.0f), Mathf.Repeat(offset4.w, 1.0f));
mat.SetVector("_WaveOffset", offsetClamped);
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 0d2f50a8e0bb841a5aaa90ae55db8849
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:

View File

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

View File

@@ -0,0 +1,90 @@
// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
Shader "FX/Water (Basic)" {
Properties {
_horizonColor ("Horizon color", COLOR) = ( .172 , .463 , .435 , 0)
_WaveScale ("Wave scale", Range (0.02,0.15)) = .07
[NoScaleOffset] _ColorControl ("Reflective color (RGB) fresnel (A) ", 2D) = "" { }
[NoScaleOffset] _BumpMap ("Waves Normalmap ", 2D) = "" { }
WaveSpeed ("Wave speed (map1 x,y; map2 x,y)", Vector) = (19,9,-16,-7)
}
CGINCLUDE
#include "UnityCG.cginc"
uniform float4 _horizonColor;
uniform float4 WaveSpeed;
uniform float _WaveScale;
uniform float4 _WaveOffset;
struct appdata {
float4 vertex : POSITION;
float3 normal : NORMAL;
};
struct v2f {
float4 pos : SV_POSITION;
float2 bumpuv[2] : TEXCOORD0;
float3 viewDir : TEXCOORD2;
UNITY_FOG_COORDS(3)
};
v2f vert(appdata v)
{
v2f o;
float4 s;
o.pos = UnityObjectToClipPos(v.vertex);
// scroll bump waves
float4 temp;
float4 wpos = mul (unity_ObjectToWorld, v.vertex);
temp.xyzw = wpos.xzxz * _WaveScale + _WaveOffset;
o.bumpuv[0] = temp.xy * float2(.4, .45);
o.bumpuv[1] = temp.wz;
// object space view direction
o.viewDir.xzy = normalize( WorldSpaceViewDir(v.vertex) );
UNITY_TRANSFER_FOG(o,o.pos);
return o;
}
ENDCG
Subshader {
Tags { "RenderType"="Opaque" }
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_fog
sampler2D _BumpMap;
sampler2D _ColorControl;
half4 frag( v2f i ) : COLOR
{
half3 bump1 = UnpackNormal(tex2D( _BumpMap, i.bumpuv[0] )).rgb;
half3 bump2 = UnpackNormal(tex2D( _BumpMap, i.bumpuv[1] )).rgb;
half3 bump = (bump1 + bump2) * 0.5;
half fresnel = dot( i.viewDir, bump );
half4 water = tex2D( _ColorControl, float2(fresnel,fresnel) );
half4 col;
col.rgb = lerp( water.rgb, _horizonColor.rgb, water.a );
col.a = _horizonColor.a;
UNITY_APPLY_FOG(i.fogCoord, col);
return col;
}
ENDCG
}
}
}

View File

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

View File

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

View File

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

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,154 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 3
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: WaterPlaneMaterial
m_Shader: {fileID: 45, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
- _LIGHTMAPPING_STATIC_LIGHTMAPS
- _UVSEC_UV1
m_CustomRenderQueue: -1
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _BumpMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _EmissionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _ParallaxMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _Occlusion
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _SpecGlossMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailMask
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailAlbedoMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailNormalMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
data:
first:
name: _Lightmapping
second: 0
data:
first:
name: _SrcBlend
second: 1
data:
first:
name: _DstBlend
second: 0
data:
first:
name: _Parallax
second: .0199999996
data:
first:
name: _ZWrite
second: 1
data:
first:
name: _AlphaTestRef
second: .5
data:
first:
name: _Glossiness
second: 0
data:
first:
name: _BumpScale
second: 1
data:
first:
name: _OcclusionStrength
second: 1
data:
first:
name: _DetailNormalMapScale
second: 1
data:
first:
name: _UVSec
second: 0
data:
first:
name: _Mode
second: 0
data:
first:
name: _EmissionScaleUI
second: 1
m_Colors:
data:
first:
name: _Color
second: {r: .5, g: .5, b: .5, a: 1}
data:
first:
name: _EmissionColor
second: {r: 0, g: 0, b: 0, a: 1}
data:
first:
name: _SpecularColor
second: {r: .200000003, g: .200000003, b: .200000003, a: 1}
data:
first:
name: _EmissionColorUI
second: {r: 0, g: 0, b: 0, a: 1}
data:
first:
name: _EmissionColorWithMapUI
second: {r: 1, g: 1, b: 1, a: 1}

View File

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

View File

@@ -0,0 +1,68 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: WaterProDaytime 1
m_Shader: {fileID: 4800000, guid: 1cac2e0bcc34e4b3cbb4bd85982eba83, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 2800000, guid: 2dd3788f8589b40bf82a92d76ffc5091, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Fresnel:
m_Texture: {fileID: 2800000, guid: 5b5c5575fd4c74abd9f7b30862fb76a3, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: e6f8288974c664a309d6c66de636978c, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ReflectionTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ReflectiveColor:
m_Texture: {fileID: 2800000, guid: ab97f9ab7c2ce724ebc9446060a819a4, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ReflectiveColorCube:
m_Texture: {fileID: 8900000, guid: 9cda328e4b6954d70841a8a66f42ec08, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _RefractionTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _ReflDistort: 0.91
- _RefrDistort: 0.719
- _WaveScale: 0.0811
m_Colors:
- WaveSpeed: {r: 1, g: 0.5, b: -1, a: -0.4}
- _BumpMap_ST: {r: 1, g: 1, b: 0, a: 0}
- _Fresnel_ST: {r: 1, g: 1, b: 0, a: 0}
- _HorizonColor: {r: 0.5377358, g: 0.5377358, b: 0.5377358, a: 1}
- _MainTex_ST: {r: 1, g: 1, b: 0, a: 0}
- _ReflectionTex_ST: {r: 1, g: 1, b: 0, a: 0}
- _ReflectiveColorCube_ST: {r: 1, g: 1, b: 0, a: 0}
- _ReflectiveColor_ST: {r: 1, g: 1, b: 0, a: 0}
- _RefrColor: {r: 0.990566, g: 0.91349936, b: 0.8071932, a: 1}
- _RefractionTex_ST: {r: 1, g: 1, b: 0, a: 0}
m_BuildTextureStacks: []
--- !u!1002 &2100001
EditorExtensionImpl:
serializedVersion: 6

View File

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

View File

@@ -0,0 +1,68 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: WaterProDaytime
m_Shader: {fileID: 4800000, guid: 1cac2e0bcc34e4b3cbb4bd85982eba83, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 2800000, guid: 2dd3788f8589b40bf82a92d76ffc5091, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Fresnel:
m_Texture: {fileID: 2800000, guid: 5b5c5575fd4c74abd9f7b30862fb76a3, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: e6f8288974c664a309d6c66de636978c, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ReflectionTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ReflectiveColor:
m_Texture: {fileID: 2800000, guid: ab97f9ab7c2ce724ebc9446060a819a4, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ReflectiveColorCube:
m_Texture: {fileID: 8900000, guid: 9cda328e4b6954d70841a8a66f42ec08, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _RefractionTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _ReflDistort: 0.817
- _RefrDistort: 0.841
- _WaveScale: 0.0934
m_Colors:
- WaveSpeed: {r: 1, g: 0.5, b: -1, a: -0.4}
- _BumpMap_ST: {r: 1, g: 1, b: 0, a: 0}
- _Fresnel_ST: {r: 1, g: 1, b: 0, a: 0}
- _HorizonColor: {r: 0.13575952, g: 0.22810712, b: 0.3810788, a: 0}
- _MainTex_ST: {r: 1, g: 1, b: 0, a: 0}
- _ReflectionTex_ST: {r: 1, g: 1, b: 0, a: 0}
- _ReflectiveColorCube_ST: {r: 1, g: 1, b: 0, a: 0}
- _ReflectiveColor_ST: {r: 1, g: 1, b: 0, a: 0}
- _RefrColor: {r: 0.990566, g: 0.91349936, b: 0.8071932, a: 1}
- _RefractionTex_ST: {r: 1, g: 1, b: 0, a: 0}
m_BuildTextureStacks: []
--- !u!1002 &2100001
EditorExtensionImpl:
serializedVersion: 6

View File

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

View File

@@ -0,0 +1,69 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: WaterProNighttime
m_Shader: {fileID: 4800000, guid: 1cac2e0bcc34e4b3cbb4bd85982eba83, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 2800000, guid: 2dd3788f8589b40bf82a92d76ffc5091, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Fresnel:
m_Texture: {fileID: 2800000, guid: 5b5c5575fd4c74abd9f7b30862fb76a3, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: e6f8288974c664a309d6c66de636978c, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ReflectionTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ReflectiveColor:
m_Texture: {fileID: 2800000, guid: ab97f9ab7c2ce724ebc9446060a819a4, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ReflectiveColorCube:
m_Texture: {fileID: 8900000, guid: 15c6acc4f11254a04b03849245d80574, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _RefractionTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _ReflDistort: 1.372
- _RefrDistort: 0.157
- _WaveScale: 0.1278
m_Colors:
- WaveSpeed: {r: 1, g: 1, b: -1, a: -1}
- _BumpMap_ST: {r: 1, g: 1, b: 0, a: 0}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _Fresnel_ST: {r: 1, g: 1, b: 0, a: 0}
- _HorizonColor: {r: 0.6886792, g: 0.6886792, b: 0.6886792, a: 0}
- _MainTex_ST: {r: 1, g: 1, b: 0, a: 0}
- _ReflectionTex_ST: {r: 1, g: 1, b: 0, a: 0}
- _ReflectiveColorCube_ST: {r: 1, g: 1, b: 0, a: 0}
- _ReflectiveColor_ST: {r: 1, g: 1, b: 0, a: 0}
- _RefrColor: {r: 1, g: 1, b: 1, a: 0.73333335}
- _RefractionTex_ST: {r: 1, g: 1, b: 0, a: 0}
m_BuildTextureStacks: []
--- !u!1002 &2100001
EditorExtensionImpl:
serializedVersion: 6

View File

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

View File

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

View File

@@ -0,0 +1,71 @@
fileFormatVersion: 2
guid: ba6a41dc489914734857bb5924eb70ad
ModelImporter:
serializedVersion: 18
fileIDToRecycleName:
100000: //RootNode
400000: //RootNode
2300000: //RootNode
3300000: //RootNode
4300000: pPlane1
4300002: nurbsToPoly1
4300004: pCylinder1
4300006: waterPlaneMesh
11100000: //RootNode
materials:
importMaterials: 1
materialName: 1
materialSearch: 1
animations:
legacyGenerateAnimations: 0
bakeSimulation: 0
optimizeGameObjects: 0
motionNodeName:
pivotNodeName:
animationCompression: 1
animationRotationError: .5
animationPositionError: .5
animationScaleError: .5
animationWrapMode: 0
extraExposedTransformPaths: []
clipAnimations: []
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
importBlendShapes: 1
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 0
optimizeMeshForGPU: 1
weldVertices: 1
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15
secondaryUVHardAngle: 88
secondaryUVPackMargin: 4
useFileScale: 0
tangentSpace:
normalSmoothAngle: 60
splitTangentsAcrossUV: 0
normalImportMode: 0
tangentImportMode: 1
importAnimation: 1
copyAvatar: 0
humanDescription:
human: []
skeleton: []
armTwist: .5
foreArmTwist: .5
upperLegTwist: .5
legTwist: .5
armStretch: .0500000007
legStretch: .0500000007
feetSpacing: 0
rootMotionBoneName:
lastHumanDescriptionAvatarSource: {instanceID: 0}
animationType: 1
additionalBone: 1
userData:
assetBundleName:

View File

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

View File

@@ -0,0 +1,102 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &100000
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 400000}
- component: {fileID: 3300000}
- component: {fileID: 2300000}
- component: {fileID: 11400000}
m_Layer: 4
m_Name: WaterProDaytime
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &400000
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100000}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 16, y: 1, z: 16}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &3300000
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100000}
m_Mesh: {fileID: 4300006, guid: ba6a41dc489914734857bb5924eb70ad, type: 3}
--- !u!23 &2300000
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100000}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 7350b65a6431f604a8496c39db1ac9c5, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100000}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a3d3ef1a5bbfb4e0a910fbbe5830b1f9, type: 3}
m_Name:
m_EditorClassIdentifier:
waterMode: 2
disablePixelLights: 1
textureSize: 256
clipPlaneOffset: 0.07
reflectLayers:
serializedVersion: 2
m_Bits: 4294967295
refractLayers:
serializedVersion: 2
m_Bits: 4294967295

View File

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

View File

@@ -0,0 +1,102 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &100000
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 400000}
- component: {fileID: 3300000}
- component: {fileID: 2300000}
- component: {fileID: 11400000}
m_Layer: 4
m_Name: WaterProNighttime
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &400000
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100000}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 16, y: 1, z: 16}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &3300000
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100000}
m_Mesh: {fileID: 4300006, guid: ba6a41dc489914734857bb5924eb70ad, type: 3}
--- !u!23 &2300000
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100000}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: e633a20421c47426aa04444234225b69, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100000}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a3d3ef1a5bbfb4e0a910fbbe5830b1f9, type: 3}
m_Name:
m_EditorClassIdentifier:
waterMode: 2
disablePixelLights: 1
textureSize: 256
clipPlaneOffset: 0.07
reflectLayers:
serializedVersion: 2
m_Bits: 4294967295
refractLayers:
serializedVersion: 2
m_Bits: 4294967295

View File

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

View File

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

View File

@@ -0,0 +1,36 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.Water
{
[ExecuteInEditMode]
[RequireComponent(typeof(WaterBase))]
public class Displace : MonoBehaviour
{
public void Awake()
{
if (enabled)
{
OnEnable();
}
else
{
OnDisable();
}
}
public void OnEnable()
{
Shader.EnableKeyword("WATER_VERTEX_DISPLACEMENT_ON");
Shader.DisableKeyword("WATER_VERTEX_DISPLACEMENT_OFF");
}
public void OnDisable()
{
Shader.EnableKeyword("WATER_VERTEX_DISPLACEMENT_OFF");
Shader.DisableKeyword("WATER_VERTEX_DISPLACEMENT_ON");
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: c62b7d87755b447919138e67f8e22e0c
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:

View File

@@ -0,0 +1,9 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.Water
{
[ExecuteInEditMode]
[RequireComponent(typeof(WaterBase))]
public class GerstnerDisplace : Displace { }
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 42e7f46d0e5a84171a3909479c1646ba
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:

View File

@@ -0,0 +1,27 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.Water
{
public class MeshContainer
{
public Mesh mesh;
public Vector3[] vertices;
public Vector3[] normals;
public MeshContainer(Mesh m)
{
mesh = m;
vertices = m.vertices;
normals = m.normals;
}
public void Update()
{
mesh.vertices = vertices;
mesh.normals = normals;
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 951d74f7d57bed84cb623c62436bd064
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:

View File

@@ -0,0 +1,284 @@
using System;
using System.Collections.Generic;
using UnityEngine;
namespace UnityStandardAssets.Water
{
[ExecuteInEditMode]
[RequireComponent(typeof(WaterBase))]
public class PlanarReflection : MonoBehaviour
{
public LayerMask reflectionMask;
public bool reflectSkybox = false;
public Color clearColor = Color.grey;
public String reflectionSampler = "_ReflectionTex";
public float clipPlaneOffset = 0.07F;
Vector3 m_Oldpos;
Camera m_ReflectionCamera;
Material m_SharedMaterial;
Dictionary<Camera, bool> m_HelperCameras;
public void Start()
{
m_SharedMaterial = ((WaterBase)gameObject.GetComponent(typeof(WaterBase))).sharedMaterial;
}
Camera CreateReflectionCameraFor(Camera cam)
{
String reflName = gameObject.name + "Reflection" + cam.name;
GameObject go = GameObject.Find(reflName);
if (!go)
{
go = new GameObject(reflName, typeof(Camera));
}
if (!go.GetComponent(typeof(Camera)))
{
go.AddComponent(typeof(Camera));
}
Camera reflectCamera = go.GetComponent<Camera>();
reflectCamera.backgroundColor = clearColor;
reflectCamera.clearFlags = reflectSkybox ? CameraClearFlags.Skybox : CameraClearFlags.SolidColor;
SetStandardCameraParameter(reflectCamera, reflectionMask);
if (!reflectCamera.targetTexture)
{
reflectCamera.targetTexture = CreateTextureFor(cam);
}
return reflectCamera;
}
void SetStandardCameraParameter(Camera cam, LayerMask mask)
{
cam.cullingMask = mask & ~(1 << LayerMask.NameToLayer("Water"));
cam.backgroundColor = Color.black;
cam.enabled = false;
}
RenderTexture CreateTextureFor(Camera cam)
{
RenderTexture rt = new RenderTexture(Mathf.FloorToInt(cam.pixelWidth * 0.5F),
Mathf.FloorToInt(cam.pixelHeight * 0.5F), 24);
rt.hideFlags = HideFlags.DontSave;
return rt;
}
public void RenderHelpCameras(Camera currentCam)
{
if (null == m_HelperCameras)
{
m_HelperCameras = new Dictionary<Camera, bool>();
}
if (!m_HelperCameras.ContainsKey(currentCam))
{
m_HelperCameras.Add(currentCam, false);
}
if (m_HelperCameras[currentCam])
{
return;
}
if (!m_ReflectionCamera)
{
m_ReflectionCamera = CreateReflectionCameraFor(currentCam);
}
RenderReflectionFor(currentCam, m_ReflectionCamera);
m_HelperCameras[currentCam] = true;
}
public void LateUpdate()
{
if (null != m_HelperCameras)
{
m_HelperCameras.Clear();
}
}
public void WaterTileBeingRendered(Transform tr, Camera currentCam)
{
RenderHelpCameras(currentCam);
if (m_ReflectionCamera && m_SharedMaterial)
{
m_SharedMaterial.SetTexture(reflectionSampler, m_ReflectionCamera.targetTexture);
}
}
public void OnEnable()
{
Shader.EnableKeyword("WATER_REFLECTIVE");
Shader.DisableKeyword("WATER_SIMPLE");
}
public void OnDisable()
{
Shader.EnableKeyword("WATER_SIMPLE");
Shader.DisableKeyword("WATER_REFLECTIVE");
}
void RenderReflectionFor(Camera cam, Camera reflectCamera)
{
if (!reflectCamera)
{
return;
}
if (m_SharedMaterial && !m_SharedMaterial.HasProperty(reflectionSampler))
{
return;
}
reflectCamera.cullingMask = reflectionMask & ~(1 << LayerMask.NameToLayer("Water"));
SaneCameraSettings(reflectCamera);
reflectCamera.backgroundColor = clearColor;
reflectCamera.clearFlags = reflectSkybox ? CameraClearFlags.Skybox : CameraClearFlags.SolidColor;
if (reflectSkybox)
{
if (cam.gameObject.GetComponent(typeof(Skybox)))
{
Skybox sb = (Skybox)reflectCamera.gameObject.GetComponent(typeof(Skybox));
if (!sb)
{
sb = (Skybox)reflectCamera.gameObject.AddComponent(typeof(Skybox));
}
sb.material = ((Skybox)cam.GetComponent(typeof(Skybox))).material;
}
}
GL.invertCulling = true;
Transform reflectiveSurface = transform; //waterHeight;
Vector3 eulerA = cam.transform.eulerAngles;
reflectCamera.transform.eulerAngles = new Vector3(-eulerA.x, eulerA.y, eulerA.z);
reflectCamera.transform.position = cam.transform.position;
Vector3 pos = reflectiveSurface.transform.position;
pos.y = reflectiveSurface.position.y;
Vector3 normal = reflectiveSurface.transform.up;
float d = -Vector3.Dot(normal, pos) - clipPlaneOffset;
Vector4 reflectionPlane = new Vector4(normal.x, normal.y, normal.z, d);
Matrix4x4 reflection = Matrix4x4.zero;
reflection = CalculateReflectionMatrix(reflection, reflectionPlane);
m_Oldpos = cam.transform.position;
Vector3 newpos = reflection.MultiplyPoint(m_Oldpos);
reflectCamera.worldToCameraMatrix = cam.worldToCameraMatrix * reflection;
Vector4 clipPlane = CameraSpacePlane(reflectCamera, pos, normal, 1.0f);
Matrix4x4 projection = cam.projectionMatrix;
projection = CalculateObliqueMatrix(projection, clipPlane);
reflectCamera.projectionMatrix = projection;
reflectCamera.transform.position = newpos;
Vector3 euler = cam.transform.eulerAngles;
reflectCamera.transform.eulerAngles = new Vector3(-euler.x, euler.y, euler.z);
reflectCamera.Render();
GL.invertCulling = false;
}
void SaneCameraSettings(Camera helperCam)
{
helperCam.depthTextureMode = DepthTextureMode.None;
helperCam.backgroundColor = Color.black;
helperCam.clearFlags = CameraClearFlags.SolidColor;
helperCam.renderingPath = RenderingPath.Forward;
}
static Matrix4x4 CalculateObliqueMatrix(Matrix4x4 projection, Vector4 clipPlane)
{
Vector4 q = projection.inverse * new Vector4(
Sgn(clipPlane.x),
Sgn(clipPlane.y),
1.0F,
1.0F
);
Vector4 c = clipPlane * (2.0F / (Vector4.Dot(clipPlane, q)));
// third row = clip plane - fourth row
projection[2] = c.x - projection[3];
projection[6] = c.y - projection[7];
projection[10] = c.z - projection[11];
projection[14] = c.w - projection[15];
return projection;
}
static Matrix4x4 CalculateReflectionMatrix(Matrix4x4 reflectionMat, Vector4 plane)
{
reflectionMat.m00 = (1.0F - 2.0F * plane[0] * plane[0]);
reflectionMat.m01 = (- 2.0F * plane[0] * plane[1]);
reflectionMat.m02 = (- 2.0F * plane[0] * plane[2]);
reflectionMat.m03 = (- 2.0F * plane[3] * plane[0]);
reflectionMat.m10 = (- 2.0F * plane[1] * plane[0]);
reflectionMat.m11 = (1.0F - 2.0F * plane[1] * plane[1]);
reflectionMat.m12 = (- 2.0F * plane[1] * plane[2]);
reflectionMat.m13 = (- 2.0F * plane[3] * plane[1]);
reflectionMat.m20 = (- 2.0F * plane[2] * plane[0]);
reflectionMat.m21 = (- 2.0F * plane[2] * plane[1]);
reflectionMat.m22 = (1.0F - 2.0F * plane[2] * plane[2]);
reflectionMat.m23 = (- 2.0F * plane[3] * plane[2]);
reflectionMat.m30 = 0.0F;
reflectionMat.m31 = 0.0F;
reflectionMat.m32 = 0.0F;
reflectionMat.m33 = 1.0F;
return reflectionMat;
}
static float Sgn(float a)
{
if (a > 0.0F)
{
return 1.0F;
}
if (a < 0.0F)
{
return -1.0F;
}
return 0.0F;
}
Vector4 CameraSpacePlane(Camera cam, Vector3 pos, Vector3 normal, float sideSign)
{
Vector3 offsetPos = pos + normal * clipPlaneOffset;
Matrix4x4 m = cam.worldToCameraMatrix;
Vector3 cpos = m.MultiplyPoint(offsetPos);
Vector3 cnormal = m.MultiplyVector(normal).normalized * sideSign;
return new Vector4(cnormal.x, cnormal.y, cnormal.z, -Vector3.Dot(cpos, cnormal));
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 4185bc77c7194462ca3b1097ef4a5de0
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:

View File

@@ -0,0 +1,33 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.Water
{
[RequireComponent(typeof(WaterBase))]
[ExecuteInEditMode]
public class SpecularLighting : MonoBehaviour
{
public Transform specularLight;
private WaterBase m_WaterBase;
public void Start()
{
m_WaterBase = (WaterBase)gameObject.GetComponent(typeof(WaterBase));
}
public void Update()
{
if (!m_WaterBase)
{
m_WaterBase = (WaterBase)gameObject.GetComponent(typeof(WaterBase));
}
if (specularLight && m_WaterBase.sharedMaterial)
{
m_WaterBase.sharedMaterial.SetVector("_WorldLightDir", specularLight.transform.forward);
}
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: de2ab2b9ac93bb544b9552e49030371b
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:

View File

@@ -0,0 +1,403 @@
using System;
using System.Collections.Generic;
using UnityEngine;
namespace UnityStandardAssets.Water
{
[ExecuteInEditMode] // Make water live-update even when not in play mode
public class Water : MonoBehaviour
{
public enum WaterMode
{
Simple = 0,
Reflective = 1,
Refractive = 2,
};
public WaterMode waterMode = WaterMode.Refractive;
public bool disablePixelLights = true;
public int textureSize = 256;
public float clipPlaneOffset = 0.07f;
public LayerMask reflectLayers = -1;
public LayerMask refractLayers = -1;
private Dictionary<Camera, Camera> m_ReflectionCameras = new Dictionary<Camera, Camera>(); // Camera -> Camera table
private Dictionary<Camera, Camera> m_RefractionCameras = new Dictionary<Camera, Camera>(); // Camera -> Camera table
private RenderTexture m_ReflectionTexture;
private RenderTexture m_RefractionTexture;
private WaterMode m_HardwareWaterSupport = WaterMode.Refractive;
private int m_OldReflectionTextureSize;
private int m_OldRefractionTextureSize;
private static bool s_InsideWater;
// This is called when it's known that the object will be rendered by some
// camera. We render reflections / refractions and do other updates here.
// Because the script executes in edit mode, reflections for the scene view
// camera will just work!
public void OnWillRenderObject()
{
if (!enabled || !GetComponent<Renderer>() || !GetComponent<Renderer>().sharedMaterial ||
!GetComponent<Renderer>().enabled)
{
return;
}
Camera cam = Camera.current;
if (!cam)
{
return;
}
// Safeguard from recursive water reflections.
if (s_InsideWater)
{
return;
}
s_InsideWater = true;
// Actual water rendering mode depends on both the current setting AND
// the hardware support. There's no point in rendering refraction textures
// if they won't be visible in the end.
m_HardwareWaterSupport = FindHardwareWaterSupport();
WaterMode mode = GetWaterMode();
Camera reflectionCamera, refractionCamera;
CreateWaterObjects(cam, out reflectionCamera, out refractionCamera);
// find out the reflection plane: position and normal in world space
Vector3 pos = transform.position;
Vector3 normal = transform.up;
// Optionally disable pixel lights for reflection/refraction
int oldPixelLightCount = QualitySettings.pixelLightCount;
if (disablePixelLights)
{
QualitySettings.pixelLightCount = 0;
}
UpdateCameraModes(cam, reflectionCamera);
UpdateCameraModes(cam, refractionCamera);
// Render reflection if needed
if (mode >= WaterMode.Reflective)
{
// Reflect camera around reflection plane
float d = -Vector3.Dot(normal, pos) - clipPlaneOffset;
Vector4 reflectionPlane = new Vector4(normal.x, normal.y, normal.z, d);
Matrix4x4 reflection = Matrix4x4.zero;
CalculateReflectionMatrix(ref reflection, reflectionPlane);
Vector3 oldpos = cam.transform.position;
Vector3 newpos = reflection.MultiplyPoint(oldpos);
reflectionCamera.worldToCameraMatrix = cam.worldToCameraMatrix * reflection;
// Setup oblique projection matrix so that near plane is our reflection
// plane. This way we clip everything below/above it for free.
Vector4 clipPlane = CameraSpacePlane(reflectionCamera, pos, normal, 1.0f);
reflectionCamera.projectionMatrix = cam.CalculateObliqueMatrix(clipPlane);
// Set custom culling matrix from the current camera
reflectionCamera.cullingMatrix = cam.projectionMatrix * cam.worldToCameraMatrix;
reflectionCamera.cullingMask = ~(1 << 4) & reflectLayers.value; // never render water layer
reflectionCamera.targetTexture = m_ReflectionTexture;
bool oldCulling = GL.invertCulling;
GL.invertCulling = !oldCulling;
reflectionCamera.transform.position = newpos;
Vector3 euler = cam.transform.eulerAngles;
reflectionCamera.transform.eulerAngles = new Vector3(-euler.x, euler.y, euler.z);
reflectionCamera.Render();
reflectionCamera.transform.position = oldpos;
GL.invertCulling = oldCulling;
GetComponent<Renderer>().sharedMaterial.SetTexture("_ReflectionTex", m_ReflectionTexture);
}
// Render refraction
if (mode >= WaterMode.Refractive)
{
refractionCamera.worldToCameraMatrix = cam.worldToCameraMatrix;
// Setup oblique projection matrix so that near plane is our reflection
// plane. This way we clip everything below/above it for free.
Vector4 clipPlane = CameraSpacePlane(refractionCamera, pos, normal, -1.0f);
refractionCamera.projectionMatrix = cam.CalculateObliqueMatrix(clipPlane);
// Set custom culling matrix from the current camera
refractionCamera.cullingMatrix = cam.projectionMatrix * cam.worldToCameraMatrix;
refractionCamera.cullingMask = ~(1 << 4) & refractLayers.value; // never render water layer
refractionCamera.targetTexture = m_RefractionTexture;
refractionCamera.transform.position = cam.transform.position;
refractionCamera.transform.rotation = cam.transform.rotation;
refractionCamera.Render();
GetComponent<Renderer>().sharedMaterial.SetTexture("_RefractionTex", m_RefractionTexture);
}
// Restore pixel light count
if (disablePixelLights)
{
QualitySettings.pixelLightCount = oldPixelLightCount;
}
// Setup shader keywords based on water mode
switch (mode)
{
case WaterMode.Simple:
Shader.EnableKeyword("WATER_SIMPLE");
Shader.DisableKeyword("WATER_REFLECTIVE");
Shader.DisableKeyword("WATER_REFRACTIVE");
break;
case WaterMode.Reflective:
Shader.DisableKeyword("WATER_SIMPLE");
Shader.EnableKeyword("WATER_REFLECTIVE");
Shader.DisableKeyword("WATER_REFRACTIVE");
break;
case WaterMode.Refractive:
Shader.DisableKeyword("WATER_SIMPLE");
Shader.DisableKeyword("WATER_REFLECTIVE");
Shader.EnableKeyword("WATER_REFRACTIVE");
break;
}
s_InsideWater = false;
}
// Cleanup all the objects we possibly have created
void OnDisable()
{
if (m_ReflectionTexture)
{
DestroyImmediate(m_ReflectionTexture);
m_ReflectionTexture = null;
}
if (m_RefractionTexture)
{
DestroyImmediate(m_RefractionTexture);
m_RefractionTexture = null;
}
foreach (var kvp in m_ReflectionCameras)
{
DestroyImmediate((kvp.Value).gameObject);
}
m_ReflectionCameras.Clear();
foreach (var kvp in m_RefractionCameras)
{
DestroyImmediate((kvp.Value).gameObject);
}
m_RefractionCameras.Clear();
}
// This just sets up some matrices in the material; for really
// old cards to make water texture scroll.
void Update()
{
if (!GetComponent<Renderer>())
{
return;
}
Material mat = GetComponent<Renderer>().sharedMaterial;
if (!mat)
{
return;
}
Vector4 waveSpeed = mat.GetVector("WaveSpeed");
float waveScale = mat.GetFloat("_WaveScale");
Vector4 waveScale4 = new Vector4(waveScale, waveScale, waveScale * 0.4f, waveScale * 0.45f);
// Time since level load, and do intermediate calculations with doubles
double t = Time.timeSinceLevelLoad / 20.0;
Vector4 offsetClamped = new Vector4(
(float)Math.IEEERemainder(waveSpeed.x * waveScale4.x * t, 1.0),
(float)Math.IEEERemainder(waveSpeed.y * waveScale4.y * t, 1.0),
(float)Math.IEEERemainder(waveSpeed.z * waveScale4.z * t, 1.0),
(float)Math.IEEERemainder(waveSpeed.w * waveScale4.w * t, 1.0)
);
mat.SetVector("_WaveOffset", offsetClamped);
mat.SetVector("_WaveScale4", waveScale4);
}
void UpdateCameraModes(Camera src, Camera dest)
{
if (dest == null)
{
return;
}
// set water camera to clear the same way as current camera
dest.clearFlags = src.clearFlags;
dest.backgroundColor = src.backgroundColor;
if (src.clearFlags == CameraClearFlags.Skybox)
{
Skybox sky = src.GetComponent<Skybox>();
Skybox mysky = dest.GetComponent<Skybox>();
if (!sky || !sky.material)
{
mysky.enabled = false;
}
else
{
mysky.enabled = true;
mysky.material = sky.material;
}
}
// update other values to match current camera.
// even if we are supplying custom camera&projection matrices,
// some of values are used elsewhere (e.g. skybox uses far plane)
dest.farClipPlane = src.farClipPlane;
dest.nearClipPlane = src.nearClipPlane;
dest.orthographic = src.orthographic;
dest.fieldOfView = src.fieldOfView;
dest.aspect = src.aspect;
dest.orthographicSize = src.orthographicSize;
}
// On-demand create any objects we need for water
void CreateWaterObjects(Camera currentCamera, out Camera reflectionCamera, out Camera refractionCamera)
{
WaterMode mode = GetWaterMode();
reflectionCamera = null;
refractionCamera = null;
if (mode >= WaterMode.Reflective)
{
// Reflection render texture
if (!m_ReflectionTexture || m_OldReflectionTextureSize != textureSize)
{
if (m_ReflectionTexture)
{
DestroyImmediate(m_ReflectionTexture);
}
m_ReflectionTexture = new RenderTexture(textureSize, textureSize, 16);
m_ReflectionTexture.name = "__WaterReflection" + GetInstanceID();
m_ReflectionTexture.isPowerOfTwo = true;
m_ReflectionTexture.hideFlags = HideFlags.DontSave;
m_OldReflectionTextureSize = textureSize;
}
// Camera for reflection
m_ReflectionCameras.TryGetValue(currentCamera, out reflectionCamera);
if (!reflectionCamera) // catch both not-in-dictionary and in-dictionary-but-deleted-GO
{
GameObject go = new GameObject("Water Refl Camera id" + GetInstanceID() + " for " + currentCamera.GetInstanceID(), typeof(Camera), typeof(Skybox));
reflectionCamera = go.GetComponent<Camera>();
reflectionCamera.enabled = false;
reflectionCamera.transform.position = transform.position;
reflectionCamera.transform.rotation = transform.rotation;
reflectionCamera.gameObject.AddComponent<FlareLayer>();
go.hideFlags = HideFlags.HideAndDontSave;
m_ReflectionCameras[currentCamera] = reflectionCamera;
}
}
if (mode >= WaterMode.Refractive)
{
// Refraction render texture
if (!m_RefractionTexture || m_OldRefractionTextureSize != textureSize)
{
if (m_RefractionTexture)
{
DestroyImmediate(m_RefractionTexture);
}
m_RefractionTexture = new RenderTexture(textureSize, textureSize, 16);
m_RefractionTexture.name = "__WaterRefraction" + GetInstanceID();
m_RefractionTexture.isPowerOfTwo = true;
m_RefractionTexture.hideFlags = HideFlags.DontSave;
m_OldRefractionTextureSize = textureSize;
}
// Camera for refraction
m_RefractionCameras.TryGetValue(currentCamera, out refractionCamera);
if (!refractionCamera) // catch both not-in-dictionary and in-dictionary-but-deleted-GO
{
GameObject go =
new GameObject("Water Refr Camera id" + GetInstanceID() + " for " + currentCamera.GetInstanceID(),
typeof(Camera), typeof(Skybox));
refractionCamera = go.GetComponent<Camera>();
refractionCamera.enabled = false;
refractionCamera.transform.position = transform.position;
refractionCamera.transform.rotation = transform.rotation;
refractionCamera.gameObject.AddComponent<FlareLayer>();
go.hideFlags = HideFlags.HideAndDontSave;
m_RefractionCameras[currentCamera] = refractionCamera;
}
}
}
WaterMode GetWaterMode()
{
if (m_HardwareWaterSupport < waterMode)
{
return m_HardwareWaterSupport;
}
return waterMode;
}
WaterMode FindHardwareWaterSupport()
{
if (!GetComponent<Renderer>())
{
return WaterMode.Simple;
}
Material mat = GetComponent<Renderer>().sharedMaterial;
if (!mat)
{
return WaterMode.Simple;
}
string mode = mat.GetTag("WATERMODE", false);
if (mode == "Refractive")
{
return WaterMode.Refractive;
}
if (mode == "Reflective")
{
return WaterMode.Reflective;
}
return WaterMode.Simple;
}
// Given position/normal of the plane, calculates plane in camera space.
Vector4 CameraSpacePlane(Camera cam, Vector3 pos, Vector3 normal, float sideSign)
{
Vector3 offsetPos = pos + normal * clipPlaneOffset;
Matrix4x4 m = cam.worldToCameraMatrix;
Vector3 cpos = m.MultiplyPoint(offsetPos);
Vector3 cnormal = m.MultiplyVector(normal).normalized * sideSign;
return new Vector4(cnormal.x, cnormal.y, cnormal.z, -Vector3.Dot(cpos, cnormal));
}
// Calculates reflection matrix around the given plane
static void CalculateReflectionMatrix(ref Matrix4x4 reflectionMat, Vector4 plane)
{
reflectionMat.m00 = (1F - 2F * plane[0] * plane[0]);
reflectionMat.m01 = (- 2F * plane[0] * plane[1]);
reflectionMat.m02 = (- 2F * plane[0] * plane[2]);
reflectionMat.m03 = (- 2F * plane[3] * plane[0]);
reflectionMat.m10 = (- 2F * plane[1] * plane[0]);
reflectionMat.m11 = (1F - 2F * plane[1] * plane[1]);
reflectionMat.m12 = (- 2F * plane[1] * plane[2]);
reflectionMat.m13 = (- 2F * plane[3] * plane[1]);
reflectionMat.m20 = (- 2F * plane[2] * plane[0]);
reflectionMat.m21 = (- 2F * plane[2] * plane[1]);
reflectionMat.m22 = (1F - 2F * plane[2] * plane[2]);
reflectionMat.m23 = (- 2F * plane[3] * plane[2]);
reflectionMat.m30 = 0F;
reflectionMat.m31 = 0F;
reflectionMat.m32 = 0F;
reflectionMat.m33 = 1F;
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: a3d3ef1a5bbfb4e0a910fbbe5830b1f9
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:

View File

@@ -0,0 +1,78 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.Water
{
public enum WaterQuality
{
High = 2,
Medium = 1,
Low = 0,
}
[ExecuteInEditMode]
public class WaterBase : MonoBehaviour
{
public Material sharedMaterial;
public WaterQuality waterQuality = WaterQuality.High;
public bool edgeBlend = true;
public void UpdateShader()
{
if (waterQuality > WaterQuality.Medium)
{
sharedMaterial.shader.maximumLOD = 501;
}
else if (waterQuality > WaterQuality.Low)
{
sharedMaterial.shader.maximumLOD = 301;
}
else
{
sharedMaterial.shader.maximumLOD = 201;
}
// If the system does not support depth textures (ie. NaCl), turn off edge bleeding,
// as the shader will render everything as transparent if the depth texture is not valid.
if (!SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.Depth))
{
edgeBlend = false;
}
if (edgeBlend)
{
Shader.EnableKeyword("WATER_EDGEBLEND_ON");
Shader.DisableKeyword("WATER_EDGEBLEND_OFF");
// just to make sure (some peeps might forget to add a water tile to the patches)
if (Camera.main)
{
Camera.main.depthTextureMode |= DepthTextureMode.Depth;
}
}
else
{
Shader.EnableKeyword("WATER_EDGEBLEND_OFF");
Shader.DisableKeyword("WATER_EDGEBLEND_ON");
}
}
public void WaterTileBeingRendered(Transform tr, Camera currentCam)
{
if (currentCam && edgeBlend)
{
currentCam.depthTextureMode |= DepthTextureMode.Depth;
}
}
public void Update()
{
if (sharedMaterial)
{
UpdateShader();
}
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: a1da353243062479a9b31c85074a796b
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:

View File

@@ -0,0 +1,67 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.Water
{
[ExecuteInEditMode]
public class WaterTile : MonoBehaviour
{
public PlanarReflection reflection;
public WaterBase waterBase;
public void Start()
{
AcquireComponents();
}
void AcquireComponents()
{
if (!reflection)
{
if (transform.parent)
{
reflection = transform.parent.GetComponent<PlanarReflection>();
}
else
{
reflection = transform.GetComponent<PlanarReflection>();
}
}
if (!waterBase)
{
if (transform.parent)
{
waterBase = transform.parent.GetComponent<WaterBase>();
}
else
{
waterBase = transform.GetComponent<WaterBase>();
}
}
}
#if UNITY_EDITOR
public void Update()
{
AcquireComponents();
}
#endif
public void OnWillRenderObject()
{
if (reflection)
{
reflection.WaterTileBeingRendered(transform, Camera.current);
}
if (waterBase)
{
waterBase.WaterTileBeingRendered(transform, Camera.current);
}
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 2a91e8dd37cdd41efb4859b65aced7a2
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,92 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Water4Simple
m_Shader: {fileID: 4800000, guid: 8aaff0751054e4a9cb4642d01eaf5be9, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 2800000, guid: fb6566c21f717904f83743a5a76dd0b0, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _CubeTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DisplacementHeightMap:
m_Texture: {fileID: 2800000, guid: a782b26d6436b48d9882906b9f8ca31a, type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: e6f8288974c664a309d6c66de636978c, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ReflectionTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _RefractionTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SecondDisplacementHeightMap:
m_Texture: {fileID: 2800000, guid: 4facc21e08e3a43ed97c930f7dae6e7b, type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ShoreTex:
m_Texture: {fileID: 2800000, guid: 36dd0b22da8874ed38075789055ca664, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ThirdDisplacementHeightMap:
m_Texture: {fileID: 2800000, guid: dc30b984e8e3c4cdfb38d5fceb411602, type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _WavesTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _FresnelScale: 2.69
- _GerstnerIntensity: -2.5
- _HeightDisplacement: 2.3370318
- _NormalsDisplacement: 72.72728
- _Shininess: 349.13794
m_Colors:
- _AnimationDirection: {r: 2, g: 1, b: -1, a: 1}
- _AnimationTiling: {r: 0.4, g: 0.39099997, b: 0.56, a: 0.7}
- _BaseColor: {r: 0.17275561, g: 0.224076, b: 0.24626863, a: 0.5058824}
- _BumpDirection: {r: -17.45, g: 5, b: 2, a: -1}
- _BumpTiling: {r: 0.05, g: 0.05, b: 0.05, a: 0.05}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _DepthColor: {r: 0.29811764, g: 0.36611718, b: 0.39552242, a: 0.34509805}
- _DistortParams: {r: -4, g: -0.5, b: 0.88, a: -1.81}
- _Foam: {r: 0.3275862, g: 0.7471264, b: 0, a: 0}
- _GAmplitude: {r: 0.3, g: 0.2, b: 0.25, a: 0.25}
- _GDirectionAB: {r: 0.85, g: 0.3, b: 0.25, a: 0.25}
- _GDirectionCD: {r: -0.3, g: -0.9, b: 0.5, a: 0.5}
- _GFrequency: {r: 0.5, g: 0.25, b: 0.6, a: 0.245}
- _GSpeed: {r: 4, g: 2, b: 1, a: 1}
- _GSteepness: {r: 3.0301306, g: 1, b: 1, a: 1}
- _InvFadeParemeter: {r: 3, g: 0.08562102, b: 0.09414239, a: 1.52}
- _ReflectionColor: {r: 0.47582978, g: 0.6064865, b: 0.6641791, a: 0.47058824}
- _RefractionFog: {r: 0.8681778, g: 0.8797176, b: 0.8880597, a: 1}
- _SpecularColor: {r: 0.82089555, g: 0.80581594, b: 0.7718869, a: 1}
- _WorldLightDir: {r: 0.013992369, g: -0.17359081, b: -0.9847186, a: 0}
m_BuildTextureStacks: []
--- !u!1002 &2100001
EditorExtensionImpl:
serializedVersion: 6

View File

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

View File

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

View File

@@ -0,0 +1,312 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &100000
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 400000}
- component: {fileID: 3300000}
- component: {fileID: 2300000}
- component: {fileID: 11400010}
m_Layer: 4
m_Name: Tile
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &400000
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100000}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -25}
m_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
m_Children: []
m_Father: {fileID: 400006}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &3300000
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100000}
m_Mesh: {fileID: 4300002, guid: 681e41ee1260343b395ca58745c94870, type: 3}
--- !u!23 &2300000
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100000}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 656fde119942645aa8e062e04c119aa1, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!114 &11400010
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100000}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2a91e8dd37cdd41efb4859b65aced7a2, type: 3}
m_Name:
m_EditorClassIdentifier:
reflection: {fileID: 11400004}
waterBase: {fileID: 11400008}
--- !u!1 &100004
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 400004}
- component: {fileID: 3300004}
- component: {fileID: 2300004}
- component: {fileID: 11400014}
m_Layer: 4
m_Name: Tile
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &400004
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100004}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 25}
m_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
m_Children: []
m_Father: {fileID: 400006}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &3300004
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100004}
m_Mesh: {fileID: 4300002, guid: 681e41ee1260343b395ca58745c94870, type: 3}
--- !u!23 &2300004
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100004}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 656fde119942645aa8e062e04c119aa1, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!114 &11400014
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100004}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2a91e8dd37cdd41efb4859b65aced7a2, type: 3}
m_Name:
m_EditorClassIdentifier:
reflection: {fileID: 11400004}
waterBase: {fileID: 11400008}
--- !u!1 &100006
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 400006}
- component: {fileID: 11400008}
- component: {fileID: 11400004}
- component: {fileID: 11400002}
- component: {fileID: 11400000}
m_Layer: 0
m_Name: Water4Simple
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &400006
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100006}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 400004}
- {fileID: 400012}
- {fileID: 400000}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &11400008
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100006}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a1da353243062479a9b31c85074a796b, type: 3}
m_Name:
m_EditorClassIdentifier:
sharedMaterial: {fileID: 2100000, guid: 656fde119942645aa8e062e04c119aa1, type: 2}
waterQuality: 2
edgeBlend: 1
--- !u!114 &11400004
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100006}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4185bc77c7194462ca3b1097ef4a5de0, type: 3}
m_Name:
m_EditorClassIdentifier:
reflectionMask:
serializedVersion: 2
m_Bits: 4294967295
reflectSkybox: 1
clearColor: {r: 1, g: 1, b: 1, a: 1}
reflectionSampler: _ReflectionTex
clipPlaneOffset: 0.07
--- !u!114 &11400002
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100006}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: de2ab2b9ac93bb544b9552e49030371b, type: 3}
m_Name:
m_EditorClassIdentifier:
specularLight: {fileID: 400012}
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100006}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 42e7f46d0e5a84171a3909479c1646ba, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &100012
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 400012}
m_Layer: 0
m_Name: Specular
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &400012
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100012}
m_LocalRotation: {x: -0.72684336, y: 0.6812181, z: -0.064706124, w: -0.05876977}
m_LocalPosition: {x: -0.6994095, y: 16.829224, z: 52.072815}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 400006}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

View File

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

View File

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

View File

@@ -0,0 +1,435 @@
// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
Shader "FX/SimpleWater4" {
Properties {
_ReflectionTex ("Internal reflection", 2D) = "white" {}
_MainTex ("Fallback texture", 2D) = "black" {}
_BumpMap ("Normals ", 2D) = "bump" {}
_DistortParams ("Distortions (Bump waves, Reflection, Fresnel power, Fresnel bias)", Vector) = (1.0 ,1.0, 2.0, 1.15)
_InvFadeParemeter ("Auto blend parameter (Edge, Shore, Distance scale)", Vector) = (0.15 ,0.15, 0.5, 1.0)
_AnimationTiling ("Animation Tiling (Displacement)", Vector) = (2.2 ,2.2, -1.1, -1.1)
_AnimationDirection ("Animation Direction (displacement)", Vector) = (1.0 ,1.0, 1.0, 1.0)
_BumpTiling ("Bump Tiling", Vector) = (1.0 ,1.0, -2.0, 3.0)
_BumpDirection ("Bump Direction & Speed", Vector) = (1.0 ,1.0, -1.0, 1.0)
_FresnelScale ("FresnelScale", Range (0.15, 4.0)) = 0.75
_BaseColor ("Base color", COLOR) = ( .54, .95, .99, 0.5)
_ReflectionColor ("Reflection color", COLOR) = ( .54, .95, .99, 0.5)
_SpecularColor ("Specular color", COLOR) = ( .72, .72, .72, 1)
_WorldLightDir ("Specular light direction", Vector) = (0.0, 0.1, -0.5, 0.0)
_Shininess ("Shininess", Range (2.0, 500.0)) = 200.0
_GerstnerIntensity("Per vertex displacement", Float) = 1.0
_GAmplitude ("Wave Amplitude", Vector) = (0.3 ,0.35, 0.25, 0.25)
_GFrequency ("Wave Frequency", Vector) = (1.3, 1.35, 1.25, 1.25)
_GSteepness ("Wave Steepness", Vector) = (1.0, 1.0, 1.0, 1.0)
_GSpeed ("Wave Speed", Vector) = (1.2, 1.375, 1.1, 1.5)
_GDirectionAB ("Wave Direction", Vector) = (0.3 ,0.85, 0.85, 0.25)
_GDirectionCD ("Wave Direction", Vector) = (0.1 ,0.9, 0.5, 0.5)
}
CGINCLUDE
#include "UnityCG.cginc"
#include "WaterInclude.cginc"
struct appdata
{
float4 vertex : POSITION;
float3 normal : NORMAL;
};
// interpolator structs
struct v2f
{
float4 pos : SV_POSITION;
float4 normalInterpolator : TEXCOORD0;
float3 viewInterpolator : TEXCOORD1;
float4 bumpCoords : TEXCOORD2;
float4 screenPos : TEXCOORD3;
float4 grabPassPos : TEXCOORD4;
UNITY_FOG_COORDS(5)
};
struct v2f_noGrab
{
float4 pos : SV_POSITION;
float4 normalInterpolator : TEXCOORD0;
float3 viewInterpolator : TEXCOORD1;
float4 bumpCoords : TEXCOORD2;
float4 screenPos : TEXCOORD3;
UNITY_FOG_COORDS(4)
};
struct v2f_simple
{
float4 pos : SV_POSITION;
float3 viewInterpolator : TEXCOORD0;
float4 bumpCoords : TEXCOORD1;
UNITY_FOG_COORDS(2)
};
// textures
sampler2D _BumpMap;
sampler2D _ReflectionTex;
sampler2D _RefractionTex;
sampler2D _ShoreTex;
sampler2D_float _CameraDepthTexture;
// colors in use
uniform float4 _RefrColorDepth;
uniform float4 _SpecularColor;
uniform float4 _BaseColor;
uniform float4 _ReflectionColor;
// edge & shore fading
uniform float4 _InvFadeParemeter;
// specularity
uniform float _Shininess;
uniform float4 _WorldLightDir;
// fresnel, vertex & bump displacements & strength
uniform float4 _DistortParams;
uniform float _FresnelScale;
uniform float4 _BumpTiling;
uniform float4 _BumpDirection;
uniform float4 _GAmplitude;
uniform float4 _GFrequency;
uniform float4 _GSteepness;
uniform float4 _GSpeed;
uniform float4 _GDirectionAB;
uniform float4 _GDirectionCD;
// shortcuts
#define PER_PIXEL_DISPLACE _DistortParams.x
#define REALTIME_DISTORTION _DistortParams.y
#define FRESNEL_POWER _DistortParams.z
#define VERTEX_WORLD_NORMAL i.normalInterpolator.xyz
#define DISTANCE_SCALE _InvFadeParemeter.z
#define FRESNEL_BIAS _DistortParams.w
//
// HQ VERSION
//
v2f vert(appdata_full v)
{
v2f o;
half3 worldSpaceVertex = mul(unity_ObjectToWorld,(v.vertex)).xyz;
half3 vtxForAni = (worldSpaceVertex).xzz;
half3 nrml;
half3 offsets;
Gerstner (
offsets, nrml, v.vertex.xyz, vtxForAni, // offsets, nrml will be written
_GAmplitude, // amplitude
_GFrequency, // frequency
_GSteepness, // steepness
_GSpeed, // speed
_GDirectionAB, // direction # 1, 2
_GDirectionCD // direction # 3, 4
);
v.vertex.xyz += offsets;
half2 tileableUv = worldSpaceVertex.xz;
o.bumpCoords.xyzw = (tileableUv.xyxy + _Time.xxxx * _BumpDirection.xyzw) * _BumpTiling.xyzw;
o.viewInterpolator.xyz = worldSpaceVertex - _WorldSpaceCameraPos;
o.pos = UnityObjectToClipPos(v.vertex);
ComputeScreenAndGrabPassPos(o.pos, o.screenPos, o.grabPassPos);
o.normalInterpolator.xyz = nrml;
o.normalInterpolator.w = 1;//GetDistanceFadeout(o.screenPos.w, DISTANCE_SCALE);
UNITY_TRANSFER_FOG(o,o.pos);
return o;
}
half4 frag( v2f i ) : SV_Target
{
half3 worldNormal = PerPixelNormal(_BumpMap, i.bumpCoords, VERTEX_WORLD_NORMAL, PER_PIXEL_DISPLACE);
half3 viewVector = normalize(i.viewInterpolator.xyz);
half4 distortOffset = half4(worldNormal.xz * REALTIME_DISTORTION * 10.0, 0, 0);
half4 screenWithOffset = i.screenPos + distortOffset;
half4 grabWithOffset = i.grabPassPos + distortOffset;
half4 rtRefractionsNoDistort = tex2Dproj(_RefractionTex, UNITY_PROJ_COORD(i.grabPassPos));
half refrFix = SAMPLE_DEPTH_TEXTURE_PROJ(_CameraDepthTexture, UNITY_PROJ_COORD(grabWithOffset));
half4 rtRefractions = tex2Dproj(_RefractionTex, UNITY_PROJ_COORD(grabWithOffset));
#ifdef WATER_REFLECTIVE
half4 rtReflections = tex2Dproj(_ReflectionTex, UNITY_PROJ_COORD(screenWithOffset));
#endif
#ifdef WATER_EDGEBLEND_ON
if (LinearEyeDepth(refrFix) < i.screenPos.z)
rtRefractions = rtRefractionsNoDistort;
#endif
half3 reflectVector = normalize(reflect(viewVector, worldNormal));
half3 h = normalize ((_WorldLightDir.xyz) + viewVector.xyz);
float nh = max (0, dot (worldNormal, -h));
float spec = max(0.0,pow (nh, _Shininess));
half4 edgeBlendFactors = half4(1.0, 0.0, 0.0, 0.0);
#ifdef WATER_EDGEBLEND_ON
half depth = SAMPLE_DEPTH_TEXTURE_PROJ(_CameraDepthTexture, UNITY_PROJ_COORD(i.screenPos));
depth = LinearEyeDepth(depth);
edgeBlendFactors = saturate(_InvFadeParemeter * (depth-i.screenPos.w));
#endif
// shading for fresnel term
worldNormal.xz *= _FresnelScale;
half refl2Refr = Fresnel(viewVector, worldNormal, FRESNEL_BIAS, FRESNEL_POWER);
// base, depth & reflection colors
half4 baseColor = _BaseColor;
#ifdef WATER_REFLECTIVE
half4 reflectionColor = lerp (rtReflections,_ReflectionColor,_ReflectionColor.a);
#else
half4 reflectionColor = _ReflectionColor;
#endif
baseColor = lerp (lerp (rtRefractions, baseColor, baseColor.a), reflectionColor, refl2Refr);
baseColor = baseColor + spec * _SpecularColor;
baseColor.a = edgeBlendFactors.x;
UNITY_APPLY_FOG(i.fogCoord, baseColor);
return baseColor;
}
//
// MQ VERSION
//
v2f_noGrab vert300(appdata_full v)
{
v2f_noGrab o;
half3 worldSpaceVertex = mul(unity_ObjectToWorld,(v.vertex)).xyz;
half3 vtxForAni = (worldSpaceVertex).xzz;
half3 nrml;
half3 offsets;
Gerstner (
offsets, nrml, v.vertex.xyz, vtxForAni, // offsets, nrml will be written
_GAmplitude, // amplitude
_GFrequency, // frequency
_GSteepness, // steepness
_GSpeed, // speed
_GDirectionAB, // direction # 1, 2
_GDirectionCD // direction # 3, 4
);
v.vertex.xyz += offsets;
half2 tileableUv = worldSpaceVertex.xz;
o.bumpCoords.xyzw = (tileableUv.xyxy + _Time.xxxx * _BumpDirection.xyzw) * _BumpTiling.xyzw;
o.viewInterpolator.xyz = worldSpaceVertex - _WorldSpaceCameraPos;
o.pos = UnityObjectToClipPos(v.vertex);
o.screenPos = ComputeNonStereoScreenPos(o.pos);
o.normalInterpolator.xyz = nrml;
o.normalInterpolator.w = 1;//GetDistanceFadeout(o.screenPos.w, DISTANCE_SCALE);
UNITY_TRANSFER_FOG(o,o.pos);
return o;
}
half4 frag300( v2f_noGrab i ) : SV_Target
{
half3 worldNormal = PerPixelNormal(_BumpMap, i.bumpCoords, VERTEX_WORLD_NORMAL, PER_PIXEL_DISPLACE);
half3 viewVector = normalize(i.viewInterpolator.xyz);
half4 distortOffset = half4(worldNormal.xz * REALTIME_DISTORTION * 10.0, 0, 0);
half4 screenWithOffset = i.screenPos + distortOffset;
#ifdef WATER_REFLECTIVE
half4 rtReflections = tex2Dproj(_ReflectionTex, UNITY_PROJ_COORD(screenWithOffset));
#endif
half3 reflectVector = normalize(reflect(viewVector, worldNormal));
half3 h = normalize (_WorldLightDir.xyz + viewVector.xyz);
float nh = max (0, dot (worldNormal, -h));
float spec = max(0.0,pow (nh, _Shininess));
half4 edgeBlendFactors = half4(1.0, 0.0, 0.0, 0.0);
#ifdef WATER_EDGEBLEND_ON
half depth = SAMPLE_DEPTH_TEXTURE_PROJ(_CameraDepthTexture, UNITY_PROJ_COORD(i.screenPos));
depth = LinearEyeDepth(depth);
edgeBlendFactors = saturate(_InvFadeParemeter * (depth-i.screenPos.z));
#endif
worldNormal.xz *= _FresnelScale;
half refl2Refr = Fresnel(viewVector, worldNormal, FRESNEL_BIAS, FRESNEL_POWER);
half4 baseColor = _BaseColor;
#ifdef WATER_REFLECTIVE
baseColor = lerp (baseColor, lerp (rtReflections,_ReflectionColor,_ReflectionColor.a), saturate(refl2Refr * 1.0));
#else
baseColor = _ReflectionColor;//lerp (baseColor, _ReflectionColor, saturate(refl2Refr * 2.0));
#endif
baseColor = baseColor + spec * _SpecularColor;
baseColor.a = edgeBlendFactors.x * saturate(0.5 + refl2Refr * 1.0);
UNITY_APPLY_FOG(i.fogCoord, baseColor);
return baseColor;
}
//
// LQ VERSION
//
v2f_simple vert200(appdata_full v)
{
v2f_simple o;
half3 worldSpaceVertex = mul(unity_ObjectToWorld, v.vertex).xyz;
half2 tileableUv = worldSpaceVertex.xz;
o.bumpCoords.xyzw = (tileableUv.xyxy + _Time.xxxx * _BumpDirection.xyzw) * _BumpTiling.xyzw;
o.viewInterpolator.xyz = worldSpaceVertex-_WorldSpaceCameraPos;
o.pos = UnityObjectToClipPos( v.vertex);
UNITY_TRANSFER_FOG(o,o.pos);
return o;
}
half4 frag200( v2f_simple i ) : SV_Target
{
half3 worldNormal = PerPixelNormal(_BumpMap, i.bumpCoords, half3(0,1,0), PER_PIXEL_DISPLACE);
half3 viewVector = normalize(i.viewInterpolator.xyz);
half3 reflectVector = normalize(reflect(viewVector, worldNormal));
half3 h = normalize ((_WorldLightDir.xyz) + viewVector.xyz);
float nh = max (0, dot (worldNormal, -h));
float spec = max(0.0,pow (nh, _Shininess));
worldNormal.xz *= _FresnelScale;
half refl2Refr = Fresnel(viewVector, worldNormal, FRESNEL_BIAS, FRESNEL_POWER);
half4 baseColor = _BaseColor;
baseColor = lerp(baseColor, _ReflectionColor, saturate(refl2Refr * 2.0));
baseColor.a = saturate(2.0 * refl2Refr + 0.5);
baseColor.rgb += spec * _SpecularColor.rgb;
UNITY_APPLY_FOG(i.fogCoord, baseColor);
return baseColor;
}
ENDCG
Subshader
{
Tags {"RenderType"="Transparent" "Queue"="Transparent"}
Lod 500
ColorMask RGB
GrabPass { "_RefractionTex" }
Pass {
Blend SrcAlpha OneMinusSrcAlpha
ZTest LEqual
ZWrite Off
Cull Off
CGPROGRAM
#pragma target 3.0
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_fog
#pragma multi_compile WATER_VERTEX_DISPLACEMENT_ON WATER_VERTEX_DISPLACEMENT_OFF
#pragma multi_compile WATER_EDGEBLEND_ON WATER_EDGEBLEND_OFF
#pragma multi_compile WATER_REFLECTIVE WATER_SIMPLE
ENDCG
}
}
Subshader
{
Tags {"RenderType"="Transparent" "Queue"="Transparent"}
Lod 300
ColorMask RGB
Pass {
Blend SrcAlpha OneMinusSrcAlpha
ZTest LEqual
ZWrite Off
Cull Off
CGPROGRAM
#pragma target 3.0
#pragma vertex vert300
#pragma fragment frag300
#pragma multi_compile_fog
#pragma multi_compile WATER_VERTEX_DISPLACEMENT_ON WATER_VERTEX_DISPLACEMENT_OFF
#pragma multi_compile WATER_EDGEBLEND_ON WATER_EDGEBLEND_OFF
#pragma multi_compile WATER_REFLECTIVE WATER_SIMPLE
ENDCG
}
}
Subshader
{
Tags {"RenderType"="Transparent" "Queue"="Transparent"}
Lod 200
ColorMask RGB
Pass {
Blend SrcAlpha OneMinusSrcAlpha
ZTest LEqual
ZWrite Off
Cull Off
CGPROGRAM
#pragma vertex vert200
#pragma fragment frag200
#pragma multi_compile_fog
ENDCG
}
}
Fallback "Transparent/Diffuse"
}

View File

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

View File

@@ -0,0 +1,257 @@
#ifndef WATER_CG_INCLUDED
#define WATER_CG_INCLUDED
#include "UnityCG.cginc"
half _GerstnerIntensity;
inline half3 PerPixelNormal(sampler2D bumpMap, half4 coords, half3 vertexNormal, half bumpStrength)
{
half3 bump = (UnpackNormal(tex2D(bumpMap, coords.xy)) + UnpackNormal(tex2D(bumpMap, coords.zw))) * 0.5;
half3 worldNormal = vertexNormal + bump.xxy * bumpStrength * half3(1,0,1);
return normalize(worldNormal);
}
inline half3 PerPixelNormalUnpacked(sampler2D bumpMap, half4 coords, half bumpStrength)
{
half4 bump = tex2D(bumpMap, coords.xy) + tex2D(bumpMap, coords.zw);
bump = bump * 0.5;
half3 normal = UnpackNormal(bump);
normal.xy *= bumpStrength;
return normalize(normal);
}
inline half3 GetNormal(half4 tf) {
#ifdef WATER_VERTEX_DISPLACEMENT_ON
return half3(2,1,2) * tf.rbg - half3(1,0,1);
#else
return half3(0,1,0);
#endif
}
inline half GetDistanceFadeout(half screenW, half speed) {
return 1.0f / abs(0.5f + screenW * speed);
}
half4 GetDisplacement3(half4 tileableUv, half4 tiling, half4 directionSpeed, sampler2D mapA, sampler2D mapB, sampler2D mapC)
{
half4 displacementUv = tileableUv * tiling + _Time.xxxx * directionSpeed;
#ifdef WATER_VERTEX_DISPLACEMENT_ON
half4 tf = tex2Dlod(mapA, half4(displacementUv.xy, 0.0,0.0));
tf += tex2Dlod(mapB, half4(displacementUv.zw, 0.0,0.0));
tf += tex2Dlod(mapC, half4(displacementUv.xw, 0.0,0.0));
tf *= 0.333333;
#else
half4 tf = half4(0.5,0.5,0.5,0.0);
#endif
return tf;
}
half4 GetDisplacement2(half4 tileableUv, half4 tiling, half4 directionSpeed, sampler2D mapA, sampler2D mapB)
{
half4 displacementUv = tileableUv * tiling + _Time.xxxx * directionSpeed;
#ifdef WATER_VERTEX_DISPLACEMENT_ON
half4 tf = tex2Dlod(mapA, half4(displacementUv.xy, 0.0,0.0));
tf += tex2Dlod(mapB, half4(displacementUv.zw, 0.0,0.0));
tf *= 0.5;
#else
half4 tf = half4(0.5,0.5,0.5,0.0);
#endif
return tf;
}
inline void ComputeScreenAndGrabPassPos (float4 pos, out float4 screenPos, out float4 grabPassPos)
{
#if UNITY_UV_STARTS_AT_TOP
float scale = -1.0;
#else
float scale = 1.0f;
#endif
screenPos = ComputeNonStereoScreenPos(pos);
grabPassPos.xy = ( float2( pos.x, pos.y*scale ) + pos.w ) * 0.5;
grabPassPos.zw = pos.zw;
}
inline half3 PerPixelNormalUnpacked(sampler2D bumpMap, half4 coords, half bumpStrength, half2 perVertxOffset)
{
half4 bump = tex2D(bumpMap, coords.xy) + tex2D(bumpMap, coords.zw);
bump = bump * 0.5;
half3 normal = UnpackNormal(bump);
normal.xy *= bumpStrength;
normal.xy += perVertxOffset;
return normalize(normal);
}
inline half3 PerPixelNormalLite(sampler2D bumpMap, half4 coords, half3 vertexNormal, half bumpStrength)
{
half4 bump = tex2D(bumpMap, coords.xy);
bump.xy = bump.wy - half2(0.5, 0.5);
half3 worldNormal = vertexNormal + bump.xxy * bumpStrength * half3(1,0,1);
return normalize(worldNormal);
}
inline half4 Foam(sampler2D shoreTex, half4 coords, half amount)
{
half4 foam = ( tex2D(shoreTex, coords.xy) * tex2D(shoreTex,coords.zw) ) - 0.125;
foam.a = amount;
return foam;
}
inline half4 Foam(sampler2D shoreTex, half4 coords)
{
half4 foam = (tex2D(shoreTex, coords.xy) * tex2D(shoreTex,coords.zw)) - 0.125;
return foam;
}
inline half Fresnel(half3 viewVector, half3 worldNormal, half bias, half power)
{
half facing = clamp(1.0-max(dot(-viewVector, worldNormal), 0.0), 0.0,1.0);
half refl2Refr = saturate(bias+(1.0-bias) * pow(facing,power));
return refl2Refr;
}
inline half FresnelViaTexture(half3 viewVector, half3 worldNormal, sampler2D fresnel)
{
half facing = saturate(dot(-viewVector, worldNormal));
half fresn = tex2D(fresnel, half2(facing, 0.5f)).b;
return fresn;
}
inline void VertexDisplacementHQ( sampler2D mapA, sampler2D mapB,
sampler2D mapC, half4 uv,
half vertexStrength, half3 normal,
out half4 vertexOffset, out half2 normalOffset)
{
half4 tf = tex2Dlod(mapA, half4(uv.xy, 0.0,0.0));
tf += tex2Dlod(mapB, half4(uv.zw, 0.0,0.0));
tf += tex2Dlod(mapC, half4(uv.xw, 0.0,0.0));
tf /= 3.0;
tf.rga = tf.rga-half3(0.5,0.5,0.0);
// height displacement in alpha channel, normals info in rgb
vertexOffset = tf.a * half4(normal.xyz, 0.0) * vertexStrength;
normalOffset = tf.rg;
}
inline void VertexDisplacementLQ( sampler2D mapA, sampler2D mapB,
sampler2D mapC, half4 uv,
half vertexStrength, half normalsStrength,
out half4 vertexOffset, out half2 normalOffset)
{
// @NOTE: for best performance, this should really be properly packed!
half4 tf = tex2Dlod(mapA, half4(uv.xy, 0.0,0.0));
tf += tex2Dlod(mapB, half4(uv.zw, 0.0,0.0));
tf *= 0.5;
tf.rga = tf.rga-half3(0.5,0.5,0.0);
// height displacement in alpha channel, normals info in rgb
vertexOffset = tf.a * half4(0,1,0,0) * vertexStrength;
normalOffset = tf.rg * normalsStrength;
}
half4 ExtinctColor (half4 baseColor, half extinctionAmount)
{
// tweak the extinction coefficient for different coloring
return baseColor - extinctionAmount * half4(0.15, 0.03, 0.01, 0.0);
}
half3 GerstnerOffsets (half2 xzVtx, half steepness, half amp, half freq, half speed, half2 dir)
{
half3 offsets;
offsets.x =
steepness * amp * dir.x *
cos( freq * dot( dir, xzVtx ) + speed * _Time.x);
offsets.z =
steepness * amp * dir.y *
cos( freq * dot( dir, xzVtx ) + speed * _Time.x);
offsets.y =
amp * sin ( freq * dot( dir, xzVtx ) + speed * _Time.x);
return offsets;
}
half3 GerstnerOffset4 (half2 xzVtx, half4 steepness, half4 amp, half4 freq, half4 speed, half4 dirAB, half4 dirCD)
{
half3 offsets;
half4 AB = steepness.xxyy * amp.xxyy * dirAB.xyzw;
half4 CD = steepness.zzww * amp.zzww * dirCD.xyzw;
half4 dotABCD = freq.xyzw * half4(dot(dirAB.xy, xzVtx), dot(dirAB.zw, xzVtx), dot(dirCD.xy, xzVtx), dot(dirCD.zw, xzVtx));
half4 TIME = _Time.yyyy * speed;
half4 COS = cos (dotABCD + TIME);
half4 SIN = sin (dotABCD + TIME);
offsets.x = dot(COS, half4(AB.xz, CD.xz));
offsets.z = dot(COS, half4(AB.yw, CD.yw));
offsets.y = dot(SIN, amp);
return offsets;
}
half3 GerstnerNormal (half2 xzVtx, half steepness, half amp, half freq, half speed, half2 dir)
{
half3 nrml = half3(0,0,0);
nrml.x -=
dir.x * (amp * freq) *
cos(freq * dot( dir, xzVtx ) + speed * _Time.x);
nrml.z -=
dir.y * (amp * freq) *
cos(freq * dot( dir, xzVtx ) + speed * _Time.x);
return nrml;
}
half3 GerstnerNormal4 (half2 xzVtx, half4 amp, half4 freq, half4 speed, half4 dirAB, half4 dirCD)
{
half3 nrml = half3(0,2.0,0);
half4 AB = freq.xxyy * amp.xxyy * dirAB.xyzw;
half4 CD = freq.zzww * amp.zzww * dirCD.xyzw;
half4 dotABCD = freq.xyzw * half4(dot(dirAB.xy, xzVtx), dot(dirAB.zw, xzVtx), dot(dirCD.xy, xzVtx), dot(dirCD.zw, xzVtx));
half4 TIME = _Time.yyyy * speed;
half4 COS = cos (dotABCD + TIME);
nrml.x -= dot(COS, half4(AB.xz, CD.xz));
nrml.z -= dot(COS, half4(AB.yw, CD.yw));
nrml.xz *= _GerstnerIntensity;
nrml = normalize (nrml);
return nrml;
}
void Gerstner ( out half3 offs, out half3 nrml,
half3 vtx, half3 tileableVtx,
half4 amplitude, half4 frequency, half4 steepness,
half4 speed, half4 directionAB, half4 directionCD )
{
#ifdef WATER_VERTEX_DISPLACEMENT_ON
offs = GerstnerOffset4(tileableVtx.xz, steepness, amplitude, frequency, speed, directionAB, directionCD);
nrml = GerstnerNormal4(tileableVtx.xz + offs.xz, amplitude, frequency, speed, directionAB, directionCD);
#else
offs = half3(0,0,0);
nrml = half3(0,1,0);
#endif
}
#endif

View File

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

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 KiB

View File

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