0

I have written a small C++ program to generate bezier surface using 4x4 control points.

What I want to do next is to parallelize this process and break the whole surface into sub-patches where each thread will only generate coordinates based on a boundary(bbox) assigned to it.

sample code:

for(i=0;i<steps;i++)
{
  float u = i/(steps-1);
  for(j=0;j<steps;j++)
  {
   float v = j/(steps-1);
   Point P = calculate_bezier(u,v);
  }
}

calculate_bezier is a function that returns a point on the surface based on the control points. Variable "steps" decides how fine the surface is tesslated.

Here's a not-so-good picture showing what I want to acheive: enter image description here

Each color represents a small bounding box assigned to a thread, which then executes the above snippet of code and generates bezier points in respective areas. I know min/max of these bboxes.

I wanted to ask HOW to do it. I mean, how to restrict the bezier-coordinate generation process only to a bounding box area? Given the bbox bounds for each thread, how will this affect the u and v values?

4

1 回答 1

1

通过限制输出顶点来拆分工作可能不是一个好主意。虽然可以将贝塞尔补丁与边界框相交,但这并不容易或高效。改为绑定 UV 坐标会更好。

于 2013-11-11T08:06:34.503 回答