4

I need efficient fill algorithm to fill closed polygons (like ex. Scanline fill), which I can run on CUDA. Have you got any suggestions?

Thanks in advance for any replays!

MattheW
  • 808
  • 11
  • 25
  • What do you mean by efficient? What ratio close to the performance of GPU HW rasterizers? Should the algorithm be fully general purpose/ VS specialized for small triangles etc. Be precise! – elmattic Nov 09 '10 at 12:32
  • Thanks for answer. Here's what I need to do: I've got a scene of a few cuboids (some of them overlapping). I need to render them on a plane and fill them inside as fast as possible - that's why I thought about CUDA. I'd appreciate any suggestions! – MattheW Nov 09 '10 at 14:18
  • 1
    It might be better to put your geometry in a Vertex Buffer Object and rasterize it with OpenGL instead. – tkerwin Nov 27 '10 at 05:33

1 Answers1

2

Thrust has a really good scanning algorithm, but only along single line. You may need to extend it a bit to work with images. Assuming edges are 1 and 0 everywhere else, all you need to do is perform a prefix sum on the image. Once the prefix sum is complete, all you need to do is fill the areas where the sum is Odd.

Pavan Yalamanchili
  • 12,021
  • 2
  • 35
  • 55
  • This would not necessarily work, imagine you'd have a single pixel are the image corner, or two pixels at the top corner of the polygon. – TripleS Aug 13 '15 at 11:40