[Bf-blender-cvs] [b29aafe5ce6] cycles_oneapi: Sculpt: Fix backwards normals in PBVH_GRIDS raycasting

Joseph Eagar noreply at git.blender.org
Wed Jun 29 10:38:37 CEST 2022


Commit: b29aafe5ce6349c351792e9aba495187ac0b6a84
Author: Joseph Eagar
Date:   Mon Jun 27 11:15:44 2022 -0700
Branches: cycles_oneapi
https://developer.blender.org/rBb29aafe5ce6349c351792e9aba495187ac0b6a84

Sculpt: Fix backwards normals in PBVH_GRIDS raycasting

Winding order of grid quads was backwards.

===================================================================

M	source/blender/blenkernel/intern/pbvh.c

===================================================================

diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c
index 3b20bdc826c..5e5443f48ca 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -2394,16 +2394,16 @@ static bool pbvh_grids_node_raycast(PBVH *pbvh,
 
         const float *co[4];
         if (origco) {
-          co[0] = origco[y * gridsize + x];
-          co[1] = origco[y * gridsize + x + 1];
-          co[2] = origco[(y + 1) * gridsize + x + 1];
-          co[3] = origco[(y + 1) * gridsize + x];
+          co[0] = origco[(y + 1) * gridsize + x];
+          co[1] = origco[(y + 1) * gridsize + x + 1];
+          co[2] = origco[y * gridsize + x + 1];
+          co[3] = origco[y * gridsize + x];
         }
         else {
-          co[0] = CCG_grid_elem_co(gridkey, grid, x, y);
-          co[1] = CCG_grid_elem_co(gridkey, grid, x + 1, y);
-          co[2] = CCG_grid_elem_co(gridkey, grid, x + 1, y + 1);
-          co[3] = CCG_grid_elem_co(gridkey, grid, x, y + 1);
+          co[0] = CCG_grid_elem_co(gridkey, grid, x, y + 1);
+          co[1] = CCG_grid_elem_co(gridkey, grid, x + 1, y + 1);
+          co[2] = CCG_grid_elem_co(gridkey, grid, x + 1, y);
+          co[3] = CCG_grid_elem_co(gridkey, grid, x, y);
         }
 
         if (ray_face_intersection_quad(



More information about the Bf-blender-cvs mailing list