备份CatanBuilding瘦身独立工程

This commit is contained in:
JSD\13999
2026-05-26 16:15:54 +08:00
commit 2d0e6a61b7
12001 changed files with 2431925 additions and 0 deletions

View File

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

View File

@@ -0,0 +1,239 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Serialization;
namespace zz.water.editor
{
[System.Serializable]
public class WaterMesh
{
public enum Shape
{
Rectangle,
Disk
}
public Shape shape;
[FormerlySerializedAs("size")]
[Range(10, 1000)]
public float scale = 100f;
[Tooltip("Distance between vertices")]
[Range(0.15f, 10f)]
public float vertexDistance = 1f;
public float UVTiling = 1f;
[Tooltip("Shifts the vertices in a random direction. Definitely use this when using flat shading")]
[Range(0f, 1f)]
public float noise;
[Min(0)]
[Tooltip("The surface is normally flat, yet vertex displacement on the GPU such as waves can give the surface artificial height." +
"\n\nThis can cause a Mesh Renderer to be prematurely culled, despite still actually being visible." +
"\n\nThis value adds an artificial amount of height to the generate mesh's bounds, to avoid this from happening.")]
public float boundsPadding = 4f;
/// <summary>
/// Generated output mesh. Empty by default, use the Rebuild() function to generate one from the current settings.
/// </summary>
public Mesh mesh;
public Mesh Rebuild()
{
switch (shape)
{
case Shape.Rectangle: mesh = CreatePlane();
break;
case Shape.Disk: mesh = CreateCircle();
break;
}
return mesh;
}
public static Mesh Create(Shape shape, float size, float vertexDistance, float uvTiling = 1f, float noise = 0f)
{
WaterMesh waterMesh = new WaterMesh();
waterMesh.shape = shape;
waterMesh.scale = size;
waterMesh.vertexDistance = vertexDistance;
waterMesh.UVTiling = uvTiling;
waterMesh.noise = noise;
return waterMesh.Rebuild();
}
// Get the index of point number 'x' in circle number 'c'
private int GetPointIndex(int c, int x)
{
if (c < 0) return 0;
x = x % ((c + 1) * 6);
return (3 * c * (c + 1) + x + 1);
}
private Mesh CreateCircle()
{
Mesh m = new Mesh();
m.name = "WaterDisk";
int subdivisions = Mathf.FloorToInt(scale / vertexDistance);
float distance = 1f / subdivisions;
var vertices = new List<Vector3>();
var uvs = new List<Vector2>();
var uvs2 = new List<Vector2>();
vertices.Add(Vector3.zero); //Center
var tris = new List<int>();
// First pass => build vertices
for (int loop = 0; loop < subdivisions; loop++)
{
float angleStep = (Mathf.PI * 2f) / ((loop + 1) * 6);
for (int point = 0; point < (loop + 1) * 6; ++point)
{
Vector3 vPos = new Vector3(
Mathf.Sin(angleStep * point) ,
0f,
Mathf.Cos(angleStep * point));
UnityEngine.Random.InitState(loop + point);
vPos.x += UnityEngine.Random.Range(-noise * 0.01f, noise * 0.01f);
vPos.z -= UnityEngine.Random.Range(noise * 0.01f, -noise * 0.01f);
vertices.Add(vPos * (scale * 0.5f) * distance * (loop + 1));
}
}
//Planar mapping
for (int i = 0; i < vertices.Count; i++)
{
uvs.Add(new Vector2(0.5f + (vertices[i].x) * UVTiling,0.5f + (vertices[i].z) * UVTiling));
//Lightmap UV's
uvs2.Add(new Vector2(0.5f + (vertices[i].x / scale),0.5f + (vertices[i].z / scale)));
}
// Second pass => connect vertices into triangles
for (int circ = 0; circ < subdivisions; ++circ)
{
for (int point = 0, other = 0; point < (circ + 1) * 6; ++point)
{
if (point % (circ + 1) != 0)
{
// Create 2 triangles
tris.Add(GetPointIndex(circ - 1, other + 1));
tris.Add(GetPointIndex(circ - 1, other));
tris.Add(GetPointIndex(circ, point));
tris.Add(GetPointIndex(circ, point));
tris.Add(GetPointIndex(circ, point + 1));
tris.Add(GetPointIndex(circ - 1, other + 1));
++other;
}
else
{
// Create 1 inverse triangle
tris.Add(GetPointIndex(circ, point));
tris.Add(GetPointIndex(circ, point + 1));
tris.Add(GetPointIndex(circ - 1, other));
// Do not move to the next point in the smaller circle
}
}
}
// Create the mesh
m.SetVertices(vertices);
m.SetTriangles(tris, 0);
m.RecalculateNormals();
m.RecalculateTangents();
m.SetUVs(0, uvs);
m.SetUVs(1, uvs2);
m.colors = new Color[vertices.Count];
m.bounds = new Bounds(Vector3.zero, new Vector3(scale, boundsPadding, scale));
return m;
}
private Mesh CreatePlane()
{
Mesh m = new Mesh();
m.name = "WaterPlane";
scale = Mathf.Max(1f, scale);
int subdivisions = Mathf.FloorToInt(scale / vertexDistance);
int xCount = subdivisions + 1;
int zCount = subdivisions + 1;
int numTriangles = subdivisions * subdivisions * 6;
int numVertices = xCount * zCount;
Vector3[] vertices = new Vector3[numVertices];
Vector2[] uvs = new Vector2[numVertices];
Vector2[] uvs2 = new Vector2[numVertices];
int[] triangles = new int[numTriangles];
Vector4[] tangents = new Vector4[numVertices];
Vector3[] normals = new Vector3[numVertices];
Vector4 tangent = new Vector4(1f, 0f, 0f, -1f);
int index = 0;
float scaleX = scale / subdivisions;
float scaleY = scale / subdivisions;
float noiseScale = vertexDistance * 0.5f;
for (int z = 0; z < zCount; z++)
{
for (int x = 0; x < xCount; x++)
{
vertices[index] = new Vector3(x * scaleX - (scale * 0.5f), 0f, z * scaleY - (scale * 0.5f));
UnityEngine.Random.InitState(index);
vertices[index].x += UnityEngine.Random.Range(-noise * noiseScale, noise * noiseScale);
vertices[index].z -= UnityEngine.Random.Range(noise * noiseScale, -noise * noiseScale);
tangents[index] = tangent;
uvs[index] = new Vector2(0.5f + (vertices[index].x) * UVTiling, 0.5f + (vertices[index].z) * UVTiling);
//Lightmap UV's
uvs2[index] = new Vector2(0.5f + vertices[index].x / scale, 0.5f + vertices[index].z / scale);
normals[index] = Vector3.up;
index++;
}
}
index = 0;
for (int z = 0; z < subdivisions; z++)
{
for (int x = 0; x < subdivisions; x++)
{
triangles[index] = (z * xCount) + x;
triangles[index + 1] = ((z + 1) * xCount) + x;
triangles[index + 2] = (z * xCount) + x + 1;
triangles[index + 3] = ((z + 1) * xCount) + x;
triangles[index + 4] = ((z + 1) * xCount) + x + 1;
triangles[index + 5] = (z * xCount) + x + 1;
index += 6;
}
}
m.vertices = vertices;
m.triangles = triangles;
m.uv = uvs;
m.uv2 = uvs2;
m.tangents = tangents;
m.normals = normals;
m.colors = new Color[vertices.Length];
m.bounds = new Bounds(Vector3.zero, new Vector3(scale, boundsPadding, scale));
return m;
}
}
}

View File

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

View File

@@ -0,0 +1,135 @@
using System.IO;
using UnityEditor;
using UnityEditor.AssetImporters;
using UnityEngine;
namespace zz.water.editor
{
[ScriptedImporter(1, FILE_EXTENSION)]
public class WaterMeshImporter : ScriptedImporter
{
private const string FILE_EXTENSION = "zwatermesh";
[SerializeField] public WaterMesh waterMesh = new WaterMesh();
public override void OnImportAsset(AssetImportContext context)
{
waterMesh.Rebuild();
context.AddObjectToAsset("mesh", waterMesh.mesh);
context.SetMainObject(waterMesh.mesh);
}
//Handles correct behaviour when double-clicking a .watermesh asset assigned to a field
//Otherwise the OS prompts to open it
[UnityEditor.Callbacks.OnOpenAsset]
public static bool OnOpenAsset(int instanceID, int line)
{
Object target = EditorUtility.InstanceIDToObject(instanceID);
if (target is Mesh)
{
var path = AssetDatabase.GetAssetPath(instanceID);
if (Path.GetExtension(path) != "." + FILE_EXTENSION) return false;
Selection.activeObject = target;
return true;
}
return false;
}
}
[CustomEditor(typeof(WaterMeshImporter))]
public class WaterMeshImporterEditor: ScriptedImporterEditor
{
private SerializedProperty waterMesh;
private SerializedProperty shape;
private SerializedProperty scale;
private SerializedProperty UVTiling;
private SerializedProperty vertexDistance;
private SerializedProperty noise;
private SerializedProperty boundsPadding;
private WaterMeshImporter importer;
private bool autoApplyChanges;
public override void OnEnable()
{
base.OnEnable();
importer = (WaterMeshImporter)target;
waterMesh = serializedObject.FindProperty("waterMesh");
shape = waterMesh.FindPropertyRelative("shape");
scale = waterMesh.FindPropertyRelative("scale");
UVTiling = waterMesh.FindPropertyRelative("UVTiling");
vertexDistance = waterMesh.FindPropertyRelative("vertexDistance");
noise = waterMesh.FindPropertyRelative("noise");
boundsPadding = waterMesh.FindPropertyRelative("boundsPadding");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(shape);
EditorGUILayout.Space();
EditorGUILayout.PropertyField(scale);
EditorGUILayout.PropertyField(vertexDistance);
int subdivisions = Mathf.FloorToInt(scale.floatValue / vertexDistance.floatValue);
int vertexCount = Mathf.FloorToInt(subdivisions * subdivisions);
using (new EditorGUILayout.HorizontalScope())
{
GUILayout.Space(EditorGUIUtility.labelWidth);
Rect rect = EditorGUILayout.GetControlRect();
EditorGUI.ProgressBar(rect, (float)vertexCount/65535f, $"Vertex count: {vertexCount:N1}/{65535f:N1}");
}
if(vertexCount > 65535)
{
EditorGUILayout.HelpBox("Vertex count (" + vertexCount + ") is too high. Decrease the scale, or increase the vertex distance.", MessageType.Error);
}
EditorGUILayout.Space();
EditorGUILayout.PropertyField(UVTiling);
EditorGUILayout.PropertyField(noise);
EditorGUILayout.PropertyField(boundsPadding);
EditorGUILayout.Space();
autoApplyChanges = EditorGUILayout.Toggle("Auto-apply changes", autoApplyChanges);
if (EditorGUI.EndChangeCheck())
{
serializedObject.ApplyModifiedProperties();
if (autoApplyChanges && HasModified())
{
#if UNITY_2022_2_OR_NEWER
this.SaveChanges();
#else
this.ApplyAndImport();
#endif
importer = (WaterMeshImporter)target;
}
}
this.ApplyRevertGUI();
}
}
}

