diff options
| author | yum <yum.food.vr@gmail.com> | 2025-10-18 13:43:51 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2025-10-18 13:56:29 -0700 |
| commit | f65f4b6e07b47115911bf33deb90597e201c1066 (patch) | |
| tree | 9cf783bc5ab7c885dda038159df5b8a006ce8e70 /vertex.cginc | |
| parent | c6581fe78d5abae4289432d9d8fd01729fe17b0e (diff) | |
add fbm deformation effect
Diffstat (limited to 'vertex.cginc')
| -rw-r--r-- | vertex.cginc | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/vertex.cginc b/vertex.cginc index 84185c6..eba7031 100644 --- a/vertex.cginc +++ b/vertex.cginc @@ -44,6 +44,26 @@ void deform(inout float3 objPos) { objPos = sine_wave(objPos.xyz, amplitude, direction, k, omega, t); } #endif // _VERTEX_DEFORMATION_SINE_WAVES +#if defined(_VERTEX_DEFORMATION_FBM) + { + float t = _Time[3]; + float amplitude = _Vertex_Deformation_FBM_Amplitude; + float gain = _Vertex_Deformation_FBM_Gain; + float lacunarity = _Vertex_Deformation_FBM_Lacunarity; + float scale = _Vertex_Deformation_FBM_Scale; + float octaves = _Vertex_Deformation_FBM_Octaves; + float3 velocity = _Vertex_Deformation_FBM_Velocity; + objPos = fbm( + objPos, + t, + amplitude, + gain, + lacunarity, + scale, + octaves, + velocity); + } +#endif // _VERTEX_DEFORMATION_FBM } void deform_normal(float3 objPos, inout float3 objNorm, inout float3 objTan) { @@ -83,6 +103,28 @@ void deform_normal(float3 objPos, inout float3 objNorm, inout float3 objTan) { sine_wave_normal(objPos, objNorm, objTan, amplitude, direction, k, omega, t); } #endif // _VERTEX_DEFORMATION_SINE_WAVES +#if defined(_VERTEX_DEFORMATION_FBM) + { + float t = _Time[3]; + float amplitude = _Vertex_Deformation_FBM_Amplitude; + float gain = _Vertex_Deformation_FBM_Gain; + float lacunarity = _Vertex_Deformation_FBM_Lacunarity; + float scale = _Vertex_Deformation_FBM_Scale; + float octaves = _Vertex_Deformation_FBM_Octaves; + float3 velocity = _Vertex_Deformation_FBM_Velocity; + fbm_normal( + objPos, + objNorm, + objTan, + t, + amplitude, + gain, + lacunarity, + scale, + octaves, + velocity); + } +#endif // _VERTEX_DEFORMATION_FBM } void propagateObjPos(inout v2f i) { @@ -92,4 +134,3 @@ void propagateObjPos(inout v2f i) { } #endif // __VERTEX_INC - |
