rutra 1 Posted March 31 (edited) Is it possible, analytically to voxalize a surface by displacing P along N to floored P planes? Analytically meaning not using Ray or intersect() but in shading for example. Basic flooring: Attempted point projection to floored planes: On a simple circle/sphere, I would need to iterate over neighbouring cells (a'la vornoi loop) and check if P is above or below the plane? Then there is a question of tight bends where the normal doesn't intersect any floored planes. Currently I'm stuck at projections being clipped by voxel size in all directions. The script belwo is as far as I got (also included HIP). Initially I had a feeling that there is a elegant/simple solution but now I suspect there is a simple proof/example that its impossible. VEX Wrangler prototype: vector P = v@P; vector N = -v@N; // tangent in case of a curve vector floorX = set(floor(P.x), P.y, 0); vector floorY = set(P.x, floor(P.y), 0); // adjacent vector dirX = floorX - P; vector dirY = floorY - P; // theta float tX = dot(normalize(dirX), N); float tY = dot(normalize(dirY), N); // hypotenuse length float lX = length(dirX) / tX; float lY = length(dirY) / tY; float planesMin = min(lX, lY); v@P = v@P + (N * planesMin); scene: voxelisation.hipnc Edited April 1 by rutra fix tags Share this post Link to post Share on other sites
underscoreus 28 Posted April 1 Heyo, I'm not sure I've completely understood what you want to do, but I've managed to make a "voxelized" sphere using this little vex snippet: v@P = lerp(v@P, floor(v@P), chf('Lerp')); Adding the lerp since I assumed based on the gifs that you wanted to animate the transformation over time. You could also change out the "floor" function for the "rint" function if you'd like the positions to snap to the nearest whole value instead of always rounding down. However, the advanced math you are doing in your VEX code is making me doubt whether or not I've understood what you actually want to do, haha. Hope it can help! Share this post Link to post Share on other sites