News for hackers. Stuff that matters.
Re:Voronoi Diagrams on the GPU by mrec on Thursday April 14, 2016 @07:42AM (#11495786)
Heh, I remember this technique from the OpenGL Red Book, at least 15-20 years ago.

http://www.glprogramming.com/red/chapter14.html#name19

Re:Voronoi Diagrams on the GPU by exDM69 on Thursday April 14, 2016 @08:25AM (#11496032)
Cool! I've of course read the Redbook back in the day (I think I still have it printed out in my shelf) but for some reason I've missed that chapter.

I didn't quite get what you need the stencil buffer for in that technique.

Re:Voronoi Diagrams on the GPU by mrec on Thursday April 14, 2016 @09:39AM (#11496555)
The stencil buffer provides a boolean mask for the regions you care about, making it easy to draw them in flat color with a subsequent pass. I can't see a way to do that easily with depth information only.

(Plus, it was traditional to combine 24-bit depth with 8-bit stencil in the same buffer, so stencil writes were basically free if you're writing depth anyway.)

Re:Voronoi Diagrams on the GPU by exDM69 on Thursday April 14, 2016 @02:16PM (#11499149)
Yeah, that's pretty similar to the stenil-then-cover technique used in vector graphics.

But what advantage does a two pass stencil technique have over just writing to the color buffer in the first pass?

Re:Voronoi Diagrams on the GPU by mrec on Thursday April 14, 2016 @07:02PM (#11500943)
Oh, I see what you mean. Good question. I suppose it might have been more efficient to avoid multiple colour buffer overdraws (since you're drawing a fullscreen quad for each seed point, albeit a depth-tested one). And you could render the depth+stencil buffer once then reuse it to highlight different regions, e.g. on mouseover.

But you're right, it doesn't sound massively compelling. And the traditional 24depth+8stencil buffer format would limit you to a maximum of 256 regions, which could easily cramp your style.