View File

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

View File

@@ -0,0 +1,13 @@
using UnityEditor;
namespace zz.water.editor
{
public class ZZWaterEditor
{
[MenuItem("Assets/Create/ZZWater/Mesh")]
private static void CreateWaterPlaneAsset() {
ProjectWindowUtil.CreateAssetWithContent("NewWatermesh.watermesh", "");
}
}
}

View File

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

View File

@@ -0,0 +1,16 @@
{
"name": "zzwater.editor",
"rootNamespace": "zz.water.editor",
"references": [],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 3e0e85f981a1e47ecb3f4ed489b3234e
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

@@ -0,0 +1,134 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: FSBlur
m_Shader: {fileID: 4800000, guid: 4cb3a33af23f76541a3829b6fe8b4bed, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _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}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AlphaClip: 0
- _AlphaToMask: 0
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _Deep: 0
- _DepthThreshold: 6
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _Surface: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
m_BuildTextureStacks: []
--- !u!114 &4828077842088583083
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 7

View File

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

View File

@@ -0,0 +1,134 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: HorizenOcean
m_Shader: {fileID: 4800000, guid: 838018c478c7946c7a600a5350e7d4e1, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _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}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AlphaClip: 0
- _AlphaToMask: 0
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _ReflectionBlur: 0.01
- _ReflectionStrength: 0
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _Surface: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 0.9716981, g: 0.9716981, b: 0.9716981, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
m_BuildTextureStacks: []
--- !u!114 &2783795249461312039
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 7

View File

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

View File

@@ -0,0 +1,169 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Ocean
m_Shader: {fileID: 4800000, guid: e52380eaa118b4aa7adc141fb339553b, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _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}
- _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}
- _IntersectionNoise:
m_Texture: {fileID: 2800000, guid: 6e4f6abf9612841adaf37e0d026dd5a4, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AlphaClip: 0
- _AlphaToMask: 0
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DepthHorizontal: 2.36
- _DepthVertical: 7.44
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EdgeFade: 19.08
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _HorizonDistance: 26.6
- _IntersectionClipping: 0.721
- _IntersectionDurationMulti1: 3.48
- _IntersectionDurationMulti2: 0.76
- _IntersectionFalloff: 0.525
- _IntersectionLength: 1.46
- _IntersectionSpeed: -0.2
- _IntersectionTiling: 1.3
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _ReflectionBlur: 0.049
- _ReflectionFresnel: 4.92
- _ReflectionStrength: 0.913
- _RefractionStrength: 0.278
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _Speed: 1
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _Surface: 0
- _TranslucencyCurvatureMask: 0.708
- _TranslucencyExp: 10
- _TranslucencyReflectionMask: 0.764
- _TranslucencyStrength: 0.7
- _TranslucencyStrengthDirect: 0.421
- _WaveCount: 2
- _WaveDistance: 0.764
- _WaveHeight: 0.17
- _WaveNormalStr: 0.2
- _WaveSpeed: 1.2
- _WaveSteepness: 3.17
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 0.1254902, g: 0.2901961, b: 0.34509805, a: 0.9490196}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _Direction: {r: 1, g: 1, b: 0, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _HorizonColor: {r: 0.09376113, g: 0.10980392, b: 0.32156864, a: 1}
- _IntersectionColor: {r: 1, g: 1, b: 1, a: 1}
- _ShallowColor: {r: 0.105882354, g: 0.4117647, b: 0.62352943, a: 0.9019608}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
- _WaveDirection: {r: 1, g: 1, b: 1, a: 2}
- _WaveFadeDistance: {r: 0, g: 200, b: 0, a: 0}
m_BuildTextureStacks: []
--- !u!114 &1635733923474585344
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 7

View File

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

View File

@@ -0,0 +1,180 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Ocean_tess
m_Shader: {fileID: 4800000, guid: 5e1bb555fbe9641c1b49b207771e3641, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _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}
- _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}
- _IntersectionNoise:
m_Texture: {fileID: 2800000, guid: 6e4f6abf9612841adaf37e0d026dd5a4, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AlphaClip: 0
- _AlphaToMask: 0
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DepthHorizontal: 1.78
- _DepthVertical: 7.44
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EdgeFade: 19.08
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _HorizonDistance: 26.6
- _InterscetionSpeed: 1
- _IntersectionClipping: 0.407
- _IntersectionDurationMulti: 1
- _IntersectionDurationMulti1: 2.53
- _IntersectionDurationMulti2: 0.83
- _IntersectionFalloff: 0.73
- _IntersectionLength: 2.03
- _IntersectionSpeed: 0.2
- _IntersectionTiling: 0.82
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _ReflectionBlur: 0.049
- _ReflectionFresnel: 4.92
- _ReflectionStrength: 1
- _RefractionStrength: 0.278
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _Speed: 1
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _Surface: 0
- _TessMax: 15
- _TessMin: 0
- _TessValue: 16
- _TranslucencyCurvatureMask: 0.708
- _TranslucencyExp: 10
- _TranslucencyReflectionMask: 0.764
- _TranslucencyStrength: 0.7
- _TranslucencyStrengthDirect: 0.443
- _WaveCount: 2
- _WaveDistance: 0.808
- _WaveFoamBaseLvl: -2.66
- _WaveFoamClipping: 0.328
- _WaveFoamExp: 5
- _WaveFoamLength: 1
- _WaveHeight: 0.23
- _WaveMesureMax: -2.51
- _WaveMesureMin: -2.68
- _WaveNormalStr: 0.2
- _WaveSpeed: 1
- _WaveSteepness: 3.65
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 0.01619794, g: 0.20062576, b: 0.26415092, a: 0.9490196}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _Direction: {r: 0.66, g: -1, b: 0, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _HorizonColor: {r: 0.09376113, g: 0.10980392, b: 0.32156864, a: 1}
- _IntersectionColor: {r: 0.9622642, g: 0.9577252, b: 0.9577252, a: 1}
- _ShallowColor: {r: 0.105882354, g: 0.4117647, b: 0.62352943, a: 0.9372549}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
- _WaveDirection: {r: 1, g: 1, b: 1, a: 2}
- _WaveFadeDistance: {r: 100, g: 200, b: 0, a: 0}
m_BuildTextureStacks: []
--- !u!114 &1635733923474585344
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 7

View File

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

View File

@@ -0,0 +1,133 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: WaterPlantG
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap:
RenderType: Opaque
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _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}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AlphaClip: 0
- _AlphaToMask: 0
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _Surface: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
m_BuildTextureStacks: []
--- !u!114 &7309648709844754497
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 7

View File

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

View File

@@ -0,0 +1,138 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: water_plant
m_Shader: {fileID: 4800000, guid: b1f0cdff4e5484686a1fd600c2d2c6b1, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _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}
- _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: 016ab36f33e35487bb91a3712c78b36e, 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}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AlphaClip: 0
- _AlphaToMask: 0
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _SubFreq: 0.3
- _Surface: 0
- _SwayFreq: 1.18
- _SwayIntensity: 0.129
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
- _TineColor: {r: 0.8773585, g: 0.78201175, b: 0.36832502, a: 1}
- _WaterDir: {r: 0.58, g: 0.44, b: -0.42, a: 2.2}
- _WindDir: {r: 1, g: 0, b: 1, a: 0}
m_BuildTextureStacks: []
--- !u!114 &8498174157611730267
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 7

View File

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

View File

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

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 154c6496b574b495eaf1e56696d041c5
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: eb1723d9808f34b8fa4c8c24d2a380d9, type: 3}
waterMesh:
shape: 0
scale: 180
vertexDistance: 1
UVTiling: 1
noise: 0
boundsPadding: 4
mesh: {fileID: -8670151273213183110, guid: 154c6496b574b495eaf1e56696d041c5, type: 3}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: fb57683f9728c4705998b5ac260018d9
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: eb1723d9808f34b8fa4c8c24d2a380d9, type: 3}
waterMesh:
shape: 0
scale: 90
vertexDistance: 1
UVTiling: 1
noise: 0
boundsPadding: 4
mesh: {fileID: -8670151273213183110, guid: fb57683f9728c4705998b5ac260018d9, type: 3}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: f9a87e99a9bed4d78b46a38bbaaa03c4
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: eb1723d9808f34b8fa4c8c24d2a380d9, type: 3}
waterMesh:
shape: 0
scale: 135
vertexDistance: 2
UVTiling: 1
noise: 0
boundsPadding: 4
mesh: {fileID: -8670151273213183110, guid: f9a87e99a9bed4d78b46a38bbaaa03c4, type: 3}

View File

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

View File

