Search This Blog

Thursday, March 4, 2010

Heightfield Intersection

HFTest.lxs

landsea-0.lxs

landsea-1.lxs

landsea-2.lxs

landsea-big.lxs

4 fuctions have been implemented for Heightfield Intersection.

Heightfield::IntersectTriangle - refer 'MeshBaryTriangle::Intersect' in Luxrender
Heightfield::IntersectPTriangle - refer MeshBaryTriangle::IntersectP' in Luxrender
Heightfield::Intersect - refer 'GridAccel::Intersect' in Luxrender
Heightfield::IntersectP - refer 'GridAccel::IntersectP' in Luxrender

Heightfield::IntersectTriangle and Heightfield::IntersectPTriangle are checking if the ray intersects the plane which consist of 3 points.

Heightfield::Intersect and Heightfield::IntersectP are checking if the ray intersects the cell, while traversing a 2D grid. In a cell, they are building two height field triangles and check if the ray intersects triangles using Heightfield::IntersectTriangle and Heightfield::IntersectPTriangle. To traverse a 2D grid more efficiently, they are considering the ray direction in x and y axies. In this way, they don't have to consider other cells which doesn't have a ray segment above them, and unnecessary calculations will be avoided.

To compare the memory consumption and the speed, memory usage and "TotS/s" of each algorithm for landsee-big.lxs was checked after 10 min rendering. "TotS/s" stands for "Total samples per second" and is an average since the start of the current rendering.

For rendering speed, the implemented intersection algorithm makes rendering slower than the conventional algorithm by 1/4 times approximately.

Conventional intersection algorithm: 236550 TotS/s
Implemented intersection algorithm: 58405 TotS/s

For memory consumption, the implemented intersection algorithm used 71.576 KB, while the conventional intersection algorithm used 443.204 KB. Thus, the new intersectional algorithm is more memory efficient by 6 times approximately.

Conventional intersection algorithm: 443.204 KB
Implemented intersection algorithm: 71.576 KB

In this experiment, following computer was used:

Intel (R) Xeon (R) CPU E5405 @ 2.00GHz, 2.00GHz, 16 GB of RAM
Microsoft Windows XP Professional x64 Edition

No comments:

Post a Comment

Blog Archive