[vtkusers] How to build depth map of a 3D model?

Bill Lorensen bill.lorensen at gmail.com
Wed May 9 08:20:35 EDT 2012


vtkRenderWindow has methods
  // Set/Get the zbuffer data from the frame buffer.
  // (x,y) is any corner of the rectangle. (x2,y2) is its opposite corner on
  // the diagonal.
  virtual float *GetZbufferData(int x, int y, int x2, int y2) = 0;
  virtual int GetZbufferData(int x, int y, int x2, int y2, float *z) = 0;
  virtual int GetZbufferData(int x, int y, int x2, int y2,
                             vtkFloatArray *z) = 0;


On Wed, May 9, 2012 at 7:24 AM, Dženan Zukić <dzenanz at gmail.com> wrote:
> Idea is right -> Z-buffer contains your information. Z buffer might not give
> you what you want for translucent polygons. And I don't know how to access Z
> buffer.
>
> On Mon, May 7, 2012 at 2:05 PM, Wenlong <scc.wwl at gmail.com> wrote:
>>
>> Dear all,
>>
>> I have a 3D model which is a vtkPolyData instance with pre-defined
>> polygons
>> and cells.
>>
>> I visualize this 3D model in a vtkRenderWindow which size is 512x512.
>>
>> What I want to achieve is to build a depth map of this 3D model. By depth
>> map, I mean an image with translucent surface with the depth information.
>> The pixels in depth map should be darker as it's further from the camera
>> and
>> brighter as it's closer.
>>
>> I'm trying to extract z buffer value on each pixel in vtkRenderWindow and
>> write it as .bmp image. The result should be a 512x512 picture as well.
>> I'm
>> not sure if this is a promised approach.
>>
>> May I know if my idea is right?
>>
>> Many thanks in advance.
>>
>> Best wishes
>> Wenlong
>>
>> --
>> View this message in context:
>> http://vtk.1045678.n5.nabble.com/How-to-build-depth-map-of-a-3D-model-tp5690901.html
>> Sent from the VTK - Users mailing list archive at Nabble.com.
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



-- 
Unpaid intern in BillsBasement at noware dot com



More information about the vtkusers mailing list