diff options
author | Mai Lavelle <mai.lavelle@gmail.com> | 2016-04-13 02:17:34 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2016-04-13 02:37:33 +0300 |
commit | c1a27a76cf9f40ab9dabb5888ee535e585444fcd (patch) | |
tree | da5610d92bae46bc9f5682ea934f23d689a20a3b /intern/cycles/subd/subd_patch.h | |
parent | 068ee2cd98fc987453cd50285c387c6480c6d99c (diff) |
Cycles microdisplacement: preserve smooth normals for linear subdivison
This way we prevent cracks in the model due to discontinuous normals, by using
smooth normals for displacement instead of always getting flat normals after
linear subdivision.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D1916
Diffstat (limited to 'intern/cycles/subd/subd_patch.h')
-rw-r--r-- | intern/cycles/subd/subd_patch.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/intern/cycles/subd/subd_patch.h b/intern/cycles/subd/subd_patch.h index 9be4606c248..bfa04412c66 100644 --- a/intern/cycles/subd/subd_patch.h +++ b/intern/cycles/subd/subd_patch.h @@ -25,7 +25,7 @@ CCL_NAMESPACE_BEGIN class Patch { public: virtual ~Patch() {} - virtual void eval(float3 *P, float3 *dPdu, float3 *dPdv, float u, float v) = 0; + virtual void eval(float3 *P, float3 *dPdu, float3 *dPdv, float3 *N, float u, float v) = 0; virtual bool is_triangle() { return false; } virtual BoundBox bound() = 0; virtual int ptex_face_id() { return -1; } @@ -36,8 +36,9 @@ public: class LinearQuadPatch : public Patch { public: float3 hull[4]; + float3 normals[4]; - void eval(float3 *P, float3 *dPdu, float3 *dPdv, float u, float v); + void eval(float3 *P, float3 *dPdu, float3 *dPdv, float3 *N, float u, float v); bool is_triangle() { return false; } BoundBox bound(); }; @@ -47,8 +48,9 @@ public: class LinearTrianglePatch : public Patch { public: float3 hull[3]; + float3 normals[3]; - void eval(float3 *P, float3 *dPdu, float3 *dPdv, float u, float v); + void eval(float3 *P, float3 *dPdu, float3 *dPdv, float3 *N, float u, float v); bool is_triangle() { return true; } BoundBox bound(); }; @@ -59,7 +61,7 @@ class BicubicPatch : public Patch { public: float3 hull[16]; - void eval(float3 *P, float3 *dPdu, float3 *dPdv, float u, float v); + void eval(float3 *P, float3 *dPdu, float3 *dPdv, float3 *N, float u, float v); bool is_triangle() { return false; } BoundBox bound(); }; |