diff options
| author | yum <yum.food.vr@gmail.com> | 2025-11-01 11:50:17 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2025-11-01 11:50:17 -0700 |
| commit | 04c1976f17cb766961ed4dc0ad3ef26848188c00 (patch) | |
| tree | 97dce90ac8663f1289fe7cfbcb7d35d0e2d606bb | |
| parent | 12c223b5b8bf1860d77f41551cf9e5374196aed7 (diff) | |
meow
| -rw-r--r-- | ray_marching.cginc | 8 | ||||
| -rw-r--r-- | vertex_deformation.slang | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/ray_marching.cginc b/ray_marching.cginc index 1efbdf4..17777ed 100644 --- a/ray_marching.cginc +++ b/ray_marching.cginc @@ -14,7 +14,7 @@ struct RayMarchResult { float3 getObjPos(v2f i) { - return i.objPos; + return i.objPos_orig; } void GetRoRd(v2f i, out float3 ro, out float3 rd) { @@ -32,15 +32,15 @@ RayMarchResult ray_march(v2f i) { float3 rd_perp = i.normal * dot(i.normal, rd); float3 rd_tan = rd - rd_perp; float3 tmp = ro; - undeform_normal(ro, rd_perp, rd_tan); - //rd = rd_perp + rd_tan; + undeform_normal(tmp, rd_perp, rd_tan); + rd = normalize(rd_perp + rd_tan); #endif const float kMinDist = 1e-3; // TODO dial this in & parameterize const float kMaxDist = 10; // TODO parameterize - const uint kMaxIter = 10; + const uint kMaxIter = 30; float d_acc = 0; for (uint ii = 0; ii < kMaxIter; ++ii) { float3 p = ro + rd * d_acc; diff --git a/vertex_deformation.slang b/vertex_deformation.slang index 678cc24..0791aa7 100644 --- a/vertex_deformation.slang +++ b/vertex_deformation.slang @@ -55,7 +55,7 @@ float jac_det = determinant(jacobian); \ float3x3 inv_jac = inverse(jacobian, jac_det); \ float3x3 trans_jac = transpose(jacobian); \ - normal = mul(trans_jac, normal) * sign(jac_det); \ + normal = mul(trans_jac, normal); \ tangent = mul(inv_jac, tangent) // Syntactic sugar - wraps the previous three macros. |
