From 8622cbca359d77eb980250b42d0635c0dddfa48b Mon Sep 17 00:00:00 2001 From: Matt Ebb Date: Wed, 1 Oct 2008 03:35:53 +0000 Subject: * Point Density texture Replaced the previous KD-tree (for caching points) with a BVH-tree (thanks to Andre 'jaguarandi' Pinto for help here!). The bvh is quite a bit faster and doesn't suffer some of the artifacts that were apparent with the kd-tree. I've also added a choice of falloff types: Standard, Smooth, and Sharp. Standard gives a harder edge, easier to see individual particles, and when used with a larger radius, Smooth and Sharp falloffs make a much cloudier appearance possible. See the image below (note the settings and render times too) http://mke3.net/blender/devel/rendering/volumetrics/pointdensity_bvh.jpg --- source/blender/blenlib/BLI_kdopbvh.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source/blender/blenlib/BLI_kdopbvh.h') diff --git a/source/blender/blenlib/BLI_kdopbvh.h b/source/blender/blenlib/BLI_kdopbvh.h index e3591a84e98..8912ac5bd13 100644 --- a/source/blender/blenlib/BLI_kdopbvh.h +++ b/source/blender/blenlib/BLI_kdopbvh.h @@ -71,6 +71,9 @@ typedef void (*BVHTree_NearestPointCallback) (void *userdata, int index, const f /* callback must update hit in case it finds a nearest successful hit */ typedef void (*BVHTree_RayCastCallback) (void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit); +/* callback to range search query */ +typedef void (*BVHTree_RangeQuery) (void *userdata, int index, float squared_dist, float radius); + BVHTree *BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis); void BLI_bvhtree_free(BVHTree *tree); @@ -93,5 +96,9 @@ int BLI_bvhtree_find_nearest(BVHTree *tree, const float *co, BVHTreeNearest *nea int BLI_bvhtree_ray_cast(BVHTree *tree, const float *co, const float *dir, float radius, BVHTreeRayHit *hit, BVHTree_RayCastCallback callback, void *userdata); +/* range query */ +int BLI_bvhtree_range_query(BVHTree *tree, const float *co, float radius, BVHTree_RangeQuery callback, void *userdata); + + #endif // BLI_KDOPBVH_H -- cgit v1.2.3 From e114d194ae44cb72aa52954f4fdeb67805a2c7c6 Mon Sep 17 00:00:00 2001 From: Matt Ebb Date: Thu, 2 Oct 2008 01:38:12 +0000 Subject: * Re-coded the point density range checking to be a bit cleaner, and not necessary to modify the BVH functions. --- source/blender/blenlib/BLI_kdopbvh.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/blenlib/BLI_kdopbvh.h') diff --git a/source/blender/blenlib/BLI_kdopbvh.h b/source/blender/blenlib/BLI_kdopbvh.h index 8912ac5bd13..dabf12d48d3 100644 --- a/source/blender/blenlib/BLI_kdopbvh.h +++ b/source/blender/blenlib/BLI_kdopbvh.h @@ -72,7 +72,7 @@ typedef void (*BVHTree_NearestPointCallback) (void *userdata, int index, const f typedef void (*BVHTree_RayCastCallback) (void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit); /* callback to range search query */ -typedef void (*BVHTree_RangeQuery) (void *userdata, int index, float squared_dist, float radius); +typedef void (*BVHTree_RangeQuery) (void *userdata, int index, float squared_dist); BVHTree *BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis); -- cgit v1.2.3