[A] Tessellattion
This commit is contained in:
@@ -27,7 +27,7 @@ public class FPS : MonoBehaviour
|
||||
|
||||
void Start()
|
||||
{
|
||||
Application.targetFrameRate = 0;
|
||||
Application.targetFrameRate = 60;
|
||||
}
|
||||
|
||||
void OnGUI()
|
||||
@@ -47,4 +47,15 @@ public class FPS : MonoBehaviour
|
||||
Rect rect = new Rect(20, h * 0.4f, w * 0.5f, h * 2 / 100);
|
||||
GUI.Label(rect, text, fpsStyle);
|
||||
}
|
||||
|
||||
public GameObject[] objs;
|
||||
|
||||
[ContextMenu("Switch")]
|
||||
void Switch()
|
||||
{
|
||||
foreach (var obj in objs)
|
||||
{
|
||||
obj.SetActive(!obj.activeSelf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,9 @@ using UnityEngine;
|
||||
public class TestUI : MonoBehaviour
|
||||
{
|
||||
public TMP_Dropdown QualityDropdown;
|
||||
public TMP_Dropdown waterSwitch;
|
||||
|
||||
public GameObject[] Waters;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
@@ -19,5 +22,20 @@ public class TestUI : MonoBehaviour
|
||||
QualityDropdown.AddOptions(QualitySettings.names.ToList());
|
||||
QualityDropdown.value = QualitySettings.GetQualityLevel();
|
||||
QualityDropdown.onValueChanged.AddListener(index => QualitySettings.SetQualityLevel(index));
|
||||
|
||||
waterSwitch.ClearOptions();
|
||||
waterSwitch.AddOptions(Waters.Select(_ => _.name).ToList());
|
||||
waterSwitch.value = 0;
|
||||
OnWaterChange(0);
|
||||
waterSwitch.onValueChanged.AddListener(OnWaterChange);
|
||||
}
|
||||
|
||||
private void OnWaterChange(int index)
|
||||
{
|
||||
for(int i = 0; i < Waters.Length; i++)
|
||||
{
|
||||
|
||||
Waters[i].SetActive(i == index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -107,10 +107,10 @@ Material:
|
||||
- _Parallax: 0.005
|
||||
- _QueueOffset: 0
|
||||
- _ReceiveShadows: 1
|
||||
- _ReflectionBlur: 0.012
|
||||
- _ReflectionFresnel: 3.01
|
||||
- _ReflectionBlur: 0.049
|
||||
- _ReflectionFresnel: 4.92
|
||||
- _ReflectionStrength: 0.913
|
||||
- _RefractionStrength: 0.415
|
||||
- _RefractionStrength: 0.278
|
||||
- _Smoothness: 0.5
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
@@ -122,22 +122,22 @@ Material:
|
||||
- _TranslucencyExp: 10
|
||||
- _TranslucencyReflectionMask: 0.764
|
||||
- _TranslucencyStrength: 0.7
|
||||
- _TranslucencyStrengthDirect: 0.411
|
||||
- _TranslucencyStrengthDirect: 0.421
|
||||
- _WaveCount: 2
|
||||
- _WaveDistance: 0.66
|
||||
- _WaveDistance: 0.764
|
||||
- _WaveHeight: 0.17
|
||||
- _WaveNormalStr: 0.2
|
||||
- _WaveSpeed: 0.88
|
||||
- _WaveSpeed: 1.2
|
||||
- _WaveSteepness: 3.17
|
||||
- _WorkflowMode: 1
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _BaseColor: {r: 0.1254902, g: 0.2901961, b: 0.34509805, a: 1}
|
||||
- _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: 0.95686275}
|
||||
- _ShallowColor: {r: 0.105882354, g: 0.4117647, b: 0.62352943, a: 1}
|
||||
- _HorizonColor: {r: 0.09376113, g: 0.10980392, b: 0.32156864, 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}
|
||||
|
||||
160
Packages/zzwater/Mats/Ocean_tess.mat
Normal file
160
Packages/zzwater/Mats/Ocean_tess.mat
Normal file
@@ -0,0 +1,160 @@
|
||||
%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}
|
||||
- _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
|
||||
- _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
|
||||
- _TessMax: 15
|
||||
- _TessMin: 0
|
||||
- _TessValue: 19.2
|
||||
- _TranslucencyCurvatureMask: 0.708
|
||||
- _TranslucencyExp: 10
|
||||
- _TranslucencyReflectionMask: 0.764
|
||||
- _TranslucencyStrength: 0.7
|
||||
- _TranslucencyStrengthDirect: 0.421
|
||||
- _WaveCount: 3
|
||||
- _WaveDistance: 0.764
|
||||
- _WaveHeight: 0.17
|
||||
- _WaveNormalStr: 0.2
|
||||
- _WaveSpeed: 1.2
|
||||
- _WaveSteepness: 3.76
|
||||
- _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}
|
||||
- _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
|
||||
8
Packages/zzwater/Mats/Ocean_tess.mat.meta
Normal file
8
Packages/zzwater/Mats/Ocean_tess.mat.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 26dea0e0ded16447caf69e797f3e571b
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 72eca873094d1443fa3b139331b80887
|
||||
guid: 1d05120cc1a284396a8f76069854c618
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
@@ -11,7 +11,7 @@ ScriptedImporter:
|
||||
waterMesh:
|
||||
shape: 0
|
||||
scale: 100
|
||||
vertexDistance: 2
|
||||
vertexDistance: 1
|
||||
UVTiling: 1
|
||||
noise: 0
|
||||
boundsPadding: 4
|
||||
0
Packages/zzwater/Mods/dis2water.watermesh
Normal file
0
Packages/zzwater/Mods/dis2water.watermesh
Normal file
18
Packages/zzwater/Mods/dis2water.watermesh.meta
Normal file
18
Packages/zzwater/Mods/dis2water.watermesh.meta
Normal 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: 100
|
||||
vertexDistance: 2
|
||||
UVTiling: 1
|
||||
noise: 0
|
||||
boundsPadding: 4
|
||||
mesh: {fileID: -8670151273213183110, guid: 154c6496b574b495eaf1e56696d041c5, type: 3}
|
||||
@@ -4,6 +4,12 @@ CBUFFER_START(UnityPerMaterial)
|
||||
float2 _Direction;
|
||||
float _Speed;
|
||||
|
||||
#ifdef TESSELLATION_ON
|
||||
float _TessValue;
|
||||
float _TessMin;
|
||||
float _TessMax;
|
||||
#endif
|
||||
|
||||
//Color + Transparency
|
||||
half4 _BaseColor;
|
||||
half4 _ShallowColor;
|
||||
|
||||
167
Packages/zzwater/shaders/libs/Tesselation.hlsl
Normal file
167
Packages/zzwater/shaders/libs/Tesselation.hlsl
Normal file
@@ -0,0 +1,167 @@
|
||||
|
||||
//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
|
||||
{
|
||||
half4 fogFactorAndVertexLight : TEXCOORD1; // x: fogFactor, yzw: vertex light
|
||||
|
||||
//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);
|
||||
|
||||
return output;
|
||||
}
|
||||
7
Packages/zzwater/shaders/libs/Tesselation.hlsl.meta
Normal file
7
Packages/zzwater/shaders/libs/Tesselation.hlsl.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 997d96eeb92684567bef3d090a4b62f4
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -69,15 +69,10 @@ Shader "zzwater/ocean"
|
||||
#include "Packages/zzwater/shaders/libs/Common.hlsl"
|
||||
#include "Packages/zzwater/shaders/libs/Input.hlsl"
|
||||
#include "Packages/zzwater/shaders/libs/Waves.hlsl"
|
||||
|
||||
#pragma vertex LitPassVertex
|
||||
#include "Packages/zzwater/shaders/libs/Vertex.hlsl"
|
||||
|
||||
#pragma vertex Vertex
|
||||
|
||||
Varyings Vertex(Attributes v)
|
||||
{
|
||||
return LitPassVertex(v);
|
||||
}
|
||||
|
||||
#pragma fragment ForwardPassFragment
|
||||
#include "Packages/zzwater/shaders/libs/ForwardPass.hlsl"
|
||||
|
||||
|
||||
96
Packages/zzwater/shaders/ocean_tess.shader
Normal file
96
Packages/zzwater/shaders/ocean_tess.shader
Normal file
@@ -0,0 +1,96 @@
|
||||
Shader "zzwater/ocean_tess"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_Direction("Animation direction", Vector) = (0,-1,0,0)
|
||||
_Speed("Animation Speed", Float) = 1
|
||||
|
||||
//Tessellation
|
||||
_TessValue("Max subdivisions", Range(1, 64)) = 16
|
||||
_TessMin("Start Distance", Float) = 0
|
||||
_TessMax("End Distance", Float) = 15
|
||||
|
||||
//Color + Transparency
|
||||
[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
|
||||
|
||||
_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
|
||||
|
||||
|
||||
//waves
|
||||
_WaveSpeed("Speed", Float) = 2
|
||||
_WaveHeight("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 Off
|
||||
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 vertex VertexTessellation
|
||||
#include "Packages/zzwater/shaders/libs/Tesselation.hlsl"
|
||||
|
||||
|
||||
#pragma fragment ForwardPassFragment
|
||||
#include "Packages/zzwater/shaders/libs/ForwardPass.hlsl"
|
||||
|
||||
ENDHLSL
|
||||
|
||||
}
|
||||
}
|
||||
FallBack "Diffuse"
|
||||
}
|
||||
9
Packages/zzwater/shaders/ocean_tess.shader.meta
Normal file
9
Packages/zzwater/shaders/ocean_tess.shader.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5e1bb555fbe9641c1b49b207771e3641
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user