[A] wind cloth

This commit is contained in:
2025-01-08 14:18:52 +08:00
parent e1775823a8
commit 6752d8b4f8
17 changed files with 391 additions and 347 deletions

View File

@@ -24,6 +24,10 @@ Material:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _Texture2D:
m_Texture: {fileID: 2800000, guid: 016ab36f33e35487bb91a3712c78b36e, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
@@ -40,10 +44,10 @@ Material:
m_Floats:
- _QueueControl: 0
- _QueueOffset: 0
- _WindAmplitude: 0
- _WindSpeed: 0
- _WindAmplitude: 0.5
- _WindSpeed: 0.1
m_Colors:
- _Wind: {r: 0, g: 0, b: 0, a: 0}
- _Wind: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []
--- !u!114 &291855134940589853
MonoBehaviour:

View File

@@ -27,12 +27,6 @@
{
"m_Id": "0943fe63088d42efa041e455f21e71d2"
},
{
"m_Id": "ea742361e9744acb8cd31aa4949b4301"
},
{
"m_Id": "b952358911ea49fb8f07a4d4cfc07c41"
},
{
"m_Id": "e840963ab3d244ffaa6bf841a0301395"
},
@@ -67,10 +61,7 @@
"m_Id": "371efd375f804703bc60c3816f4d04c7"
},
{
"m_Id": "add0750df8c14705991461537098d01f"
},
{
"m_Id": "c62ea57a43424109b96fc7522d4c2ac3"
"m_Id": "2449ef89a25342508eabaf32b84f3a91"
}
],
"m_GroupDatas": [],
@@ -93,13 +84,13 @@
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "2703a6f6f3bf44a19836f57c9a4b35f3"
"m_Id": "2803cfec9f194fb5974e8777c214b995"
},
"m_SlotId": 0
},
"m_InputSlot": {
"m_Node": {
"m_Id": "c62ea57a43424109b96fc7522d4c2ac3"
"m_Id": "e840963ab3d244ffaa6bf841a0301395"
},
"m_SlotId": 0
}
@@ -215,20 +206,6 @@
},
"m_SlotId": 0
}
},
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "c62ea57a43424109b96fc7522d4c2ac3"
},
"m_SlotId": 4
},
"m_InputSlot": {
"m_Node": {
"m_Id": "e840963ab3d244ffaa6bf841a0301395"
},
"m_SlotId": 0
}
}
],
"m_VertexContext": {
@@ -239,12 +216,6 @@
"m_Blocks": [
{
"m_Id": "0943fe63088d42efa041e455f21e71d2"
},
{
"m_Id": "ea742361e9744acb8cd31aa4949b4301"
},
{
"m_Id": "b952358911ea49fb8f07a4d4cfc07c41"
}
]
},
@@ -261,7 +232,7 @@
"m_Id": "371efd375f804703bc60c3816f4d04c7"
},
{
"m_Id": "add0750df8c14705991461537098d01f"
"m_Id": "2449ef89a25342508eabaf32b84f3a91"
}
]
},
@@ -436,6 +407,40 @@
"m_SupportVFX": false
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
"m_ObjectId": "2449ef89a25342508eabaf32b84f3a91",
"m_Group": {
"m_Id": ""
},
"m_Name": "SurfaceDescription.AlphaClipThreshold",
"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": "f341a428b0504d3db00746f3c6e989d0"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_SerializedDescriptor": "SurfaceDescription.AlphaClipThreshold"
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.VertexColorNode",
@@ -729,7 +734,7 @@
"m_CustomColors": {
"m_SerializableColors": []
},
"m_Space": 2
"m_Space": 0
}
{
@@ -747,21 +752,6 @@
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "55e7ed677b2f43ff972e2ba047fff85d",
"m_Id": 3,
"m_DisplayName": "B",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "B",
"m_StageCapability": 3,
"m_Value": 0.0,
"m_DefaultValue": 0.0,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
@@ -838,30 +828,6 @@
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.NormalMaterialSlot",
"m_ObjectId": "61e22519e853484aaf32f71f2870d0e8",
"m_Id": 0,
"m_DisplayName": "Normal",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "Normal",
"m_StageCapability": 1,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_Labels": [],
"m_Space": 0
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
@@ -1027,30 +993,6 @@
}
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot",
"m_ObjectId": "8fd4b67b566a41a8b0d6415f6ea4fc2d",
"m_Id": 0,
"m_DisplayName": "In",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "In",
"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_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.PropertyNode",
@@ -1108,21 +1050,6 @@
"m_ObjectId": "9be54a1b27b54d5590cdb2b8c4313bdf"
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "a1b6d64974c6499fa66d5d9291d491de",
"m_Id": 1,
"m_DisplayName": "R",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "R",
"m_StageCapability": 3,
"m_Value": 0.0,
"m_DefaultValue": 0.0,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.PropertyNode",
@@ -1195,21 +1122,6 @@
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "a7a2f25f3c1d44f48f90f2bf7d23d966",
"m_Id": 0,
"m_DisplayName": "Alpha Clip Threshold",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "AlphaClipThreshold",
"m_StageCapability": 2,
"m_Value": 0.5,
"m_DefaultValue": 0.5,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
@@ -1250,40 +1162,6 @@
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
"m_ObjectId": "add0750df8c14705991461537098d01f",
"m_Group": {
"m_Id": ""
},
"m_Name": "SurfaceDescription.AlphaClipThreshold",
"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": "a7a2f25f3c1d44f48f90f2bf7d23d966"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_SerializedDescriptor": "SurfaceDescription.AlphaClipThreshold"
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.SamplerStateMaterialSlot",
@@ -1322,55 +1200,6 @@
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
"m_ObjectId": "b952358911ea49fb8f07a4d4cfc07c41",
"m_Group": {
"m_Id": ""
},
"m_Name": "VertexDescription.Tangent",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 0.0,
"y": 0.0,
"width": 0.0,
"height": 0.0
}
},
"m_Slots": [
{
"m_Id": "dd86009a27bd487989a74d81707f35d2"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_SerializedDescriptor": "VertexDescription.Tangent"
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "bcb3b318c9974741b0b5d7948559d4b7",
"m_Id": 2,
"m_DisplayName": "G",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "G",
"m_StageCapability": 3,
"m_Value": 0.0,
"m_DefaultValue": 0.0,
"m_Labels": []
}
{
"m_SGVersion": 1,
"m_Type": "UnityEditor.ShaderGraph.PositionNode",
@@ -1408,68 +1237,6 @@
"m_PositionSource": 0
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.SplitNode",
"m_ObjectId": "c62ea57a43424109b96fc7522d4c2ac3",
"m_Group": {
"m_Id": ""
},
"m_Name": "Split",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 15.0,
"y": 674.0,
"width": 120.0,
"height": 149.0
}
},
"m_Slots": [
{
"m_Id": "8fd4b67b566a41a8b0d6415f6ea4fc2d"
},
{
"m_Id": "a1b6d64974c6499fa66d5d9291d491de"
},
{
"m_Id": "bcb3b318c9974741b0b5d7948559d4b7"
},
{
"m_Id": "55e7ed677b2f43ff972e2ba047fff85d"
},
{
"m_Id": "c9444fdf7967477a941288e2f10128af"
}
],
"synonyms": [
"separate"
],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
}
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "c9444fdf7967477a941288e2f10128af",
"m_Id": 4,
"m_DisplayName": "A",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "A",
"m_StageCapability": 3,
"m_Value": 0.0,
"m_DefaultValue": 0.0,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Texture2DMaterialSlot",
@@ -1513,30 +1280,6 @@
"m_DefaultType": 0
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.TangentMaterialSlot",
"m_ObjectId": "dd86009a27bd487989a74d81707f35d2",
"m_Id": 0,
"m_DisplayName": "Tangent",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "Tangent",
"m_StageCapability": 1,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_Labels": [],
"m_Space": 0
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Texture2DInputMaterialSlot",
@@ -1589,40 +1332,6 @@
"m_SerializedDescriptor": "SurfaceDescription.BaseColor"
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
"m_ObjectId": "ea742361e9744acb8cd31aa4949b4301",
"m_Group": {
"m_Id": ""
},
"m_Name": "VertexDescription.Normal",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 0.0,
"y": 0.0,
"width": 0.0,
"height": 0.0
}
},
"m_Slots": [
{
"m_Id": "61e22519e853484aaf32f71f2870d0e8"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_SerializedDescriptor": "VertexDescription.Normal"
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
@@ -1638,6 +1347,21 @@
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "f341a428b0504d3db00746f3c6e989d0",
"m_Id": 0,
"m_DisplayName": "Alpha Clip Threshold",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "AlphaClipThreshold",
"m_StageCapability": 2,
"m_Value": 0.5,
"m_DefaultValue": 0.5,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",

View File

@@ -2,20 +2,16 @@
#ifndef WIND_ANIM
#define WIND_ANIM
// SmoothTriangleWave function
inline float SmoothTriangleWave(float x)
{
// 将输入值限制在 [0, 1] 范围内,使用 frac 函数保证值是周期性的
x = frac(x);
// 使用三角函数生成平滑的波形注意frac(x) 生成的是 [0, 1] 之间的值
return 1.0 - abs(2.0 * x - 1.0); // 生成平滑的三角波
inline float4 SmoothCurve( float4 x ) {
return x * x *( 3.0 - 2.0 * x );
}
// SmoothTriangleWave function for a 4-component vector
inline float4 SmoothTriangleWave(float4 x)
{
return float4(SmoothTriangleWave(x.x), SmoothTriangleWave(x.y), SmoothTriangleWave(x.z), SmoothTriangleWave(x.w));
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 void WindVert_float(float4 pos, float3 normal, float3 vertColor, float4 wind, float speed, float amplitude, out float4 aniPos)
@@ -27,8 +23,8 @@ inline void WindVert_float(float4 pos, float3 normal, float3 vertColor, float4 w
float bendingFact = 1 - vertColor.b;
//wind.xyz = TransformWorldToObject(wind.xyz);
//wind.z = wind.z * bendingFact;
wind.xyz = TransformWorldToObject(wind.xyz);
wind.z = wind.z * bendingFact;
float4 animParams = float4(0, amplitude, bendingFact.xx);
float time = _Time.y * float2(speed, 1);

View File

@@ -0,0 +1,135 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-8966936789293289874
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
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: WindCloth
m_Shader: {fileID: 4800000, guid: cbc110f6abccf47ada5a8569ec9eb889, 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: 2800000, guid: 016ab36f33e35487bb91a3712c78b36e, type: 3}
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
- _WindAmplitude: 1.3
- _WindSpeed: 0.14
- _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}
- _Wind: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []

View File

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

View File

Before

Width:  |  Height:  |  Size: 4.0 MiB

After

Width:  |  Height:  |  Size: 4.0 MiB