diff options
| author | yum <yum.food.vr@gmail.com> | 2025-03-26 00:25:26 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2025-03-26 00:25:26 -0700 |
| commit | 70f30643e6c392535cfbf0b82054bd4b53868833 (patch) | |
| tree | 9c684658c09f36318f94a8fc8ec3f8baf51be34d /tessellation.cginc | |
| parent | 274f601c9c49f69e4acef24b56982190b5b0bf93 (diff) | |
Finish adding tessellation; add 4 channels to shatterwave
Diffstat (limited to 'tessellation.cginc')
| -rw-r--r-- | tessellation.cginc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tessellation.cginc b/tessellation.cginc index 92aca3a..8ba2595 100644 --- a/tessellation.cginc +++ b/tessellation.cginc @@ -54,25 +54,26 @@ v2f domain( #if defined(_TESSELLATION) o.objPos = DOMAIN_INTERP(tpos); #else - o.objPos = DOMAIN_INTERP(pos); + o.objPos = DOMAIN_INTERP(objPos); #endif o.normal = DOMAIN_INTERP(normal); o.tangent = DOMAIN_INTERP(tangent); o.binormal = DOMAIN_INTERP(binormal); o.uv01 = DOMAIN_INTERP(uv01); -#if defined(_SHATTER_WAVE) +#if defined(_TESSELLATION) && defined(_SHATTER_WAVE) shatterWaveVert(o.objPos.xyz, o.normal, o.tangent); - o.binormal = cross(o.normal, o.tangent); #endif #if defined(_TESSELLATION_HEIGHTMAP) - float height = _Tessellation_Heightmap.SampleLevel(linear_repeat_s, o.uv01.xy * _Tessellation_Heightmap_ST.xy + _Tessellation_Heightmap_ST.zw, 0).r * _Tessellation_Heightmap_Scale; + float height = _Tessellation_Heightmap.SampleLevel(linear_repeat_s, + o.uv01.xy * _Tessellation_Heightmap_ST.xy + _Tessellation_Heightmap_ST.zw, 0).r * + _Tessellation_Heightmap_Scale + _Tessellation_Heightmap_Offset; o.objPos.xyz += o.normal * height; #endif o.pos = UnityObjectToClipPos(o.objPos); - o.worldPos = mul(unity_ObjectToWorld, o.objPos); + o.worldPos = mul(unity_ObjectToWorld, float4(o.objPos, 1.0)).xyz; o.eyeVec.xyz = normalize(o.worldPos - _WorldSpaceCameraPos); o.eyeVec.w = 1; @@ -83,7 +84,6 @@ v2f domain( return o; } - //endex #endif // __TESSELLATION_INC |
