Add water system package

This commit is contained in:
Vova
2023-12-06 20:29:45 +02:00
parent 627a90012a
commit 58d0f79bd1
140 changed files with 33167 additions and 3 deletions
+61 -3
View File
@@ -1227,7 +1227,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 250, y: 0}
m_SizeDelta: {x: 480, y: 0} m_SizeDelta: {x: 480, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &249161732 --- !u!114 &249161732
@@ -2917,7 +2917,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 749553635} m_GameObject: {fileID: 749553635}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: 0.26693356, y: -0.000000028720944, z: 0.00000000795524, w: 0.96371496} m_LocalRotation: {x: 0.2669336, y: 3.4238033e-15, z: -1.836517e-15, w: 0.96371496}
m_LocalPosition: {x: 29.11, y: 3, z: -5} m_LocalPosition: {x: 29.11, y: 3, z: -5}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
@@ -3232,7 +3232,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 835327588} m_GameObject: {fileID: 835327588}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: 0.26693356, y: -0.000000028720944, z: 0.00000000795524, w: 0.96371496} m_LocalRotation: {x: 0.2669336, y: 3.4238033e-15, z: -1.836517e-15, w: 0.96371496}
m_LocalPosition: {x: 29.11, y: 3, z: -5} m_LocalPosition: {x: 29.11, y: 3, z: -5}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
@@ -10824,6 +10824,63 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 200, y: 30} m_SizeDelta: {x: 200, y: 30}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!1001 &2045477720
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 1015499191777110, guid: 2cac2e60f3f6f2447ad9b550450f60ed, type: 3}
propertyPath: m_Name
value: SeaVisual
objectReference: {fileID: 0}
- target: {fileID: 4554327062270080, guid: 2cac2e60f3f6f2447ad9b550450f60ed, type: 3}
propertyPath: m_LocalPosition.x
value: 14.277622
objectReference: {fileID: 0}
- target: {fileID: 4554327062270080, guid: 2cac2e60f3f6f2447ad9b550450f60ed, type: 3}
propertyPath: m_LocalPosition.y
value: 0.0000019073486
objectReference: {fileID: 0}
- target: {fileID: 4554327062270080, guid: 2cac2e60f3f6f2447ad9b550450f60ed, type: 3}
propertyPath: m_LocalPosition.z
value: -4.9958153
objectReference: {fileID: 0}
- target: {fileID: 4554327062270080, guid: 2cac2e60f3f6f2447ad9b550450f60ed, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4554327062270080, guid: 2cac2e60f3f6f2447ad9b550450f60ed, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4554327062270080, guid: 2cac2e60f3f6f2447ad9b550450f60ed, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4554327062270080, guid: 2cac2e60f3f6f2447ad9b550450f60ed, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4554327062270080, guid: 2cac2e60f3f6f2447ad9b550450f60ed, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4554327062270080, guid: 2cac2e60f3f6f2447ad9b550450f60ed, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4554327062270080, guid: 2cac2e60f3f6f2447ad9b550450f60ed, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 2cac2e60f3f6f2447ad9b550450f60ed, type: 3}
--- !u!1 &2057527360 --- !u!1 &2057527360
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -11155,3 +11212,4 @@ SceneRoots:
- {fileID: 464115413} - {fileID: 464115413}
- {fileID: 495189437} - {fileID: 495189437}
- {fileID: 1291994925} - {fileID: 1291994925}
- {fileID: 2045477720}
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ff6ef3b3109514061b996e1f998625ba
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,45 @@
using UnityEditor;
namespace WaterSystem
{
[CustomEditor(typeof(BuoyantObject))]
public class BuoyantObjectEditor : Editor
{
private BuoyantObject obj;
private bool _heightsDebugBool;
private bool _generalSettingsBool;
private void OnEnable()
{
obj = serializedObject.targetObject as BuoyantObject;
}
public override void OnInspectorGUI()
{
_generalSettingsBool = EditorGUILayout.BeginFoldoutHeaderGroup(_generalSettingsBool, "General Settings");
if (_generalSettingsBool)
{
base.OnInspectorGUI();
}
EditorGUILayout.EndFoldoutHeaderGroup();
_heightsDebugBool = EditorGUILayout.BeginFoldoutHeaderGroup(_heightsDebugBool, "Height Debug Values");
if (_heightsDebugBool)
{
if (obj.Heights != null)
{
for (var i = 0; i < obj.Heights.Length; i++)
{
var h = obj.Heights[i];
EditorGUILayout.LabelField($"{i})Wave(heights):", $"X:{h.x:00.00} Y:{h.y:00.00} Z:{h.z:00.00}");
}
}
else
{
EditorGUILayout.HelpBox("Height debug info only available in playmode.", MessageType.Info);
}
}
EditorGUILayout.EndFoldoutHeaderGroup();
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8763206c9fce6479698aa739878ca7c7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,46 @@
using UnityEngine;
using UnityEditor;
using UnityEngine.Rendering.Universal;
namespace WaterSystem
{
[CustomPropertyDrawer(typeof(PlanarReflections.PlanarReflectionSettings))]
public class PlanarSettingsDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
EditorGUI.BeginProperty(position, label, property);
// Don't make child fields be indented
var indent = EditorGUI.indentLevel;
EditorGUI.indentLevel = 0;
// Rects
Rect resMultiRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);
Rect offsetRect = new Rect(position.x, resMultiRect.yMax + EditorGUIUtility.standardVerticalSpacing, position.width, EditorGUIUtility.singleLineHeight);
Rect layerMaskRect = new Rect(position.x, offsetRect.yMax + EditorGUIUtility.standardVerticalSpacing, position.width, EditorGUIUtility.singleLineHeight);
Rect shadowRect = new Rect(position.x, layerMaskRect.yMax + EditorGUIUtility.standardVerticalSpacing, position.width * 0.5f, EditorGUIUtility.singleLineHeight);
Rect maxLODRect = new Rect(position.x + position.width * 0.5f, layerMaskRect.yMax + EditorGUIUtility.standardVerticalSpacing, position.width * 0.5f, EditorGUIUtility.singleLineHeight);
var resMulti = property.FindPropertyRelative("m_ResolutionMultiplier");
EditorGUI.PropertyField(resMultiRect, resMulti);
position.y += EditorGUIUtility.singleLineHeight;
var offset = property.FindPropertyRelative("m_ClipPlaneOffset");
EditorGUI.Slider(offsetRect, offset, -0.500f, 0.500f);
var layerMask = property.FindPropertyRelative("m_ReflectLayers");
EditorGUI.PropertyField(layerMaskRect, layerMask);
var shadows = property.FindPropertyRelative("m_Shadows");
EditorGUI.PropertyField(shadowRect, shadows);
// Set indent back to what it was
EditorGUI.indentLevel = indent;
EditorGUI.EndProperty();
}
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
return (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) * 4f;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e0bc0b238a7fa4c69938228f2c8d657e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,79 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEditorInternal;
using WaterSystem.Data;
namespace WaterSystem
{
[CustomEditor(typeof(Water))]
public class WaterEditor : Editor
{
public override void OnInspectorGUI()
{
serializedObject.Update();
Water w = (Water)target;
var waterSettingsData = serializedObject.FindProperty("settingsData");
EditorGUILayout.PropertyField(waterSettingsData, true);
if(waterSettingsData.objectReferenceValue != null)
{
CreateEditor((WaterSettingsData)waterSettingsData.objectReferenceValue).OnInspectorGUI();
}
var waterSurfaceData = serializedObject.FindProperty("surfaceData");
EditorGUILayout.PropertyField(waterSurfaceData, true);
if(waterSurfaceData.objectReferenceValue != null)
{
CreateEditor((WaterSurfaceData)waterSurfaceData.objectReferenceValue).OnInspectorGUI();
}
serializedObject.ApplyModifiedProperties();
if(GUI.changed)
{
w.Init();
}
}
void OnSceneGUI()
{
/* Water w = target as Water;
Camera cam = SceneView.currentDrawingSceneView.camera;
var waveDebug = serializedObject.FindProperty("_debugMode");
if (cam && waveDebug.intValue != 0)
{
Vector3 pos = Vector3.zero;
float dist = 10f;
if (waveDebug.intValue == 2)
{
Plane p = new Plane(Vector3.zero, Vector3.forward, Vector3.right);
Ray r = Camera.current.ViewportPointToRay(new Vector2(0.25f, 0.25f));
if (p.Raycast(r, out dist))
{
pos = Camera.current.ViewportToWorldPoint(new Vector3(0.25f, 0.25f, dist));
}
}
for (int i = w._waves.Length - 1; i >= 0; i--)
{
Wave wave = w._waves[i];
Random.InitState(i);
Color c = Color.HSVToRGB(Random.Range(0f, 1f), 1f, 1f);
c.a = Mathf.Clamp01(0.01f * dist - 0.1f) * 0.5f;
Handles.color = c;
pos.y = wave.amplitude;
DrawWaveGizmo(pos, wave.direction, wave.amplitude, wave.wavelength);
}
}*/
}
void DrawWaveGizmo(Vector3 pos, float angle, float size, float length)
{
Handles.DrawSolidDisc(pos, Vector3.up, length / 2f);
Handles.ArrowHandleCap(0, pos, Quaternion.AngleAxis(angle, Vector3.up), -length / 1.75f, EventType.Repaint);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7760ef1f46dfd455cae527e7f91824d3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,47 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEditorInternal;
namespace WaterSystem.Data
{
[CustomEditor(typeof(WaterSettingsData))]
public class WaterSettingsDataEditor : Editor
{
public override void OnInspectorGUI()
{
var geomType = serializedObject.FindProperty("waterGeomType");
EditorGUILayout.PropertyField(geomType);
var refType = serializedObject.FindProperty("refType");
refType.enumValueIndex = GUILayout.Toolbar(refType.enumValueIndex, refType.enumDisplayNames);
switch(refType.enumValueIndex)
{
case 0:
{
// cubemap
var cube = serializedObject.FindProperty("cubemapRefType");
EditorGUILayout.PropertyField(cube, new GUIContent("Cubemap Texture"));
}
break;
case 1:
{
// probe
EditorGUILayout.HelpBox("Reflection Probe setting has no options, it automatically uses the nearest reflection probe to the main camera", MessageType.Info);
}
break;
case 2:
{
// planar
var planarSettings = serializedObject.FindProperty("planarSettings");
EditorGUILayout.PropertyField(planarSettings, true);
}
break;
}
serializedObject.ApplyModifiedProperties();
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0935a4ad227524d3cae739e174b846b2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,361 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEditorInternal;
namespace WaterSystem.Data
{
[CustomEditor(typeof(WaterSurfaceData))]
public class WaterSurfaceDataEditor : Editor
{
[SerializeField]
ReorderableList waveList;
private void OnValidate()
{
var init = serializedObject.FindProperty("_init");
if(init?.boolValue == false)
Setup();
var standardHeight = EditorGUIUtility.singleLineHeight;
var standardLine = standardHeight + EditorGUIUtility.standardVerticalSpacing;
//Reorderable list stuff////////////////////////////////////////////////
waveList = new ReorderableList(serializedObject, serializedObject.FindProperty("_waves"), true, true, true, true);
//Single entry GUI
waveList.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) =>
{
var element = waveList.serializedProperty.GetArrayElementAtIndex(index);
rect.y += 2;
// Swell height
var preWidth = EditorGUIUtility.labelWidth;
EditorGUIUtility.labelWidth = rect.width * 0.2f;
Rect ampRect = new Rect(rect.x, rect.y + standardLine, rect.width * 0.5f, standardHeight);
var waveAmp = element.FindPropertyRelative("amplitude");
waveAmp.floatValue = EditorGUI.Slider(ampRect, "Swell Height", waveAmp.floatValue, 0.1f, 30f);
// Wavelength
Rect lengthRect = new Rect(rect.x + ampRect.width, rect.y + standardLine, rect.width * 0.5f, standardHeight);
var waveLen = element.FindPropertyRelative("wavelength");
waveLen.floatValue = EditorGUI.Slider(lengthRect, "Wavelength", waveLen.floatValue, 1.0f, 200f);
EditorGUIUtility.labelWidth = preWidth;
// Directional controls
Rect dirToggleRect = new Rect(rect.x, rect.y + 2 + standardLine * 2, rect.width * 0.5f, standardHeight);
Rect omniToggleRect = new Rect(rect.x + rect.width * 0.5f, dirToggleRect.y, rect.width * 0.5f, standardHeight);
Rect containerRect = new Rect(rect.x, dirToggleRect.y + 1, rect.width, standardLine * 3.2f);
// Direction/origin
var waveType = element.FindPropertyRelative("onmiDir");
var wTypeBool = (int)waveType.floatValue == 1 ? true : false;
GUI.Box(containerRect, "", EditorStyles.helpBox );
wTypeBool = !GUI.Toggle(dirToggleRect, !wTypeBool, "Directional", EditorStyles.miniButtonLeft);
wTypeBool = GUI.Toggle(omniToggleRect, wTypeBool, "Omni-directional", EditorStyles.miniButtonRight);
waveType.floatValue = wTypeBool ? 1 : 0;
Rect dirRect = new Rect(rect.x + 4, dirToggleRect.y + standardLine, rect.width - 8, standardHeight);
Rect buttonRect = new Rect(rect.x + 4, dirRect.y + standardLine + 2, rect.width - 8, standardHeight);
// Directional
if(!wTypeBool)
{
var waveDir = element.FindPropertyRelative("direction");
waveDir.floatValue = EditorGUI.Slider(dirRect, "Facing Direction", waveDir.floatValue, -180.0f, 180.0f);
if(GUI.Button(buttonRect, "Align with Scene Camera"))
waveDir.floatValue = CameraRelativeDirection();
}
else
{// Omni-Directional
EditorGUIUtility.wideMode = true;
//var perWidth = EditorGUIUtility.labelWidth;
//EditorGUIUtility.labelWidth = 20f;
var waveOrig = element.FindPropertyRelative("origin");
waveOrig.vector2Value = EditorGUI.Vector2Field(dirRect, "Point of Origin", waveOrig.vector2Value);
if(GUI.Button(buttonRect, "Project Origin from Scene Camera"))
waveOrig.vector2Value = CameraRelativeOrigin(waveOrig.vector2Value);
//EditorGUIUtility.labelWidth = perWidth;
}
};
// Check can remove to make sure at least one wave remains
waveList.onCanRemoveCallback = (ReorderableList l) =>
{
return l.count > 1;
};
// Check on remove to give a warning incase removing by accident
waveList.onRemoveCallback = (ReorderableList l) =>
{
if (EditorUtility.DisplayDialog("Warning!", "Are you sure you want to delete the wave?", "Yes", "No"))
{
ReorderableList.defaultBehaviours.DoRemoveButton(l);
}
};
// When adding, check if under 10, if so add a new random wave
waveList.onAddCallback = (ReorderableList l) =>
{
var index = l.serializedProperty.arraySize;
if (index < 10)
{
l.serializedProperty.arraySize++;
l.index = index;
var element = l.serializedProperty.GetArrayElementAtIndex(index);
element.FindPropertyRelative("amplitude").floatValue = Random.Range(0.25f, 1.5f);
element.FindPropertyRelative("direction").floatValue = Random.Range(-180f, 180f);
element.FindPropertyRelative("wavelength").floatValue = Random.Range(2f, 8f);
}
else
{
EditorUtility.DisplayDialog("Warning!", "You have reached the limit of 10 waves for this Water.", "Close");
}
};
//Draw header
waveList.drawHeaderCallback = (Rect rect) =>
{
EditorGUI.LabelField(rect, "Wave List");
};
//Do height of list entry
waveList.elementHeightCallback = (index) =>
{
var elementHeight = standardLine * 6f;
return elementHeight;
};
}
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.LabelField("Visual Settings", EditorStyles.boldLabel);
EditorGUI.indentLevel += 1;
// Max visibility - slider 3-300
var maxDepth = serializedObject.FindProperty("_waterMaxVisibility");
EditorGUILayout.Slider(maxDepth, 3, 300, new GUIContent("Maximum Visibility", maxDepthTT));
// Colouring settings
DoSmallHeader("Coloring Controls");
// Absorbstion Ramp
var absorpRamp = serializedObject.FindProperty("_absorptionRamp");
EditorGUILayout.PropertyField(absorpRamp, new GUIContent("Absorption Color", absorpRampTT), true, null);
// Scatter Ramp
var scatterRamp = serializedObject.FindProperty("_scatterRamp");
EditorGUILayout.PropertyField(scatterRamp, new GUIContent("Scattering Color", scatterRampTT), true, null);
// Foam Ramps
DoSmallHeader("Surface Foam");
var foamSettings = serializedObject.FindProperty("_foamSettings");
var foamType = foamSettings.FindPropertyRelative("foamType");
foamType.intValue = GUILayout.Toolbar(foamType.intValue, foamTypeOptions);
EditorGUILayout.Space();
switch (foamType.intValue)
{
case 0: //// Auto ////
{
EditorGUILayout.HelpBox("Automatic will distribute the foam suitable for an average swell", MessageType.Info);
}
break;
case 1: //// Simple ////
{
EditorGUILayout.BeginHorizontal();
DoInlineLabel("Foam Profile", foamCurveTT, 50f);
var basicFoam = foamSettings.FindPropertyRelative("basicFoam");
basicFoam.animationCurveValue = EditorGUILayout.CurveField(basicFoam.animationCurveValue, Color.white, new Rect(Vector2.zero, Vector2.one));
EditorGUILayout.EndHorizontal();
}
break;
case 2: //// Simple ////
{
EditorGUILayout.BeginHorizontal();
DoInlineLabel("Foam Profiles", foam3curvesTT, 50f);
var liteFoam = foamSettings.FindPropertyRelative("liteFoam");
liteFoam.animationCurveValue = EditorGUILayout.CurveField(liteFoam.animationCurveValue, new Color(0.5f, 0.75f, 1f, 1f), new Rect(Vector2.zero, Vector2.one));
var mediumFoam = foamSettings.FindPropertyRelative("mediumFoam");
mediumFoam.animationCurveValue = EditorGUILayout.CurveField(mediumFoam.animationCurveValue, new Color(0f, 0.5f, 1f, 1f), new Rect(Vector2.zero, Vector2.one));
var denseFoam = foamSettings.FindPropertyRelative("denseFoam");
denseFoam.animationCurveValue = EditorGUILayout.CurveField(denseFoam.animationCurveValue, Color.blue, new Rect(Vector2.zero, Vector2.one));
EditorGUILayout.EndHorizontal();
}
break;
}
EditorGUI.indentLevel -= 1;
EditorGUILayout.LabelField("Wave Settings", EditorStyles.boldLabel);
EditorGUI.indentLevel += 1;
// Wave type - Automatic / Customized
//wavesType = EditorGUILayout.Popup("System Type", wavesType, wavesTypeOptions);
// Toolbar labels here
var customWaves = serializedObject.FindProperty("_customWaves");
var intVal = customWaves.boolValue ? 1 : 0;
intVal = GUILayout.Toolbar(intVal, wavesTypeOptions);
customWaves.boolValue = intVal == 1 ? true : false;
EditorGUILayout.Space();
switch(customWaves.boolValue ? 1 : 0)
{
case 0: //// Automatic ////
{
var basicSettings = serializedObject.FindProperty("_basicWaveSettings");
// Wave count (display warning of on mobile platform and over 6) dropdown 1 > 10
var autoCount = basicSettings.FindPropertyRelative("numWaves");
EditorGUILayout.IntSlider(autoCount, 1, 10, new GUIContent("Wave Count", waveCountTT), null);
// Average Wave height - slider 0.05 - 30
var avgHeight = basicSettings.FindPropertyRelative("amplitude");
EditorGUILayout.Slider(avgHeight, 0.1f, 30.0f, new GUIContent("Avg Swell Height", avgHeightTT), null);
// Average Wavelength - slider 1 - 200
var avgWavelength = basicSettings.FindPropertyRelative("wavelength");
EditorGUILayout.Slider(avgWavelength, 1.0f, 200.0f, new GUIContent("Avg Wavelength", avgWavelengthTT), null);
// Wind direction - slider -180-180
EditorGUILayout.BeginHorizontal();
var windDir = basicSettings.FindPropertyRelative("direction");
EditorGUILayout.Slider(windDir, -180.0f, 180.0f, new GUIContent("Wind Direction", windDirTT), null);
if(GUILayout.Button(new GUIContent("Align to scene camera", alignButtonTT)))
windDir.floatValue = CameraRelativeDirection();
EditorGUILayout.EndHorizontal();
// [override] - random otherwise(on creation/override check)
// Random seed - int input
EditorGUILayout.BeginHorizontal();
var randSeed = serializedObject.FindProperty("randomSeed");
randSeed.intValue = EditorGUILayout.IntField(new GUIContent("Random Seed", randSeedTT), randSeed.intValue);
if (GUILayout.Button("Randomize Waves"))
{
randSeed.intValue = System.DateTime.Now.Millisecond * 100 - System.DateTime.Now.Millisecond;
}
EditorGUILayout.EndHorizontal();
}
break;
case 1: //// Customized ////
{
EditorGUI.indentLevel -= 1;
// Re-orderable list with wave details
waveList.DoLayoutList();
/// Type - Directional / Omi-directional
//// Amplitude - slider 0.05 - 30
//// Wavelength - slider 1 - 200
////// Direction(facing) - slider -180-180 && face scene camera direction(if scene view)
// OR
////// Origin(point of origin) - Vector input && origin at camera aim
}
break;
}
EditorUtility.SetDirty(this);
serializedObject.ApplyModifiedProperties();
}
void DoSmallHeader(string header)
{
EditorGUI.indentLevel -= 1;
EditorGUILayout.LabelField(header, EditorStyles.miniBoldLabel);
EditorGUI.indentLevel += 1;
}
void DoInlineLabel(string label, string tooltip, float width)
{
var preWidth = EditorGUIUtility.labelWidth;
EditorGUIUtility.labelWidth = width;
EditorGUILayout.LabelField(new GUIContent(label, tooltip));
EditorGUIUtility.labelWidth = preWidth;
}
void Setup()
{
WaterSurfaceData wsd = (WaterSurfaceData)target;
wsd._init = true;
wsd._absorptionRamp = DefaultAbsorptionGrad();
wsd._scatterRamp = DefaultScatterGrad();
EditorUtility.SetDirty(wsd);
}
Gradient DefaultAbsorptionGrad() // Preset for absorption
{
Gradient g = new Gradient();
GradientColorKey[] gck = new GradientColorKey[5];
GradientAlphaKey[] gak = new GradientAlphaKey[1];
gak[0].alpha = 1;
gak[0].time = 0;
gck[0].color = Color.white;
gck[0].time = 0f;
gck[1].color = new Color(0.22f, 0.87f, 0.87f);
gck[1].time = 0.082f;
gck[2].color = new Color(0f, 0.47f, 0.49f);
gck[2].time = 0.318f;
gck[3].color = new Color(0f, 0.275f, 0.44f);
gck[3].time = 0.665f;
gck[4].color = Color.black;
gck[4].time = 1f;
g.SetKeys(gck, gak);
return g;
}
Gradient DefaultScatterGrad() // Preset for scattering
{
Gradient g = new Gradient();
GradientColorKey[] gck = new GradientColorKey[4];
GradientAlphaKey[] gak = new GradientAlphaKey[1];
gak[0].alpha = 1;
gak[0].time = 0;
gck[0].color = Color.black;
gck[0].time = 0f;
gck[1].color = new Color(0.08f, 0.41f, 0.34f);
gck[1].time = 0.15f;
gck[2].color = new Color(0.13f, 0.55f, 0.45f);
gck[2].time = 0.42f;
gck[3].color = new Color(0.21f, 0.62f, 0.6f);
gck[3].time = 1f;
g.SetKeys(gck, gak);
return g;
}
float CameraRelativeDirection()
{
float degrees = 0;
Vector3 camFwd = UnityEditor.SceneView.lastActiveSceneView.camera.transform.forward;
camFwd.y = 0f;
camFwd.Normalize();
float dot = Vector3.Dot(-Vector3.forward, camFwd);
degrees = Mathf.LerpUnclamped(90.0f, 180.0f, dot);
if(camFwd.x < 0)
degrees *= -1f;
return Mathf.RoundToInt(degrees * 1000) / 1000;
}
Vector2 CameraRelativeOrigin(Vector2 original)
{
Camera sceneCam = UnityEditor.SceneView.lastActiveSceneView.camera;
float angle = 90f - Vector3.Angle(sceneCam.transform.forward, Vector3.down);
if (angle > 0.1f)
{
Vector3 intersect = Vector2.zero;
float hypot = (sceneCam.transform.position.y) * (1 / Mathf.Sin(Mathf.Deg2Rad * angle));
Vector3 fwd = sceneCam.transform.forward * hypot;
intersect = fwd + sceneCam.transform.position;
return new Vector2(intersect.x, intersect.z);
}
else
{
return original;
}
}
static string[] wavesTypeOptions = new string[] { "Automatic", "Customized" };
static string[] foamTypeOptions = new string[3] { "Automatic", "Simple Curve", "Density Curves" };
////TOOLTIPS////
private string maxDepthTT = "This controls the max depth of the waters transparency/visiblility, the absorption and scattering gradients map to this depth. Units:Meters";
private string absorpRampTT = "This gradient controls the color of the water as it gets deeper, darkening the surfaces under the water as they get deeper.";
private string scatterRampTT = "This gradient controls the 'scattering' of the water from shallow to deep, lighting the water as there becomes more of it.";
private string waveCountTT = "Number of waves the automatic setup creates, if aiming for mobile set to 6 or less";
private string avgHeightTT = "The average height of the waves. Units:Meters";
private string avgWavelengthTT = "The average wavelength of the waves. Units:Meters";
private string windDirTT = "The general wind direction, this is in degrees from Z+";
private string alignButtonTT = "This aligns the wave direction to the current scene view camera facing direction";
private string foamCurveTT = "This curve control the foam propagation. X is wave height and Y is foam opacity";
private string foam3curvesTT = "These three curves control the Lite, Medium and Dense foam propagation. X is wave height and Y is foam opacity";
private string randSeedTT = "This seed controls the automatic wave generation";
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1016bd3ba0af54af184326cd470c1bb3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,19 @@
{
"name": "WaterSystem.Editor",
"references": [
"GUID:eee6090a63a1e48e6857869e0cbe74dc",
"GUID:b75d3cd3037d383a8d1e2f9a26d73d8a",
"GUID:d8b63aba1907145bea998dd612889d6b"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 7ccf8aeedcc0c4661aacb3c94f093356
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 281da5c5be36c43d6963c96af26acf64
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,113 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-3341692864896818629
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: 1
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Caustics
m_Shader: {fileID: 4800000, guid: 90939d2e4b62841d29c136c866715501, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- Texture2DArray_29EA5301:
m_Texture: {fileID: 18700000, guid: 2bf4e75081aab4b5f88bfb7069f598ac, type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- Texture2D_A294F6AA:
m_Texture: {fileID: 2800000, guid: f395b7d64f44848c6a3cba1f1173fe90, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _CameraDepthTexture:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _CausticMap:
m_Texture: {fileID: 2800000, guid: f395b7d64f44848c6a3cba1f1173fe90, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- Vector1_CD857B77: 0.47
- Vector1_DC11883E: 0.5
- Vector1_E85F4D08: -0.15
- Vector1_EA2AE021: 0.4
- Vector1_F3303B3C: 0.5
- _AlphaClip: 0
- _Blend: 0
- _BlendDistance: 3
- _BumpScale: 1
- _Cull: 2
- _Cutoff: 0.5
- _DstBlend: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Size: 0.25
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 2
- _Surface: 0
- _WaterLevel: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
- _Color: {r: 0.5, g: 0.5, b: 0.5, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7e6ea000873112847bd146ddb78ac67d
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,83 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: InfiniteWater
m_Shader: {fileID: 4800000, guid: 5f51d4f8f480441339ead24ab495af7d, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 4b5fce50854cd46f1b97bcd5ba7f019b, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _Size: 1.2
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e9927401bf96341d5bba91ea4c815e14
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,88 @@
%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: Sea
m_Shader: {fileID: 4800000, guid: a94edd303261140cf9e6ce8c90d7a99a, type: 3}
m_ShaderKeywords: _DEBUG_DIFFUSE _DEBUG_OFF _GLOSSINESS_FROM_BASE_ALPHA _REFLECTION_PLANARREFLECTION
_SPECULAR_COLOR _STATIC_WATER
m_LightmapFlags: 6
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 1
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DitherPattern:
m_Texture: {fileID: 2800000, guid: 7247454f970266b4c8d99e1f01e15296, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _AlphaClip: 0
- _Blend: 0
- _BumpScale: 0.25
- _Cull: 2
- _Cutoff: 0.5
- _Debug: 0
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossinessSource: 0
- _GlossyReflections: 1
- _Parallax: 0.02
- _ReceiveShadows: 1
- _Shininess: 0.5
- _SmoothnessTextureChannel: 0
- _SpecSource: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Static: 0
- _Surface: 0
- _TessellationEdgeLength: 50
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 0.43867922, g: 0.80530274, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_BuildTextureStacks: []
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4849d4d15a9cb42eb9533ae935e2630b
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bc33e2c6cda7143a3b9bd922abb88865
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,99 @@
fileFormatVersion: 2
guid: 0694fda6617df4cd6a3d240f5eeb580b
ModelImporter:
serializedVersion: 22
fileIDToRecycleName:
100000: //RootNode
400000: //RootNode
2100000: Default
2300000: //RootNode
3300000: //RootNode
4300000: InfiniteSea
7400000: Take 001
9500000: //RootNode
externalObjects:
- first:
type: UnityEngine:Material
assembly: UnityEngine.CoreModule
name: Default
second: {fileID: 2100000, guid: e9927401bf96341d5bba91ea4c815e14, type: 2}
materials:
importMaterials: 1
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 25
meshCompression: 0
addColliders: 0
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
optimizeMeshForGPU: 1
keepQuads: 0
weldVertices: 1
preserveHierarchy: 0
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVPackMargin: 4
useFileScale: 1
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
importAnimation: 0
copyAvatar: 0
humanDescription:
serializedVersion: 2
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
rootMotionBoneName:
rootMotionBoneRotation: {x: 0, y: 0, z: 0, w: 1}
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
animationType: 0
humanoidOversampling: 1
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,230 @@
fileFormatVersion: 2
guid: 074aa8ca109924e18baf19f3e26665b6
ModelImporter:
serializedVersion: 23
fileIDToRecycleName:
100000: //RootNode
100002: SeaVertDisp_center
100004: SeaVertDisp_far1
100006: SeaVertDisp_far2
100008: SeaVertDisp_far3
100010: SeaVertDisp_far4
100012: SeaVertDisp_mid1
100014: SeaVertDisp_mid2
100016: SeaVertDisp_mid3
100018: SeaVertDisp_mid4
100020: SeaVertDisp_near1
100022: SeaVertDisp_near2
100024: SeaVertDisp_near3
100026: SeaVertDisp_near4
100028: SeaVertDisp_outter1
100030: SeaVertDisp_outter2
100032: SeaVertDisp_outter3
100034: SeaVertDisp_outter4
100036: SeaDistant_01
100038: SeaDistant_02
100040: SeaDistant_03
100042: SeaDistant_04
100044: SeaDistant_01 (2)
100046: SeaDistant_02 (2)
100048: SeaDistant_03 (2)
100050: SeaDistant_04 (2)
400000: //RootNode
400002: SeaVertDisp_center
400004: SeaVertDisp_far1
400006: SeaVertDisp_far2
400008: SeaVertDisp_far3
400010: SeaVertDisp_far4
400012: SeaVertDisp_mid1
400014: SeaVertDisp_mid2
400016: SeaVertDisp_mid3
400018: SeaVertDisp_mid4
400020: SeaVertDisp_near1
400022: SeaVertDisp_near2
400024: SeaVertDisp_near3
400026: SeaVertDisp_near4
400028: SeaVertDisp_outter1
400030: SeaVertDisp_outter2
400032: SeaVertDisp_outter3
400034: SeaVertDisp_outter4
400036: SeaDistant_01
400038: SeaDistant_02
400040: SeaDistant_03
400042: SeaDistant_04
400044: SeaDistant_01 (2)
400046: SeaDistant_02 (2)
400048: SeaDistant_03 (2)
400050: SeaDistant_04 (2)
2100000: Default
2300000: //RootNode
2300002: SeaVertDisp_center
2300004: SeaVertDisp_far1
2300006: SeaVertDisp_far2
2300008: SeaVertDisp_far3
2300010: SeaVertDisp_far4
2300012: SeaVertDisp_mid1
2300014: SeaVertDisp_mid2
2300016: SeaVertDisp_mid3
2300018: SeaVertDisp_mid4
2300020: SeaVertDisp_near1
2300022: SeaVertDisp_near2
2300024: SeaVertDisp_near3
2300026: SeaVertDisp_near4
2300028: SeaVertDisp_outter1
2300030: SeaVertDisp_outter2
2300032: SeaVertDisp_outter3
2300034: SeaVertDisp_outter4
2300036: SeaDistant_01
2300038: SeaDistant_02
2300040: SeaDistant_03
2300042: SeaDistant_04
2300044: SeaDistant_01 (2)
2300046: SeaDistant_02 (2)
2300048: SeaDistant_03 (2)
2300050: SeaDistant_04 (2)
3300000: //RootNode
3300002: SeaVertDisp_center
3300004: SeaVertDisp_far1
3300006: SeaVertDisp_far2
3300008: SeaVertDisp_far3
3300010: SeaVertDisp_far4
3300012: SeaVertDisp_mid1
3300014: SeaVertDisp_mid2
3300016: SeaVertDisp_mid3
3300018: SeaVertDisp_mid4
3300020: SeaVertDisp_near1
3300022: SeaVertDisp_near2
3300024: SeaVertDisp_near3
3300026: SeaVertDisp_near4
3300028: SeaVertDisp_outter1
3300030: SeaVertDisp_outter2
3300032: SeaVertDisp_outter3
3300034: SeaVertDisp_outter4
3300036: SeaDistant_01
3300038: SeaDistant_02
3300040: SeaDistant_03
3300042: SeaDistant_04
3300044: SeaDistant_01 (2)
3300046: SeaDistant_02 (2)
3300048: SeaDistant_03 (2)
3300050: SeaDistant_04 (2)
4300000: SeaVertDisp
4300002: SeaVertDisp_outter4
4300004: SeaVertDisp_mid4
4300006: SeaVertDisp_mid3
4300008: SeaVertDisp_outter3
4300010: SeaVertDisp_outter1
4300012: SeaVertDisp_mid2
4300014: SeaVertDisp_mid1
4300016: SeaVertDisp_outter2
4300018: SeaVertDisp_far4
4300020: SeaVertDisp_far3
4300022: SeaVertDisp_far2
4300024: SeaVertDisp_far1
4300026: SeaVertDisp_center
4300028: SeaVertDisp_near4
4300030: SeaVertDisp_near3
4300032: SeaVertDisp_near2
4300034: SeaVertDisp_near1
4300036: SeaDistant_01
4300038: SeaDistant_02
4300040: SeaDistant_03
4300042: SeaDistant_04
4300044: SeaDistant_04 (2)
4300046: SeaDistant_03 (2)
4300048: SeaDistant_02 (2)
4300050: SeaDistant_01 (2)
7400000: Take 001
9500000: //RootNode
2186277476908879412: ImportLogs
externalObjects:
- first:
type: UnityEngine:Material
assembly: UnityEngine.CoreModule
name: Default
second: {fileID: 2100000, guid: 4849d4d15a9cb42eb9533ae935e2630b, type: 2}
materials:
importMaterials: 1
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
importVisibility: 0
importBlendShapes: 0
importCameras: 0
importLights: 0
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
optimizeMeshForGPU: 0
keepQuads: 0
weldVertices: 0
preserveHierarchy: 0
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVPackMargin: 4
useFileScale: 1
previousCalculatedGlobalScale: 0.01
hasPreviousCalculatedGlobalScale: 1
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 1
tangentImportMode: 2
normalCalculationMode: 1
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
importAnimation: 0
copyAvatar: 0
humanDescription:
serializedVersion: 2
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 1
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
animationType: 0
humanoidOversampling: 1
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.
@@ -0,0 +1,234 @@
fileFormatVersion: 2
guid: fb2f5cec30b474b89b778e3aab6f3dfe
ModelImporter:
serializedVersion: 25
internalIDToNameTable:
- first:
1: 100000
second: //RootNode
- first:
1: 100002
second: WaterBlock_50m_LOD0
- first:
1: 100004
second: WaterBlock_50m_LOD1
- first:
1: 100006
second: WaterBlock_50m_LOD2
- first:
1: 100008
second: WaterBlock_tessellation_1k
- first:
4: 400000
second: //RootNode
- first:
4: 400002
second: WaterBlock_50m_LOD0
- first:
4: 400004
second: WaterBlock_50m_LOD1
- first:
4: 400006
second: WaterBlock_50m_LOD2
- first:
4: 400008
second: WaterBlock_tessellation_1k
- first:
21: 2100000
second: Water
- first:
23: 2300000
second: //RootNode
- first:
23: 2300002
second: WaterBlock_50m_LOD0
- first:
23: 2300004
second: WaterBlock_50m_LOD1
- first:
23: 2300006
second: WaterBlock_50m_LOD2
- first:
23: 2300008
second: WaterBlock_tessellation_1k
- first:
33: 3300000
second: //RootNode
- first:
33: 3300002
second: WaterBlock_50m_LOD0
- first:
33: 3300004
second: WaterBlock_50m_LOD1
- first:
33: 3300006
second: WaterBlock_50m_LOD2
- first:
33: 3300008
second: WaterBlock_tessellation_1k
- first:
43: 4300000
second: WaterBlock
- first:
43: 4300002
second: WaterBlock_50m_LOD0
- first:
43: 4300004
second: WaterBlock_tessellation_1k
- first:
43: 4300006
second: WaterBlock_50m_LOD1
- first:
43: 4300008
second: WaterBlock_50m_LOD2
- first:
74: 7400000
second: Take 001
- first:
95: 9500000
second: //RootNode
- first:
205: 20500000
second: //RootNode
- first:
41386430: 2186277476908879412
second: ImportLogs
- first:
41386430: 2186277476908879414
second: ImportLogs
- first:
41386430: 2186277476908879416
second: ImportLogs
- first:
41386430: 2186277476908879418
second: ImportLogs
- first:
41386430: 2186277476908879420
second: ImportLogs
- first:
41386430: 2186277476908879422
second: ImportLogs
- first:
41386430: 2186277476908879424
second: ImportLogs
- first:
41386430: 2186277476908879426
second: ImportLogs
- first:
41386430: 2186277476908879428
second: ImportLogs
- first:
41386430: 2186277476908879430
second: ImportLogs
- first:
41386430: 2186277476908879432
second: ImportLogs
- first:
41386430: 2186277476908879434
second: ImportLogs
- first:
41386430: 2186277476908879436
second: ImportLogs
- first:
41386430: 2186277476908879438
second: ImportLogs
- first:
41386430: 2186277476908879440
second: ImportLogs
externalObjects:
- first:
type: UnityEngine:Material
assembly: UnityEngine.CoreModule
name: Default
second: {fileID: 2100000, guid: 4849d4d15a9cb42eb9533ae935e2630b, type: 2}
materials:
importMaterials: 1
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 1
meshes:
lODScreenPercentages:
- 0.25
- 0.125
- 0.01
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
importVisibility: 0
importBlendShapes: 0
importCameras: 0
importLights: 0
swapUVChannels: 0
generateSecondaryUV: 1
useFileUnits: 1
keepQuads: 0
weldVertices: 0
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
minBoneWeight: 0.001
meshOptimizationFlags: -1
indexFormat: 2
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVPackMargin: 4
useFileScale: 1
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 2
tangentImportMode: 2
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 1
blendShapeNormalImportMode: 2
normalSmoothingSource: 0
referencedClips: []
importAnimation: 0
copyAvatar: 0
humanDescription:
serializedVersion: 3
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
globalScale: 1
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
animationType: 0
humanoidOversampling: 1
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: cfac61b5ac93c4101b40011e6cd637b3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,411 @@
// Buoyancy.cs
// by Alex Zhdankin
// Version 2.1
//
// http://forum.unity3d.com/threads/72974-Buoyancy-script
//
// Terms of use: do whatever you like
//
// Further tweaks by Andre McGrail
//
//
using System;
using System.Collections.Generic;
using UnityEngine;
using Unity.Collections;
using Unity.Mathematics;
namespace WaterSystem
{
public class BuoyantObject : MonoBehaviour
{
public BuoyancyType _buoyancyType; // type of buoyancy to calculate
public float density; // density of the object, this is calculated off it's volume and mass
public float volume; // volume of the object, this is calculated via it's colliders
public float voxelResolution = 0.51f; // voxel resolution, represents the half size of a voxel when creating the voxel representation
private Bounds _voxelBounds; // bounds of the voxels
public Vector3 centerOfMass = Vector3.zero; // Center Of Mass offset
public float waterLevelOffset = 0f;
private const float Dampner = 0.005f;
private const float WaterDensity = 1000;
private float _baseDrag; // reference to original drag
private float _baseAngularDrag; // reference to original angular drag
private int _guid; // GUID for the height system
private float3 _localArchimedesForce;
private Vector3[] _voxels; // voxel position
private NativeArray<float3> _samplePoints; // sample points for height calc
[NonSerialized] public float3[] Heights; // water height array(only size of 1 when simple or non-physical)
private float3[] _normals; // water normal array(only used when non-physical and size of 1 also when simple)
private float3[] _velocity; // voxel velocity for buoyancy
[SerializeField] Collider[] colliders; // colliders attatched ot this object
private Rigidbody _rb;
private DebugDrawing[] _debugInfo; // For drawing force gizmos
[NonSerialized] public float PercentSubmerged;
[ContextMenu("Initialize")]
private void Init()
{
_voxels = null;
switch (_buoyancyType)
{
case BuoyancyType.NonPhysical:
SetupVoxels();
SetupData();
break;
case BuoyancyType.NonPhysicalVoxel:
SetupColliders();
SetupVoxels();
SetupData();
break;
case BuoyancyType.Physical:
SetupVoxels();
SetupData();
SetupPhysical();
break;
case BuoyancyType.PhysicalVoxel:
SetupColliders();
SetupVoxels();
SetupData();
SetupPhysical();
break;
default:
throw new ArgumentOutOfRangeException();
}
}
private void SetupVoxels()
{
if (_buoyancyType == BuoyancyType.NonPhysicalVoxel || _buoyancyType == BuoyancyType.PhysicalVoxel)
{
SliceIntoVoxels();
}
else
{
_voxels = new Vector3[1];
_voxels[0] = centerOfMass;
}
}
private void SetupData()
{
_debugInfo = new DebugDrawing[_voxels.Length];
Heights = new float3[_voxels.Length];
_normals = new float3[_voxels.Length];
_samplePoints = new NativeArray<float3>(_voxels.Length, Allocator.Persistent);
}
private void OnEnable()
{
_guid = gameObject.GetInstanceID();
Init();
LocalToWorldConversion();
}
private void SetupColliders()
{
// The object must have a Collider
colliders = GetComponentsInChildren<Collider>();
if (colliders.Length != 0) return;
colliders = new Collider[1];
colliders[0] = gameObject.AddComponent<BoxCollider>();
Debug.LogError($"Buoyancy:Object \"{name}\" had no coll. BoxCollider has been added.");
}
private void Update()
{
#if STATIC_EVERYTHING
var dt = 0.0f;
#else
var dt = Time.deltaTime;
#endif
switch (_buoyancyType)
{
case BuoyancyType.NonPhysical:
{
var t = transform;
var vec = t.position;
vec.y = Heights[0].y + waterLevelOffset;
t.position = vec;
t.up = Vector3.Slerp(t.up, _normals[0], dt);
break;
}
case BuoyancyType.NonPhysicalVoxel:
// do the voxel non-physical
break;
case BuoyancyType.Physical:
LocalToWorldJob.CompleteJob(_guid);
GetVelocityPoints();
break;
case BuoyancyType.PhysicalVoxel:
LocalToWorldJob.CompleteJob(_guid);
GetVelocityPoints();
break;
default:
throw new ArgumentOutOfRangeException();
}
GerstnerWavesJobs.UpdateSamplePoints(ref _samplePoints, _guid);
GerstnerWavesJobs.GetData(_guid, ref Heights, ref _normals);
}
private void FixedUpdate()
{
var submergedAmount = 0f;
switch (_buoyancyType)
{
case BuoyancyType.PhysicalVoxel:
{
LocalToWorldJob.CompleteJob(_guid);
//Debug.Log("new pass: " + gameObject.name);
Physics.autoSyncTransforms = false;
for (var i = 0; i < _voxels.Length; i++)
BuoyancyForce(_samplePoints[i], _velocity[i], Heights[i].y + waterLevelOffset, ref submergedAmount, ref _debugInfo[i]);
Physics.SyncTransforms();
Physics.autoSyncTransforms = true;
UpdateDrag(submergedAmount);
break;
}
case BuoyancyType.Physical:
//LocalToWorldJob.CompleteJob(_guid);
BuoyancyForce(Vector3.zero, _velocity[0], Heights[0].y + waterLevelOffset, ref submergedAmount, ref _debugInfo[0]);
//UpdateDrag(submergedAmount);
break;
case BuoyancyType.NonPhysical:
break;
case BuoyancyType.NonPhysicalVoxel:
break;
default:
throw new ArgumentOutOfRangeException();
}
}
private void LateUpdate() { LocalToWorldConversion(); }
private void OnDestroy()
{
CleanUp();
}
void CleanUp()
{
if (_buoyancyType == BuoyancyType.Physical || _buoyancyType == BuoyancyType.PhysicalVoxel)
{
LocalToWorldJob.Cleanup(_guid);
}
else
{
_samplePoints.Dispose();
}
}
private void LocalToWorldConversion()
{
if (_buoyancyType != BuoyancyType.Physical && _buoyancyType != BuoyancyType.PhysicalVoxel) return;
var transformMatrix = transform.localToWorldMatrix;
LocalToWorldJob.ScheduleJob(_guid, transformMatrix);
}
private void BuoyancyForce(Vector3 position, float3 velocity, float waterHeight, ref float submergedAmount, ref DebugDrawing debug)
{
debug.Position = position;
debug.WaterHeight = waterHeight;
debug.Force = Vector3.zero;
if (!(position.y - voxelResolution < waterHeight)) return;
var k = math.clamp(waterHeight - (position.y - voxelResolution), 0f, 1f);
submergedAmount += k / _voxels.Length;
var localDampingForce = Dampner * _rb.mass * -velocity;
var force = localDampingForce + math.sqrt(k) * _localArchimedesForce;
_rb.AddForceAtPosition(force, position);
debug.Force = force; // For drawing force Gizmos
//Debug.Log(string.Format("Position: {0:f1} -- Force: {1:f2} -- Height: {2:f2}\nVelocity: {3:f2} -- Damp: {4:f2} -- Mass: {5:f1} -- K: {6:f2}", wp, force, waterLevel, velocity, localDampingForce, RB.mass, localArchimedesForce));
}
private void UpdateDrag(float submergedAmount)
{
PercentSubmerged = math.lerp(PercentSubmerged, submergedAmount, 0.25f);
_rb.drag = _baseDrag + _baseDrag * (PercentSubmerged * 10f);
_rb.angularDrag = _baseAngularDrag + PercentSubmerged * 0.5f;
}
private void GetVelocityPoints()
{
for (var i = 0; i < _voxels.Length; i++) { _velocity[i] = _rb.GetPointVelocity(_samplePoints[i]); }
}
private void SliceIntoVoxels()
{
var t = transform;
var rot = t.rotation;
var pos = t.position;
var size = t.localScale;
t.SetPositionAndRotation(Vector3.zero, Quaternion.identity);
t.localScale = Vector3.one;
_voxels = null;
var points = new List<Vector3>();
var rawBounds = VoxelBounds();
_voxelBounds = rawBounds;
_voxelBounds.size = RoundVector(rawBounds.size, voxelResolution);
for (var ix = -_voxelBounds.extents.x; ix < _voxelBounds.extents.x; ix += voxelResolution)
{
for (var iy = -_voxelBounds.extents.y; iy < _voxelBounds.extents.y; iy += voxelResolution)
{
for (var iz = -_voxelBounds.extents.z; iz < _voxelBounds.extents.z; iz += voxelResolution)
{
var x = (voxelResolution * 0.5f) + ix;
var y = (voxelResolution * 0.5f) + iy;
var z = (voxelResolution * 0.5f) + iz;
var p = new Vector3(x, y, z) + _voxelBounds.center;
var inside = false;
foreach (var t1 in colliders)
{
if (PointIsInsideCollider(t1, p))
{
inside = true;
}
}
if(inside)
points.Add(p);
}
}
}
_voxels = points.ToArray();
t.SetPositionAndRotation(pos, rot);
t.localScale = size;
var voxelVolume = Mathf.Pow(voxelResolution, 3f) * _voxels.Length;
var rawVolume = rawBounds.size.x * rawBounds.size.y * rawBounds.size.z;
volume = Mathf.Min(rawVolume, voxelVolume);
density = gameObject.GetComponent<Rigidbody>().mass / volume;
}
private Bounds VoxelBounds()
{
var bounds = new Bounds();
foreach (var nextCollider in colliders)
{
bounds.Encapsulate(nextCollider.bounds);
}
return bounds;
}
private static Vector3 RoundVector(Vector3 vec, float rounding)
{
return new Vector3(Mathf.Ceil(vec.x / rounding) * rounding, Mathf.Ceil(vec.y / rounding) * rounding, Mathf.Ceil(vec.z / rounding) * rounding);
}
private bool PointIsInsideCollider(Collider c, Vector3 p)
{
var cp = Physics.ClosestPoint(p, c, Vector3.zero, Quaternion.identity);
return Vector3.Distance(cp, p) < 0.01f;
}
private void SetupPhysical()
{
if (!TryGetComponent(out _rb))
{
_rb = gameObject.AddComponent<Rigidbody>();
Debug.LogError($"Buoyancy:Object \"{name}\" had no Rigidbody. Rigidbody has been added.");
}
_rb.centerOfMass = centerOfMass + _voxelBounds.center;
_baseDrag = _rb.drag;
_baseAngularDrag = _rb.angularDrag;
_velocity = new float3[_voxels.Length];
var archimedesForceMagnitude = WaterDensity * Mathf.Abs(Physics.gravity.y) * volume;
_localArchimedesForce = new float3(0, archimedesForceMagnitude, 0) / _voxels.Length;
LocalToWorldJob.SetupJob(_guid, _voxels, ref _samplePoints);
}
private void OnDrawGizmosSelected()
{
const float gizmoSize = 0.05f;
var t = transform;
var matrix = Matrix4x4.TRS(t.position, t.rotation, t.lossyScale);
if (_voxels != null)
{
Gizmos.color = Color.yellow;
foreach (var p in _voxels)
{
Gizmos.DrawCube(p, new Vector3(gizmoSize, gizmoSize, gizmoSize));
}
}
Gizmos.matrix = matrix;
if (voxelResolution >= 0.1f)
{
Gizmos.DrawWireCube(_voxelBounds.center, _voxelBounds.size);
Vector3 center = _voxelBounds.center;
float y = center.y - _voxelBounds.extents.y;
for (float x = -_voxelBounds.extents.x; x < _voxelBounds.extents.x; x += voxelResolution)
{
Gizmos.DrawLine(new Vector3(x, y, -_voxelBounds.extents.z + center.z), new Vector3(x, y, _voxelBounds.extents.z + center.z));
}
for (float z = -_voxelBounds.extents.z; z < _voxelBounds.extents.z; z += voxelResolution)
{
Gizmos.DrawLine(new Vector3(-_voxelBounds.extents.x, y, z + center.z), new Vector3(_voxelBounds.extents.x, y, z + center.z));
}
}
else
_voxelBounds = VoxelBounds();
Gizmos.color = Color.red;
Gizmos.DrawSphere(_voxelBounds.center + centerOfMass, 0.2f);
Gizmos.matrix = Matrix4x4.identity;Gizmos.matrix = Matrix4x4.identity;
if (_debugInfo != null)
{
foreach (DebugDrawing debug in _debugInfo)
{
Gizmos.color = Color.cyan;
Gizmos.DrawCube(debug.Position, new Vector3(gizmoSize, gizmoSize, gizmoSize)); // drawCenter
var water = debug.Position;
water.y = debug.WaterHeight;
Gizmos.DrawLine(debug.Position, water); // draw the water line
Gizmos.DrawSphere(water, gizmoSize * 4f);
if(_buoyancyType == BuoyancyType.Physical || _buoyancyType == BuoyancyType.PhysicalVoxel)
{
Gizmos.color = Color.red;
Gizmos.DrawRay(debug.Position, debug.Force / _rb.mass); // draw force
}
}
}
}
private struct DebugDrawing
{
public Vector3 Force;
public Vector3 Position;
public float WaterHeight;
}
public enum BuoyancyType
{
NonPhysical,
NonPhysicalVoxel,
Physical,
PhysicalVoxel
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3d5ac9593b59d4847815e4528b52a6d2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a28afa3e85133492baf302b1d3849fe9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,44 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e73e41b71c5f541679f1bb37dee026c1, type: 3}
m_Name: WaterResources
m_EditorClassIdentifier:
defaultFoamRamp: {fileID: 2800000, guid: 4098762bce32f44b9b7c56531d1a988e, type: 3}
defaultFoamMap: {fileID: 2800000, guid: ca439406e806ecf44a9586510be9477d, type: 3}
defaultSurfaceMap: {fileID: 2800000, guid: f395b7d64f44848c6a3cba1f1173fe90, type: 3}
defaultSeaMaterial: {fileID: 2100000, guid: 4849d4d15a9cb42eb9533ae935e2630b, type: 2}
defaultWaterMeshes:
- {fileID: 4300036, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300050, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300038, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300048, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300040, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300046, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300042, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300044, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300026, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300024, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300022, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300020, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300018, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300014, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300012, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300006, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300004, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300034, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300032, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300030, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300028, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300010, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300016, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300008, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300002, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 40615c805d6e84ce7800418367985fe1
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,19 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace WaterSystem
{
/// <summary>
/// This scriptable object holds default resources for the water rendering
/// </summary>
[System.Serializable][CreateAssetMenu(fileName = "WaterResources", menuName = "WaterSystem/Resource", order = 0)]
public class WaterResources : ScriptableObject
{
public Texture2D defaultFoamRamp; // a default foam ramp for the basic foam setting
public Texture2D defaultFoamMap; // a default foam texture map
public Texture2D defaultSurfaceMap; // a default normal/caustic map
public Material defaultSeaMaterial;
public Mesh[] defaultWaterMeshes;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e73e41b71c5f541679f1bb37dee026c1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,26 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7ad544ee67a064d3eb407c8c47c67b8d, type: 3}
m_Name: WaterSettingsData
m_EditorClassIdentifier:
waterGeomType: 0
refType: 2
planarSettings:
m_ResolutionMultiplier: 1
m_ClipPlaneOffset: 0.24
m_ReflectLayers:
serializedVersion: 2
m_Bits: 4294967295
m_Shadows: 0
cubemapRefType: {fileID: 8900000, guid: a90d3c9b1c3ed4d36bffc02f6b335464, type: 3}
isInfinite: 0
originOffset: {x: 0, y: 0, z: 500, w: 500}
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a4cacf74654e54b35b9eaea74fd20b4e
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,43 @@
using UnityEngine;
using UnityEngine.Rendering.Universal;
namespace WaterSystem.Data
{
/// <summary>
/// This scriptable object stores teh graphical/rendering settings for a water system
/// </summary>
[System.Serializable][CreateAssetMenu(fileName = "WaterSettingsData", menuName = "WaterSystem/Settings", order = 0)]
public class WaterSettingsData : ScriptableObject
{
public GeometryType waterGeomType; // The type of geometry, either vertex offset or tessellation
public ReflectionType refType = ReflectionType.PlanarReflection; // How the reflecitons are generated
// planar
public PlanarReflections.PlanarReflectionSettings planarSettings; // Planar reflection settings
// cubemap
public Cubemap cubemapRefType; // custom cubemap reference
public bool isInfinite; // Is the water infinite (shader incomplete)
public Vector4 originOffset = new Vector4(0f, 0f, 500f, 500f);
}
/// <summary>
/// The type of reflection source, custom cubemap, closest refelction probe, planar reflection
/// </summary>
[System.Serializable]
public enum ReflectionType
{
Cubemap,
ReflectionProbe,
PlanarReflection
}
/// <summary>
/// The type of geometry, either vertex offset or tessellation
/// </summary>
[System.Serializable]
public enum GeometryType
{
VertexOffset,
Tesselation
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7ad544ee67a064d3eb407c8c47c67b8d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,258 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b17284ebf5e80436eb6089f8c7459dab, type: 3}
m_Name: WaterSurfaceData
m_EditorClassIdentifier:
_waterMaxVisibility: 16.2
_absorptionRamp:
serializedVersion: 2
key0: {r: 1, g: 1, b: 1, a: 1}
key1: {r: 0.18396229, g: 0.89963174, b: 1, a: 1}
key2: {r: 0.021626905, g: 0.49048996, b: 0.509434, a: 0}
key3: {r: 0, g: 0.275, b: 0.44, a: 0}
key4: {r: 0, g: 0, b: 0, a: 0}
key5: {r: 0, g: 0, b: 0, a: 0}
key6: {r: 0, g: 0, b: 0, a: 0}
key7: {r: 0, g: 0, b: 0, a: 0}
ctime0: 0
ctime1: 6746
ctime2: 20817
ctime3: 43581
ctime4: 65535
ctime5: 0
ctime6: 0
ctime7: 0
atime0: 0
atime1: 65535
atime2: 0
atime3: 0
atime4: 0
atime5: 0
atime6: 0
atime7: 0
m_Mode: 0
m_NumColorKeys: 5
m_NumAlphaKeys: 2
_scatterRamp:
serializedVersion: 2
key0: {r: 0, g: 0, b: 0, a: 1}
key1: {r: 0.07843137, g: 0.24471705, b: 0.4117647, a: 1}
key2: {r: 0.12549019, g: 0.50673026, b: 0.58431375, a: 0}
key3: {r: 0.28888598, g: 0.45325178, b: 0.542, a: 0}
key4: {r: 0.19571698, g: 0.3647036, b: 0.45099998, a: 0}
key5: {r: 0, g: 0, b: 0, a: 0}
key6: {r: 0, g: 0, b: 0, a: 0}
key7: {r: 0, g: 0, b: 0, a: 0}
ctime0: 0
ctime1: 3277
ctime2: 24672
ctime3: 52043
ctime4: 63029
ctime5: 0
ctime6: 0
ctime7: 0
atime0: 0
atime1: 65535
atime2: 0
atime3: 0
atime4: 0
atime5: 0
atime6: 0
atime7: 0
m_Mode: 0
m_NumColorKeys: 4
m_NumAlphaKeys: 2
_waves:
- amplitude: 1
direction: -6.03
wavelength: 10
origin:
x: -146.4
y: 326.2
onmiDir: 1
- amplitude: 0.9
direction: 166
wavelength: 8
origin:
x: 0
y: 0
onmiDir: 0
- amplitude: 0.5
direction: 6.532788
wavelength: 7.455916
origin:
x: -63.14
y: 931.6
onmiDir: 1
- amplitude: 0.7
direction: 4.051435
wavelength: 4.6626315
origin:
x: -72.74
y: -16.01
onmiDir: 1
- amplitude: 0.5
direction: 180
wavelength: 2.6733496
origin:
x: -50.43
y: 0
onmiDir: 0
- amplitude: 0.5
direction: -151
wavelength: 2.9848163
origin:
x: 0
y: 0
onmiDir: 0
_customWaves: 0
randomSeed: 891
_basicWaveSettings:
numWaves: 6
amplitude: 0.6
direction: -176
wavelength: 8
_foamSettings:
foamType: 1
basicFoam:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0.16228558
outSlope: 0.16228558
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0.15316528
- serializedVersion: 3
time: 0.6247411
value: 0.39698213
inSlope: 1.2551872
outSlope: 1.2551872
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.28785437
- serializedVersion: 3
time: 0.8523668
value: 0.81129223
inSlope: 1.9929253
outSlope: 1.9929253
tangentMode: 0
weightedMode: 0
inWeight: 0.27977753
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 1
inSlope: 0.6611113
outSlope: 0.6611113
tangentMode: 0
weightedMode: 0
inWeight: 0.55429333
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
liteFoam:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0.2
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.4
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.7
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
mediumFoam:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0.4
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.7
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
denseFoam:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0.7
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
_init: 1
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 846f3dc3b5341447a86687211f741bc7
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,86 @@
using System.Collections.Generic;
using Unity.Mathematics;
using UnityEngine;
namespace WaterSystem.Data
{
/// <summary>
/// This scriptable object contains setting for how the water looks visually
/// </summary>
[System.Serializable][CreateAssetMenu(fileName = "WaterSurfaceData", menuName = "WaterSystem/Surface Data", order = 0)]
public class WaterSurfaceData : ScriptableObject
{
public float _waterMaxVisibility = 40.0f;
public Gradient _absorptionRamp;
public Gradient _scatterRamp;
public List<Wave> _waves = new List<Wave>();
public bool _customWaves = false;
public int randomSeed = 3234;
public BasicWaves _basicWaveSettings = new BasicWaves(1.5f, 45.0f, 5.0f);
public FoamSettings _foamSettings = new FoamSettings();
[SerializeField]
public bool _init = false;
}
[System.Serializable]
public struct Wave
{
public float amplitude; // height of the wave in units(m)
public float direction; // direction the wave travels in degrees from Z+
public float wavelength; // distance between crest>crest
public float2 origin; // Omi directional point of origin
public float onmiDir; // Is omni?
public Wave(float amp, float dir, float length, float2 org, bool omni)
{
amplitude = amp;
direction = dir;
wavelength = length;
origin = org;
onmiDir = omni ? 1 : 0;
}
}
[System.Serializable]
public class BasicWaves
{
public int numWaves = 6;
public float amplitude;
public float direction;
public float wavelength;
public BasicWaves(float amp, float dir, float len)
{
numWaves = 6;
amplitude = amp;
direction = dir;
wavelength = len;
}
}
[System.Serializable]
public class FoamSettings
{
public int foamType; // 0=default, 1=simple, 3=custom
public AnimationCurve basicFoam;
public AnimationCurve liteFoam;
public AnimationCurve mediumFoam;
public AnimationCurve denseFoam;
// Foam curves
public FoamSettings()
{
foamType = 0;
basicFoam = new AnimationCurve(new Keyframe[2]{new Keyframe(0.25f, 0f),
new Keyframe(1f, 1f)});
liteFoam = new AnimationCurve(new Keyframe[3]{new Keyframe(0.2f, 0f),
new Keyframe(0.4f, 1f),
new Keyframe(0.7f, 0f)});
mediumFoam = new AnimationCurve(new Keyframe[3]{new Keyframe(0.4f, 0f),
new Keyframe(0.7f, 1f),
new Keyframe(1f, 0f)});
denseFoam = new AnimationCurve(new Keyframe[2]{new Keyframe(0.7f, 0f),
new Keyframe(1f, 1f)});
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b17284ebf5e80436eb6089f8c7459dab
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,206 @@
using System.Collections.Generic;
using UnityEngine;
using Unity.Jobs;
using Unity.Burst;
using Unity.Mathematics;
using Unity.Collections;
using UnityEngine.Rendering.Universal;
using WaterSystem.Data;
namespace WaterSystem
{
/// <summary>
/// C# Jobs system version of the Gerstner waves implimentation
/// </summary>
public static class GerstnerWavesJobs
{
//General variables
public static bool Initialized;
private static bool _firstFrame = true;
private static bool _processing;
private static int _waveCount;
private static NativeArray<Wave> _waveData; // Wave data from the water system
//Details for Buoyant Objects
private static NativeArray<float3> _positions;
private static int _positionCount;
private static NativeArray<float3> _wavePos;
private static NativeArray<float3> _waveNormal;
private static JobHandle _waterHeightHandle;
static readonly Dictionary<int, int2> Registry = new Dictionary<int, int2>();
public static void Init()
{
if(Debug.isDebugBuild)
Debug.Log("Initializing Gerstner Waves Jobs");
//Wave data
_waveCount = Water.Instance._waves.Length;
_waveData = new NativeArray<Wave>(_waveCount, Allocator.Persistent);
for (var i = 0; i < _waveData.Length; i++)
{
_waveData[i] = Water.Instance._waves[i];
}
_positions = new NativeArray<float3>(4096, Allocator.Persistent);
_wavePos = new NativeArray<float3>(4096, Allocator.Persistent);
_waveNormal = new NativeArray<float3>(4096, Allocator.Persistent);
Initialized = true;
}
public static void Cleanup()
{
if(Debug.isDebugBuild)
Debug.Log("Cleaning up Gerstner Wave Jobs");
_waterHeightHandle.Complete();
//Cleanup native arrays
_waveData.Dispose();
_positions.Dispose();
_wavePos.Dispose();
_waveNormal.Dispose();
}
public static void UpdateSamplePoints(ref NativeArray<float3> samplePoints, int guid)
{
CompleteJobs();
if (Registry.TryGetValue(guid, out var offsets))
{
for (var i = offsets.x; i < offsets.y; i++) _positions[i] = samplePoints[i - offsets.x];
}
else
{
if (_positionCount + samplePoints.Length >= _positions.Length) return;
offsets = new int2(_positionCount, _positionCount + samplePoints.Length);
Registry.Add(guid, offsets);
_positionCount += samplePoints.Length;
}
}
public static void GetData(int guid, ref float3[] outPos, ref float3[] outNorm)
{
if (!Registry.TryGetValue(guid, out var offsets)) return;
_wavePos.Slice(offsets.x, offsets.y - offsets.x).CopyTo(outPos);
if(outNorm != null)
_waveNormal.Slice(offsets.x, offsets.y - offsets.x).CopyTo(outNorm);
}
// Height jobs for the next frame
public static void UpdateHeights()
{
if (_processing) return;
_processing = true;
#if STATIC_EVERYTHING
var t = 0.0f;
#else
var t = Time.time;
#endif
// Buoyant Object Job
var waterHeight = new HeightJob()
{
WaveData = _waveData,
Position = _positions,
OffsetLength = new int2(0, _positions.Length),
Time = t,
OutPosition = _wavePos,
OutNormal = _waveNormal
};
_waterHeightHandle = waterHeight.Schedule(_positionCount, 32);
JobHandle.ScheduleBatchedJobs();
_firstFrame = false;
}
private static void CompleteJobs()
{
if (_firstFrame || !_processing) return;
_waterHeightHandle.Complete();
_processing = false;
}
// Gerstner Height C# Job
[BurstCompile]
private struct HeightJob : IJobParallelFor
{
[ReadOnly]
public NativeArray<Wave> WaveData; // wave data stroed in vec4's like the shader version but packed into one
[ReadOnly]
public NativeArray<float3> Position;
[WriteOnly]
public NativeArray<float3> OutPosition;
[WriteOnly]
public NativeArray<float3> OutNormal;
[ReadOnly]
public float Time;
[ReadOnly]
public int2 OffsetLength;
// The code actually running on the job
public void Execute(int i)
{
if (i < OffsetLength.x || i >= OffsetLength.y - OffsetLength.x) return;
var waveCountMulti = 1f / WaveData.Length;
var wavePos = new float3(0f, 0f, 0f);
var waveNorm = new float3(0f, 0f, 0f);
for (var wave = 0; wave < WaveData.Length; wave++) // for each wave
{
// Wave data vars
var pos = Position[i].xz;
var amplitude = WaveData[wave].amplitude;
var direction = WaveData[wave].direction;
var wavelength = WaveData[wave].wavelength;
var omniPos = WaveData[wave].origin;
////////////////////////////////wave value calculations//////////////////////////
var w = 6.28318f / wavelength; // 2pi over wavelength(hardcoded)
var wSpeed = math.sqrt(9.8f * w); // frequency of the wave based off wavelength
const float peak = 0.8f; // peak value, 1 is the sharpest peaks
var qi = peak / (amplitude * w * WaveData.Length);
var windDir = new float2(0f, 0f);
direction = math.radians(direction); // convert the incoming degrees to radians
var windDirInput = new float2(math.sin(direction), math.cos(direction)) * (1 - WaveData[wave].onmiDir); // calculate wind direction - TODO - currently radians
var windOmniInput = (pos - omniPos) * WaveData[wave].onmiDir;
windDir += windDirInput;
windDir += windOmniInput;
windDir = math.normalize(windDir);
var dir = math.dot(windDir, pos - (omniPos * WaveData[wave].onmiDir));
////////////////////////////position output calculations/////////////////////////
var calc = dir * w + -Time * wSpeed; // the wave calculation
var cosCalc = math.cos(calc); // cosine version(used for horizontal undulation)
var sinCalc = math.sin(calc); // sin version(used for vertical undulation)
// calculate the offsets for the current point
wavePos.x += qi * amplitude * windDir.x * cosCalc;
wavePos.z += qi * amplitude * windDir.y * cosCalc;
wavePos.y += sinCalc * amplitude * waveCountMulti; // the height is divided by the number of waves
////////////////////////////normal output calculations/////////////////////////
var wa = w * amplitude;
// normal vector
var norm = new float3(-(windDir.xy * wa * cosCalc),
1 - (qi * wa * sinCalc));
waveNorm += (norm * waveCountMulti) * amplitude;
}
OutPosition[i] = wavePos;
OutNormal[i] = math.normalize(waveNorm.xzy);
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e09f45dd7e088412e85c5924433ad4ff
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,87 @@
using System.Collections.Generic;
using UnityEngine;
using Unity.Collections;
using Unity.Jobs;
using Unity.Burst;
using Unity.Mathematics;
public static class LocalToWorldJob
{
private static readonly Dictionary<int, TransformLocalToWorld> Data = new Dictionary<int, TransformLocalToWorld>();
[BurstCompile]
struct LocalToWorldConvertJob : IJob
{
[WriteOnly] public NativeArray<float3> PositionsWorld;
[ReadOnly] public Matrix4x4 Matrix;
[ReadOnly] public NativeArray<float3> PositionsLocal;
// The code actually running on the job
public void Execute()
{
for (var i = 0; i < PositionsLocal.Length; i++)
{
var pos = float4.zero;
pos.xyz = PositionsLocal[i];
pos.w = 1f;
pos = Matrix * pos;
PositionsWorld[i] = pos.xyz;
}
}
}
public static void SetupJob(int guid, Vector3[] positions, ref NativeArray<float3> output)
{
var jobData = new TransformLocalToWorld
{
PositionsWorld = output,
PositionsLocal = new NativeArray<float3>(positions.Length, Allocator.Persistent)
};
for (var i = 0; i < positions.Length; i++)
jobData.PositionsLocal[i] = positions[i];
Data.Add(guid, jobData);
}
public static void ScheduleJob(int guid, Matrix4x4 localToWorld)
{
if (Data[guid].Processing)
return;
Data[guid].Job = new LocalToWorldConvertJob()
{
PositionsWorld = Data[guid].PositionsWorld,
PositionsLocal = Data[guid].PositionsLocal,
Matrix = localToWorld
};
Data[guid].Handle = Data[guid].Job.Schedule();
Data[guid].Processing = true;
JobHandle.ScheduleBatchedJobs();
}
public static void CompleteJob(int guid)
{
Data[guid].Handle.Complete();
Data[guid].Processing = false;
}
public static void Cleanup(int guid)
{
if (!Data.ContainsKey(guid)) return;
Data[guid].Handle.Complete();
Data[guid].PositionsWorld.Dispose();
Data[guid].PositionsLocal.Dispose();
Data.Remove(guid);
}
class TransformLocalToWorld
{
public NativeArray<float3> PositionsLocal;
public NativeArray<float3> PositionsWorld;
public JobHandle Handle;
public LocalToWorldConvertJob Job;
public bool Processing;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3813a158650064768b37058dc089214a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,43 @@
using UnityEngine;
using UnityEngine.Rendering;
namespace WaterSystem
{
/// <summary>
/// Camera script to align the water mesh with the camera in a quantized manner
/// </summary>
[ExecuteInEditMode]
public class MainCameraAlign : MonoBehaviour
{
public float quantizeValue = 6.25f;
public float forwards = 10f;
public float yOffset = -0.25f;
private void OnEnable()
{
RenderPipelineManager.beginCameraRendering += UpdatePosition;
}
private void OnDisable()
{
RenderPipelineManager.beginCameraRendering -= UpdatePosition;
}
private void UpdatePosition(ScriptableRenderContext src, Camera cam)
{
if (cam.cameraType == CameraType.Preview) return;
var newPos = cam.transform.TransformPoint(Vector3.forward * forwards);
newPos.y = yOffset;
newPos.x = QuantizeValue(newPos.x);
newPos.z = QuantizeValue(newPos.z);
transform.position = newPos;
}
private float QuantizeValue(float value)
{
return quantizeValue * (int) (value / quantizeValue);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9a6b4e1e324e641ff86ca879104e20de
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ceb62181994bc49eb8ac45fd7f5c4634
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,291 @@
using System;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Serialization;
using Unity.Mathematics;
namespace UnityEngine.Rendering.Universal
{
[ExecuteAlways]
public class PlanarReflections : MonoBehaviour
{
[Serializable]
public enum ResolutionMulltiplier
{
Full,
Half,
Third,
Quarter
}
[Serializable]
public class PlanarReflectionSettings
{
public ResolutionMulltiplier m_ResolutionMultiplier = ResolutionMulltiplier.Third;
public float m_ClipPlaneOffset = 0.07f;
public LayerMask m_ReflectLayers = -1;
public bool m_Shadows;
}
[SerializeField]
public PlanarReflectionSettings m_settings = new PlanarReflectionSettings();
public GameObject target;
[FormerlySerializedAs("camOffset")] public float m_planeOffset;
private static Camera _reflectionCamera;
private RenderTexture _reflectionTexture;
private readonly int _planarReflectionTextureId = Shader.PropertyToID("_PlanarReflectionTexture");
private int2 _oldReflectionTextureSize;
public static event Action<ScriptableRenderContext, Camera> BeginPlanarReflections;
private void OnEnable()
{
RenderPipelineManager.beginCameraRendering += ExecutePlanarReflections;
}
// Cleanup all the objects we possibly have created
private void OnDisable()
{
Cleanup();
}
private void OnDestroy()
{
Cleanup();
}
private void Cleanup()
{
RenderPipelineManager.beginCameraRendering -= ExecutePlanarReflections;
if(_reflectionCamera)
{
_reflectionCamera.targetTexture = null;
SafeDestroy(_reflectionCamera.gameObject);
}
if (_reflectionTexture)
{
RenderTexture.ReleaseTemporary(_reflectionTexture);
}
}
private static void SafeDestroy(Object obj)
{
if (Application.isEditor)
{
DestroyImmediate(obj);
}
else
{
Destroy(obj);
}
}
private void UpdateCamera(Camera src, Camera dest)
{
if (dest == null) return;
dest.CopyFrom(src);
dest.useOcclusionCulling = false;
if (dest.gameObject.TryGetComponent(out UniversalAdditionalCameraData camData))
{
camData.renderShadows = m_settings.m_Shadows; // turn off shadows for the reflection camera
}
}
private void UpdateReflectionCamera(Camera realCamera)
{
if (_reflectionCamera == null)
_reflectionCamera = CreateMirrorObjects();
// find out the reflection plane: position and normal in world space
Vector3 pos = Vector3.zero;
Vector3 normal = Vector3.up;
if (target != null)
{
pos = target.transform.position + Vector3.up * m_planeOffset;
normal = target.transform.up;
}
UpdateCamera(realCamera, _reflectionCamera);
// Render reflection
// Reflect camera around reflection plane
var d = -Vector3.Dot(normal, pos) - m_settings.m_ClipPlaneOffset;
var reflectionPlane = new Vector4(normal.x, normal.y, normal.z, d);
var reflection = Matrix4x4.identity;
reflection *= Matrix4x4.Scale(new Vector3(1, -1, 1));
CalculateReflectionMatrix(ref reflection, reflectionPlane);
var oldPosition = realCamera.transform.position - new Vector3(0, pos.y * 2, 0);
var newPosition = ReflectPosition(oldPosition);
_reflectionCamera.transform.forward = Vector3.Scale(realCamera.transform.forward, new Vector3(1, -1, 1));
_reflectionCamera.worldToCameraMatrix = realCamera.worldToCameraMatrix * reflection;
// Setup oblique projection matrix so that near plane is our reflection
// plane. This way we clip everything below/above it for free.
var clipPlane = CameraSpacePlane(_reflectionCamera, pos - Vector3.up * 0.1f, normal, 1.0f);
var projection = realCamera.CalculateObliqueMatrix(clipPlane);
_reflectionCamera.projectionMatrix = projection;
_reflectionCamera.cullingMask = m_settings.m_ReflectLayers; // never render water layer
_reflectionCamera.transform.position = newPosition;
}
// Calculates reflection matrix around the given plane
private 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;
}
private static Vector3 ReflectPosition(Vector3 pos)
{
var newPos = new Vector3(pos.x, -pos.y, pos.z);
return newPos;
}
private float GetScaleValue()
{
switch(m_settings.m_ResolutionMultiplier)
{
case ResolutionMulltiplier.Full:
return 1f;
case ResolutionMulltiplier.Half:
return 0.5f;
case ResolutionMulltiplier.Third:
return 0.33f;
case ResolutionMulltiplier.Quarter:
return 0.25f;
default:
return 0.5f; // default to half res
}
}
// Compare two int2
private static bool Int2Compare(int2 a, int2 b)
{
return a.x == b.x && a.y == b.y;
}
// Given position/normal of the plane, calculates plane in camera space.
private Vector4 CameraSpacePlane(Camera cam, Vector3 pos, Vector3 normal, float sideSign)
{
var offsetPos = pos + normal * m_settings.m_ClipPlaneOffset;
var m = cam.worldToCameraMatrix;
var cameraPosition = m.MultiplyPoint(offsetPos);
var cameraNormal = m.MultiplyVector(normal).normalized * sideSign;
return new Vector4(cameraNormal.x, cameraNormal.y, cameraNormal.z, -Vector3.Dot(cameraPosition, cameraNormal));
}
private Camera CreateMirrorObjects()
{
var go = new GameObject("Planar Reflections",typeof(Camera));
var cameraData = go.AddComponent(typeof(UniversalAdditionalCameraData)) as UniversalAdditionalCameraData;
cameraData.requiresColorOption = CameraOverrideOption.Off;
cameraData.requiresDepthOption = CameraOverrideOption.Off;
cameraData.SetRenderer(1);
var t = transform;
var reflectionCamera = go.GetComponent<Camera>();
reflectionCamera.transform.SetPositionAndRotation(t.position, t.rotation);
reflectionCamera.depth = -10;
reflectionCamera.enabled = false;
go.hideFlags = HideFlags.HideAndDontSave;
return reflectionCamera;
}
private void PlanarReflectionTexture(Camera cam)
{
if (_reflectionTexture == null)
{
var res = ReflectionResolution(cam, UniversalRenderPipeline.asset.renderScale);
bool useHdr10 = RenderingUtils.SupportsRenderTextureFormat(RenderTextureFormat.RGB111110Float);
RenderTextureFormat hdrFormat = useHdr10 ? RenderTextureFormat.RGB111110Float : RenderTextureFormat.DefaultHDR;
_reflectionTexture = RenderTexture.GetTemporary(res.x, res.y, 16,
GraphicsFormatUtility.GetGraphicsFormat(hdrFormat, true));
}
_reflectionCamera.targetTexture = _reflectionTexture;
}
private int2 ReflectionResolution(Camera cam, float scale)
{
var x = (int)(cam.pixelWidth * scale * GetScaleValue());
var y = (int)(cam.pixelHeight * scale * GetScaleValue());
return new int2(x, y);
}
private void ExecutePlanarReflections(ScriptableRenderContext context, Camera camera)
{
// we dont want to render planar reflections in reflections or previews
if (camera.cameraType == CameraType.Reflection || camera.cameraType == CameraType.Preview)
return;
UpdateReflectionCamera(camera); // create reflected camera
PlanarReflectionTexture(camera); // create and assign RenderTexture
var data = new PlanarReflectionSettingData(); // save quality settings and lower them for the planar reflections
data.Set(); // set quality settings
Shader.EnableKeyword("_PLANAR_REFLECTION_CAMERA");
BeginPlanarReflections?.Invoke(context, _reflectionCamera); // callback Action for PlanarReflection
UniversalRenderPipeline.RenderSingleCamera(context, _reflectionCamera); // render planar reflections
data.Restore(); // restore the quality settings
Shader.SetGlobalTexture(_planarReflectionTextureId, _reflectionTexture); // Assign texture to water shader
Shader.DisableKeyword("_PLANAR_REFLECTION_CAMERA");
}
class PlanarReflectionSettingData
{
private readonly bool _fog;
private readonly int _maxLod;
private readonly float _lodBias;
public PlanarReflectionSettingData()
{
_fog = RenderSettings.fog;
_maxLod = QualitySettings.maximumLODLevel;
_lodBias = QualitySettings.lodBias;
}
public void Set()
{
GL.invertCulling = true;
RenderSettings.fog = false; // disable fog for now as it's incorrect with projection
QualitySettings.maximumLODLevel = 1;
QualitySettings.lodBias = _lodBias * 0.5f;
}
public void Restore()
{
GL.invertCulling = false;
RenderSettings.fog = _fog;
QualitySettings.maximumLODLevel = _maxLod;
QualitySettings.lodBias = _lodBias;
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3971d89a730cd5846a1944ab0228bf76
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,234 @@
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
namespace WaterSystem
{
public class WaterSystemFeature : ScriptableRendererFeature
{
#region Water Effects Pass
class WaterFxPass : ScriptableRenderPass
{
private const string k_RenderWaterFXTag = "Render Water FX";
private ProfilingSampler m_WaterFX_Profile = new ProfilingSampler(k_RenderWaterFXTag);
private readonly ShaderTagId m_WaterFXShaderTag = new ShaderTagId("WaterFX");
private readonly Color m_ClearColor = new Color(0.0f, 0.5f, 0.5f, 0.5f); //r = foam mask, g = normal.x, b = normal.z, a = displacement
private FilteringSettings m_FilteringSettings;
private RTHandle m_WaterFX;
public WaterFxPass()
{
m_WaterFX=RTHandles.Alloc("_WaterFXMap", "_WaterFXMap");
// only wanting to render transparent objects
m_FilteringSettings = new FilteringSettings(RenderQueueRange.transparent);
}
// Calling Configure since we are wanting to render into a RenderTexture and control cleat
public override void Configure(CommandBuffer cmd, RenderTextureDescriptor cameraTextureDescriptor)
{
// no need for a depth buffer
cameraTextureDescriptor.depthBufferBits = 0;
// Half resolution
cameraTextureDescriptor.width /= 2;
cameraTextureDescriptor.height /= 2;
// default format TODO research usefulness of HDR format
cameraTextureDescriptor.colorFormat = RenderTextureFormat.Default;
// get a temp RT for rendering into
cmd.GetTemporaryRT(Shader.PropertyToID(m_WaterFX.name), cameraTextureDescriptor, FilterMode.Bilinear);
ConfigureTarget(m_WaterFX);
// clear the screen with a specific color for the packed data
ConfigureClear(ClearFlag.Color, m_ClearColor);
}
public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
{
CommandBuffer cmd = CommandBufferPool.Get();
using (new ProfilingScope(cmd, m_WaterFX_Profile)) // makes sure we have profiling ability
{
context.ExecuteCommandBuffer(cmd);
cmd.Clear();
// here we choose renderers based off the "WaterFX" shader pass and also sort back to front
var drawSettings = CreateDrawingSettings(m_WaterFXShaderTag, ref renderingData,
SortingCriteria.CommonTransparent);
// draw all the renderers matching the rules we setup
context.DrawRenderers(renderingData.cullResults, ref drawSettings, ref m_FilteringSettings);
}
context.ExecuteCommandBuffer(cmd);
CommandBufferPool.Release(cmd);
}
public override void OnCameraCleanup(CommandBuffer cmd)
{
// since the texture is used within the single cameras use we need to cleanup the RT afterwards
cmd.ReleaseTemporaryRT(Shader.PropertyToID(m_WaterFX.name));
}
}
#endregion
#region Caustics Pass
class WaterCausticsPass : ScriptableRenderPass
{
private const string k_RenderWaterCausticsTag = "Render Water Caustics";
private ProfilingSampler m_WaterCaustics_Profile = new ProfilingSampler(k_RenderWaterCausticsTag);
public Material WaterCausticMaterial;
private static Mesh m_mesh;
public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
{
var cam = renderingData.cameraData.camera;
// Stop the pass rendering in the preview or material missing
if (cam.cameraType == CameraType.Preview || !WaterCausticMaterial)
return;
CommandBuffer cmd = CommandBufferPool.Get();
using (new ProfilingScope(cmd, m_WaterCaustics_Profile))
{
var sunMatrix = RenderSettings.sun != null
? RenderSettings.sun.transform.localToWorldMatrix
: Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(-45f, 45f, 0f), Vector3.one);
WaterCausticMaterial.SetMatrix("_MainLightDir", sunMatrix);
// Create mesh if needed
if (!m_mesh)
m_mesh = GenerateCausticsMesh(1000f);
// Create the matrix to position the caustics mesh.
var position = cam.transform.position;
position.y = 0; // TODO should read a global 'water height' variable.
var matrix = Matrix4x4.TRS(position, Quaternion.identity, Vector3.one);
// Setup the CommandBuffer and draw the mesh with the caustic material and matrix
cmd.DrawMesh(m_mesh, matrix, WaterCausticMaterial, 0, 0);
}
context.ExecuteCommandBuffer(cmd);
CommandBufferPool.Release(cmd);
}
}
#endregion
WaterFxPass m_WaterFxPass;
WaterCausticsPass m_CausticsPass;
public WaterSystemSettings settings = new WaterSystemSettings();
[HideInInspector][SerializeField] private Shader causticShader;
[HideInInspector][SerializeField] private Texture2D causticTexture;
private Material _causticMaterial;
private static readonly int SrcBlend = Shader.PropertyToID("_SrcBlend");
private static readonly int DstBlend = Shader.PropertyToID("_DstBlend");
private static readonly int Size = Shader.PropertyToID("_Size");
private static readonly int CausticTexture = Shader.PropertyToID("_CausticMap");
public override void Create()
{
// WaterFX Pass
m_WaterFxPass = new WaterFxPass {renderPassEvent = RenderPassEvent.BeforeRenderingOpaques};
// Caustic Pass
m_CausticsPass = new WaterCausticsPass();
causticShader = causticShader ? causticShader : Shader.Find("Hidden/BoatAttack/Caustics");
if (causticShader == null) return;
if (_causticMaterial)
{
DestroyImmediate(_causticMaterial);
}
_causticMaterial = CoreUtils.CreateEngineMaterial(causticShader);
_causticMaterial.SetFloat("_BlendDistance", settings.causticBlendDistance);
if (causticTexture == null)
{
Debug.Log("Caustics Texture missing, attempting to load.");
#if UNITY_EDITOR
causticTexture = UnityEditor.AssetDatabase.LoadAssetAtPath<Texture2D>("Packages/com.verasl.water-system/Textures/WaterSurface_single.tif");
#endif
}
_causticMaterial.SetTexture(CausticTexture, causticTexture);
switch (settings.debug)
{
case WaterSystemSettings.DebugMode.Caustics:
_causticMaterial.SetFloat(SrcBlend, 1f);
_causticMaterial.SetFloat(DstBlend, 0f);
_causticMaterial.EnableKeyword("_DEBUG");
m_CausticsPass.renderPassEvent = RenderPassEvent.AfterRenderingPostProcessing;
break;
case WaterSystemSettings.DebugMode.WaterEffects:
break;
case WaterSystemSettings.DebugMode.Disabled:
// Caustics
_causticMaterial.SetFloat(SrcBlend, 2f);
_causticMaterial.SetFloat(DstBlend, 0f);
_causticMaterial.DisableKeyword("_DEBUG");
m_CausticsPass.renderPassEvent = RenderPassEvent.AfterRenderingSkybox + 1;
// WaterEffects
break;
}
_causticMaterial.SetFloat(Size, settings.causticScale);
m_CausticsPass.WaterCausticMaterial = _causticMaterial;
}
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
{
renderer.EnqueuePass(m_WaterFxPass);
renderer.EnqueuePass(m_CausticsPass);
}
/// <summary>
/// This function Generates a flat quad for use with the caustics pass.
/// </summary>
/// <param name="size">The length of the quad.</param>
/// <returns></returns>
private static Mesh GenerateCausticsMesh(float size)
{
var m = new Mesh();
size *= 0.5f;
var verts = new[]
{
new Vector3(-size, 0f, -size),
new Vector3(size, 0f, -size),
new Vector3(-size, 0f, size),
new Vector3(size, 0f, size)
};
m.vertices = verts;
var tris = new[]
{
0, 2, 1,
2, 3, 1
};
m.triangles = tris;
return m;
}
[System.Serializable]
public class WaterSystemSettings
{
[Header("Caustics Settings")] [Range(0.1f, 1f)]
public float causticScale = 0.25f;
public float causticBlendDistance = 3f;
[Header("Advanced Settings")] public DebugMode debug = DebugMode.Disabled;
public enum DebugMode
{
Disabled,
WaterEffects,
Caustics
}
}
}
}
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: adbe377f4f72c497faee64bc3f0580b9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences:
- causticShader: {fileID: 4800000, guid: 90939d2e4b62841d29c136c866715501, type: 3}
- causticTexture: {fileID: 2800000, guid: f395b7d64f44848c6a3cba1f1173fe90, type: 3}
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,402 @@
using System;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Rendering.Universal;
using WaterSystem.Data;
using Object = UnityEngine.Object;
using Random = UnityEngine.Random;
namespace WaterSystem
{
[ExecuteAlways]
public class Water : MonoBehaviour
{
// Singleton
private static Water _instance;
public static Water Instance
{
get
{
if (_instance == null)
_instance = (Water)FindObjectOfType(typeof(Water));
return _instance;
}
}
// Script references
private PlanarReflections _planarReflections;
private bool _useComputeBuffer;
public bool computeOverride;
[SerializeField] RenderTexture _depthTex;
public Texture bakedDepthTex;
private Camera _depthCam;
private Texture2D _rampTexture;
[SerializeField]
public Wave[] _waves;
[SerializeField]
private ComputeBuffer waveBuffer;
private float _maxWaveHeight;
private float _waveHeight;
[SerializeField]
public WaterSettingsData settingsData;
[SerializeField]
public WaterSurfaceData surfaceData;
[SerializeField]
private WaterResources resources;
private static readonly int CameraRoll = Shader.PropertyToID("_CameraRoll");
private static readonly int InvViewProjection = Shader.PropertyToID("_InvViewProjection");
private static readonly int WaterDepthMap = Shader.PropertyToID("_WaterDepthMap");
private static readonly int FoamMap = Shader.PropertyToID("_FoamMap");
private static readonly int SurfaceMap = Shader.PropertyToID("_SurfaceMap");
private static readonly int WaveHeight = Shader.PropertyToID("_WaveHeight");
private static readonly int MaxWaveHeight = Shader.PropertyToID("_MaxWaveHeight");
private static readonly int MaxDepth = Shader.PropertyToID("_MaxDepth");
private static readonly int WaveCount = Shader.PropertyToID("_WaveCount");
private static readonly int CubemapTexture = Shader.PropertyToID("_CubemapTexture");
private static readonly int WaveDataBuffer = Shader.PropertyToID("_WaveDataBuffer");
private static readonly int WaveData = Shader.PropertyToID("waveData");
private static readonly int AbsorptionScatteringRamp = Shader.PropertyToID("_AbsorptionScatteringRamp");
private static readonly int DepthCamZParams = Shader.PropertyToID("_VeraslWater_DepthCamParams");
private void OnEnable()
{
if (!computeOverride)
_useComputeBuffer = SystemInfo.supportsComputeShaders &&
Application.platform != RuntimePlatform.WebGLPlayer &&
Application.platform != RuntimePlatform.Android;
else
_useComputeBuffer = false;
Init();
RenderPipelineManager.beginCameraRendering += BeginCameraRendering;
if(resources == null)
{
resources = Resources.Load("WaterResources") as WaterResources;
}
}
private void OnDisable() {
Cleanup();
}
private void OnApplicationQuit()
{
GerstnerWavesJobs.Cleanup();
}
void Cleanup()
{
RenderPipelineManager.beginCameraRendering -= BeginCameraRendering;
if (_depthCam)
{
_depthCam.targetTexture = null;
SafeDestroy(_depthCam.gameObject);
}
if (_depthTex)
{
SafeDestroy(_depthTex);
}
waveBuffer?.Dispose();
}
private void BeginCameraRendering(ScriptableRenderContext src, Camera cam)
{
if (cam.cameraType == CameraType.Preview) return;
var roll = cam.transform.localEulerAngles.z;
Shader.SetGlobalFloat(CameraRoll, roll);
Shader.SetGlobalMatrix(InvViewProjection,
(GL.GetGPUProjectionMatrix(cam.projectionMatrix, false) * cam.worldToCameraMatrix).inverse);
// Water matrix
const float quantizeValue = 6.25f;
const float forwards = 10f;
const float yOffset = -0.25f;
var newPos = cam.transform.TransformPoint(Vector3.forward * forwards);
newPos.y = yOffset;
newPos.x = quantizeValue * (int) (newPos.x / quantizeValue);
newPos.z = quantizeValue * (int) (newPos.z / quantizeValue);
var matrix = Matrix4x4.TRS(newPos + transform.position, Quaternion.identity, transform.localScale); // transform.localToWorldMatrix;
foreach (var mesh in resources.defaultWaterMeshes)
{
Graphics.DrawMesh(mesh,
matrix,
resources.defaultSeaMaterial,
gameObject.layer,
cam,
0,
null,
ShadowCastingMode.Off,
true,
null,
LightProbeUsage.Off,
null);
}
}
private static void SafeDestroy(Object o)
{
if(Application.isPlaying)
Destroy(o);
else
DestroyImmediate(o);
}
public void Init()
{
SetWaves();
GenerateColorRamp();
if (bakedDepthTex)
{
Shader.SetGlobalTexture(WaterDepthMap, bakedDepthTex);
}
if (!gameObject.TryGetComponent(out _planarReflections))
{
_planarReflections = gameObject.AddComponent<PlanarReflections>();
}
_planarReflections.hideFlags = HideFlags.HideAndDontSave | HideFlags.HideInInspector;
_planarReflections.m_settings = settingsData.planarSettings;
_planarReflections.enabled = settingsData.refType == ReflectionType.PlanarReflection;
if(resources == null)
{
resources = Resources.Load("WaterResources") as WaterResources;
}
if(Application.platform != RuntimePlatform.WebGLPlayer) // TODO - bug with Opengl depth
CaptureDepthMap();
}
private void LateUpdate()
{
GerstnerWavesJobs.UpdateHeights();
}
public void FragWaveNormals(bool toggle)
{
var mat = GetComponent<Renderer>().sharedMaterial;
if (toggle)
mat.EnableKeyword("GERSTNER_WAVES");
else
mat.DisableKeyword("GERSTNER_WAVES");
}
private void SetWaves()
{
SetupWaves(surfaceData._customWaves);
// set default resources
Shader.SetGlobalTexture(FoamMap, resources.defaultFoamMap);
Shader.SetGlobalTexture(SurfaceMap, resources.defaultSurfaceMap);
_maxWaveHeight = 0f;
foreach (var w in _waves)
{
_maxWaveHeight += w.amplitude;
}
_maxWaveHeight /= _waves.Length;
_waveHeight = transform.position.y;
Shader.SetGlobalFloat(WaveHeight, _waveHeight);
Shader.SetGlobalFloat(MaxWaveHeight, _maxWaveHeight);
Shader.SetGlobalFloat(MaxDepth, surfaceData._waterMaxVisibility);
switch(settingsData.refType)
{
case ReflectionType.Cubemap:
Shader.EnableKeyword("_REFLECTION_CUBEMAP");
Shader.DisableKeyword("_REFLECTION_PROBES");
Shader.DisableKeyword("_REFLECTION_PLANARREFLECTION");
Shader.SetGlobalTexture(CubemapTexture, settingsData.cubemapRefType);
break;
case ReflectionType.ReflectionProbe:
Shader.DisableKeyword("_REFLECTION_CUBEMAP");
Shader.EnableKeyword("_REFLECTION_PROBES");
Shader.DisableKeyword("_REFLECTION_PLANARREFLECTION");
break;
case ReflectionType.PlanarReflection:
Shader.DisableKeyword("_REFLECTION_CUBEMAP");
Shader.DisableKeyword("_REFLECTION_PROBES");
Shader.EnableKeyword("_REFLECTION_PLANARREFLECTION");
break;
default:
throw new ArgumentOutOfRangeException();
}
Shader.SetGlobalInt(WaveCount, _waves.Length);
//GPU side
if (_useComputeBuffer)
{
Shader.EnableKeyword("USE_STRUCTURED_BUFFER");
waveBuffer?.Dispose();
waveBuffer = new ComputeBuffer(10, (sizeof(float) * 6));
waveBuffer.SetData(_waves);
Shader.SetGlobalBuffer(WaveDataBuffer, waveBuffer);
}
else
{
Shader.DisableKeyword("USE_STRUCTURED_BUFFER");
Shader.SetGlobalVectorArray(WaveData, GetWaveData());
}
//CPU side
if(GerstnerWavesJobs.Initialized == false && Application.isPlaying)
GerstnerWavesJobs.Init();
}
private Vector4[] GetWaveData()
{
var waveData = new Vector4[20];
for (var i = 0; i < _waves.Length; i++)
{
waveData[i] = new Vector4(_waves[i].amplitude, _waves[i].direction, _waves[i].wavelength, _waves[i].onmiDir);
waveData[i+10] = new Vector4(_waves[i].origin.x, _waves[i].origin.y, 0, 0);
}
return waveData;
}
private void SetupWaves(bool custom)
{
if(!custom)
{
//create basic waves based off basic wave settings
var backupSeed = Random.state;
Random.InitState(surfaceData.randomSeed);
var basicWaves = surfaceData._basicWaveSettings;
var a = basicWaves.amplitude;
var d = basicWaves.direction;
var l = basicWaves.wavelength;
var numWave = basicWaves.numWaves;
_waves = new Wave[numWave];
var r = 1f / numWave;
for (var i = 0; i < numWave; i++)
{
var p = Mathf.Lerp(0.5f, 1.5f, i * r);
var amp = a * p * Random.Range(0.8f, 1.2f);
var dir = d + Random.Range(-90f, 90f);
var len = l * p * Random.Range(0.6f, 1.4f);
_waves[i] = new Wave(amp, dir, len, Vector2.zero, false);
Random.InitState(surfaceData.randomSeed + i + 1);
}
Random.state = backupSeed;
}
else
{
_waves = surfaceData._waves.ToArray();
}
}
private void GenerateColorRamp()
{
if(_rampTexture == null)
_rampTexture = new Texture2D(128, 4, GraphicsFormat.R8G8B8A8_SRGB, TextureCreationFlags.None);
_rampTexture.wrapMode = TextureWrapMode.Clamp;
var defaultFoamRamp = resources.defaultFoamRamp;
var cols = new Color[512];
for (var i = 0; i < 128; i++)
{
cols[i] = surfaceData._absorptionRamp.Evaluate(i / 128f);
}
for (var i = 0; i < 128; i++)
{
cols[i + 128] = surfaceData._scatterRamp.Evaluate(i / 128f);
}
for (var i = 0; i < 128; i++)
{
switch(surfaceData._foamSettings.foamType)
{
case 0: // default
cols[i + 256] = defaultFoamRamp.GetPixelBilinear(i / 128f , 0.5f);
break;
case 1: // simple
cols[i + 256] = defaultFoamRamp.GetPixelBilinear(surfaceData._foamSettings.basicFoam.Evaluate(i / 128f) , 0.5f);
break;
case 2: // custom
cols[i + 256] = Color.black;
break;
}
}
_rampTexture.SetPixels(cols);
_rampTexture.Apply();
Shader.SetGlobalTexture(AbsorptionScatteringRamp, _rampTexture);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////Shoreline Depth Texture/////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
[ContextMenu("Capture Depth")]
public void CaptureDepthMap()
{
//Generate the camera
if(_depthCam == null)
{
var go =
new GameObject("depthCamera") {hideFlags = HideFlags.HideAndDontSave}; //create the cameraObject
_depthCam = go.AddComponent<Camera>();
}
var additionalCamData = _depthCam.GetUniversalAdditionalCameraData();
additionalCamData.renderShadows = false;
additionalCamData.requiresColorOption = CameraOverrideOption.Off;
additionalCamData.requiresDepthOption = CameraOverrideOption.Off;
var t = _depthCam.transform;
var depthExtra = 4.0f;
t.position = Vector3.up * (transform.position.y + depthExtra);//center the camera on this water plane height
t.up = Vector3.forward;//face the camera down
_depthCam.enabled = true;
_depthCam.orthographic = true;
_depthCam.orthographicSize = 250;//hardcoded = 1k area - TODO
_depthCam.nearClipPlane =0.01f;
_depthCam.farClipPlane = surfaceData._waterMaxVisibility + depthExtra;
_depthCam.allowHDR = false;
_depthCam.allowMSAA = false;
_depthCam.cullingMask = (1 << 10);
//Generate RT
if (!_depthTex)
_depthTex = new RenderTexture(1024, 1024, 24, RenderTextureFormat.Depth, RenderTextureReadWrite.Linear);
if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.OpenGLES2 || SystemInfo.graphicsDeviceType == GraphicsDeviceType.OpenGLES3)
{
_depthTex.filterMode = FilterMode.Point;
}
_depthTex.wrapMode = TextureWrapMode.Clamp;
_depthTex.name = "WaterDepthMap";
//do depth capture
_depthCam.targetTexture = _depthTex;
_depthCam.Render();
Shader.SetGlobalTexture(WaterDepthMap, _depthTex);
// set depth bufferParams for depth cam(since it doesnt exist and only temporary)
var _params = new Vector4(t.position.y, 250, 0, 0);
//Vector4 zParams = new Vector4(1-f/n, f/n, (1-f/n)/f, (f/n)/f);//2015
Shader.SetGlobalVector(DepthCamZParams, _params);
/* #if UNITY_EDITOR
Texture2D tex2D = new Texture2D(1024, 1024, TextureFormat.Alpha8, false);
Graphics.CopyTexture(_depthTex, tex2D);
byte[] image = tex2D.EncodeToPNG();
System.IO.File.WriteAllBytes(Application.dataPath + "/WaterDepth.png", image);
#endif*/
_depthCam.enabled = false;
_depthCam.targetTexture = null;
}
[Serializable]
public enum DebugMode { none, stationary, screen };
}
}
@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: b6edb8448c9b94f018953ca2a6fa5891
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences:
- _rampTexture: {instanceID: 0}
- settingsData: {fileID: 11400000, guid: a4cacf74654e54b35b9eaea74fd20b4e, type: 2}
- surfaceData: {fileID: 11400000, guid: 846f3dc3b5341447a86687211f741bc7, type: 2}
- resources: {fileID: 11400000, guid: 40615c805d6e84ce7800418367985fe1, type: 2}
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,19 @@
{
"name": "WaterSystem",
"references": [
"GUID:d8b63aba1907145bea998dd612889d6b",
"GUID:15fc0a57446b3144c949da3e2b9737a9",
"GUID:df380645f10b7bc4b97d4f5eb6303d95",
"GUID:2665a8d13d1b3f18800f46e256720795",
"GUID:9e24947de15b9834991c9d8411ea37cf"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: eee6090a63a1e48e6857869e0cbe74dc
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2cac2e60f3f6f2447ad9b550450f60ed
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6aab7b5e54a384c2790bfb04db9d7cfe
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,139 @@
Shader "Hidden/BoatAttack/Caustics"
{
Properties
{
//Vector1_F3303B3C("Speed", Float) = 0.5
_Size("Size", Float) = 0.5
[NoScaleOffset]_CausticMap("Caustics", 2D) = "white" {}
_WaterLevel("WaterLevel", Float) = 0
_BlendDistance("BlendDistance", Float) = 3
//Vector1_CD857B77("CausticsRGB Split", Float) = 2
//Color blends
[HideInInspector] _SrcBlend("__src", Float) = 2.0
[HideInInspector] _DstBlend("__dst", Float) = 0.0
}
SubShader
{
ZWrite Off
Pass
{
Blend [_SrcBlend] [_DstBlend], One Zero
HLSLPROGRAM
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl"
#pragma multi_compile _ _DEBUG
#pragma multi_compile _ _STATIC_SHADER
#pragma vertex vert
#pragma fragment frag
struct Attributes
{
float4 positionOS : POSITION;
float2 uv : TEXCOORD0;
};
struct Varyings
{
float4 screenpos : TEXCOORD0;
float4 positionCS : SV_POSITION;
};
TEXTURE2D(_CausticMap); SAMPLER(sampler_CausticMap);
TEXTURE2D(_AbsorptionScatteringRamp); SAMPLER(sampler_AbsorptionScatteringRamp);
half _Size;
half _WaterLevel;
half _MaxDepth;
half _BlendDistance;
half4x4 _MainLightDir;
// World Posision reconstriction
float3 ReconstructWorldPos(half2 screenPos, float depth)
{
float4x4 mat = UNITY_MATRIX_I_VP;
#if UNITY_REVERSED_Z
mat._12_22_32_42 = -mat._12_22_32_42;
#else
depth = depth * 2 - 1;
#endif
float4 raw = mul(mat, float4(screenPos * 2 - 1, depth, 1));
float3 worldPos = raw.rgb / raw.a;
return worldPos;
}
// Can be done per-vertex
float2 CausticUVs(float2 rawUV, float2 offset)
{
float2 uv = rawUV * _Size;
return uv + offset * 0.1;
}
Varyings vert (Attributes input)
{
Varyings output;
VertexPositionInputs vertexInput = GetVertexPositionInputs(input.positionOS.xyz);
output.positionCS = vertexInput.positionCS;
output.screenpos = ComputeScreenPos(output.positionCS);
return output;
}
real4 frag (Varyings input) : SV_Target
{
float4 screenPos = input.screenpos / input.screenpos.w;
// Get depth
real depth = SampleSceneDepth(screenPos.xy);
// Get main light
Light MainLight = GetMainLight();
// Reconstruct Position of objects in depth map
float4 WorldPos = ReconstructWorldPos(screenPos.xy, depth).xyzz;
// Get light direction and use it to rotate the world position
float3 LightUVs = mul(WorldPos, _MainLightDir).xyz;
#if defined(_STATIC_SHADER)
float time = 0;
#else
float time = _Time.x;
#endif
// Read wave texture for noise to offset cautics UVs
float2 uv = WorldPos.xz * 0.025 + time * 0.25;
float waveOffset = SAMPLE_TEXTURE2D(_CausticMap, sampler_CausticMap, uv).w - 0.5;
float2 causticUV = CausticUVs(LightUVs.xy, waveOffset);
float LodLevel = abs(WorldPos.y - _WaterLevel) * 4 / _BlendDistance;
float4 A = SAMPLE_TEXTURE2D_LOD(_CausticMap, sampler_CausticMap, causticUV + time, LodLevel);
float4 B = SAMPLE_TEXTURE2D_LOD(_CausticMap, sampler_CausticMap, causticUV * 2.0, LodLevel);
float CausticsDriver = (A.z * B.z) * 10 + A.z + B.z;
// Mask caustics from above water and fade below
half upperMask = saturate(-WorldPos.y + _WaterLevel);
half lowerMask = saturate((WorldPos.y - _WaterLevel) / _BlendDistance + _BlendDistance);
CausticsDriver *= min(upperMask, lowerMask);
// Fake light dispersion
half3 Caustics = CausticsDriver * half3(A.w * 0.5, B.w * 0.75, B.x) * MainLight.color;
#ifdef _DEBUG
return real4(Caustics, 1.0);
#endif
// Add 1 for blending level to work nicely
return real4(Caustics + 1.0, 1.0);
}
ENDHLSL
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 90939d2e4b62841d29c136c866715501
ShaderImporter:
externalObjects: {}
defaultTextures:
- _CausticMap: {instanceID: 0}
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,49 @@
#ifndef COMMON_UTILITIES_INCLUDED
#define COMMON_UTILITIES_INCLUDED
// remaps a value based on a in:min/max and out:min/max
// value = value to be remapped
// remap = x = min in, y = max in, z = min out, w = max out
float Remap(half value, half4 remap)
{
return remap.z + (value - remap.x) * (remap.w - remap.z) / (remap.y - remap.x);
}
// Converts greyscale height to normal
// _tex = input texture(separate from a sampler)
// _sampler = the sampler to use
// _uv = uv coordinates
// _intensity = intensity of the effect
float3 HeightToNormal(Texture2D _tex, SamplerState _sampler, float2 _uv, half _intensity)
{
float3 bumpSamples;
bumpSamples.x = _tex.Sample(_sampler, _uv).x; // Sample center
bumpSamples.y = _tex.Sample(_sampler, float2(_uv.x + _intensity / _ScreenParams.x, _uv.y)).x; // Sample U
bumpSamples.z = _tex.Sample(_sampler, float2(_uv.x, _uv.y + _intensity / _ScreenParams.y)).x; // Sample V
half dHdU = bumpSamples.z - bumpSamples.x;//bump U offset
half dHdV = bumpSamples.y - bumpSamples.x;//bump V offset
return float3(-dHdU, dHdV, 0.5);//return tangent normal
}
// Simple noise from thebookofshaders.com
// 2D Random
float2 random(float2 st){
st = float2( dot(st,float2(127.1,311.7)), dot(st,float2(269.5,183.3)) );
return -1.0 + 2.0 * frac(sin(st) * 43758.5453123);
}
// 2D Noise based on Morgan McGuire @morgan3d
// https://www.shadertoy.com/view/4dS3Wd
float noise (float2 st) {
float2 i = floor(st);
float2 f = frac(st);
float2 u = f*f*(3.0-2.0*f);
return lerp( lerp( dot( random(i), f),
dot( random(i + float2(1.0,0.0) ), f - float2(1.0,0.0) ), u.x),
lerp( dot( random(i + float2(0.0,1.0) ), f - float2(0.0,1.0) ),
dot( random(i + float2(1.0,1.0) ), f - float2(1.0,1.0) ), u.x), u.y);
}
#endif // COMMON_UTILITIES_INCLUDED
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 74c950d64fbb9465c9dd5b5d9800f9f5
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,108 @@
#ifndef GERSTNER_WAVES_INCLUDED
#define GERSTNER_WAVES_INCLUDED
uniform uint _WaveCount; // how many waves, set via the water component
struct Wave
{
float amplitude;
float direction;
float wavelength;
float2 origin;
float omni;
};
#if defined(USE_STRUCTURED_BUFFER)
StructuredBuffer<Wave> _WaveDataBuffer;
#else
half4 waveData[20]; // 0-9 amplitude, direction, wavelength, omni, 10-19 origin.xy
#endif
struct WaveStruct
{
float3 position;
float3 normal;
};
WaveStruct GerstnerWave(half2 pos, float waveCountMulti, half amplitude, half direction, half wavelength, half omni, half2 omniPos)
{
WaveStruct waveOut;
#if defined(_STATIC_SHADER)
float time = 0;
#else
float time = _Time.y;
#endif
////////////////////////////////wave value calculations//////////////////////////
half3 wave = 0; // wave vector
half w = 6.28318 / wavelength; // 2pi over wavelength(hardcoded)
half wSpeed = sqrt(9.8 * w); // frequency of the wave based off wavelength
half peak = 1.5; // peak value, 1 is the sharpest peaks
half qi = peak / (amplitude * w * _WaveCount);
direction = radians(direction); // convert the incoming degrees to radians, for directional waves
half2 dirWaveInput = half2(sin(direction), cos(direction)) * (1 - omni);
half2 omniWaveInput = (pos - omniPos) * omni;
half2 windDir = normalize(dirWaveInput + omniWaveInput); // calculate wind direction
half dir = dot(windDir, pos - (omniPos * omni)); // calculate a gradient along the wind direction
////////////////////////////position output calculations/////////////////////////
half calc = dir * w + -time * wSpeed; // the wave calculation
half cosCalc = cos(calc); // cosine version(used for horizontal undulation)
half sinCalc = sin(calc); // sin version(used for vertical undulation)
// calculate the offsets for the current point
wave.xz = qi * amplitude * windDir.xy * cosCalc;
wave.y = ((sinCalc * amplitude)) * waveCountMulti;// the height is divided by the number of waves
////////////////////////////normal output calculations/////////////////////////
half wa = w * amplitude;
// normal vector
half3 n = half3(-(windDir.xy * wa * cosCalc),
1-(qi * wa * sinCalc));
////////////////////////////////assign to output///////////////////////////////
waveOut.position = wave * saturate(amplitude * 10000);
waveOut.normal = (n.xzy * waveCountMulti);
return waveOut;
}
inline void SampleWaves(float3 position, half opacity, out WaveStruct waveOut)
{
half2 pos = position.xz;
waveOut.position = 0;
waveOut.normal = 0;
half waveCountMulti = 1.0 / _WaveCount;
half3 opacityMask = saturate(half3(3, 3, 1) * opacity);
UNITY_LOOP
for(uint i = 0; i < _WaveCount; i++)
{
#if defined(USE_STRUCTURED_BUFFER)
Wave w = _WaveDataBuffer[i];
#else
Wave w;
w.amplitude = waveData[i].x;
w.direction = waveData[i].y;
w.wavelength = waveData[i].z;
w.omni = waveData[i].w;
w.origin = waveData[i + 10].xy;
#endif
WaveStruct wave = GerstnerWave(pos,
waveCountMulti,
w.amplitude,
w.direction,
w.wavelength,
w.omni,
w.origin); // calculate the wave
waveOut.position += wave.position; // add the position
waveOut.normal += wave.normal; // add the normal
}
waveOut.position *= opacityMask;
waveOut.normal *= half3(opacity, 1, opacity);
}
#endif // GERSTNER_WAVES_INCLUDED
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 218546c4603ef4cbd9ebc00e80bf714d
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 88513df6dcc2e42048817fd8a57904b9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,109 @@
{
"m_SerializedProperties": [
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.Vector2ShaderProperty"
},
"JSONnodeData": "{\n \"m_Name\": \"Vector 2\",\n \"m_GeneratePropertyBlock\": true,\n \"m_Guid\": {\n \"m_GuidSerialized\": \"88b7efb8-be5d-4496-ba09-4d430fc6423b\"\n },\n \"m_DefaultReferenceName\": \"Vector2_BC829BCE\",\n \"m_OverrideReferenceName\": \"\",\n \"m_Value\": {\n \"x\": 0.0,\n \"y\": 0.0,\n \"z\": 0.0,\n \"w\": 0.0\n },\n \"m_Hidden\": false\n}"
}
],
"m_GUID": {
"m_GuidSerialized": "86ffa601-7695-4f3f-b4a5-8ad0731529eb"
},
"m_SerializableNodes": [
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.SubGraphOutputNode"
},
"JSONnodeData": "{\n \"m_GuidSerialized\": \"c3ddab77-2275-442d-881c-6e7df36e94e2\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"SubGraphOutputs\",\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": 652.0,\n \"y\": -12.0,\n \"width\": 208.0,\n \"height\": 351.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector4MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"Output 1\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Output1\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n }\n ],\n \"m_PreviewExpanded\": true\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.SineNode"
},
"JSONnodeData": "{\n \"m_GuidSerialized\": \"484819f3-bc05-4dd6-8c34-db0b85970eb9\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"Sine\",\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -35.49995422363281,\n \"y\": -102.0,\n \"width\": 126.0,\n \"height\": 94.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"In\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"In\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"Out\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Out\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n }\n ],\n \"m_PreviewExpanded\": false\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.CosineNode"
},
"JSONnodeData": "{\n \"m_GuidSerialized\": \"e37d3a70-615a-442f-b583-732e50988715\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"Cosine\",\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -37.49992370605469,\n \"y\": 8.0,\n \"width\": 126.0,\n \"height\": 94.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"In\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"In\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"Out\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Out\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n }\n ],\n \"m_PreviewExpanded\": false\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.SplitNode"
},
"JSONnodeData": "{\n \"m_GuidSerialized\": \"41d89d3e-4071-4778-8334-db448d97cda0\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"Split\",\n \"m_DrawState\": {\n \"m_Expanded\": false,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -221.50003051757813,\n \"y\": -75.0,\n \"width\": 115.00000762939453,\n \"height\": 149.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"In\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"In\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"R\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"R\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 2,\\n \\\"m_DisplayName\\\": \\\"G\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"G\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 3,\\n \\\"m_DisplayName\\\": \\\"B\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"B\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 4,\\n \\\"m_DisplayName\\\": \\\"A\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"A\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n }\n ],\n \"m_PreviewExpanded\": true\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.CombineNode"
},
"JSONnodeData": "{\n \"m_GuidSerialized\": \"3d525ca4-def9-4fa4-9ce5-b816e075cd5a\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"Combine\",\n \"m_DrawState\": {\n \"m_Expanded\": false,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": 116.50001525878906,\n \"y\": -61.0,\n \"width\": 95.0,\n \"height\": 118.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"R\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"R\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"G\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"G\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 2,\\n \\\"m_DisplayName\\\": \\\"B\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"B\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 3,\\n \\\"m_DisplayName\\\": \\\"A\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"A\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector4MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 4,\\n \\\"m_DisplayName\\\": \\\"RGBA\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"RGBA\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector3MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 5,\\n \\\"m_DisplayName\\\": \\\"RGB\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"RGB\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\",\\n \\\"Z\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector2MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 6,\\n \\\"m_DisplayName\\\": \\\"RG\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"RG\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\"\\n ]\\n}\"\n }\n ],\n \"m_PreviewExpanded\": false\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.PropertyNode"
},
"JSONnodeData": "{\n \"m_GuidSerialized\": \"5d612b30-4cac-4be9-85fb-7ad6c3299a29\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"Property\",\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -466.0,\n \"y\": -41.0,\n \"width\": 115.0,\n \"height\": 34.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector2MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"Vector 2\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Out\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\"\\n ]\\n}\"\n }\n ],\n \"m_PreviewExpanded\": true,\n \"m_PropertyGuidSerialized\": \"88b7efb8-be5d-4496-ba09-4d430fc6423b\"\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.NormalizeNode"
},
"JSONnodeData": "{\n \"m_GuidSerialized\": \"6f0285e7-475c-45f4-b17b-610704bed243\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"Normalize\",\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": 332.0,\n \"y\": 33.0,\n \"width\": 208.0,\n \"height\": 278.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"In\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"In\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"Out\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Out\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n }\n ],\n \"m_PreviewExpanded\": true\n}"
}
],
"m_Groups": [],
"m_SerializableEdges": [
{
"typeInfo": {
"fullName": "UnityEditor.Graphing.Edge"
},
"JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 1,\n \"m_NodeGUIDSerialized\": \"41d89d3e-4071-4778-8334-db448d97cda0\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"484819f3-bc05-4dd6-8c34-db0b85970eb9\"\n }\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.Graphing.Edge"
},
"JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 1,\n \"m_NodeGUIDSerialized\": \"484819f3-bc05-4dd6-8c34-db0b85970eb9\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"3d525ca4-def9-4fa4-9ce5-b816e075cd5a\"\n }\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.Graphing.Edge"
},
"JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 2,\n \"m_NodeGUIDSerialized\": \"41d89d3e-4071-4778-8334-db448d97cda0\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"e37d3a70-615a-442f-b583-732e50988715\"\n }\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.Graphing.Edge"
},
"JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 1,\n \"m_NodeGUIDSerialized\": \"e37d3a70-615a-442f-b583-732e50988715\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 1,\n \"m_NodeGUIDSerialized\": \"3d525ca4-def9-4fa4-9ce5-b816e075cd5a\"\n }\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.Graphing.Edge"
},
"JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"5d612b30-4cac-4be9-85fb-7ad6c3299a29\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"41d89d3e-4071-4778-8334-db448d97cda0\"\n }\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.Graphing.Edge"
},
"JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 6,\n \"m_NodeGUIDSerialized\": \"3d525ca4-def9-4fa4-9ce5-b816e075cd5a\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"6f0285e7-475c-45f4-b17b-610704bed243\"\n }\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.Graphing.Edge"
},
"JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 1,\n \"m_NodeGUIDSerialized\": \"6f0285e7-475c-45f4-b17b-610704bed243\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 1,\n \"m_NodeGUIDSerialized\": \"c3ddab77-2275-442d-881c-6e7df36e94e2\"\n }\n}"
}
],
"m_PreviewData": {
"serializedMesh": {
"m_SerializedMesh": "",
"m_Guid": ""
}
},
"m_Path": "Sub Graphs"
}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: b736aebad82ef413a938600669d91b16
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,272 @@
{
"m_SerializedProperties": [
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.Vector2ShaderProperty"
},
"JSONnodeData": "{\n \"m_Name\": \"PositionWS\",\n \"m_GeneratePropertyBlock\": true,\n \"m_Guid\": {\n \"m_GuidSerialized\": \"aeefdbaf-8e06-4609-a30f-f67419e845a7\"\n },\n \"m_DefaultReferenceName\": \"Vector2_84DBE9C3\",\n \"m_OverrideReferenceName\": \"_PositionWS\",\n \"m_Value\": {\n \"x\": 0.0,\n \"y\": 0.0,\n \"z\": 0.0,\n \"w\": 0.0\n },\n \"m_Hidden\": false\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.Vector1ShaderProperty"
},
"JSONnodeData": "{\n \"m_Name\": \"WaveSpeed\",\n \"m_GeneratePropertyBlock\": true,\n \"m_Guid\": {\n \"m_GuidSerialized\": \"8f63cb42-bf59-43eb-ba27-5d049864a1b7\"\n },\n \"m_DefaultReferenceName\": \"Vector1_CA0C9FBC\",\n \"m_OverrideReferenceName\": \"_WaveSpeed\",\n \"m_Value\": 1.0,\n \"m_FloatType\": 0,\n \"m_RangeValues\": {\n \"x\": 0.0,\n \"y\": 1.0\n },\n \"m_Hidden\": false\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.Vector2ShaderProperty"
},
"JSONnodeData": "{\n \"m_Name\": \"Direction\",\n \"m_GeneratePropertyBlock\": true,\n \"m_Guid\": {\n \"m_GuidSerialized\": \"d67ebba8-8192-4475-b3e0-2ea7f568875f\"\n },\n \"m_DefaultReferenceName\": \"Vector2_E2C1429D\",\n \"m_OverrideReferenceName\": \"_WaveDirection\",\n \"m_Value\": {\n \"x\": 0.0,\n \"y\": 1.0,\n \"z\": 0.0,\n \"w\": 0.0\n },\n \"m_Hidden\": false\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.Vector1ShaderProperty"
},
"JSONnodeData": "{\n \"m_Name\": \"Wavelength\",\n \"m_GeneratePropertyBlock\": true,\n \"m_Guid\": {\n \"m_GuidSerialized\": \"6e16ae66-da50-4bd7-8271-2cd58482d131\"\n },\n \"m_DefaultReferenceName\": \"Vector1_7F170A2F\",\n \"m_OverrideReferenceName\": \"\",\n \"m_Value\": 5.0,\n \"m_FloatType\": 0,\n \"m_RangeValues\": {\n \"x\": 0.0,\n \"y\": 1.0\n },\n \"m_Hidden\": false\n}"
}
],
"m_GUID": {
"m_GuidSerialized": "0aa03c24-2568-4410-b173-f1f1b1423bc7"
},
"m_SerializableNodes": [
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.SubGraphOutputNode"
},
"JSONnodeData": "{\n \"m_GuidSerialized\": \"f40aece3-7622-466f-8d20-8878977bde6c\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"SubGraphOutputs\",\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": 804.0,\n \"y\": 116.0,\n \"width\": 208.0,\n \"height\": 352.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector4MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"Output 1\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Output1\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n }\n ],\n \"m_PreviewExpanded\": true\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.DotProductNode"
},
"JSONnodeData": "{\n \"m_GuidSerialized\": \"81b6e165-ee60-4b75-b79f-ecebc2bc6f47\",\n \"m_GroupGuidSerialized\": \"e1cad54c-ed2c-4ec2-9ca4-8ab28b699bb6\",\n \"m_Name\": \"Dot Product\",\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -182.9999237060547,\n \"y\": 176.00003051757813,\n \"width\": 122.0,\n \"height\": 118.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"A\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"A\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"B\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"B\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 1.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 2,\\n \\\"m_DisplayName\\\": \\\"Out\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Out\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n }\n ],\n \"m_PreviewExpanded\": false\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.MultiplyNode"
},
"JSONnodeData": "{\n \"m_GuidSerialized\": \"51e152d7-3931-4d7a-bfcd-bc25dc9a89e9\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"Multiply\",\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": 151.0000457763672,\n \"y\": 124.99995422363281,\n \"width\": 122.0,\n \"height\": 118.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicValueMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"A\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"A\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"e00\\\": 0.0,\\n \\\"e01\\\": 0.0,\\n \\\"e02\\\": 0.0,\\n \\\"e03\\\": 0.0,\\n \\\"e10\\\": 0.0,\\n \\\"e11\\\": 0.0,\\n \\\"e12\\\": 0.0,\\n \\\"e13\\\": 0.0,\\n \\\"e20\\\": 0.0,\\n \\\"e21\\\": 0.0,\\n \\\"e22\\\": 0.0,\\n \\\"e23\\\": 0.0,\\n \\\"e30\\\": 0.0,\\n \\\"e31\\\": 0.0,\\n \\\"e32\\\": 0.0,\\n \\\"e33\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"e00\\\": 1.0,\\n \\\"e01\\\": 0.0,\\n \\\"e02\\\": 0.0,\\n \\\"e03\\\": 0.0,\\n \\\"e10\\\": 0.0,\\n \\\"e11\\\": 1.0,\\n \\\"e12\\\": 0.0,\\n \\\"e13\\\": 0.0,\\n \\\"e20\\\": 0.0,\\n \\\"e21\\\": 0.0,\\n \\\"e22\\\": 1.0,\\n \\\"e23\\\": 0.0,\\n \\\"e30\\\": 0.0,\\n \\\"e31\\\": 0.0,\\n \\\"e32\\\": 0.0,\\n \\\"e33\\\": 1.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicValueMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"B\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"B\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"e00\\\": 1.0,\\n \\\"e01\\\": 2.0,\\n \\\"e02\\\": 2.0,\\n \\\"e03\\\": 2.0,\\n \\\"e10\\\": 2.0,\\n \\\"e11\\\": 2.0,\\n \\\"e12\\\": 2.0,\\n \\\"e13\\\": 2.0,\\n \\\"e20\\\": 2.0,\\n \\\"e21\\\": 2.0,\\n \\\"e22\\\": 2.0,\\n \\\"e23\\\": 2.0,\\n \\\"e30\\\": 2.0,\\n \\\"e31\\\": 2.0,\\n \\\"e32\\\": 2.0,\\n \\\"e33\\\": 2.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"e00\\\": 1.0,\\n \\\"e01\\\": 0.0,\\n \\\"e02\\\": 0.0,\\n \\\"e03\\\": 0.0,\\n \\\"e10\\\": 0.0,\\n \\\"e11\\\": 1.0,\\n \\\"e12\\\": 0.0,\\n \\\"e13\\\": 0.0,\\n \\\"e20\\\": 0.0,\\n \\\"e21\\\": 0.0,\\n \\\"e22\\\": 1.0,\\n \\\"e23\\\": 0.0,\\n \\\"e30\\\": 0.0,\\n \\\"e31\\\": 0.0,\\n \\\"e32\\\": 0.0,\\n \\\"e33\\\": 1.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicValueMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 2,\\n \\\"m_DisplayName\\\": \\\"Out\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Out\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"e00\\\": 0.0,\\n \\\"e01\\\": 0.0,\\n \\\"e02\\\": 0.0,\\n \\\"e03\\\": 0.0,\\n \\\"e10\\\": 0.0,\\n \\\"e11\\\": 0.0,\\n \\\"e12\\\": 0.0,\\n \\\"e13\\\": 0.0,\\n \\\"e20\\\": 0.0,\\n \\\"e21\\\": 0.0,\\n \\\"e22\\\": 0.0,\\n \\\"e23\\\": 0.0,\\n \\\"e30\\\": 0.0,\\n \\\"e31\\\": 0.0,\\n \\\"e32\\\": 0.0,\\n \\\"e33\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"e00\\\": 1.0,\\n \\\"e01\\\": 0.0,\\n \\\"e02\\\": 0.0,\\n \\\"e03\\\": 0.0,\\n \\\"e10\\\": 0.0,\\n \\\"e11\\\": 1.0,\\n \\\"e12\\\": 0.0,\\n \\\"e13\\\": 0.0,\\n \\\"e20\\\": 0.0,\\n \\\"e21\\\": 0.0,\\n \\\"e22\\\": 1.0,\\n \\\"e23\\\": 0.0,\\n \\\"e30\\\": 0.0,\\n \\\"e31\\\": 0.0,\\n \\\"e32\\\": 0.0,\\n \\\"e33\\\": 1.0\\n }\\n}\"\n }\n ],\n \"m_PreviewExpanded\": false\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.TimeNode"
},
"JSONnodeData": "{\n \"m_GuidSerialized\": \"38cdda13-6816-454d-a834-035268698849\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"Time\",\n \"m_DrawState\": {\n \"m_Expanded\": false,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": 48.00003433227539,\n \"y\": 108.99995422363281,\n \"width\": 75.0,\n \"height\": 77.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"Time\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Time\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"Sine Time\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Sine Time\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 2,\\n \\\"m_DisplayName\\\": \\\"Cosine Time\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Cosine Time\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 3,\\n \\\"m_DisplayName\\\": \\\"Delta Time\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Delta Time\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 4,\\n \\\"m_DisplayName\\\": \\\"Smooth Delta\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Smooth Delta\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n }\n ],\n \"m_PreviewExpanded\": true\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.AddNode"
},
"JSONnodeData": "{\n \"m_GuidSerialized\": \"bc7444dc-8505-4e77-a28b-6dbe95f7a238\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"Add\",\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": 317.0,\n \"y\": 263.0,\n \"width\": 122.0,\n \"height\": 118.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"A\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"A\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"B\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"B\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 2,\\n \\\"m_DisplayName\\\": \\\"Out\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Out\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n }\n ],\n \"m_PreviewExpanded\": false\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.SineNode"
},
"JSONnodeData": "{\n \"m_GuidSerialized\": \"1b303909-07bc-4de9-8d41-8b4d762ad743\",\n \"m_GroupGuidSerialized\": \"41c12357-62d5-420d-bbf0-186ea48337b1\",\n \"m_Name\": \"Sine\",\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -847.0,\n \"y\": 2.0000252723693849,\n \"width\": 123.00000762939453,\n \"height\": 94.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"In\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"In\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"Out\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Out\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n }\n ],\n \"m_PreviewExpanded\": false\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.CosineNode"
},
"JSONnodeData": "{\n \"m_GuidSerialized\": \"dfdf2055-22ce-44e0-9360-bd63d1812c75\",\n \"m_GroupGuidSerialized\": \"41c12357-62d5-420d-bbf0-186ea48337b1\",\n \"m_Name\": \"Cosine\",\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -849.0,\n \"y\": 112.00003814697266,\n \"width\": 123.00000762939453,\n \"height\": 94.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"In\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"In\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"Out\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Out\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n }\n ],\n \"m_PreviewExpanded\": false\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.SplitNode"
},
"JSONnodeData": "{\n \"m_GuidSerialized\": \"dc545918-35b3-45b4-8b75-44da6099161b\",\n \"m_GroupGuidSerialized\": \"41c12357-62d5-420d-bbf0-186ea48337b1\",\n \"m_Name\": \"Split\",\n \"m_DrawState\": {\n \"m_Expanded\": false,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -983.9999389648438,\n \"y\": 38.0000114440918,\n \"width\": 114.0,\n \"height\": 101.00000762939453\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"In\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"In\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"R\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"R\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 2,\\n \\\"m_DisplayName\\\": \\\"G\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"G\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 3,\\n \\\"m_DisplayName\\\": \\\"B\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"B\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 4,\\n \\\"m_DisplayName\\\": \\\"A\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"A\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n }\n ],\n \"m_PreviewExpanded\": true\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.CombineNode"
},
"JSONnodeData": "{\n \"m_GuidSerialized\": \"ca74969a-af21-4f32-906d-74ee8424edb9\",\n \"m_GroupGuidSerialized\": \"41c12357-62d5-420d-bbf0-186ea48337b1\",\n \"m_Name\": \"Combine\",\n \"m_DrawState\": {\n \"m_Expanded\": false,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -694.9999389648438,\n \"y\": 43.00002670288086,\n \"width\": 121.0,\n \"height\": 118.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"R\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"R\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"G\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"G\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 2,\\n \\\"m_DisplayName\\\": \\\"B\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"B\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 3,\\n \\\"m_DisplayName\\\": \\\"A\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"A\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector4MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 4,\\n \\\"m_DisplayName\\\": \\\"RGBA\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"RGBA\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector3MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 5,\\n \\\"m_DisplayName\\\": \\\"RGB\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"RGB\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\",\\n \\\"Z\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector2MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 6,\\n \\\"m_DisplayName\\\": \\\"RG\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"RG\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\"\\n ]\\n}\"\n }\n ],\n \"m_PreviewExpanded\": false\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.NormalizeNode"
},
"JSONnodeData": "{\n \"m_GuidSerialized\": \"546ba884-4094-4754-817a-b9419b61d3ae\",\n \"m_GroupGuidSerialized\": \"41c12357-62d5-420d-bbf0-186ea48337b1\",\n \"m_Name\": \"Normalize\",\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -536.0,\n \"y\": -2.9999916553497316,\n \"width\": 123.00000762939453,\n \"height\": 94.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"In\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"In\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"Out\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Out\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n }\n ],\n \"m_PreviewExpanded\": false\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.CosineNode"
},
"JSONnodeData": "{\n \"m_GuidSerialized\": \"9523a8bd-eb1e-4fe8-879f-40ff1f0e6158\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"Cosine\",\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": 637.0,\n \"y\": 65.0,\n \"width\": 123.0,\n \"height\": 94.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"In\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"In\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"Out\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Out\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n }\n ],\n \"m_PreviewExpanded\": false\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.PropertyNode"
},
"JSONnodeData": "{\n \"m_GuidSerialized\": \"d3bf50ed-fd2e-4951-82b0-b533f08c6cd2\",\n \"m_GroupGuidSerialized\": \"e1cad54c-ed2c-4ec2-9ca4-8ab28b699bb6\",\n \"m_Name\": \"Property\",\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -346.0,\n \"y\": 289.0,\n \"width\": 129.0,\n \"height\": 34.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector2MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"PositionWS\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Out\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\"\\n ]\\n}\"\n }\n ],\n \"m_PreviewExpanded\": true,\n \"m_PropertyGuidSerialized\": \"aeefdbaf-8e06-4609-a30f-f67419e845a7\"\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.PropertyNode"
},
"JSONnodeData": "{\n \"m_GuidSerialized\": \"e5f420e3-2e52-4998-996b-b5c64ce003e0\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"Property\",\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -7.999978065490723,\n \"y\": 200.0,\n \"width\": 135.0,\n \"height\": 34.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"WaveSpeed\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Out\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n }\n ],\n \"m_PreviewExpanded\": true,\n \"m_PropertyGuidSerialized\": \"8f63cb42-bf59-43eb-ba27-5d049864a1b7\"\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.PropertyNode"
},
"JSONnodeData": "{\n \"m_GuidSerialized\": \"fe02e829-5aaa-4f0b-a386-17a7dbc377a5\",\n \"m_GroupGuidSerialized\": \"41c12357-62d5-420d-bbf0-186ea48337b1\",\n \"m_Name\": \"Property\",\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -1124.0,\n \"y\": 37.000022888183597,\n \"width\": 117.0,\n \"height\": 34.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector2MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"Direction\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Out\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\"\\n ]\\n}\"\n }\n ],\n \"m_PreviewExpanded\": true,\n \"m_PropertyGuidSerialized\": \"d67ebba8-8192-4475-b3e0-2ea7f568875f\"\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.PropertyNode"
},
"JSONnodeData": "{\n \"m_GuidSerialized\": \"2ea1e991-c155-4ea0-9b87-a68915922e85\",\n \"m_GroupGuidSerialized\": \"efc0a636-e970-439e-81e2-b32304cc24fb\",\n \"m_Name\": \"Property\",\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -342.0000305175781,\n \"y\": 527.0,\n \"width\": 133.0,\n \"height\": 34.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"Wavelength\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Out\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n }\n ],\n \"m_PreviewExpanded\": true,\n \"m_PropertyGuidSerialized\": \"6e16ae66-da50-4bd7-8271-2cd58482d131\"\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.DivideNode"
},
"JSONnodeData": "{\n \"m_GuidSerialized\": \"8f5b007b-9f95-4364-8807-02241e2feb3a\",\n \"m_GroupGuidSerialized\": \"efc0a636-e970-439e-81e2-b32304cc24fb\",\n \"m_Name\": \"Divide\",\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -186.00001525878907,\n \"y\": 431.0000305175781,\n \"width\": 124.0,\n \"height\": 118.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"A\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"A\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 6.283180236816406,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"B\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"B\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 2.0,\\n \\\"y\\\": 2.0,\\n \\\"z\\\": 2.0,\\n \\\"w\\\": 2.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 2,\\n \\\"m_DisplayName\\\": \\\"Out\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Out\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n }\n ],\n \"m_PreviewExpanded\": false\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.MultiplyNode"
},
"JSONnodeData": "{\n \"m_GuidSerialized\": \"3d8cdea2-8c5e-499c-964d-d296b089c944\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"Multiply\",\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": 44.000003814697269,\n \"y\": 288.0000305175781,\n \"width\": 124.0,\n \"height\": 118.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicValueMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"A\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"A\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"e00\\\": 0.0,\\n \\\"e01\\\": 0.0,\\n \\\"e02\\\": 0.0,\\n \\\"e03\\\": 0.0,\\n \\\"e10\\\": 0.0,\\n \\\"e11\\\": 0.0,\\n \\\"e12\\\": 0.0,\\n \\\"e13\\\": 0.0,\\n \\\"e20\\\": 0.0,\\n \\\"e21\\\": 0.0,\\n \\\"e22\\\": 0.0,\\n \\\"e23\\\": 0.0,\\n \\\"e30\\\": 0.0,\\n \\\"e31\\\": 0.0,\\n \\\"e32\\\": 0.0,\\n \\\"e33\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"e00\\\": 1.0,\\n \\\"e01\\\": 0.0,\\n \\\"e02\\\": 0.0,\\n \\\"e03\\\": 0.0,\\n \\\"e10\\\": 0.0,\\n \\\"e11\\\": 1.0,\\n \\\"e12\\\": 0.0,\\n \\\"e13\\\": 0.0,\\n \\\"e20\\\": 0.0,\\n \\\"e21\\\": 0.0,\\n \\\"e22\\\": 1.0,\\n \\\"e23\\\": 0.0,\\n \\\"e30\\\": 0.0,\\n \\\"e31\\\": 0.0,\\n \\\"e32\\\": 0.0,\\n \\\"e33\\\": 1.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicValueMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"B\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"B\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"e00\\\": 2.0,\\n \\\"e01\\\": 2.0,\\n \\\"e02\\\": 2.0,\\n \\\"e03\\\": 2.0,\\n \\\"e10\\\": 2.0,\\n \\\"e11\\\": 2.0,\\n \\\"e12\\\": 2.0,\\n \\\"e13\\\": 2.0,\\n \\\"e20\\\": 2.0,\\n \\\"e21\\\": 2.0,\\n \\\"e22\\\": 2.0,\\n \\\"e23\\\": 2.0,\\n \\\"e30\\\": 2.0,\\n \\\"e31\\\": 2.0,\\n \\\"e32\\\": 2.0,\\n \\\"e33\\\": 2.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"e00\\\": 1.0,\\n \\\"e01\\\": 0.0,\\n \\\"e02\\\": 0.0,\\n \\\"e03\\\": 0.0,\\n \\\"e10\\\": 0.0,\\n \\\"e11\\\": 1.0,\\n \\\"e12\\\": 0.0,\\n \\\"e13\\\": 0.0,\\n \\\"e20\\\": 0.0,\\n \\\"e21\\\": 0.0,\\n \\\"e22\\\": 1.0,\\n \\\"e23\\\": 0.0,\\n \\\"e30\\\": 0.0,\\n \\\"e31\\\": 0.0,\\n \\\"e32\\\": 0.0,\\n \\\"e33\\\": 1.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicValueMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 2,\\n \\\"m_DisplayName\\\": \\\"Out\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Out\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"e00\\\": 0.0,\\n \\\"e01\\\": 0.0,\\n \\\"e02\\\": 0.0,\\n \\\"e03\\\": 0.0,\\n \\\"e10\\\": 0.0,\\n \\\"e11\\\": 0.0,\\n \\\"e12\\\": 0.0,\\n \\\"e13\\\": 0.0,\\n \\\"e20\\\": 0.0,\\n \\\"e21\\\": 0.0,\\n \\\"e22\\\": 0.0,\\n \\\"e23\\\": 0.0,\\n \\\"e30\\\": 0.0,\\n \\\"e31\\\": 0.0,\\n \\\"e32\\\": 0.0,\\n \\\"e33\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"e00\\\": 1.0,\\n \\\"e01\\\": 0.0,\\n \\\"e02\\\": 0.0,\\n \\\"e03\\\": 0.0,\\n \\\"e10\\\": 0.0,\\n \\\"e11\\\": 1.0,\\n \\\"e12\\\": 0.0,\\n \\\"e13\\\": 0.0,\\n \\\"e20\\\": 0.0,\\n \\\"e21\\\": 0.0,\\n \\\"e22\\\": 1.0,\\n \\\"e23\\\": 0.0,\\n \\\"e30\\\": 0.0,\\n \\\"e31\\\": 0.0,\\n \\\"e32\\\": 0.0,\\n \\\"e33\\\": 1.0\\n }\\n}\"\n }\n ],\n \"m_PreviewExpanded\": false\n}"
}
],
"m_Groups": [
{
"m_GuidSerialized": "41c12357-62d5-420d-bbf0-186ea48337b1",
"m_Title": "Wind Direction",
"m_Position": {
"x": 55.292537689208987,
"y": 12.417510032653809
}
},
{
"m_GuidSerialized": "e1cad54c-ed2c-4ec2-9ca4-8ab28b699bb6",
"m_Title": "Direction",
"m_Position": {
"x": 45.19003677368164,
"y": 9.902510643005371
}
},
{
"m_GuidSerialized": "efc0a636-e970-439e-81e2-b32304cc24fb",
"m_Title": "W",
"m_Position": {
"x": 41.300079345703128,
"y": 35.034942626953128
}
}
],
"m_SerializableEdges": [
{
"typeInfo": {
"fullName": "UnityEditor.Graphing.Edge"
},
"JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 1,\n \"m_NodeGUIDSerialized\": \"546ba884-4094-4754-817a-b9419b61d3ae\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"81b6e165-ee60-4b75-b79f-ecebc2bc6f47\"\n }\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.Graphing.Edge"
},
"JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"38cdda13-6816-454d-a834-035268698849\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"51e152d7-3931-4d7a-bfcd-bc25dc9a89e9\"\n }\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.Graphing.Edge"
},
"JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 2,\n \"m_NodeGUIDSerialized\": \"51e152d7-3931-4d7a-bfcd-bc25dc9a89e9\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"bc7444dc-8505-4e77-a28b-6dbe95f7a238\"\n }\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.Graphing.Edge"
},
"JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 2,\n \"m_NodeGUIDSerialized\": \"bc7444dc-8505-4e77-a28b-6dbe95f7a238\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"9523a8bd-eb1e-4fe8-879f-40ff1f0e6158\"\n }\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.Graphing.Edge"
},
"JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 1,\n \"m_NodeGUIDSerialized\": \"dc545918-35b3-45b4-8b75-44da6099161b\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"1b303909-07bc-4de9-8d41-8b4d762ad743\"\n }\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.Graphing.Edge"
},
"JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 1,\n \"m_NodeGUIDSerialized\": \"1b303909-07bc-4de9-8d41-8b4d762ad743\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"ca74969a-af21-4f32-906d-74ee8424edb9\"\n }\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.Graphing.Edge"
},
"JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 2,\n \"m_NodeGUIDSerialized\": \"dc545918-35b3-45b4-8b75-44da6099161b\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"dfdf2055-22ce-44e0-9360-bd63d1812c75\"\n }\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.Graphing.Edge"
},
"JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 1,\n \"m_NodeGUIDSerialized\": \"dfdf2055-22ce-44e0-9360-bd63d1812c75\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 1,\n \"m_NodeGUIDSerialized\": \"ca74969a-af21-4f32-906d-74ee8424edb9\"\n }\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.Graphing.Edge"
},
"JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 6,\n \"m_NodeGUIDSerialized\": \"ca74969a-af21-4f32-906d-74ee8424edb9\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"546ba884-4094-4754-817a-b9419b61d3ae\"\n }\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.Graphing.Edge"
},
"JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"d3bf50ed-fd2e-4951-82b0-b533f08c6cd2\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 1,\n \"m_NodeGUIDSerialized\": \"81b6e165-ee60-4b75-b79f-ecebc2bc6f47\"\n }\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.Graphing.Edge"
},
"JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"e5f420e3-2e52-4998-996b-b5c64ce003e0\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 1,\n \"m_NodeGUIDSerialized\": \"51e152d7-3931-4d7a-bfcd-bc25dc9a89e9\"\n }\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.Graphing.Edge"
},
"JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"fe02e829-5aaa-4f0b-a386-17a7dbc377a5\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"dc545918-35b3-45b4-8b75-44da6099161b\"\n }\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.Graphing.Edge"
},
"JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 1,\n \"m_NodeGUIDSerialized\": \"9523a8bd-eb1e-4fe8-879f-40ff1f0e6158\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 1,\n \"m_NodeGUIDSerialized\": \"f40aece3-7622-466f-8d20-8878977bde6c\"\n }\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.Graphing.Edge"
},
"JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"2ea1e991-c155-4ea0-9b87-a68915922e85\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 1,\n \"m_NodeGUIDSerialized\": \"8f5b007b-9f95-4364-8807-02241e2feb3a\"\n }\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.Graphing.Edge"
},
"JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 2,\n \"m_NodeGUIDSerialized\": \"8f5b007b-9f95-4364-8807-02241e2feb3a\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 1,\n \"m_NodeGUIDSerialized\": \"3d8cdea2-8c5e-499c-964d-d296b089c944\"\n }\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.Graphing.Edge"
},
"JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 2,\n \"m_NodeGUIDSerialized\": \"81b6e165-ee60-4b75-b79f-ecebc2bc6f47\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"3d8cdea2-8c5e-499c-964d-d296b089c944\"\n }\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.Graphing.Edge"
},
"JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 2,\n \"m_NodeGUIDSerialized\": \"3d8cdea2-8c5e-499c-964d-d296b089c944\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 1,\n \"m_NodeGUIDSerialized\": \"bc7444dc-8505-4e77-a28b-6dbe95f7a238\"\n }\n}"
}
],
"m_PreviewData": {
"serializedMesh": {
"m_SerializedMesh": "",
"m_Guid": ""
}
},
"m_Path": "Sub Graphs"
}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 050d4204de13e4b108feb78488946f52
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,158 @@
// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
Shader "Unlit/InfiniteWater"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_Size ("size", float) = 3.0
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent-101" "RenderPipeline" = "UniversalPipeline" }
LOD 100
Pass
{
ZWrite On
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
// make fog work
#pragma multi_compile_fog
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "WaterInput.hlsl"
#include "CommonUtilities.hlsl"
#include "WaterLighting.hlsl"
#define EPSILON 0.00001
// ray-plane intersection test
// @return side of plane hit
// 0 : no hit
// 1 : front
// 2 : back
int intersect_plane (float3 ro, float3 rd, float3 po, float3 pd, out float3 hit)
{
float D = dot(po, pd); // re-parameterize plane to normal + distance
float tn = D - dot(ro, pd); // ray pos w.r.t. plane (frnt, back, on)
float td = dot (rd, pd); // ray ori w.r.t. plane (towards, away, parallel)
if (td > -EPSILON && td < EPSILON) return 0; // parallel to plane
float t = tn / td; // dist along ray to hit
if (t < 0.0) return 0; // plane lies behind ray
hit = ro + t * rd; // got a hit
return (tn > 0.0) ? 2 : 1; // which side of the plane?
}
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 screenPos : TEXCOORD2;//screen position of the verticies after wave distortion
float4 viewDir : TEXCOORD3;
float4 vertex : SV_POSITION;
};
sampler2D _MainTex;
float4 _MainTex_ST;
float _Size;
float _CameraRoll;
v2f vert (appdata v)
{
v2f o;
float3 posWS = TransformObjectToWorld(v.vertex.xyz);
o.vertex = TransformWorldToHClip(posWS);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
o.screenPos = ComputeScreenPos(o.vertex);
o.viewDir.xyz = UNITY_MATRIX_IT_MV[2].xyz;
float3 viewPos = TransformWorldToView(posWS);// posWS - _WorldSpaceCameraPos;
o.viewDir.w = length(viewPos / viewPos.z);
return o;
}
void frag (v2f i, out half4 outColor:SV_Target, out float outDepth : SV_Depth) //: SV_Target
{
float3 viewDir = i.viewDir.xyz; //UNITY_MATRIX_IT_MV[2].xyz;
float3 pos = _WorldSpaceCameraPos * viewDir;
i.uv = pos.xy;
//////
float4 p = i.screenPos;
float2 uv = p.xy / p.w; // [0, 1]
half2 st = 2.0 * uv - half2(1.0, 1.0);
float asp = _ScreenParams.x / _ScreenParams.y;
float2 st_adj = float2(st.x * asp, st.y);
// camera settings
//float dist = 2.0 + 0.5*sin(0.5*Time);
//float theta = 0.1230596391*_Time.y;
// float cx = dist * sin(theta);
// float cz = dist * cos(theta);
float3 cam_ori = float3(-_WorldSpaceCameraPos.x, _WorldSpaceCameraPos.y, _WorldSpaceCameraPos.z);
// vec3 cam_look = vec3(0.0, 0.50, 0.0);
float3 cam_dir = float3(viewDir.x, -viewDir.y, -viewDir.z);
// over, up, norm basis vectors for camera
half zRot = radians(-_CameraRoll);
float3 cam_ovr = normalize(cross(cam_dir, half3(0, cos(zRot), sin(zRot))));
float3 cam_uhp = normalize(cross(cam_ovr, cam_dir));
// scene
float3 po = 0;
float3 pd = half3(0.0, 1.0, 0.0);
// ray
half3 ro = cam_ori;
float cam_dist = unity_CameraProjection._m11;//80 degrees = 1.2
float3 rt = cam_ori + cam_dist*cam_dir;
rt += st_adj.x * cam_ovr;
rt += st_adj.y * cam_uhp;
half3 rd = normalize(rt - cam_ori);
float3 hit;
int side = intersect_plane (ro, rd, po, pd, hit);
if(side == 0)
discard;
//half fog = pow(1-abs(rd.y), 20);
// plane
// - figure out UV on plane to sample texture
half3 dee = hit;
float tSize = 0.05;
float2 p_uv = float2(dot(dee, half3(1, 0, 0)) * tSize, dot(dee, half3(0, 0, 1)) * tSize);
///
// sample the texture
half4 col = tex2D(_MainTex, p_uv);
//re-construct depth
half3 camPos = _WorldSpaceCameraPos;
float a = _ProjectionParams.z / ( _ProjectionParams.z - _ProjectionParams.y );
float b = _ProjectionParams.z * _ProjectionParams.y / ( _ProjectionParams.y - _ProjectionParams.z );
float z = length(hit + half3(camPos.x, camPos.y + 1, -camPos.z)) / i.viewDir.w;
float d = a + b / z;
// apply fog
//UNITY_APPLY_FOG(i.fogCoord, col);
//return float4(col);
//outColor = half4(i.viewDir.xyz, 1);
outColor = half4(frac(p_uv), frac(1-d), 1);
outDepth = 1-d;
}
ENDHLSL
}
}
FallBack "Hidden/InternalErrorShader"
}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 5f51d4f8f480441339ead24ab495af7d
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,52 @@
Shader "BoatAttack/Water"
{
Properties
{
_BumpScale("Detail Wave Amount", Range(0, 2)) = 0.2//fine detail multiplier
_DitherPattern ("Dithering Pattern", 2D) = "bump" {}
[Toggle(_STATIC_SHADER)] _Static ("Static", Float) = 0
[KeywordEnum(Off, SSS, Refraction, Reflection, Normal, Fresnel, WaterEffects, Foam, WaterDepth)] _Debug ("Debug mode", Float) = 0
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent-100" "RenderPipeline" = "UniversalPipeline" }
ZWrite On
Pass
{
Name "WaterShading"
Tags{"LightMode" = "UniversalForward"}
HLSLPROGRAM
#pragma prefer_hlslcc gles
/////////////////SHADER FEATURES//////////////////
#pragma shader_feature _REFLECTION_CUBEMAP _REFLECTION_PROBES _REFLECTION_PLANARREFLECTION
#pragma multi_compile _ USE_STRUCTURED_BUFFER
#pragma multi_compile _ _STATIC_SHADER
#pragma shader_feature _DEBUG_OFF _DEBUG_SSS _DEBUG_REFRACTION _DEBUG_REFLECTION _DEBUG_NORMAL _DEBUG_FRESNEL _DEBUG_WATEREFFECTS _DEBUG_FOAM _DEBUG_WATERDEPTH
// -------------------------------------
// Lightweight Pipeline keywords
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE
#pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS
#pragma multi_compile _ _ADDITIONAL_LIGHT_SHADOWS
#pragma multi_compile _ _SHADOWS_SOFT
//--------------------------------------
// GPU Instancing
#pragma multi_compile_instancing
#pragma multi_compile_fog
////////////////////INCLUDES//////////////////////
#include "WaterCommon.hlsl"
//non-tess
#pragma vertex WaterVertex
#pragma fragment WaterFragment
ENDHLSL
}
}
FallBack "Hidden/InternalErrorShader"
}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: a94edd303261140cf9e6ce8c90d7a99a
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,301 @@
#ifndef WATER_COMMON_INCLUDED
#define WATER_COMMON_INCLUDED
#define SHADOWS_SCREEN 0
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "WaterInput.hlsl"
#include "CommonUtilities.hlsl"
#include "GerstnerWaves.hlsl"
#include "WaterLighting.hlsl"
///////////////////////////////////////////////////////////////////////////////
// Structs //
///////////////////////////////////////////////////////////////////////////////
struct WaterVertexInput // vert struct
{
float4 vertex : POSITION; // vertex positions
float2 texcoord : TEXCOORD0; // local UVs
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct WaterVertexOutput // fragment struct
{
float4 uv : TEXCOORD0; // Geometric UVs stored in xy, and world(pre-waves) in zw
float3 posWS : TEXCOORD1; // world position of the vertices
half3 normal : NORMAL; // vert normals
float3 viewDir : TEXCOORD2; // view direction
float3 preWaveSP : TEXCOORD3; // screen position of the verticies before wave distortion
half2 fogFactorNoise : TEXCOORD4; // x: fogFactor, y: noise
float4 additionalData : TEXCOORD5; // x = distance to surface, y = distance to surface, z = normalized wave height, w = horizontal movement
half4 shadowCoord : TEXCOORD6; // for ssshadows
float4 clipPos : SV_POSITION;
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
///////////////////////////////////////////////////////////////////////////////
// Water debug functions //
///////////////////////////////////////////////////////////////////////////////
half3 DebugWaterFX(half3 input, half4 waterFX, half screenUV)
{
input = lerp(input, half3(waterFX.y, 1, waterFX.z), saturate(floor(screenUV + 0.7)));
input = lerp(input, waterFX.xxx, saturate(floor(screenUV + 0.5)));
half3 disp = lerp(0, half3(1, 0, 0), saturate((waterFX.www - 0.5) * 4));
disp += lerp(0, half3(0, 0, 1), saturate(((1-waterFX.www) - 0.5) * 4));
input = lerp(input, disp, saturate(floor(screenUV + 0.3)));
return input;
}
///////////////////////////////////////////////////////////////////////////////
// Water shading functions //
///////////////////////////////////////////////////////////////////////////////
half3 Scattering(half depth)
{
return SAMPLE_TEXTURE2D(_AbsorptionScatteringRamp, sampler_AbsorptionScatteringRamp, half2(depth, 0.375h)).rgb;
}
half3 Absorption(half depth)
{
return SAMPLE_TEXTURE2D(_AbsorptionScatteringRamp, sampler_AbsorptionScatteringRamp, half2(depth, 0.0h)).rgb;
}
float2 AdjustedDepth(half2 uvs, half4 additionalData)
{
float rawD = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, sampler_ScreenTextures_linear_clamp, uvs);
float d = LinearEyeDepth(rawD, _ZBufferParams);
// TODO: Changing the usage of UNITY_REVERSED_Z this way to fix testing, but I'm not sure the original code is correct anyway.
// In OpenGL, rawD should already have be remmapped before converting depth to linear eye depth.
#if UNITY_REVERSED_Z
float offset = 0;
#else
float offset = 1;
#endif
return float2(d * additionalData.x - additionalData.y, (rawD * -_ProjectionParams.x) + offset);
}
float WaterTextureDepth(float3 posWS)
{
return (1 - SAMPLE_TEXTURE2D_LOD(_WaterDepthMap, sampler_WaterDepthMap_linear_clamp, posWS.xz * 0.002 + 0.5, 1).r) * (_MaxDepth + _VeraslWater_DepthCamParams.x) - _VeraslWater_DepthCamParams.x;
}
float3 WaterDepth(float3 posWS, half4 additionalData, half2 screenUVs)// x = seafloor depth, y = water depth
{
float3 outDepth = 0;
outDepth.xz = AdjustedDepth(screenUVs, additionalData);
float wd = WaterTextureDepth(posWS);
outDepth.y = wd + posWS.y;
return outDepth;
}
half3 Refraction(half2 distortion, half depth, real depthMulti)
{
half3 output = SAMPLE_TEXTURE2D_LOD(_CameraOpaqueTexture, sampler_CameraOpaqueTexture_linear_clamp, distortion, depth * 0.25).rgb;
output *= Absorption((depth) * depthMulti);
return output;
}
half2 DistortionUVs(half depth, float3 normalWS)
{
half3 viewNormal = mul((float3x3)GetWorldToHClipMatrix(), -normalWS).xyz;
return viewNormal.xz * saturate((depth) * 0.005);
}
half4 AdditionalData(float3 postionWS, WaveStruct wave)
{
half4 data = half4(0.0, 0.0, 0.0, 0.0);
float3 viewPos = TransformWorldToView(postionWS);
data.x = length(viewPos / viewPos.z);// distance to surface
data.y = length(GetCameraPositionWS().xyz - postionWS); // local position in camera space
data.z = wave.position.y / _MaxWaveHeight * 0.5 + 0.5; // encode the normalized wave height into additional data
data.w = wave.position.x + wave.position.z;
return data;
}
WaterVertexOutput WaveVertexOperations(WaterVertexOutput input)
{
#ifdef _STATIC_SHADER
float time = 0;
#else
float time = _Time.y;
#endif
input.normal = float3(0, 1, 0);
input.fogFactorNoise.y = ((noise((input.posWS.xz * 0.5) + time) + noise((input.posWS.xz * 1) + time)) * 0.25 - 0.5) + 1;
// Detail UVs
input.uv.zw = input.posWS.xz * 0.1h + time * 0.05h + (input.fogFactorNoise.y * 0.1);
input.uv.xy = input.posWS.xz * 0.4h - time.xx * 0.1h + (input.fogFactorNoise.y * 0.2);
half4 screenUV = ComputeScreenPos(TransformWorldToHClip(input.posWS));
screenUV.xyz /= screenUV.w;
// shallows mask
half waterDepth = WaterTextureDepth(input.posWS);
input.posWS.y += pow(saturate((-waterDepth + 1.5) * 0.4), 2);
//Gerstner here
WaveStruct wave;
SampleWaves(input.posWS, saturate((waterDepth * 0.1 + 0.05)), wave);
input.normal = wave.normal;
input.posWS += wave.position;
#ifdef SHADER_API_PS4
input.posWS.y -= 0.5;
#endif
// Dynamic displacement
half4 waterFX = SAMPLE_TEXTURE2D_LOD(_WaterFXMap, sampler_ScreenTextures_linear_clamp, screenUV.xy, 0);
input.posWS.y += waterFX.w * 2 - 1;
// After waves
input.clipPos = TransformWorldToHClip(input.posWS);
input.shadowCoord = ComputeScreenPos(input.clipPos);
input.viewDir = SafeNormalize(_WorldSpaceCameraPos - input.posWS);
// Fog
input.fogFactorNoise.x = ComputeFogFactor(input.clipPos.z);
input.preWaveSP = screenUV.xyz; // pre-displaced screenUVs
// Additional data
input.additionalData = AdditionalData(input.posWS, wave);
// distance blend
half distanceBlend = saturate(abs(length((_WorldSpaceCameraPos.xz - input.posWS.xz) * 0.005)) - 0.25);
input.normal = lerp(input.normal, half3(0, 1, 0), distanceBlend);
return input;
}
///////////////////////////////////////////////////////////////////////////////
// Vertex and Fragment functions //
///////////////////////////////////////////////////////////////////////////////
// Vertex: Used for Standard non-tessellated water
WaterVertexOutput WaterVertex(WaterVertexInput v)
{
WaterVertexOutput o;// = (WaterVertexOutput)0;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.uv.xy = v.texcoord; // geo uvs
o.posWS = TransformObjectToWorld(v.vertex.xyz);
o = WaveVertexOperations(o);
return o;
}
// Fragment for water
half4 WaterFragment(WaterVertexOutput IN) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(IN);
half3 screenUV = IN.shadowCoord.xyz / IN.shadowCoord.w;//screen UVs
half4 waterFX = SAMPLE_TEXTURE2D(_WaterFXMap, sampler_ScreenTextures_linear_clamp, IN.preWaveSP.xy);
// Depth
float3 depth = WaterDepth(IN.posWS, IN.additionalData, screenUV.xy);// TODO - hardcoded shore depth UVs
//return half4(0, frac(ceil(depth.y) / _MaxDepth), frac(IN.posWS.y), 1);
half depthMulti = 1 / _MaxDepth;
// Detail waves
half2 detailBump1 = SAMPLE_TEXTURE2D(_SurfaceMap, sampler_SurfaceMap, IN.uv.zw).xy * 2 - 1;
half2 detailBump2 = SAMPLE_TEXTURE2D(_SurfaceMap, sampler_SurfaceMap, IN.uv.xy).xy * 2 - 1;
half2 detailBump = (detailBump1 + detailBump2 * 0.5) * saturate(depth.x * 0.25 + 0.25);
IN.normal += half3(detailBump.x, 0, detailBump.y) * _BumpScale;
IN.normal += half3(1-waterFX.y, 0.5h, 1-waterFX.z) - 0.5;
IN.normal = normalize(IN.normal);
// Distortion
half2 distortion = DistortionUVs(depth.x, IN.normal);
distortion = screenUV.xy + distortion;// * clamp(depth.x, 0, 5);
float d = depth.x;
depth.xz = AdjustedDepth(distortion, IN.additionalData);
distortion = depth.x < 0 ? screenUV.xy : distortion;
depth.x = depth.x < 0 ? d : depth.x;
// Fresnel
half fresnelTerm = CalculateFresnelTerm(IN.normal, IN.viewDir.xyz);
//return fresnelTerm.xxxx;
// Lighting
Light mainLight = GetMainLight(TransformWorldToShadowCoord(IN.posWS));
half shadow = SoftShadows(screenUV, IN.posWS, IN.viewDir.xyz, depth.x);
half3 GI = SampleSH(IN.normal);
// SSS
half3 directLighting = dot(mainLight.direction, half3(0, 1, 0)) * mainLight.color;
directLighting += saturate(pow(dot(IN.viewDir, -mainLight.direction) * IN.additionalData.z, 3)) * 5 * mainLight.color;
half3 sss = directLighting * shadow + GI;
// Foam
half3 foamMap = SAMPLE_TEXTURE2D(_FoamMap, sampler_FoamMap, IN.uv.zw).rgb; //r=thick, g=medium, b=light
half depthEdge = saturate(depth.x * 20);
half waveFoam = saturate(IN.additionalData.z - 0.75 * 0.5); // wave tips
half depthAdd = saturate(1 - depth.x * 4) * 0.5;
half edgeFoam = saturate((1 - min(depth.x, depth.y) * 0.5 - 0.25) + depthAdd) * depthEdge;
half foamBlendMask = max(max(waveFoam, edgeFoam), waterFX.r * 2);
half3 foamBlend = SAMPLE_TEXTURE2D(_AbsorptionScatteringRamp, sampler_AbsorptionScatteringRamp, half2(foamBlendMask, 0.66)).rgb;
half foamMask = saturate(length(foamMap * foamBlend) * 1.5 - 0.1);
// Foam lighting
half3 foam = foamMask.xxx * (mainLight.shadowAttenuation * mainLight.color + GI);
BRDFData brdfData;
half alpha = 1;
InitializeBRDFData(half3(0, 0, 0), 0, half3(1, 1, 1), 0.95, alpha, brdfData);
half3 spec = DirectBDRF(brdfData, IN.normal, mainLight.direction, IN.viewDir) * shadow * mainLight.color;
#ifdef _ADDITIONAL_LIGHTS
uint pixelLightCount = GetAdditionalLightsCount();
for (uint lightIndex = 0u; lightIndex < pixelLightCount; ++lightIndex)
{
Light light = GetAdditionalLight(lightIndex, IN.posWS);
spec += LightingPhysicallyBased(brdfData, light, IN.normal, IN.viewDir);
sss += light.distanceAttenuation * light.color;
}
#endif
sss *= Scattering(depth.x * depthMulti);
// Reflections
half3 reflection = SampleReflections(IN.normal, IN.viewDir.xyz, screenUV.xy, 0.0);
// Refraction
half3 refraction = Refraction(distortion, depth.x, depthMulti);
// Do compositing
half3 comp = lerp(lerp(refraction, reflection, fresnelTerm) + sss + spec, foam, foamMask); //lerp(refraction, color + reflection + foam, 1-saturate(1-depth.x * 25));
// Fog
float fogFactor = IN.fogFactorNoise.x;
comp = MixFog(comp, fogFactor);
#if defined(_DEBUG_FOAM)
return half4(foamMask.xxx, 1);
#elif defined(_DEBUG_SSS)
return half4(sss, 1);
#elif defined(_DEBUG_REFRACTION)
return half4(refraction, 1);
#elif defined(_DEBUG_REFLECTION)
return half4(reflection, 1);
#elif defined(_DEBUG_NORMAL)
return half4(IN.normal.x * 0.5 + 0.5, 0, IN.normal.z * 0.5 + 0.5, 1);
#elif defined(_DEBUG_FRESNEL)
return half4(fresnelTerm.xxx, 1);
#elif defined(_DEBUG_WATEREFFECTS)
return half4(waterFX);
#elif defined(_DEBUG_WATERDEPTH)
return half4(frac(depth), 1);
#else
return half4(comp, 1);
#endif
}
#endif // WATER_COMMON_INCLUDED
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 8169b68b201d74e3597abae6c06c4264
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,61 @@
Shader "Unlit/WaterFXFoamOnly"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent" "RenderPipeline" = "UniversalPipeline" }
ZWrite Off
Blend One One
LOD 100
Pass
{
Name "WaterFX"
Tags{"LightMode" = "WaterFX"}
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#define _NORMALMAP 1
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
struct appdata
{
float4 vertex : POSITION;
half4 color : COLOR;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
half4 color : TEXCOORD1;
float4 vertex : SV_POSITION;
};
sampler2D _MainTex;
v2f vert (appdata v)
{
v2f o;
half3 posWS = TransformObjectToWorld(v.vertex.xyz);
o.vertex = TransformWorldToHClip(posWS);
o.uv = v.uv;
o.color = v.color;
return o;
}
half4 frag (v2f i) : SV_Target
{
half4 col = tex2D(_MainTex, i.uv) * i.color;
return half4(col.rgb, 0);
}
ENDHLSL
}
}
}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 11c17326e513c47a6a4da8bc7e511417
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,100 @@
Shader "BoatAttack/WaterFXShader"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
// Blend mode values
[Enum(UnityEngine.Rendering.BlendMode)] _SrcBlend ("Src Blend mode", Float) = 0.0
// Blend mode values
[Enum(UnityEngine.Rendering.BlendMode)] _DstBlend ("Dst Blend mode", Float) = 0.0
// Will set "_INVERT_ON" shader keyword when set
[Toggle] _Invert ("Invert?", Float) = 0
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent" "RenderPipeline" = "UniversalPipeline" }
ZWrite Off
Blend[_SrcBlend][_DstBlend]
LOD 100
Pass
{
Name "WaterFX"
Tags{"LightMode" = "WaterFX"}
HLSLPROGRAM
#pragma vertex WaterFXVertex
#pragma fragment WaterFXFragment
#pragma shader_feature _INVERT_ON
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
struct Attributes
{
float3 positionOS : POSITION;
float3 normalOS : NORMAL;
float4 tangentOS : TANGENT;
half4 color : COLOR;
float2 uv : TEXCOORD0;
};
struct Varyings
{
float2 uv : TEXCOORD0;
half4 normal : TEXCOORD1; // xyz: normal, w: viewDir.x
half4 tangent : TEXCOORD2; // xyz: tangent, w: viewDir.y
half4 bitangent : TEXCOORD3; // xyz: binormal, w: viewDir.z
half4 color : TEXCOORD4;
float4 vertex : SV_POSITION;
};
sampler2D _MainTex;
Varyings WaterFXVertex (Attributes input)
{
Varyings output = (Varyings)0;
VertexPositionInputs vertexPosition = GetVertexPositionInputs(input.positionOS.xyz);
VertexNormalInputs vertexTBN = GetVertexNormalInputs(input.normalOS, input.tangentOS);
output.vertex = vertexPosition.positionCS;
output.uv = input.uv;
output.color = input.color;
half3 viewDir = GetCameraPositionWS() - vertexPosition.positionWS;
output.normal = half4(vertexTBN.normalWS, viewDir.x);
output.tangent = half4(vertexTBN.tangentWS, viewDir.y);
output.bitangent = half4(vertexTBN.bitangentWS, viewDir.z);
return output;
}
half4 WaterFXFragment (Varyings input) : SV_Target
{
half4 col = tex2D(_MainTex, input.uv);
half foamMask = col.r * input.color.r;
half disp = col.a * 2 - 1;
disp *= input.color.a;
half3 tNorm = half3(col.b, col.g, 1) * 2 - 1;
half3 viewDir = half3(input.normal.w, input.tangent.w, input.bitangent.w);
half3 normalWS = TransformTangentToWorld(tNorm, half3x3(input.tangent.xyz, input.bitangent.xyz, input.normal.xyz));
normalWS = lerp(half3(0, 1, 0), normalWS, input.color.g);
half4 comp = half4(foamMask, normalWS.xz, disp);
#ifdef _INVERT_ON
comp *= -1;
#endif
return comp;
}
ENDHLSL
}
}
}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: e7be97cb17d9940f7b6a757181b86170
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,44 @@
#ifndef WATER_INPUT_INCLUDED
#define WATER_INPUT_INCLUDED
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
CBUFFER_START(UnityPerMaterial)
half _BumpScale;
half4 _DitherPattern_TexelSize;
CBUFFER_END
half _MaxDepth;
half _MaxWaveHeight;
int _DebugPass;
half4 _VeraslWater_DepthCamParams;
float4x4 _InvViewProjection;
// Screen Effects textures
SAMPLER(sampler_ScreenTextures_linear_clamp);
#if defined(_REFLECTION_PLANARREFLECTION)
TEXTURE2D(_PlanarReflectionTexture);
#elif defined(_REFLECTION_CUBEMAP)
TEXTURECUBE(_CubemapTexture);
SAMPLER(sampler_CubemapTexture);
#endif
TEXTURE2D(_WaterFXMap);
TEXTURE2D(_CameraDepthTexture);
TEXTURE2D(_CameraOpaqueTexture); SAMPLER(sampler_CameraOpaqueTexture_linear_clamp);
TEXTURE2D(_WaterDepthMap); SAMPLER(sampler_WaterDepthMap_linear_clamp);
// Surface textures
TEXTURE2D(_AbsorptionScatteringRamp); SAMPLER(sampler_AbsorptionScatteringRamp);
TEXTURE2D(_SurfaceMap); SAMPLER(sampler_SurfaceMap);
TEXTURE2D(_FoamMap); SAMPLER(sampler_FoamMap);
TEXTURE2D(_DitherPattern); SAMPLER(sampler_DitherPattern);
struct WaterSurfaceData
{
half3 absorption;
half3 scattering;
half3 normal;
half foam;
};
#endif // WATER_INPUT_INCLUDED
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: b63d1585d6c8e4834994e9494b1ac4fc
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,109 @@
#ifndef WATER_LIGHTING_INCLUDED
#define WATER_LIGHTING_INCLUDED
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
#define SHADOW_ITERATIONS 4
half CalculateFresnelTerm(half3 normalWS, half3 viewDirectionWS)
{
return saturate(pow(1.0 - dot(normalWS, viewDirectionWS), 5));//fresnel TODO - find a better place
}
///////////////////////////////////////////////////////////////////////////////
// Lighting Calculations //
///////////////////////////////////////////////////////////////////////////////
//diffuse
half4 VertexLightingAndFog(half3 normalWS, half3 posWS, half3 clipPos)
{
half3 vertexLight = VertexLighting(posWS, normalWS);
half fogFactor = ComputeFogFactor(clipPos.z);
return half4(fogFactor, vertexLight);
}
//specular
half3 Highlights(half3 positionWS, half roughness, half3 normalWS, half3 viewDirectionWS)
{
Light mainLight = GetMainLight();
half roughness2 = roughness * roughness;
half3 halfDir = SafeNormalize(mainLight.direction + viewDirectionWS);
half NoH = saturate(dot(normalize(normalWS), halfDir));
half LoH = saturate(dot(mainLight.direction, halfDir));
// GGX Distribution multiplied by combined approximation of Visibility and Fresnel
// See "Optimizing PBR for Mobile" from Siggraph 2015 moving mobile graphics course
// https://community.arm.com/events/1155
half d = NoH * NoH * (roughness2 - 1.h) + 1.0001h;
half LoH2 = LoH * LoH;
half specularTerm = roughness2 / ((d * d) * max(0.1h, LoH2) * (roughness + 0.5h) * 4);
// on mobiles (where half actually means something) denominator have risk of overflow
// clamp below was added specifically to "fix" that, but dx compiler (we convert bytecode to metal/gles)
// sees that specularTerm have only non-negative terms, so it skips max(0,..) in clamp (leaving only min(100,...))
#if defined (SHADER_API_MOBILE)
specularTerm = specularTerm - HALF_MIN;
specularTerm = clamp(specularTerm, 0.0, 5.0); // Prevent FP16 overflow on mobiles
#endif
return specularTerm * mainLight.color * mainLight.distanceAttenuation;
}
//Soft Shadows
half SoftShadows(float3 screenUV, float3 positionWS, half3 viewDir, half depth)
{
#if _MAIN_LIGHT_SHADOWS
half2 jitterUV = screenUV.xy * _ScreenParams.xy * _DitherPattern_TexelSize.xy;
half shadowAttenuation = 0;
float loopDiv = 1.0 / SHADOW_ITERATIONS;
half depthFrac = depth * loopDiv;
half3 lightOffset = -viewDir * depthFrac;
for (uint i = 0u; i < SHADOW_ITERATIONS; ++i)
{
#ifndef _STATIC_SHADER
jitterUV += frac(half2(_Time.x, -_Time.z));
#endif
float3 jitterTexture = SAMPLE_TEXTURE2D(_DitherPattern, sampler_DitherPattern, jitterUV + i * _ScreenParams.xy).xyz * 2 - 1;
half3 j = jitterTexture.xzy * depthFrac * i * 0.1;
float3 lightJitter = (positionWS + j) + (lightOffset * (i + jitterTexture.y));
shadowAttenuation += SAMPLE_TEXTURE2D_SHADOW(_MainLightShadowmapTexture, sampler_MainLightShadowmapTexture, TransformWorldToShadowCoord(lightJitter));
}
return BEYOND_SHADOW_FAR(TransformWorldToShadowCoord(positionWS * 1.1)) ? 1.0 : shadowAttenuation * loopDiv;
#else
return 1;
#endif
}
///////////////////////////////////////////////////////////////////////////////
// Reflection Modes //
///////////////////////////////////////////////////////////////////////////////
half3 SampleReflections(half3 normalWS, half3 viewDirectionWS, half2 screenUV, half roughness)
{
half3 reflection = 0;
half2 refOffset = 0;
#if _REFLECTION_CUBEMAP
half3 reflectVector = reflect(-viewDirectionWS, normalWS);
reflection = SAMPLE_TEXTURECUBE(_CubemapTexture, sampler_CubemapTexture, reflectVector).rgb;
#elif _REFLECTION_PROBES
half3 reflectVector = reflect(-viewDirectionWS, normalWS);
reflection = GlossyEnvironmentReflection(reflectVector, 0, 1);
#elif _REFLECTION_PLANARREFLECTION
// get the perspective projection
float2 p11_22 = float2(unity_CameraInvProjection._11, unity_CameraInvProjection._22) * 10;
// conver the uvs into view space by "undoing" projection
float3 viewDir = -(float3((screenUV * 2 - 1) / p11_22, -1));
half3 viewNormal = mul(normalWS, (float3x3)GetWorldToViewMatrix()).xyz;
half3 reflectVector = reflect(-viewDir, viewNormal);
half2 reflectionUV = screenUV + normalWS.zx * half2(0.02, 0.15);
reflection += SAMPLE_TEXTURE2D_LOD(_PlanarReflectionTexture, sampler_ScreenTextures_linear_clamp, reflectionUV, 6 * roughness).rgb;//planar reflection
#endif
//do backup
//return reflectVector.yyy;
return reflection;
}
#endif // WATER_LIGHTING_INCLUDED
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: f1b7d55b20a1440b38c82e0092d37161
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,51 @@
Shader "BoatAttack/WaterTessellated"
{
Properties
{
_TessellationEdgeLength ("Tessellation Edge Length", Range(5, 100)) = 50
_BumpScale("Detail Wave Amount", Range(0, 1)) = 0.2//fine detail multiplier
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent-100" "RenderPipeline" = "LightweightPipeline" }
LOD 300
ZWrite Off
Pass
{
Name "WaterShading"
HLSLPROGRAM
#pragma require tessellation tessHW
#pragma prefer_hlslcc gles
/////////////////SHADER FEATURES//////////////////
#pragma shader_feature _ _TESSELLATION
#define _TESSELLATION 1
#pragma multi_compile _REFLECTION_CUBEMAP _REFLECTION_PROBES _REFLECTION_PLANARREFLECTION
#pragma multi_compile _ USE_STRUCTURED_BUFFER
// -------------------------------------
// Lightweight Pipeline keywords
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS
#pragma multi_compile _ _SHADOWS_SOFT
//--------------------------------------
// GPU Instancing
#pragma multi_compile_instancing
#pragma multi_compile_fog
////////////////////INCLUDES//////////////////////
#include "WaterCommon.hlsl"
#include "WaterTessellation.hlsl"
#pragma vertex TessellationVertex
#pragma hull Hull
#pragma domain Domain
#pragma fragment WaterFragment
ENDHLSL
}
}
fallback "BoatAttack/Water"
}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 4d4deeba0d8a64503964c2f653931109
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,98 @@
#ifndef WATER_TESSELLATION_INCLUDED
#define WATER_TESSELLATION_INCLUDED
///////////////////////////////////////////////////////////////////////////////
// Structs //
///////////////////////////////////////////////////////////////////////////////
struct TessellationControlPoint
{
float4 vertex : INTERNALTESSPOS;
float4 texcoord : TEXCOORD0; // Geometric UVs stored in xy, and world(pre-waves) in zw
float3 posWS : TEXCOORD1; // world position of the vertices
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct HS_ConstantOutput
{
float TessFactor[3] : SV_TessFactor;
float InsideTessFactor : SV_InsideTessFactor;
};
///////////////////////////////////////////////////////////////////////////////
// Tessellation functions //
///////////////////////////////////////////////////////////////////////////////
half _TessellationEdgeLength;
float TessellationEdgeFactor (float3 p0, float3 p1)
{
float edgeLength = distance(p0, p1);
float3 edgeCenter = (p0 + p1) * 0.5;
float viewDistance = distance(edgeCenter, _WorldSpaceCameraPos);
return edgeLength * _ScreenParams.y / (_TessellationEdgeLength * viewDistance);
}
TessellationControlPoint TessellationVertex( WaterVertexInput v )
{
TessellationControlPoint o;
o.vertex = v.vertex;
o.posWS = TransformObjectToWorld(v.vertex.xyz);
o.texcoord.xy = v.texcoord;
o.texcoord.zw = o.posWS.xz;
//o.color = v.color;
return o;
}
HS_ConstantOutput HSConstant( InputPatch<TessellationControlPoint, 3> Input )
{
float3 p0 = TransformObjectToWorld(Input[0].vertex.xyz);
float3 p1 = TransformObjectToWorld(Input[1].vertex.xyz);
float3 p2 = TransformObjectToWorld(Input[2].vertex.xyz);
HS_ConstantOutput o = (HS_ConstantOutput)0;
o.TessFactor[0] = TessellationEdgeFactor(p1, p2);
o.TessFactor[1] = TessellationEdgeFactor(p2, p0);
o.TessFactor[2] = TessellationEdgeFactor(p0, p1);
o.InsideTessFactor = (TessellationEdgeFactor(p1, p2) +
TessellationEdgeFactor(p2, p0) +
TessellationEdgeFactor(p0, p1)) * (1 / 3.0);
return o;
}
[domain("tri")]
[partitioning("fractional_odd")]
[outputtopology("triangle_cw")]
[patchconstantfunc("HSConstant")]
[outputcontrolpoints(3)]
TessellationControlPoint Hull( InputPatch<TessellationControlPoint, 3> Input, uint uCPID : SV_OutputControlPointID )
{
return Input[uCPID];
}
// Domain: replaces vert for tessellation version
[domain("tri")]
WaterVertexOutput Domain( HS_ConstantOutput HSConstantData, const OutputPatch<TessellationControlPoint, 3> Input, float3 BarycentricCoords : SV_DomainLocation)
{
WaterVertexOutput o = (WaterVertexOutput)0;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
/////////////////////Tessellation////////////////////////
float fU = BarycentricCoords.x;
float fV = BarycentricCoords.y;
float fW = BarycentricCoords.z;
float4 vertex = Input[0].vertex * fU + Input[1].vertex * fV + Input[2].vertex * fW;
o.uv = Input[0].texcoord * fU + Input[1].texcoord * fV + Input[2].texcoord * fW;
o.posWS = Input[0].posWS * fU + Input[1].posWS * fV + Input[2].posWS * fW;
o = WaveVertexOperations(o);
return o;
}
#endif // WATER_TESSELLATION_INCLUDED
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: b43b1830f56c64692b92d59d34a90038
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7d239908403484cb08c27667c913706b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,108 @@
fileFormatVersion: 2
guid: 4098762bce32f44b9b7c56531d1a988e
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 6
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 0
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 0
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,99 @@
fileFormatVersion: 2
guid: 73acf520ecbde384a992281db16d291c
labels:
- DoubleCheck
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 6
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 0
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 2
wrapV: 2
wrapW: 2
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ac449a7aac54248e496d456cbf1be212
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

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

After

Width:  |  Height:  |  Size: 1.0 MiB

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