[vtkusers] Solid Voxelization with VTK
Berti Krüger
berti_krueger at hotmail.com
Mon Oct 1 19:15:04 EDT 2018
Hi David,
thank you very much again for your reply.
You are right in that the approach of doing rasterization with the graphics card in an offscreen buffer and then reading the pixel values out has its own problems and i stopped going that way.
Even if it didn't sound like that, alltogether i am quite satisfied with the majority voting solution with the vtkPolyDataToImageStencil filter so far. It seems to be precise enough most of the time.
But if it is not so much more work and if i have some time left, i will try to complete the solution with the rasterization of the polygons themselves.
I already stumbled upon the vtkImplicitModeller, but to be honest, from the class documentation alone i didn't completely "get" what it is really doing, e.g. what is the "output" of it.
Does it compute a distance field where the cell values of the grid contain the distances from the cell to the isosurface?
Something like:
[cid:inline_01 at geary]
(image taken from: http://bytewrangler.blogspot.com/2011/10/signed-distance-fields.html)
[http://2.bp.blogspot.com/-bQanRezjlk4/TpdpSpMq5rI/AAAAAAAAAWw/_8lQsmOJHWM/w1200-h630-p-k-no-nu/SignedDistanceField.png]<http://bytewrangler.blogspot.com/2011/10/signed-distance-fields.html>
Byte Wrangler: Signed Distance Fields<http://bytewrangler.blogspot.com/2011/10/signed-distance-fields.html>
bytewrangler.blogspot.com
delta is a constant which determines how far from the edge of the letter the anti-aliasing extends. The actual shader code I use in bulldog is slightly more complex as it handles borders and reversed characters (such as when selecting text in a textbox), as well as adjusting the anti-aliasing for different font sizes.
Regards,
Berti
Am Mo, 1. Okt, 2018 um 1:15 NACHMITTAGS schrieb David Gobbi <david.gobbi at gmail.com>:
On Sat, Sep 29, 2018 at 2:54 AM Berti Krüger <berti_krueger at hotmail.com<mailto:berti_krueger at hotmail.com>> wrote:
Hi David,
Is there some way with the available vtk filters to rasterize the polygons themselves instead of rasterizing the volume enclosed by the polygons?
That's what vtkImplicitModeller does, so you could combine its results with the results that you already have.
I know, i could in some way misuse the vtk renderer to do this by rendering the mesh without any shading, only in ambient, completely white with orthogonal projection etc. in a black render window, sized to the voxel resolution, then read the resulting screen pixels with the vtkWindowToImage Filter, fill the vtkImageData where i have white pixels, change the clipping planes to the next slice, draw the mesh again, read again ... and do that slice by slice for the depth part of the voxel resolution:
This won't work for polygons that face the camera edge-on, since they are invisible in the rendering. So you would have to do it from three directions and then combine the results. Even then, I'm not sure how good the quality would be.
- David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20181001/25d5b175/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SignedDistanceField.png
Type: image/png
Size: 19306 bytes
Desc: SignedDistanceField.png
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20181001/25d5b175/attachment.png>
More information about the vtkusers
mailing list