[F] refraction miss match water albedo
This commit is contained in:
57
Assets/Test/Shader Graphs_depth.mat
Normal file
57
Assets/Test/Shader Graphs_depth.mat
Normal file
@@ -0,0 +1,57 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Shader Graphs_depth
|
||||
m_Shader: {fileID: -6465566751694194690, guid: d06fd6b3f7bff43fa8c5a1dc85231bf2,
|
||||
type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- unity_Lightmaps:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_LightmapsInd:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_ShadowMasks:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _QueueControl: 0
|
||||
- _QueueOffset: 0
|
||||
m_Colors: []
|
||||
m_BuildTextureStacks: []
|
||||
--- !u!114 &4188733648906257179
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 11
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
version: 7
|
||||
8
Assets/Test/Shader Graphs_depth.mat.meta
Normal file
8
Assets/Test/Shader Graphs_depth.mat.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ff1b343e0bb6c437c8de76099455e056
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
450
Assets/Test/depth.shadergraph
Normal file
450
Assets/Test/depth.shadergraph
Normal file
@@ -0,0 +1,450 @@
|
||||
{
|
||||
"m_SGVersion": 3,
|
||||
"m_Type": "UnityEditor.ShaderGraph.GraphData",
|
||||
"m_ObjectId": "93bf815fe0cf48709a31692c0a8b2966",
|
||||
"m_Properties": [],
|
||||
"m_Keywords": [],
|
||||
"m_Dropdowns": [],
|
||||
"m_CategoryData": [
|
||||
{
|
||||
"m_Id": "aa0f6d45b94645e6bb3921e79114fcbb"
|
||||
}
|
||||
],
|
||||
"m_Nodes": [
|
||||
{
|
||||
"m_Id": "f15a23e461784e32b08fd7067dbfc968"
|
||||
},
|
||||
{
|
||||
"m_Id": "0489a693323a4048965d44681b9d455f"
|
||||
},
|
||||
{
|
||||
"m_Id": "cdf70c63b23c4d0298e8d6e82e28d5de"
|
||||
},
|
||||
{
|
||||
"m_Id": "79629b66dadc4057abc0e20b7826d4f1"
|
||||
},
|
||||
{
|
||||
"m_Id": "0fc9a48a00c54584a17323d8926d35fb"
|
||||
}
|
||||
],
|
||||
"m_GroupDatas": [],
|
||||
"m_StickyNoteDatas": [],
|
||||
"m_Edges": [
|
||||
{
|
||||
"m_OutputSlot": {
|
||||
"m_Node": {
|
||||
"m_Id": "0fc9a48a00c54584a17323d8926d35fb"
|
||||
},
|
||||
"m_SlotId": 1
|
||||
},
|
||||
"m_InputSlot": {
|
||||
"m_Node": {
|
||||
"m_Id": "79629b66dadc4057abc0e20b7826d4f1"
|
||||
},
|
||||
"m_SlotId": 0
|
||||
}
|
||||
}
|
||||
],
|
||||
"m_VertexContext": {
|
||||
"m_Position": {
|
||||
"x": 212.0,
|
||||
"y": 16.0
|
||||
},
|
||||
"m_Blocks": [
|
||||
{
|
||||
"m_Id": "f15a23e461784e32b08fd7067dbfc968"
|
||||
},
|
||||
{
|
||||
"m_Id": "0489a693323a4048965d44681b9d455f"
|
||||
},
|
||||
{
|
||||
"m_Id": "cdf70c63b23c4d0298e8d6e82e28d5de"
|
||||
}
|
||||
]
|
||||
},
|
||||
"m_FragmentContext": {
|
||||
"m_Position": {
|
||||
"x": 187.0,
|
||||
"y": 277.0
|
||||
},
|
||||
"m_Blocks": [
|
||||
{
|
||||
"m_Id": "79629b66dadc4057abc0e20b7826d4f1"
|
||||
}
|
||||
]
|
||||
},
|
||||
"m_PreviewData": {
|
||||
"serializedMesh": {
|
||||
"m_SerializedMesh": "{\"mesh\":{\"instanceID\":0}}",
|
||||
"m_Guid": ""
|
||||
},
|
||||
"preventRotation": false
|
||||
},
|
||||
"m_Path": "Shader Graphs",
|
||||
"m_GraphPrecision": 1,
|
||||
"m_PreviewMode": 2,
|
||||
"m_OutputNode": {
|
||||
"m_Id": ""
|
||||
},
|
||||
"m_ActiveTargets": [
|
||||
{
|
||||
"m_Id": "7ea00714a0ae443ea046847ea6e0ff1a"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
|
||||
"m_ObjectId": "0489a693323a4048965d44681b9d455f",
|
||||
"m_Group": {
|
||||
"m_Id": ""
|
||||
},
|
||||
"m_Name": "VertexDescription.Normal",
|
||||
"m_DrawState": {
|
||||
"m_Expanded": true,
|
||||
"m_Position": {
|
||||
"serializedVersion": "2",
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"width": 0.0,
|
||||
"height": 0.0
|
||||
}
|
||||
},
|
||||
"m_Slots": [
|
||||
{
|
||||
"m_Id": "4f5a8d03173b432c8dd518f4943f2af9"
|
||||
}
|
||||
],
|
||||
"synonyms": [],
|
||||
"m_Precision": 0,
|
||||
"m_PreviewExpanded": true,
|
||||
"m_DismissedVersion": 0,
|
||||
"m_PreviewMode": 0,
|
||||
"m_CustomColors": {
|
||||
"m_SerializableColors": []
|
||||
},
|
||||
"m_SerializedDescriptor": "VertexDescription.Normal"
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.SceneDepthNode",
|
||||
"m_ObjectId": "0fc9a48a00c54584a17323d8926d35fb",
|
||||
"m_Group": {
|
||||
"m_Id": ""
|
||||
},
|
||||
"m_Name": "Scene Depth",
|
||||
"m_DrawState": {
|
||||
"m_Expanded": true,
|
||||
"m_Position": {
|
||||
"serializedVersion": "2",
|
||||
"x": -141.99998474121095,
|
||||
"y": 231.99998474121095,
|
||||
"width": 144.99998474121095,
|
||||
"height": 112.00001525878906
|
||||
}
|
||||
},
|
||||
"m_Slots": [
|
||||
{
|
||||
"m_Id": "1bd199ab4df34d7daade4503f80af98b"
|
||||
},
|
||||
{
|
||||
"m_Id": "3b0c78341f30421297682853ce6e2575"
|
||||
}
|
||||
],
|
||||
"synonyms": [
|
||||
"zbuffer",
|
||||
"zdepth"
|
||||
],
|
||||
"m_Precision": 0,
|
||||
"m_PreviewExpanded": true,
|
||||
"m_DismissedVersion": 0,
|
||||
"m_PreviewMode": 0,
|
||||
"m_CustomColors": {
|
||||
"m_SerializableColors": []
|
||||
},
|
||||
"m_DepthSamplingMode": 0
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.ScreenPositionMaterialSlot",
|
||||
"m_ObjectId": "1bd199ab4df34d7daade4503f80af98b",
|
||||
"m_Id": 0,
|
||||
"m_DisplayName": "UV",
|
||||
"m_SlotType": 0,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "UV",
|
||||
"m_StageCapability": 3,
|
||||
"m_Value": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0,
|
||||
"w": 0.0
|
||||
},
|
||||
"m_DefaultValue": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0,
|
||||
"w": 0.0
|
||||
},
|
||||
"m_Labels": [],
|
||||
"m_ScreenSpaceType": 0
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
|
||||
"m_ObjectId": "3b0c78341f30421297682853ce6e2575",
|
||||
"m_Id": 1,
|
||||
"m_DisplayName": "Out",
|
||||
"m_SlotType": 1,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "Out",
|
||||
"m_StageCapability": 2,
|
||||
"m_Value": 0.0,
|
||||
"m_DefaultValue": 0.0,
|
||||
"m_Labels": []
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.NormalMaterialSlot",
|
||||
"m_ObjectId": "4f5a8d03173b432c8dd518f4943f2af9",
|
||||
"m_Id": 0,
|
||||
"m_DisplayName": "Normal",
|
||||
"m_SlotType": 0,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "Normal",
|
||||
"m_StageCapability": 1,
|
||||
"m_Value": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"m_DefaultValue": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"m_Labels": [],
|
||||
"m_Space": 0
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
|
||||
"m_ObjectId": "79629b66dadc4057abc0e20b7826d4f1",
|
||||
"m_Group": {
|
||||
"m_Id": ""
|
||||
},
|
||||
"m_Name": "SurfaceDescription.BaseColor",
|
||||
"m_DrawState": {
|
||||
"m_Expanded": true,
|
||||
"m_Position": {
|
||||
"serializedVersion": "2",
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"width": 0.0,
|
||||
"height": 0.0
|
||||
}
|
||||
},
|
||||
"m_Slots": [
|
||||
{
|
||||
"m_Id": "fb3ee442ec7b42c7adfc30aab477d9f1"
|
||||
}
|
||||
],
|
||||
"synonyms": [],
|
||||
"m_Precision": 0,
|
||||
"m_PreviewExpanded": true,
|
||||
"m_DismissedVersion": 0,
|
||||
"m_PreviewMode": 0,
|
||||
"m_CustomColors": {
|
||||
"m_SerializableColors": []
|
||||
},
|
||||
"m_SerializedDescriptor": "SurfaceDescription.BaseColor"
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 1,
|
||||
"m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalTarget",
|
||||
"m_ObjectId": "7ea00714a0ae443ea046847ea6e0ff1a",
|
||||
"m_Datas": [],
|
||||
"m_ActiveSubTarget": {
|
||||
"m_Id": "c6dfbdb1fc1845138f492ac1900bc85a"
|
||||
},
|
||||
"m_AllowMaterialOverride": false,
|
||||
"m_SurfaceType": 0,
|
||||
"m_ZTestMode": 4,
|
||||
"m_ZWriteControl": 0,
|
||||
"m_AlphaMode": 0,
|
||||
"m_RenderFace": 2,
|
||||
"m_AlphaClip": false,
|
||||
"m_CastShadows": true,
|
||||
"m_ReceiveShadows": true,
|
||||
"m_SupportsLODCrossFade": false,
|
||||
"m_CustomEditorGUI": "",
|
||||
"m_SupportVFX": false
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.CategoryData",
|
||||
"m_ObjectId": "aa0f6d45b94645e6bb3921e79114fcbb",
|
||||
"m_Name": "",
|
||||
"m_ChildObjectList": []
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.PositionMaterialSlot",
|
||||
"m_ObjectId": "b775c1ffbf6542db93d113ce389778c8",
|
||||
"m_Id": 0,
|
||||
"m_DisplayName": "Position",
|
||||
"m_SlotType": 0,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "Position",
|
||||
"m_StageCapability": 1,
|
||||
"m_Value": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"m_DefaultValue": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"m_Labels": [],
|
||||
"m_Space": 0
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 2,
|
||||
"m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalUnlitSubTarget",
|
||||
"m_ObjectId": "c6dfbdb1fc1845138f492ac1900bc85a"
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.TangentMaterialSlot",
|
||||
"m_ObjectId": "c8cf62e8421a4579a4775704d86f7b20",
|
||||
"m_Id": 0,
|
||||
"m_DisplayName": "Tangent",
|
||||
"m_SlotType": 0,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "Tangent",
|
||||
"m_StageCapability": 1,
|
||||
"m_Value": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"m_DefaultValue": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"m_Labels": [],
|
||||
"m_Space": 0
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
|
||||
"m_ObjectId": "cdf70c63b23c4d0298e8d6e82e28d5de",
|
||||
"m_Group": {
|
||||
"m_Id": ""
|
||||
},
|
||||
"m_Name": "VertexDescription.Tangent",
|
||||
"m_DrawState": {
|
||||
"m_Expanded": true,
|
||||
"m_Position": {
|
||||
"serializedVersion": "2",
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"width": 0.0,
|
||||
"height": 0.0
|
||||
}
|
||||
},
|
||||
"m_Slots": [
|
||||
{
|
||||
"m_Id": "c8cf62e8421a4579a4775704d86f7b20"
|
||||
}
|
||||
],
|
||||
"synonyms": [],
|
||||
"m_Precision": 0,
|
||||
"m_PreviewExpanded": true,
|
||||
"m_DismissedVersion": 0,
|
||||
"m_PreviewMode": 0,
|
||||
"m_CustomColors": {
|
||||
"m_SerializableColors": []
|
||||
},
|
||||
"m_SerializedDescriptor": "VertexDescription.Tangent"
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
|
||||
"m_ObjectId": "f15a23e461784e32b08fd7067dbfc968",
|
||||
"m_Group": {
|
||||
"m_Id": ""
|
||||
},
|
||||
"m_Name": "VertexDescription.Position",
|
||||
"m_DrawState": {
|
||||
"m_Expanded": true,
|
||||
"m_Position": {
|
||||
"serializedVersion": "2",
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"width": 0.0,
|
||||
"height": 0.0
|
||||
}
|
||||
},
|
||||
"m_Slots": [
|
||||
{
|
||||
"m_Id": "b775c1ffbf6542db93d113ce389778c8"
|
||||
}
|
||||
],
|
||||
"synonyms": [],
|
||||
"m_Precision": 0,
|
||||
"m_PreviewExpanded": true,
|
||||
"m_DismissedVersion": 0,
|
||||
"m_PreviewMode": 0,
|
||||
"m_CustomColors": {
|
||||
"m_SerializableColors": []
|
||||
},
|
||||
"m_SerializedDescriptor": "VertexDescription.Position"
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot",
|
||||
"m_ObjectId": "fb3ee442ec7b42c7adfc30aab477d9f1",
|
||||
"m_Id": 0,
|
||||
"m_DisplayName": "Base Color",
|
||||
"m_SlotType": 0,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "BaseColor",
|
||||
"m_StageCapability": 2,
|
||||
"m_Value": {
|
||||
"x": 0.5,
|
||||
"y": 0.5,
|
||||
"z": 0.5
|
||||
},
|
||||
"m_DefaultValue": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"m_Labels": [],
|
||||
"m_ColorMode": 0,
|
||||
"m_DefaultColor": {
|
||||
"r": 0.5,
|
||||
"g": 0.5,
|
||||
"b": 0.5,
|
||||
"a": 1.0
|
||||
}
|
||||
}
|
||||
|
||||
10
Assets/Test/depth.shadergraph.meta
Normal file
10
Assets/Test/depth.shadergraph.meta
Normal file
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d06fd6b3f7bff43fa8c5a1dc85231bf2
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
|
||||
@@ -9,7 +9,7 @@ namespace zz.water.editor
|
||||
[ScriptedImporter(1, FILE_EXTENSION)]
|
||||
public class WaterMeshImporter : ScriptedImporter
|
||||
{
|
||||
private const string FILE_EXTENSION = "watermesh";
|
||||
private const string FILE_EXTENSION = "zwatermesh";
|
||||
|
||||
[SerializeField] public WaterMesh waterMesh = new WaterMesh();
|
||||
|
||||
|
||||
@@ -107,14 +107,14 @@ Material:
|
||||
- _GlossyReflections: 0
|
||||
- _HorizonDistance: 26.6
|
||||
- _InterscetionSpeed: 1
|
||||
- _IntersectionClipping: 0.407
|
||||
- _IntersectionClipping: 0.553
|
||||
- _IntersectionDurationMulti: 1
|
||||
- _IntersectionDurationMulti1: 2.53
|
||||
- _IntersectionDurationMulti2: 0.83
|
||||
- _IntersectionFalloff: 0.73
|
||||
- _IntersectionFalloff: 1
|
||||
- _IntersectionLength: 2.03
|
||||
- _IntersectionSpeed: 0.2
|
||||
- _IntersectionTiling: 0.82
|
||||
- _IntersectionTiling: 1
|
||||
- _Metallic: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.005
|
||||
@@ -123,7 +123,7 @@ Material:
|
||||
- _ReflectionBlur: 0.049
|
||||
- _ReflectionFresnel: 4.92
|
||||
- _ReflectionStrength: 1
|
||||
- _RefractionStrength: 0.278
|
||||
- _RefractionStrength: 0.367
|
||||
- _Smoothness: 0.5
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
|
||||
@@ -34,7 +34,7 @@ TextureImporter:
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 0
|
||||
filterMode: 2
|
||||
aniso: 3
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
@@ -71,7 +71,7 @@ TextureImporter:
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: 9
|
||||
textureFormat: 18
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
|
||||
@@ -20,8 +20,10 @@ void PopulateSceneData(inout SceneData scene, in Varyings input, in WaterSurface
|
||||
scene.viewDepth = 1;
|
||||
scene.verticalDepth = 1;
|
||||
|
||||
float2 refractionOffset = input.normalWS.xz * 0.5 * _RefractionStrength + screenPos;
|
||||
|
||||
//Screen depth Projection to world position
|
||||
SceneDepth depth = SampleDepth(screenPos);
|
||||
SceneDepth depth = SampleDepth(refractionOffset);
|
||||
float3 projWorldPos = depth.eye * (water.viewDelta / input.positionNDC.w) - _WorldSpaceCameraPos;
|
||||
scene.positionWS = -projWorldPos;
|
||||
|
||||
@@ -32,8 +34,8 @@ void PopulateSceneData(inout SceneData scene, in Varyings input, in WaterSurface
|
||||
|
||||
//Distance to opaque geometry in normal direction
|
||||
scene.verticalDepth = length((water.positionWS - scene.positionWS) * water.vertexNormal);
|
||||
scene.color = SampleSceneColor(refractionOffset);
|
||||
|
||||
scene.color = SampleSceneColor(screenPos + input.normalWS.xz * 0.5 * _RefractionStrength);
|
||||
}
|
||||
|
||||
float GetWaterDensity(SceneData scene, float heightScalar, float viewDepthScalar)
|
||||
@@ -76,8 +78,8 @@ float4 ForwardPassFragment(Varyings input) : SV_Target
|
||||
|
||||
PopulateSceneData(scene, input, water);
|
||||
|
||||
//return float4(scene.verticalDepth.xxx, 0.7);
|
||||
//return float4(scene.viewDepth.xxx, 0.7);
|
||||
//return float4(scene.verticalDepth.xxx, 1);
|
||||
//return float4(scene.viewDepth.xxx, 1);
|
||||
//return float4(scene.color, 1);
|
||||
|
||||
water.fog = GetWaterDensity(scene, _DepthHorizontal, _DepthVertical);
|
||||
@@ -93,7 +95,6 @@ float4 ForwardPassFragment(Varyings input) : SV_Target
|
||||
water.albedo = lerp(baseColor.rgb, _HorizonColor.rgb, fresnel);
|
||||
|
||||
water.edgeFade = saturate(scene.verticalDepth / (_EdgeFade * 0.01));
|
||||
|
||||
water.alpha *= water.edgeFade;
|
||||
|
||||
|
||||
@@ -119,11 +120,12 @@ float4 ForwardPassFragment(Varyings input) : SV_Target
|
||||
|
||||
float dist = saturate(interSecGradient / _IntersectionFalloff);
|
||||
|
||||
float inersecNoise = saturate(foamTexNoise + intersecMesure) * dist + dist;
|
||||
inersecNoise = smoothstep(_IntersectionClipping, 1, inersecNoise);
|
||||
float intersecNoise = saturate(foamTexNoise + intersecMesure) * dist + dist;
|
||||
intersecNoise = smoothstep(_IntersectionClipping, 1, intersecNoise);
|
||||
|
||||
|
||||
float noise = saturate(inersecNoise + waveFoamNoise);
|
||||
float noise = saturate(intersecNoise + waveFoamNoise);
|
||||
//float noise = intersecNoise;
|
||||
|
||||
water.albedo.rgb = lerp(water.albedo.rgb, _IntersectionColor.rgb, noise);
|
||||
water.alpha = saturate(water.alpha + interSecGradient);
|
||||
@@ -173,7 +175,7 @@ float4 ForwardPassFragment(Varyings input) : SV_Target
|
||||
|
||||
finalColor = lerp(finalColor, _IntersectionColor.rgb, noise);
|
||||
|
||||
// =================== Make ApplyLight simple =========================
|
||||
// =================== Make ApplyLight simple end =========================
|
||||
|
||||
finalColor = lerp(scene.color, finalColor, water.fog + noise);
|
||||
|
||||
|
||||
@@ -24,10 +24,10 @@ Shader "zzwater/ocean"
|
||||
//Intersection
|
||||
[NoScaleOffset][SingleLineTexture]_IntersectionNoise("Intersection noise", 2D) = "white" {}
|
||||
_IntersectionTiling("Noise Tiling", float) = 0.2
|
||||
_IntersectionColor("Color", Color) = (1,1,1,1)
|
||||
_IntersectionColor("Foam Color", Color) = (1,1,1,1)
|
||||
_IntersectionSpeed("Intersection Speed Multi", Float) = 1
|
||||
_IntersectionClipping("Cutoff", Range(0.01, 1)) = 0.5
|
||||
_IntersectionFalloff("Falloff", Range(0.01 , 1)) = 0.5
|
||||
_IntersectionClipping("Intersection Cutoff", Range(0.01, 1)) = 0.5
|
||||
_IntersectionFalloff("Intersection Falloff", Range(0.01 , 1)) = 0.5
|
||||
_IntersectionLength("Intersection Distance", Range(0.01 , 5)) = 2
|
||||
|
||||
// Wave foam
|
||||
@@ -37,8 +37,8 @@ Shader "zzwater/ocean"
|
||||
|
||||
|
||||
//waves
|
||||
_WaveSpeed("Speed", Float) = 2
|
||||
_WaveHeight("Height", Range(0 , 10)) = 0.25
|
||||
_WaveSpeed("Wave Speed", Float) = 2
|
||||
_WaveHeight("Wave Height", Range(0 , 10)) = 0.25
|
||||
|
||||
_WaveNormalStr("Normal Strength", Range(0 , 32)) = 0.5
|
||||
_WaveDistance("Distance", Range(0 , 1)) = 0.8
|
||||
|
||||
@@ -30,10 +30,10 @@ Shader "zzwater/ocean_tess"
|
||||
//Intersection
|
||||
[NoScaleOffset][SingleLineTexture]_IntersectionNoise("Intersection noise", 2D) = "white" {}
|
||||
_IntersectionTiling("Noise Tiling", float) = 0.2
|
||||
_IntersectionColor("Color", Color) = (1,1,1,1)
|
||||
_IntersectionColor("Foam Color", Color) = (1,1,1,1)
|
||||
_IntersectionSpeed("Intersection Speed Multi", Float) = 1
|
||||
_IntersectionClipping("Cutoff", Range(0.01, 1)) = 0.5
|
||||
_IntersectionFalloff("Falloff", Range(0.01 , 1)) = 0.5
|
||||
_IntersectionClipping("Intersection Cutoff", Range(0.01, 1)) = 0.5
|
||||
_IntersectionFalloff("Intersection Falloff", Range(0.01 , 1)) = 0.5
|
||||
_IntersectionLength("Intersection Distance", Range(0.01 , 5)) = 2
|
||||
|
||||
// Wave foam
|
||||
@@ -43,8 +43,8 @@ Shader "zzwater/ocean_tess"
|
||||
|
||||
|
||||
//waves
|
||||
_WaveSpeed("Speed", Float) = 2
|
||||
_WaveHeight("Height", Range(0 , 10)) = 0.25
|
||||
_WaveSpeed("Wave Speed", Float) = 2
|
||||
_WaveHeight("Wave Height", Range(0 , 10)) = 0.25
|
||||
|
||||
_WaveNormalStr("Normal Strength", Range(0 , 32)) = 0.5
|
||||
_WaveDistance("Distance", Range(0 , 1)) = 0.8
|
||||
|
||||
Reference in New Issue
Block a user