@@ -0,0 +1,41 @@
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
namespace zzwater
{
public class URPHelper
{
public static ScriptableRendererFeature FindAndCacheRendererFeature(string name)
{
// 获取当前 URP 资产
var urpAsset = (UniversalRenderPipelineAsset)GraphicsSettings.currentRenderPipeline;
// 使用反射获取 rendererData (因为它通常是私有的)
System.Reflection.FieldInfo propertyInfo = urpAsset.GetType().GetField("m_RendererDataList", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
if (propertyInfo != null)
{
ScriptableRendererData[] rendererDataList = (ScriptableRendererData[])propertyInfo.GetValue(urpAsset);
if (rendererDataList.Length > 0)
{
var rendererData = rendererDataList[0]; // 获取第一个渲染器数据,你可能需要调整此逻辑
// 查找指定名称的 FullScreenPassRendererFeature
foreach (var feature in rendererData.rendererFeatures)
{
if (feature.name == name)
{
return feature;
}
}
}
}
return null;
}
public static void RendererFeatureSetActive(bool active, string name)
{
FindAndCacheRendererFeature(name)?.SetActive(active);
}
}
}

View File

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

View File

@@ -0,0 +1,16 @@
{
"name": "zzwater",
"rootNamespace": "zzwater",
"references": [
"GUID:15fc0a57446b3144c949da3e2b9737a9"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 40a8d4f50e806594fb91dad6449d0397
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 727 KiB

View File

@@ -0,0 +1,153 @@
fileFormatVersion: 2
guid: 6e4f6abf9612841adaf37e0d026dd5a4
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
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
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 2
aniso: 3
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
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
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: 18
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,22 @@
{
"name": "zzwater",
"description": "simplify Stylized water for the Universal Render Pipeline",
"version": "1.6.0",
"unity": "2021.3",
"unityRelease": "16f1",
"displayName": "zzwater",
"dependencies": {
"com.unity.render-pipelines.universal": "10.3.2"
},
"author": {
"name": "Skistua",
"email": "b166er.dada@gmail.com"
},
"keywords": [
"water",
"shader",
"stylized",
"mobile",
"urp"
]
}

View File

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

View File

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

View File

@@ -0,0 +1,74 @@
Shader "zzwater/FSBlur"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_DepthThreshold ("Depth Threshold", Range(0, 200)) = 50
//_BlurRadius ("Blur Radius", Range(1, 10)) = 3
}
SubShader
{
Tags { "RenderType"="Opaque" "RenderPipeline" = "UniversalPipeline"}
LOD 100
ZWrite Off Cull Off
Pass
{
Name "FSBlur"
HLSLPROGRAM
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
// The Blit.hlsl file provides the vertex shader (Vert),
// the input structure (Attributes) and the output structure (Varyings)
#include "Packages/com.unity.render-pipelines.core/Runtime/Utilities/Blit.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl"
#pragma vertex Vert
#pragma fragment frag
float _DepthThreshold;
SAMPLER(sampler_BlitTexture);
float4 _BlitTexture_TexelSize;
half4 frag (Varyings input) : SV_Target
{
// Sample depth
float deviceDepth = SampleSceneDepth(input.texcoord);
float linearDepth = LinearEyeDepth(deviceDepth, _ZBufferParams);
float _BlurRadius = 5;
// Original color
half4 originalColor = SAMPLE_TEXTURE2D(_BlitTexture, sampler_BlitTexture, input.texcoord);
// If depth is less than threshold, return original color
if (linearDepth < _DepthThreshold)
return originalColor;
// Simple box blur (much faster than Gaussian)
half4 blurredColor = half4(0, 0, 0, 0);
int samples = 0;
// Use fixed radius for simplicity
for (int x = -_BlurRadius; x <= _BlurRadius; x++)
{
for (int y = -_BlurRadius; y <= _BlurRadius; y++)
{
float2 offset = float2(x, y) * _BlitTexture_TexelSize;
blurredColor += SAMPLE_TEXTURE2D(_BlitTexture, sampler_BlitTexture, input.texcoord + offset);
samples++;
}
}
// Average the samples
return blurredColor / samples;
}
ENDHLSL
}
}
}

View File

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

View File

@@ -0,0 +1,537 @@
{
"m_SGVersion": 3,
"m_Type": "UnityEditor.ShaderGraph.GraphData",
"m_ObjectId": "97bdc616974748949d3e85eeb6169cf6",
"m_Properties": [],
"m_Keywords": [],
"m_Dropdowns": [],
"m_CategoryData": [
{
"m_Id": "251c23702d974aa796acbd724c029af7"
}
],
"m_Nodes": [
{
"m_Id": "c8cf96b42c3741b387dfa4b89feb535e"
},
{
"m_Id": "5a910df6760f4b52bb844107735592de"
},
{
"m_Id": "b89dacbc48004a04b9c7e7ff73a91785"
},
{
"m_Id": "b6a10604d3b64469942aefb11ca3202e"
},
{
"m_Id": "735bf3b859f5434b9171d848935b49bf"
}
],
"m_GroupDatas": [],
"m_StickyNoteDatas": [],
"m_Edges": [
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "735bf3b859f5434b9171d848935b49bf"
},
"m_SlotId": 0
},
"m_InputSlot": {
"m_Node": {
"m_Id": "b6a10604d3b64469942aefb11ca3202e"
},
"m_SlotId": 0
}
},
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "b6a10604d3b64469942aefb11ca3202e"
},
"m_SlotId": 1
},
"m_InputSlot": {
"m_Node": {
"m_Id": "b89dacbc48004a04b9c7e7ff73a91785"
},
"m_SlotId": 0
}
},
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "b89dacbc48004a04b9c7e7ff73a91785"
},
"m_SlotId": 2
},
"m_InputSlot": {
"m_Node": {
"m_Id": "c8cf96b42c3741b387dfa4b89feb535e"
},
"m_SlotId": 0
}
}
],
"m_VertexContext": {
"m_Position": {
"x": -0.00001239776611328125,
"y": -0.0000286102294921875
},
"m_Blocks": []
},
"m_FragmentContext": {
"m_Position": {
"x": 0.0,
"y": 200.0
},
"m_Blocks": [
{
"m_Id": "c8cf96b42c3741b387dfa4b89feb535e"
},
{
"m_Id": "5a910df6760f4b52bb844107735592de"
}
]
},
"m_PreviewData": {
"serializedMesh": {
"m_SerializedMesh": "{\"mesh\":{\"instanceID\":0}}",
"m_Guid": ""
},
"preventRotation": false
},
"m_Path": "zzwater",
"m_GraphPrecision": 1,
"m_PreviewMode": 2,
"m_OutputNode": {
"m_Id": ""
},
"m_SubDatas": [],
"m_ActiveTargets": [
{
"m_Id": "59f0b9eed4544b4f8a44a9bf01cab21e"
}
]
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.CategoryData",
"m_ObjectId": "251c23702d974aa796acbd724c029af7",
"m_Name": "",
"m_ChildObjectList": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.Rendering.Fullscreen.ShaderGraph.FullscreenData",
"m_ObjectId": "3cec1ba0bc4c4781ad9b8bf02a2920b1",
"m_Version": 0,
"m_fullscreenMode": 0,
"m_BlendMode": 0,
"m_SrcColorBlendMode": 0,
"m_DstColorBlendMode": 1,
"m_ColorBlendOperation": 0,
"m_SrcAlphaBlendMode": 0,
"m_DstAlphaBlendMode": 1,
"m_AlphaBlendOperation": 0,
"m_EnableStencil": false,
"m_StencilReference": 0,
"m_StencilReadMask": 255,
"m_StencilWriteMask": 255,
"m_StencilCompareFunction": 8,
"m_StencilPassOperation": 0,
"m_StencilFailOperation": 0,
"m_StencilDepthFailOperation": 0,
"m_DepthWrite": false,
"m_depthWriteMode": 0,
"m_AllowMaterialOverride": false,
"m_DepthTestMode": 0
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot",
"m_ObjectId": "46b8622de7be4068b625bd4bc04be38f",
"m_Id": 0,
"m_DisplayName": "Out",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Out",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
},
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "4e74e98b104e41aaa8adc8c67f972ed9",
"m_Id": 0,
"m_DisplayName": "Alpha",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "Alpha",
"m_StageCapability": 2,
"m_Value": 1.0,
"m_DefaultValue": 1.0,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector2MaterialSlot",
"m_ObjectId": "4fbd2a02b6e44e95a5f1531a7e35678e",
"m_Id": 1,
"m_DisplayName": "Out",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Out",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0
},
"m_Labels": []
}
{
"m_SGVersion": 1,
"m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalTarget",
"m_ObjectId": "59f0b9eed4544b4f8a44a9bf01cab21e",
"m_Datas": [
{
"m_Id": "3cec1ba0bc4c4781ad9b8bf02a2920b1"
}
],
"m_ActiveSubTarget": {
"m_Id": "bd0ea81575d74b88aaf8b3e9f283476d"
},
"m_AllowMaterialOverride": false,
"m_SurfaceType": 0,
"m_ZTestMode": 4,
"m_ZWriteControl": 0,
"m_AlphaMode": 0,
"m_RenderFace": 2,
"m_AlphaClip": false,
"m_CastShadows": true,
"m_ReceiveShadows": true,
"m_SupportsLODCrossFade": false,
"m_CustomEditorGUI": "",
"m_SupportVFX": false
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
"m_ObjectId": "5a910df6760f4b52bb844107735592de",
"m_Group": {
"m_Id": ""
},
"m_Name": "SurfaceDescription.Alpha",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 0.0,
"y": 0.0,
"width": 0.0,
"height": 0.0
}
},
"m_Slots": [
{
"m_Id": "4e74e98b104e41aaa8adc8c67f972ed9"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_SerializedDescriptor": "SurfaceDescription.Alpha"
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector2MaterialSlot",
"m_ObjectId": "6fb8fe7b25b24856b766270254888f90",
"m_Id": 0,
"m_DisplayName": "uv",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "uv",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0
},
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.UVNode",
"m_ObjectId": "735bf3b859f5434b9171d848935b49bf",
"m_Group": {
"m_Id": ""
},
"m_Name": "UV",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": -868.0,
"y": -21.999984741210939,
"width": 145.0,
"height": 128.99993896484376
}
},
"m_Slots": [
{
"m_Id": "46b8622de7be4068b625bd4bc04be38f"
}
],
"synonyms": [
"texcoords",
"coords",
"coordinates"
],
"m_Precision": 0,
"m_PreviewExpanded": false,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_OutputChannel": 0
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.ColorRGBAMaterialSlot",
"m_ObjectId": "874211ead7b44611aadbb9aa5338fea4",
"m_Id": 2,
"m_DisplayName": "Output",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Output",
"m_StageCapability": 2,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 1.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
},
"m_Labels": []
}
{
"m_SGVersion": 1,
"m_Type": "UnityEditor.ShaderGraph.CustomFunctionNode",
"m_ObjectId": "b6a10604d3b64469942aefb11ca3202e",
"m_Group": {
"m_Id": ""
},
"m_Name": "SCWave (Custom Function)",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": -663.0,
"y": -21.999984741210939,
"width": 208.0,
"height": 245.99998474121095
}
},
"m_Slots": [
{
"m_Id": "6fb8fe7b25b24856b766270254888f90"
},
{
"m_Id": "4fbd2a02b6e44e95a5f1531a7e35678e"
}
],
"synonyms": [
"code",
"HLSL"
],
"m_Precision": 0,
"m_PreviewExpanded": false,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_SourceType": 1,
"m_FunctionName": "SCWave",
"m_FunctionSource": "",
"m_FunctionBody": "//waveSize = 5\r\n// _Amplitude = 0.005\r\r\nfloat X = uv.x * 5 + _Time.y;\r\nfloat Y = uv.y * 5 + _Time.y;\r\nfloat Xoffset = cos(X-Y)* 0.005 *cos(Y);\r\nfloat Yoffset = sin(X+Y)* 0.005 * sin(Y);\r\nOut = uv + float2(Xoffset, Yoffset);\r\n"
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.Rendering.Universal.UniversalSampleBufferNode",
"m_ObjectId": "b89dacbc48004a04b9c7e7ff73a91785",
"m_Group": {
"m_Id": ""
},
"m_Name": "URP Sample Buffer",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": -384.0,
"y": 0.0,
"width": 208.0,
"height": 313.0
}
},
"m_Slots": [
{
"m_Id": "e02e445989c2407d9c765ef29b91a743"
},
{
"m_Id": "874211ead7b44611aadbb9aa5338fea4"
}
],
"synonyms": [
"normal",
"motion vector",
"blit"
],
"m_Precision": 0,
"m_PreviewExpanded": false,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_BufferType": 2
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalFullscreenSubTarget",
"m_ObjectId": "bd0ea81575d74b88aaf8b3e9f283476d"
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
"m_ObjectId": "c8cf96b42c3741b387dfa4b89feb535e",
"m_Group": {
"m_Id": ""
},
"m_Name": "SurfaceDescription.BaseColor",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 0.0,
"y": 0.0,
"width": 0.0,
"height": 0.0
}
},
"m_Slots": [
{
"m_Id": "e8b57279c0424bbea4332f3396bf8da8"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_SerializedDescriptor": "SurfaceDescription.BaseColor"
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.ScreenPositionMaterialSlot",
"m_ObjectId": "e02e445989c2407d9c765ef29b91a743",
"m_Id": 0,
"m_DisplayName": "UV",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "UV",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
},
"m_Labels": [],
"m_ScreenSpaceType": 0
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot",
"m_ObjectId": "e8b57279c0424bbea4332f3396bf8da8",
"m_Id": 0,
"m_DisplayName": "Base Color",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "BaseColor",
"m_StageCapability": 2,
"m_Value": {
"x": 0.5,
"y": 0.5,
"z": 0.5
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_Labels": [],
"m_ColorMode": 0,
"m_DefaultColor": {
"r": 0.5,
"g": 0.5,
"b": 0.5,
"a": 1.0
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 427374d7de305424bbe241d698028a64
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 746c94d4092dee3428d2f89537482562
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}

View File

@@ -0,0 +1,97 @@
Shader "zzwater/horizon_ocean"
{
Properties
{
[HDR]_Color("Color", Color) = (0, 0.44, 0.62, 1)
_ReflectionStrength("Reflection Strength", Range(0, 2)) = 1
_ReflectionBlur("Probe Blur Factor", Range(0, 1)) = 0
}
SubShader
{
Tags
{
"RenderType" = "Transparent"
"RenderPipeline" = "UniversalPipeline"
"UniversalMaterialType" = "Unlit"
"IgnoreProjector" = "True"
"Queue" = "Transparent+0"
}
Pass
{
Name "ForwardLit"
Tags { "LightMode"="UniversalForward" }
Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha
ZWrite On
Cull Back
ZTest LEqual
ZClip On
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
//Fog rendering (integration)
#define UnityFog
#pragma multi_compile_fog
CBUFFER_START(UnityPerMaterial)
float _ReflectionBlur;
float _ReflectionStrength;
half4 _Color;
CBUFFER_END
struct Attributes
{
float4 positionOS : POSITION;
};
struct Varyings
{
float4 positionCS : SV_POSITION;
float3 positionWS : TEXCOORD0;
float4 positionNDC : TEXCOORD1;
float fogFactor : TEXCOORD2;
};
Varyings vert(Attributes IN)
{
Varyings OUT;
// Get the position of the vertex in different spaces
VertexPositionInputs positions = GetVertexPositionInputs(IN.positionOS);
OUT.positionCS = positions.positionCS;
OUT.positionWS = positions.positionWS.xyz;
OUT.positionNDC = positions.positionNDC;
OUT.fogFactor = ComputeFogFactor(positions.positionCS.z);
return OUT;
}
half4 frag(Varyings IN) : SV_Target
{
float3 viewDir = normalize(_WorldSpaceCameraPos - IN.positionWS);
half3 reflectionVector = reflect(-viewDir, float3(0, 1, 0));
float2 screenPos = IN.positionNDC.xy / IN.positionNDC.w;
float3 reflections = GlossyEnvironmentReflection(reflectionVector, IN.positionWS, _ReflectionBlur, 1 ,screenPos) * _ReflectionStrength;
//Apply fog
half fogCoord = InitializeInputDataFog(float4(IN.positionWS,1), IN.fogFactor);
half3 finalColor = MixFog(_Color.rgb * reflections, fogCoord);
return half4(finalColor, _Color.a);
}
ENDHLSL
}
}
}

View File

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

View File

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

View File

@@ -0,0 +1,64 @@
#ifndef WATER_COMMON_INCLUDED
#define WATER_COMMON_INCLUDED
//As per the "Shader" section of the documentation, this is primarily used for synchronizing animations in networked applications.
//#define TIME_FRAG_INPUT input.uv.z
//#define TIME_VERTEX_OUTPUT output.uv.z
//#define TIME ((TIME_FRAG_INPUT * _Speed) * -_Direction.xy)
//#define TIME_VERTEX ((TIME_VERTEX_OUTPUT * _Speed) * -_Direction.xy)
#define TIME_VERTEX ((_TimeParameters.x * _Speed) * -_Direction.xy)
#define HORIZONTAL_DISPLACEMENT_SCALAR 0.01
#define UP_VECTOR float3(0,1,0)
#define RAD2DEGREE 57.29578
struct WaterSurface
{
float3 positionWS;
float3 viewDelta; //Un-normalized view direction,
float3 viewDir;
//Normal from the base geometry, in world-space
float3 vertexNormal;
float3 tangentNormal;
float3 tangentWorldNormal;
float3 albedo;
float3 offset;
float alpha;
float fog;
float edgeFade;
float intersection;
float3 reflections;
float reflectionMask;
};
struct SceneDepth
{
float raw;
float linear01;
float eye;
};
#define FAR_CLIP _ProjectionParams.z
#define NEAR_CLIP _ProjectionParams.y
//Scale linear values to the clipping planes for orthographic projection (unity_OrthoParams.w = 1 = orthographic)
#define DEPTH_SCALAR (FAR_CLIP - NEAR_CLIP)
//Return depth based on the used technique (buffer, vertex color, baked texture)
SceneDepth SampleDepth(float2 uv)
{
SceneDepth depth = (SceneDepth)0;
float raw = SampleSceneDepth(uv);
depth.raw = raw;
depth.eye = LinearEyeDepth(raw, _ZBufferParams);
depth.linear01 = Linear01Depth(raw, _ZBufferParams) * DEPTH_SCALAR;
return depth;
}
#endif

View File

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

View File

@@ -0,0 +1,235 @@
struct SceneData
{
float4 positionNDC; //Unnormalized
float2 screenPos; //Normalized and no refraction
float3 positionWS;
float3 color;
float refractionMask;
float viewDepth;
float verticalDepth;
};
// Project from eye space to world space
#define WorldPosFromDepth(NDCw, depth, viewDir) -(depth.eye * (viewDir/NDCw) - _WorldSpaceCameraPos)
//Linear depth difference between scene and current (transparent) geometry pixel
#define SurfaceDepth(depth, positionCS) depth.eye - LinearEyeDepth(positionCS.z, _ZBufferParams)
void PopulateSceneData(inout SceneData scene, in Varyings input, in WaterSurface water)
{
const float2 screenPos = input.positionNDC.xy / input.positionNDC.w;
scene.positionNDC = input.positionNDC;
scene.screenPos = screenPos;
//Default for disabled depth texture scene.viewDepth = 1;
scene.verticalDepth = 1;
#ifdef _REFRACTION
SceneDepth depth = SampleDepth(screenPos);
float3 positionWS = WorldPosFromDepth(input.positionNDC.w, depth, water.viewDelta);
float viewDepth = SurfaceDepth(depth, input.positionCS);
const float2 refractionOffset = input.normalWS.xz * 0.5 * _RefractionStrength;
SceneDepth depthRefract = SampleDepth(screenPos + refractionOffset);
float3 positionWSRefract = WorldPosFromDepth(input.positionNDC.w, depthRefract, water.viewDelta);
float viewDepthRefract = SurfaceDepth(depthRefract, input.positionCS);
float mask = saturate(viewDepth) * saturate(viewDepthRefract);
scene.positionWS = lerp(positionWS, positionWSRefract, mask);
scene.viewDepth = lerp(viewDepth, viewDepthRefract, mask);
//Distance to opaque geometry in normal direction
scene.verticalDepth = length((water.positionWS - scene.positionWS) * water.vertexNormal);
scene.color = SampleSceneColor(screenPos + refractionOffset * mask);
scene.refractionMask = mask;
#else
SceneDepth depth = SampleDepth(screenPos);
scene.positionWS = WorldPosFromDepth(input.positionNDC.w, depth, water.viewDelta);
scene.viewDepth = SurfaceDepth(depth, input.positionCS);
scene.verticalDepth = length((water.positionWS - scene.positionWS) * water.vertexNormal);
scene.color = SampleSceneColor(screenPos);
scene.refractionMask = 0;
#endif
}
float GetWaterDensity(SceneData scene, float heightScalar, float viewDepthScalar)
{
const float viewDepth = scene.viewDepth;
const float verticalDepth = scene.verticalDepth;
const float depthAttenuation = 1.0 - exp(-viewDepth * viewDepthScalar * 0.1);
const float heightAttenuation = saturate(verticalDepth * heightScalar);
return max(depthAttenuation, heightAttenuation);
}
float4 ForwardPassFragment(Varyings input) : SV_Target
{
WaterSurface water = (WaterSurface)0;
SceneData scene = (SceneData)0;
float3 normalWS = normalize(input.normalWS.xyz);
float3 WorldTangent = input.tangent.xyz;
float3 WorldBiTangent = input.bitangent.xyz;
//wPos.x in w-component
float3 positionWS = float3(input.normalWS.w, input.tangent.w, input.bitangent.w);
water.alpha = 1.0;
water.positionWS = positionWS;
water.viewDelta = _WorldSpaceCameraPos - positionWS;
float3 viewDir = normalize(water.viewDelta);
water.viewDir = viewDir;
water.vertexNormal = normalize(input.normalWS.xyz);
//Normal
water.tangentNormal = float3(0.5, 0.5, 1);
water.tangentWorldNormal = normalWS;
half VdotN = 1.0 - saturate(dot(viewDir, normalWS));
half4 shadowMask = 1.0;
float4 shadowCoords = float4(0, 0, 0, 0);
Light mainLight = GetMainLight(shadowCoords, water.positionWS, shadowMask);
PopulateSceneData(scene, input, water);
//return float4(scene.verticalDepth.xxx, 1);
//return float4(saturate(scene.viewDepth).xxx, 1);
//return float4(scene.color, 1);
water.fog = GetWaterDensity(scene, _DepthHorizontal, _DepthVertical);
//Albedo
float4 baseColor = lerp(_ShallowColor, _BaseColor, water.fog);
water.fog *= baseColor.a;
water.alpha = baseColor.a;
float fresnel = saturate(pow(VdotN, _HorizonDistance)) * _HorizonColor.a;
water.albedo = lerp(baseColor.rgb, _HorizonColor.rgb, fresnel);
water.edgeFade = saturate(scene.verticalDepth / (_EdgeFade * 0.01));
water.alpha *= water.edgeFade;
// Wave Mesure
#if _INTERSECTION || _WAVE_FOAM
float waveMesure = (positionWS.y - _WaveMesureMin) / (_WaveMesureMax - _WaveMesureMin);
float2 nUV = positionWS.xz * _IntersectionTiling;
float foamTexNoise = SAMPLE_TEXTURE2D(_IntersectionNoise, sampler_IntersectionNoise, nUV + TIME_VERTEX/_IntersectionTiling * _IntersectionSpeed).r;
float interSecGradient = 1-saturate(exp(scene.verticalDepth) / _IntersectionLength);
#endif
#ifdef _WAVE_FOAM
// remap wave from [_WaveFoamClipping,1] to [0,1]
//float waveFoamNoise = (waveMesure - _WaveFoamClipping) / (1 - _WaveFoamClipping) * foamTexNoise;
float waveFoamNoise = smoothstep(_WaveFoamClipping.x, _WaveFoamClipping.y, waveMesure * foamTexNoise);
//return float4(waveFoamNoise.xxx, 1);
#else
float waveFoamNoise = 0;
#endif
/* ========
// Intercection
=========== */
#ifdef _INTERSECTION
float intersecMesure = waveMesure * interSecGradient;
float dist = saturate(interSecGradient / _IntersectionFalloff);
float intersecNoise = saturate(foamTexNoise + intersecMesure) * dist + dist;
intersecNoise = smoothstep(_IntersectionClipping, 1, intersecNoise);
#else
float intersecNoise = 0;
#endif
#if _INTERSECTION || _WAVE_FOAM
float noise = saturate(intersecNoise + waveFoamNoise);
water.albedo.rgb = lerp(water.albedo.rgb, _IntersectionColor.rgb, noise);
water.alpha = saturate(water.alpha + interSecGradient);
#else
float noise = 0;
#endif
/* ========
// Causitcs
=========== */
#ifdef _CAUSTICS
float2 cuv = positionWS.xz * _CausticsTiling;
float coffset = TIME_VERTEX/_CausticsTiling * _CausticsSpeed;
float3 caustics1 = SAMPLE_TEXTURE2D(_CausticsTex, sampler_CausticsTex, cuv + coffset).rgb;
float3 caustics2 = SAMPLE_TEXTURE2D(_CausticsTex, sampler_CausticsTex, cuv*0.8 - coffset).rgb;
// Limit distance from cam and verticalDepth
float3 causticsDensity = saturate((1-length(water.viewDelta) / _CausticsClipping.x) * smoothstep(_CausticsClipping.y,1, scene.verticalDepth));
float3 caustics = min(caustics1, caustics2) * _CausticsBrightness * causticsDensity;
#endif
/* ========
// Reflection Prob
=========== */
half3 reflectionVector = reflect(-viewDir, normalWS);
water.reflections = GlossyEnvironmentReflection(reflectionVector, water.positionWS, _ReflectionBlur, 1 ,scene.screenPos.xy);
//Schlick's BRDF fresnel AIR_RI = 1.000293
float cosTheta = saturate(dot(normalWS, viewDir));
water.reflectionMask = pow(max(0.0, 1.000293 - cosTheta), _ReflectionFresnel) * _ReflectionStrength;
water.albedo = lerp(water.albedo, water.reflections.rgb, water.reflectionMask - noise);
// =================== Make ApplyLight simple =========================
// =====Translucency Begin========
float3 lightDir = mainLight.direction;
float3 lightColor = mainLight.color;
float3 emission = 0;
float3 specular = 0;
float scatteringMask = saturate(water.fog + water.edgeFade);
half incident = saturate(dot(lightDir, normalWS)) * _TranslucencyStrengthDirect;
const float lightIntensity = lightColor.r * 0.3 + lightColor.g * 0.59 + lightColor.b * 0.11;
half attenuation = incident * scatteringMask * lightIntensity;
#ifdef _CAUSTICS
emission += lerp(caustics * lightIntensity, _ShallowColor.rgb, attenuation) * mainLight.distanceAttenuation;
#else
emission = lerp(0, _ShallowColor.rgb, attenuation) * mainLight.distanceAttenuation;
#endif
// =====Translucency End========
#ifdef _LIGHT_COLOR
// LightingLambert Light applied here
half3 attenuatedLightColor = lightColor * (mainLight.distanceAttenuation * mainLight.shadowAttenuation);
half3 diffuseColor = LightingLambert(attenuatedLightColor, lightDir, normalWS) + _GlossyEnvironmentColor.rgb * _AmbientStrength;
float3 finalColor = (water.albedo * diffuseColor ) + emission + specular;
#else
float3 finalColor = (water.albedo ) + emission + specular;
#endif
finalColor = lerp(finalColor, _IntersectionColor.rgb, noise);
// =================== Make ApplyLight simple end =========================
finalColor = lerp(scene.color, finalColor, water.fog + noise);
//Apply fog
half fogCoord = InitializeInputDataFog(float4(positionWS,1), input.fogFactor);
finalColor = MixFog(finalColor, fogCoord);
return float4(finalColor, water.alpha);
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 95ba63cd357fb4f8f9c245d81f3e78a3
ShaderIncludeImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,69 @@
TEXTURE2D(_IntersectionNoise);
SAMPLER(sampler_IntersectionNoise);
TEXTURE2D(_CausticsTex);
SAMPLER(sampler_CausticsTex);
CBUFFER_START(UnityPerMaterial)
float2 _Direction;
float _Speed;
half _AmbientStrength;
#ifdef TESSELLATION_ON
float _TessValue;
float _TessMin;
float _TessMax;
#endif
//Color + Transparency
half4 _BaseColor;
half4 _ShallowColor;
float4 _HorizonColor;
half _HorizonDistance;
float _DepthVertical;
float _DepthHorizontal;
half _EdgeFade;
half _TranslucencyStrengthDirect;
//Reflection + Refraction
float _ReflectionBlur;
float _ReflectionFresnel;
float _ReflectionStrength;
float _RefractionStrength;
//Intercection
float4 _IntersectionColor;
float _IntersectionLength;
half _IntersectionTiling;
half _IntersectionSpeed;
half2 _IntersectionClipping;
half _IntersectionFalloff;
// Wave foam
half _WaveMesureMin;
half _WaveMesureMax;
half2 _WaveFoamClipping;
// Caustics
half _CausticsBrightness;
float _CausticsTiling;
half _CausticsSpeed;
half2 _CausticsClipping;
//Waves
float _WaveSpeed;
half _WaveHeight;
half _WaveNormalStr;
float _WaveDistance;
half2 _WaveFadeDistance;
float _WaveSteepness;
uint _WaveCount;
half4 _WaveDirection;
CBUFFER_END

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 95a615afb06ca4ffdba1edec02894c54
ShaderIncludeImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,168 @@
//Stylized Water 2
//Staggart Creations (http://staggart.xyz)
//Copyright protected under Unity Asset Store EULA
#if defined(SHADER_API_XBOXONE) || defined(SHADER_API_PSSL)
// AMD recommends this value for GCN http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2013/05/GCNPerformanceTweets.pdf
#define MAX_TESSELLATION_FACTORS 15.0
#else
#define MAX_TESSELLATION_FACTORS 64.0
#endif
#if defined(SHADER_API_GLES2)
#warning Current graphics API does not support tessellation, falling back to non-tessellated shader automatically.
#else
#define UNITY_CAN_COMPILE_TESSELLATION
#endif
struct Attributes
{
float4 positionOS : POSITION;
float4 normalOS : NORMAL;
float4 tangentOS : TANGENT;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct Varyings
{
half fogFactor : TEXCOORD1;
//wPos.x in w-component
float4 normalWS : NORMAL;
//wPos.y in w-component
float4 tangent : TANGENT;
//wPos.z in w-component
float4 bitangent : TEXCOORD4;
float4 positionNDC : TEXCOORD5;
float4 positionCS : SV_POSITION;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct TessellationFactors
{
float edge[3] : SV_TessFactor;
float inside : SV_InsideTessFactor;
};
struct VertexControl
{
float4 positionOS : INTERNALTESSPOS;
float4 normalOS : NORMAL;
float4 tangentOS : TANGENT;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
VertexControl VertexTessellation(Attributes input)
{
VertexControl output;
UNITY_SETUP_INSTANCE_ID(input);
UNITY_TRANSFER_INSTANCE_ID(input, output);
output.positionOS = input.positionOS;
output.normalOS = input.normalOS;
output.tangentOS = input.tangentOS;
return output;
}
float CalcDistanceTessFactor(float4 positionOS, float minDist, float maxDist, float tess)
{
float3 positionWS = TransformObjectToWorld(positionOS.xyz).xyz;
float dist = distance(positionWS, GetCurrentViewPosition());
float f = (1.0-saturate((dist - minDist) / (maxDist - minDist)) + 0.001) * tess;
return f;
}
float4 CalcTriEdgeTessFactors (float3 triVertexFactors)
{
float4 tess;
tess.x = 0.5 * (triVertexFactors.y + triVertexFactors.z);
tess.y = 0.5 * (triVertexFactors.x + triVertexFactors.z);
tess.z = 0.5 * (triVertexFactors.x + triVertexFactors.y);
tess.w = (triVertexFactors.x + triVertexFactors.y + triVertexFactors.z) / 3.0f;
return tess;
}
float4 DistanceBasedTess(float4 v0, float4 v1, float4 v2, float tess, float minDist, float maxDist)
{
float3 f;
f.x = CalcDistanceTessFactor(v0, minDist, maxDist, tess);
f.y = CalcDistanceTessFactor(v1, minDist, maxDist, tess);
f.z = CalcDistanceTessFactor(v2, minDist, maxDist, tess);
//Don't use the Core RP version, creates cracks on edges
return CalcTriEdgeTessFactors(f);
}
TessellationFactors HullConstant(InputPatch<VertexControl, 3> patch)
{
TessellationFactors output;
float4 tf = DistanceBasedTess(patch[0].positionOS, patch[1].positionOS, patch[2].positionOS, _TessValue, _TessMin, _TessMax);
UNITY_SETUP_INSTANCE_ID(patch[0]);
output.edge[0] = tf.x;
output.edge[1] = tf.y;
output.edge[2] = tf.z;
output.inside = tf.w;
return output;
}
[maxtessfactor(MAX_TESSELLATION_FACTORS)]
[domain("tri")]
[partitioning("fractional_odd")]
[outputtopology("triangle_cw")]
[patchconstantfunc("HullConstant")]
[outputcontrolpoints(3)]
VertexControl Hull(InputPatch<VertexControl, 3> input, uint id : SV_OutputControlPointID)
{
return input[id];
}
#define TESSELLATION_INTERPOLATE_BARY_URP(name, bary) IN.name = input[0].name * bary.x + input[1].name * bary.y + input[2].name * bary.z
[domain("tri")]
Varyings Domain(TessellationFactors factors, OutputPatch<VertexControl, 3> input, float3 baryCoords : SV_DomainLocation)
{
Attributes IN = (Attributes)0;
Varyings output = (Varyings)0;
TESSELLATION_INTERPOLATE_BARY_URP(positionOS, baryCoords);
TESSELLATION_INTERPOLATE_BARY_URP(normalOS, baryCoords);
TESSELLATION_INTERPOLATE_BARY_URP(tangentOS, baryCoords);
//Tessellation does not work entirely correct with GPU instancing
UNITY_TRANSFER_INSTANCE_ID(input[0], output);
VertexNormalInputs normalInput = GetVertexNormalInputs(IN.normalOS.xyz, IN.tangentOS);
float3 positionWS = TransformObjectToWorld(IN.positionOS.xyz);
WaveInfo waves = GetWaveInfo(positionWS.xz, TIME_VERTEX * _WaveSpeed, _WaveHeight, 1, _WaveFadeDistance.x, _WaveFadeDistance.y);
positionWS += waves.position;
float4 positionCS = TransformWorldToHClip(positionWS);
output.positionCS = positionCS;
float4 ndc = positionCS * 0.5f;
ndc.xy = float2(ndc.x, ndc.y * _ProjectionParams.x) + ndc.w;
ndc.zw = positionCS.zw;
output.positionNDC = ndc;
output.normalWS = float4(waves.normal, positionWS.x);
output.tangent = float4(normalInput.tangentWS, positionWS.y);
output.bitangent = float4(normalInput.bitangentWS, positionWS.z);
output.fogFactor = ComputeFogFactor(positionCS.z);
return output;
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 997d96eeb92684567bef3d090a4b62f4
ShaderIncludeImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,35 @@
//Stylized Water 2
//Staggart Creations (http://staggart.xyz)
//Copyright protected under Unity Asset Store EULA
#ifndef PIPELINE_INCLUDED
#define PIPELINE_INCLUDED
#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/ShaderVariablesFunctions.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SurfaceInput.hlsl"
#ifdef POST_PROCESSING //These would have the core blit library included
#define UNITY_CORE_SAMPLERS_INCLUDED
#endif
#ifndef UNITY_CORE_SAMPLERS_INCLUDED //Backwards compatibility for <2023.1+
#define UNITY_CORE_SAMPLERS_INCLUDED
SamplerState sampler_LinearClamp;
SamplerState sampler_PointClamp;
SamplerState sampler_PointRepeat;
SamplerState sampler_LinearRepeat;
#endif
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareOpaqueTexture.hlsl"
#endif

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 4cafd3b397c0142d8a82101a49d68e45
ShaderIncludeImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,64 @@
struct Attributes
{
float4 positionOS : POSITION;
float4 normalOS : NORMAL;
float4 tangentOS : TANGENT;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct Varyings
{
half fogFactor : TEXCOORD1;
//wPos.x in w-component
float4 normalWS : NORMAL;
//wPos.y in w-component
float4 tangent : TANGENT;
//wPos.z in w-component
float4 bitangent : TEXCOORD4;
float4 positionNDC : TEXCOORD5;
float4 positionCS : SV_POSITION;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
Varyings LitPassVertex(Attributes input)
{
Varyings output = (Varyings)0;
UNITY_SETUP_INSTANCE_ID(input);
UNITY_TRANSFER_INSTANCE_ID(input, output);
float3 positionWS = TransformObjectToWorld(input.positionOS.xyz);
VertexNormalInputs normalInput = GetVertexNormalInputs(input.normalOS.xyz, input.tangentOS);
//WaveInfo waves = GetWaveInfo(uv, TIME_VERTEX * _WaveSpeed, _WaveHeight, lerp(1, 0, vertexColor.b), _WaveFadeDistance.x, _WaveFadeDistance.y);
WaveInfo waves = GetWaveInfo(positionWS.xz, TIME_VERTEX * _WaveSpeed, _WaveHeight, 1, _WaveFadeDistance.x, _WaveFadeDistance.y);
//waves.normal = normalInput.normalWS;
//waves.position = 0;
//Apply vertex displacements
positionWS += waves.position.xyz;
float4 positionCS = TransformWorldToHClip(positionWS);
output.positionCS = positionCS;
float4 ndc = positionCS * 0.5f;
ndc.xy = float2(ndc.x, ndc.y * _ProjectionParams.x) + ndc.w;
ndc.zw = positionCS.zw;
output.positionNDC = ndc;
output.normalWS = float4(waves.normal, positionWS.x);
output.tangent = float4(normalInput.tangentWS, positionWS.y);
output.bitangent = float4(normalInput.bitangentWS, positionWS.z);
output.fogFactor = ComputeFogFactor(positionCS.z);
return output;
}

View File

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

View File

@@ -0,0 +1,28 @@
//UNITY_SHADER_NO_UPGRADE
#ifndef WATER_OBJ_INCLUDE
#define WATER_OBJ_INCLUDE
#ifndef GET_TF_FROM_M
#define GET_TF_FROM_M(m) dot(float3(m[0].w, m[1].w, m[2].w),1)
#endif
inline float3 GetObjWaveDisplacement(float3 positionOS, float4 waterDir, float freq, float intensity, float factor)
{
float3 positionWS = TransformObjectToWorld(positionOS);
float objFreq = _Time.y * freq + positionWS.y ;
float objPhase = objFreq + GET_TF_FROM_M(GetObjectToWorldMatrix()) * waterDir.w;
float branchPhase = objPhase + dot(positionOS.xyz,1);
float offset = sin(objPhase) + cos(branchPhase);
return normalize(waterDir.xyz) * offset * factor * intensity;
}
void GGetObjWaveDisplacement_float(float3 positionOS, float4 waterDir, float freq, float intensity, float factor, out float3 Out)
{
Out = GetObjWaveDisplacement(positionOS, waterDir, freq, intensity, factor);
}
#endif //WATER_OBJ_INCLUDE

View File

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

View File

@@ -0,0 +1,102 @@
struct WaveInfo
{
float3 position;
float3 normal;
};
float3 GerstnerOffset4(float2 xzVtx, float4 steepness, float4 amp, float4 freq, float4 speed, float4 dirAB, float4 dirCD)
{
float3 offsets;
float4 AB = steepness.xxyy * dirAB.xyzw * amp.xxyy;
float4 CD = steepness.zzww * dirCD.xyzw * amp.zzww;
float4 dotABCD = freq.xyzw * float4(dot(dirAB.xy, xzVtx), dot(dirAB.zw, xzVtx), dot(dirCD.xy, xzVtx), dot(dirCD.zw, xzVtx));
float4 COS = cos(dotABCD + speed); float4 SIN = sin(dotABCD + speed);
offsets.x = dot(COS, float4(AB.xz, CD.xz));
offsets.z = dot(COS, float4(AB.yw, CD.yw));
offsets.y = dot(SIN, amp); //Remap to only positive values;
return offsets;
}
float3 GerstnerNormal4(float2 xzVtx, float4 amp, float4 freq, float4 speed, float4 dirAB, float4 dirCD)
{
float3 nrml = float3(0, 2.0, 0);
float4 AB = freq.xxyy * amp.xxyy * dirAB.xyzw;
float4 CD = freq.zzww * amp.zzww * dirCD.xyzw;
float4 dotABCD = freq.xyzw * float4(dot(dirAB.xy, xzVtx), dot(dirAB.zw, xzVtx), dot(dirCD.xy, xzVtx), dot(dirCD.zw, xzVtx));
float4 COS = cos(dotABCD + speed);
nrml.x -= dot(COS, float4(AB.xz, CD.xz));
nrml.z -= dot(COS, float4(AB.yw, CD.yw));
nrml.xz *= _WaveNormalStr;
nrml = normalize(nrml);
return nrml;
}
void Gerstner(inout float3 offs, inout float3 nrml,
float2 position,
float4 amplitude, float4 frequency, float4 steepness,
float4 speed, float4 directionAB, float4 directionCD)
{
offs += GerstnerOffset4(position, steepness, amplitude, frequency, speed, directionAB, directionCD);
nrml += GerstnerNormal4(position, amplitude, frequency, speed, directionAB, directionCD);
}
#define WAVE_COUNT _WaveCount
#define MAX_WAVE_COUNT 5
#define STEEPNESS_SCALE 0.01
//v1.1.8+
WaveInfo GetWaveInfo(float2 position, float2 time, float height, float mask, float fadeStart, float fadeEnd)
{
WaveInfo waves = (WaveInfo)0;
float4 amp = float4(0.3, 0.35, 0.25, 0.25);
float4 freq = float4(1.3, 1.35, 1.25, 1.25) * (1-_WaveDistance) * 3.0;
const float4 speed = float4(1.2* time.x, 1.375* time.y, 1.1 * time.x, time.y) ; //Pre-multiplied with time
const float4 dir1 = float4(0.3, 0.85, 0.85, 0.25) * _WaveDirection;
const float4 dir2 = float4(0.1, 0.9, -0.5, -0.5) * _WaveDirection;
const float4 steepness = float4(12.0, 12.0, 12.0, 12.0) * _WaveSteepness * lerp(1.0, MAX_WAVE_COUNT, 1/WAVE_COUNT);
//Distance based scalar
float pixelDist = length(GetCurrentViewPosition().xz - position.xy);
float fadeFactor = saturate((fadeEnd - pixelDist ) / (fadeEnd-fadeStart));
for (uint i = 0; i <= WAVE_COUNT; i++)
{
float t = 1+((float)i / (float)WAVE_COUNT);
freq *= t;
amp *= fadeFactor;
Gerstner(/*out*/ waves.position, /*out*/ waves.normal, position, amp, freq, steepness, speed, dir1, dir2);
}
waves.normal = normalize(waves.normal);
//Average
waves.position.y /= WAVE_COUNT;
//waves.normal.xz *= WAVE_COUNT;
waves.position.xz *= STEEPNESS_SCALE * height * mask;
waves.position.y *= height * mask;
return waves;
}
//Depricated
WaveInfo GetWaveInfo(float2 position, float2 time, float fadeStart, float fadeEnd)
{
return GetWaveInfo(position, time, 1.0, 1.0, fadeStart, fadeEnd);
}

View File

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

View File

@@ -0,0 +1,56 @@
//UNITY_SHADER_NO_UPGRADE
#ifndef WIND_ANIM_INCLUDE
#define WIND_ANIM_INCLUDE
inline float4 SmoothCurve( float4 x ) {
return x * x *( 3.0 - 2.0 * x );
}
inline float4 TriangleWave( float4 x ) {
return abs( frac( x + 0.5 ) * 2.0 - 1.0 );
}
inline float4 SmoothTriangleWave( float4 x ) {
return SmoothCurve( TriangleWave( x ) );
}
inline float4 ClothWindAnim(float4 pos, float3 normal, float4 animParams,float4 wind,float2 time)
{
// animParams.x = branch phase
// animParams.y = edge flutter factor
// animParams.z = primary factor
// animParams.w = secondary factor
float fDetailAmp = 0.1f;
float fBranchAmp = 0.3f;
// Phases (object, vertex, branch)
float fObjPhase = dot(unity_ObjectToWorld[3].xyz, 1);
float fBranchPhase = fObjPhase + animParams.x;
float fVtxPhase = dot(pos.xyz, animParams.y + fBranchPhase);
// x is used for edges; y is used for branches
float2 vWavesIn = time + float2(fVtxPhase, fBranchPhase );
// 1.975, 0.793, 0.375, 0.193 are good frequencies
float4 vWaves = (frac( vWavesIn.xxyy * float4(1.975, 0.793, 0.375, 0.193) ) * 2.0 - 1.0);
vWaves = SmoothTriangleWave( vWaves );
float2 vWavesSum = vWaves.xz + vWaves.yw;
// Edge (xz) and branch bending (y)
float3 bend = animParams.y * fDetailAmp * normal.xyz;
bend.y = animParams.w * fBranchAmp;
pos.xyz += ((vWavesSum.xyx * bend)*wind.w + (wind.xyz * vWavesSum.y * animParams.w)) * wind.w;
// Primary bending
// Displace position
pos.xyz += animParams.z * wind.xyz;
return pos;
}
#endif //WIND_ANIM_INCLUDE

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 418d88a69b1774954ace0d91b8c685d7
ShaderIncludeImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,119 @@
Shader "zzwater/ocean"
{
Properties
{
_Direction("Animation direction", Vector) = (0,-1,0,0)
_Speed("Animation Speed", Float) = 1
_AmbientStrength("Ambient strength", Range(0, 1)) = 0.5
//Color + Transparency
[Toggle(_LIGHT_COLOR)] _LightColorOn("Main Light Color On", float) = 0
[HDR]_BaseColor("Deep", Color) = (0, 0.44, 0.62, 1)
[HDR]_ShallowColor("Shallow", Color) = (0.1, 0.9, 0.89, 0.02)
[HDR]_HorizonColor("Horizon", Color) = (0.84, 1, 1, 0.15)
_HorizonDistance("Horizon Distance", Range(0.01 , 32)) = 8
_DepthVertical("View Depth", Range(0.01 , 16)) = 4
_DepthHorizontal("Vertical Height Depth", Range(0.01 , 8)) = 1
_EdgeFade("Edge Fade", Float) = 0.1
_TranslucencyStrengthDirect("Translucency Strength (Direct)", Range(0 , 0.5)) = 0.05
//Reflection + Refraction
[Toggle(_REFRACTION)] _RefractionOn("Refraction On", float) = 0
_ReflectionStrength("Reflection Strength", Range(0, 1)) = 1
_ReflectionBlur("Probe Blur Factor", Range(0, 1)) = 0
_ReflectionFresnel("Reflection Curvature mask", Range(0.01, 20)) = 5
_RefractionStrength("Refraction Strength", Range(0, 1)) = 0.1
//Intersection
[Toggle(_INTERSECTION)] _IntersectionOn("Intersection On", float) = 0
[NoScaleOffset][SingleLineTexture]_IntersectionNoise("Intersection noise", 2D) = "white" {}
_IntersectionTiling("Noise Tiling", float) = 0.2
_IntersectionColor("Foam Color", Color) = (1,1,1,1)
_IntersectionSpeed("Intersection Speed Multi", Float) = 1
_IntersectionClipping("Intersection Cutoff", Vector) = (0.5, 1, 0, 0)
_IntersectionFalloff("Intersection Falloff", Range(0.01 , 1)) = 0.5
_IntersectionLength("Intersection Distance", Range(0.01 , 5)) = 2
// Wave foam
[Toggle(_WAVE_FOAM)] _WaveFoamOn("Wave Foam On", float) = 0
_WaveMesureMin("Wave Mesure Min", float) = 0
_WaveMesureMax("Wave Mesure Max", float) = 0.3
_WaveFoamClipping("Wave Cutoff", Vector) = (0.9, 1, 0, 0)
// Caustics
[Toggle(_CAUSTICS)] _CausticsOn("Caustics On", float) = 0
_CausticsBrightness("Brightness", Float) = 2
_CausticsTiling("Tiling", Float) = 0.5
_CausticsSpeed("Speed multiplier", Float) = 0.1
_CausticsClipping("Caustics Cutoff (Y)dis (X)dep", Vector) = (6,0.3, 0, 0)
//waves
_WaveSpeed("Wave Speed", Float) = 2
_WaveHeight("Wave Height", Range(0 , 10)) = 0.25
_WaveNormalStr("Normal Strength", Range(0 , 32)) = 0.5
_WaveDistance("Distance", Range(0 , 1)) = 0.8
_WaveFadeDistance("Wave fade distance (Start/End)", Vector) = (150, 300, 0, 0)
_WaveSteepness("Steepness", Range(0 , 5)) = 0.1
_WaveCount("Count", Range(1 , 5)) = 1
_WaveDirection("Direction", vector) = (1,1,1,1)
}
SubShader
{
Tags
{
"RenderType" = "Transparent"
"RenderPipeline" = "UniversalPipeline"
"UniversalMaterialType" = "Lit"
"IgnoreProjector" = "True"
"Queue" = "Transparent+0"
}
Pass
{
Name "ForwardLit"
Tags { "LightMode"="UniversalForward" }
Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha
ZWrite On
Cull Back
ZTest LEqual
ZClip On
HLSLPROGRAM
#pragma target 3.0
#pragma multi_compile_instancing
#pragma instancing_options renderinglayer
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
#include "Packages/zzwater/shaders/libs/URP.hlsl"
#include "Packages/zzwater/shaders/libs/Common.hlsl"
#include "Packages/zzwater/shaders/libs/Input.hlsl"
#include "Packages/zzwater/shaders/libs/Waves.hlsl"
#pragma shader_feature_local_fragment _LIGHT_COLOR
#pragma shader_feature_local_fragment _REFRACTION
#pragma shader_feature_local_fragment _INTERSECTION
#pragma shader_feature_local_fragment _WAVE_FOAM
#pragma shader_feature_local_fragment _CAUSTICS
//Fog rendering (integration)
#define UnityFog
#pragma multi_compile_fog
#pragma vertex LitPassVertex
#include "Packages/zzwater/shaders/libs/Vertex.hlsl"
#pragma fragment ForwardPassFragment
#include "Packages/zzwater/shaders/libs/ForwardPass.hlsl"
ENDHLSL
}
}
FallBack "Diffuse"
}

View File

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

View File

@@ -0,0 +1,135 @@
Shader "zzwater/ocean_tess"
{
Properties
{
_Direction("Animation direction", Vector) = (0,-1,0,0)
_Speed("Animation Speed", Float) = 1
_AmbientStrength("Ambient strength", Range(0, 1)) = 0.5
//Tessellation
_TessValue("Max subdivisions", Range(1, 64)) = 16
_TessMin("Start Distance", Float) = 0
_TessMax("End Distance", Float) = 15
//Color + Transparency
[Toggle(_LIGHT_COLOR)] _LightColorOn("Main Light Color On", float) = 0
[HDR]_BaseColor("Deep", Color) = (0, 0.44, 0.62, 1)
[HDR]_ShallowColor("Shallow", Color) = (0.1, 0.9, 0.89, 0.02)
[HDR]_HorizonColor("Horizon", Color) = (0.84, 1, 1, 0.15)
_HorizonDistance("Horizon Distance", Range(0.01 , 32)) = 8
_DepthVertical("View Depth", Range(0.01 , 16)) = 4
_DepthHorizontal("Vertical Height Depth", Range(0.01 , 8)) = 1
_EdgeFade("Edge Fade", Float) = 0.1
_TranslucencyStrengthDirect("Translucency Strength (Direct)", Range(0 , 0.5)) = 0.05
//Reflection + Refraction
[Toggle(_REFRACTION)] _RefractionOn("Refraction On", float) = 0
_ReflectionStrength("Reflection Strength", Range(0, 2)) = 1
_ReflectionBlur("Probe Blur Factor", Range(0, 1)) = 0
_ReflectionFresnel("Reflection Curvature mask", Range(0.01, 20)) = 5
_RefractionStrength("Refraction Strength", Range(0, 1)) = 0.1
//Intersection
[Toggle(_INTERSECTION)] _IntersectionOn("Intersection On", float) = 0
[NoScaleOffset][SingleLineTexture]_IntersectionNoise("Intersection noise", 2D) = "white" {}
_IntersectionTiling("Noise Tiling", float) = 0.2
_IntersectionColor("Foam Color", Color) = (1,1,1,1)
_IntersectionSpeed("Intersection Speed Multi", Float) = 1
_IntersectionClipping("Intersection Cutoff", Vector) = (0.5, 1, 0, 0)
_IntersectionFalloff("Intersection Falloff", Range(0.01 , 1)) = 0.5
_IntersectionLength("Intersection Distance", Range(0.01 , 5)) = 2
// Wave foam
[Toggle(_WAVE_FOAM)] _WaveFoamOn("Wave Foam On", float) = 0
_WaveMesureMin("Wave Mesure Min", float) = 0
_WaveMesureMax("Wave Mesure Max", float) = 0.3
_WaveFoamClipping("Wave Cutoff", Vector) = (0.9, 1, 0, 0)
// Caustics
[Toggle(_CAUSTICS)] _CausticsOn("Caustics On", float) = 0
[NoScaleOffset][SingleLineTexture]_CausticsTex("Caustics RGB", 2D) = "black" {}
_CausticsBrightness("Brightness", Float) = 2
_CausticsTiling("Tiling", Float) = 0.5
_CausticsSpeed("Speed multiplier", Float) = 0.1
_CausticsClipping("Caustics Cutoff (Y)dis (X)dep", Vector) = (6,0.3,0,0)
//waves
_WaveSpeed("Wave Speed", Float) = 2
_WaveHeight("Wave Height", Range(0 , 10)) = 0.25
_WaveNormalStr("Normal Strength", Range(0 , 32)) = 0.5
_WaveDistance("Distance", Range(0 , 1)) = 0.8
_WaveFadeDistance("Wave fade distance (Start/End)", Vector) = (150, 300, 0, 0)
_WaveSteepness("Steepness", Range(0 , 5)) = 0.1
_WaveCount("Count", Range(1 , 5)) = 1
_WaveDirection("Direction", vector) = (1,1,1,1)
}
SubShader
{
Tags
{
"RenderType" = "Transparent"
"RenderPipeline" = "UniversalPipeline"
"UniversalMaterialType" = "Lit"
"IgnoreProjector" = "True"
"Queue" = "Transparent+0"
}
Pass
{
Name "ForwardLit"
Tags { "LightMode"="UniversalForward" }
Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha
ZWrite On
Cull Back
ZTest LEqual
ZClip On
HLSLPROGRAM
#pragma target 4.6
#pragma exclude_renderers gles
#define TESSELLATION_ON
#pragma require tessellation tessHW
#pragma hull Hull
#pragma domain Domain
#pragma multi_compile_instancing
#pragma instancing_options renderinglayer
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
#include "Packages/zzwater/shaders/libs/URP.hlsl"
#include "Packages/zzwater/shaders/libs/Common.hlsl"
#include "Packages/zzwater/shaders/libs/Input.hlsl"
#include "Packages/zzwater/shaders/libs/Waves.hlsl"
#pragma shader_feature_local_fragment _LIGHT_COLOR
#pragma shader_feature_local_fragment _REFRACTION
#pragma shader_feature_local_fragment _INTERSECTION
#pragma shader_feature_local_fragment _WAVE_FOAM
#pragma shader_feature_local_fragment _CAUSTICS
//Fog rendering (integration)
#define UnityFog
#pragma multi_compile_fog
#pragma vertex VertexTessellation
#include "Packages/zzwater/shaders/libs/Tesselation.hlsl"
#pragma fragment ForwardPassFragment
#include "Packages/zzwater/shaders/libs/ForwardPass.hlsl"
ENDHLSL
}
}
FallBack "Diffuse"
}

View File

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

View File

@@ -0,0 +1,93 @@
Shader "zzwater/waterPlant"
{
Properties
{
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_TineColor("Tine color", Color) = (1,1,1)
_SwayFreq("Sway Frequency", Range(0,5)) = 1.0
_SwayIntensity("Sway Intensity", Range(0.05,0.5)) = 0.1
_WaterDir("Water Direction", Vector) = (1,0,0,0)
// _waterDir.w for wave diff from each other
}
SubShader
{
Tags
{
"RenderPipeline"="UniversalPipeline"
"RenderType"="Opaque"
"UniversalMaterialType" = "Unlit"
"Queue"="Geometry"
"DisableBatching"="False"
}
Pass
{
Name "Universal Forward"
Tags
{
// LightMode: <None>
}
// Render State
Cull Back
Blend One Zero
ZTest LEqual
ZWrite On
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/zzwater/shaders/libs/WaveObj.hlsl"
struct Attributes {
float4 positionOS : POSITION;
float2 uv : TEXCOORD0;
float4 color : COLOR;
};
struct Varyings
{
float4 positionHCS : SV_POSITION;
float2 uv : TEXCOORD0;
float4 color : TEXCOORD1;
};
CBUFFER_START(UnityPerMaterial)
float4 _MainTex_ST;
float3 _TineColor;
half _SwayFreq;
half _SwayIntensity;
float4 _WaterDir;
CBUFFER_END
TEXTURE2D(_MainTex);
SAMPLER(sampler_MainTex);
Varyings vert (Attributes v)
{
Varyings o;
float3 displacement;
v.positionOS.xyz += GetObjWaveDisplacement(v.positionOS, _WaterDir, _SwayFreq, _SwayIntensity, v.color.a);
o.positionHCS = TransformObjectToHClip(v.positionOS.xyz);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
o.color = v.color;
return o;
}
half4 frag (Varyings i) : SV_Target
{
half4 albedo = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv);
clip(albedo.a - 0.5);
return half4(albedo.rgb * _TineColor, 1.0);
}
ENDHLSL
}
}
}

View File

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

View File

@@ -0,0 +1,105 @@
Shader "zzwind/WindClothUnlit"
{
Properties
{
[MainTexture] _BaseMap("Texture", 2D) = "white" {}
[MainColor] _BaseColor("Color", Color) = (1, 1, 1, 1)
_Cutoff("AlphaCutout", Range(0.0, 1.0)) = 0.5
_Wind("Wind params",Vector) = (1,1,1,1)
_WindAmplitude("Wind Amplitude", float) = 0.5
_WindSpeed("Wind Speed",float) = 0.5
}
SubShader
{
Tags
{
"RenderType" = "Opaque"
"IgnoreProjector" = "True"
"UniversalMaterialType" = "Unlit"
"RenderPipeline" = "UniversalPipeline"
}
Pass
{
Name "Unlit"
Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha
ZWrite On
Cull Back
ZTest LEqual
ZClip On
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
#include "Packages/zzwater/shaders/libs/WindAnim.hlsl"
TEXTURE2D(_BaseMap);
SAMPLER(sampler_BaseMap);
CBUFFER_START(UnityPerMaterial)
float _Cutoff;
half4 _BaseColor;
half4 _BaseMap_ST;
half4 _Wind;
float _WindAmplitude;
float _WindSpeed;
CBUFFER_END
struct Attributes
{
float4 positionOS : POSITION;
float4 tangentOS : TANGENT;
float2 uv : TEXCOORD0;
float3 normalOS : NORMAL;
float4 color : COLOR;
};
struct Varyings
{
float4 positionCS : SV_POSITION;
float2 uv : TEXCOORD0;
float4 color : TEXCOORD2;
};
Varyings vert(Attributes input)
{
Varyings output;
float bendingFact = input.color.a;
float4 wind;
wind.xyz = _Wind.xyz;
wind.w = _Wind.w * bendingFact.x;
float4 windParams = float4(0,_WindAmplitude,bendingFact,0);
float windTime = _Time.y * _WindSpeed;
float4 VertexInWndPos = ClothWindAnim(input.positionOS,input.normalOS,windParams,wind,windTime);
output.positionCS = TransformObjectToHClip(VertexInWndPos);
output.uv = TRANSFORM_TEX(input.uv, _BaseMap);
output.color = input.color;
return output;
}
float4 frag(Varyings input) : SV_Target
{
half2 uv = input.uv;
half4 texColor = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, uv);
half3 color = texColor.rgb * _BaseColor.rgb;
half alpha = texColor.a * _BaseColor.a;
clip(alpha - _Cutoff);
return float4(color, alpha);
}
ENDHLSL
}
}
}

View File

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