[Robotics] Depth information from a camera

Benoit Bolsee benoit.bolsee at online.be
Tue Jan 11 12:24:12 CET 2011


Hi Gilberto,

The BGL module is still there in Blender 2.5. It is now called 'bgl' so
you have to "import bgl" at the start of the module. The bgl module is a
wrapper around OpenGL, so you can call all OpenGL functions with it. To
get the Zbuffer, you will need to run a custom render from a camera
using VideoTexture and then you can retrieve the Zbuffer using the
appropriate OpenGL function. 

Void pointer parameters in OpenGL map to buffer objects that you create
with bgl.buffer() method.
Unfortunately, the buffer objects returned by bgl.buffer() do not
support the buffer protocol, which means that you cannot export the
internal memory buffer to a C module. You can however access individual
elements of the buffer from python using sequence methods. 
Adding support for the buffer protocol to bgl.buffer object type
shouldn't be difficult though.

Hope this helps,
Benoit

> -----Original Message-----
> From: robotics-bounces at blender.org 
> [mailto:robotics-bounces at blender.org] On Behalf Of Gilberto Echeverria
> Sent: mardi 11 janvier 2011 10:07
> To: Blender and Robotics
> Subject: [Robotics] Depth information from a camera
> 
> 
> Hello everyone,
> 
> For the MORSE simulator, we are trying to recreate laser 
> range scanners, 
> that provide depth information from a sensor on a robot. We are 
> currently doing this using ray tracing, but if we want to simulate 
> sensor with a lot of lasers, I fear ray tracing all of them 
> will be too 
> slow.
> So my question is: Is there a way to get the depth information of a 
> scene in a faster way? We need something that can be used 
> from the Game 
> Engine of Blender 2.5
> One possible method is to get the z-buffer from a camera. Apparently 
> this was possible in Blender 2.49, using the BGL modules, but 
> that seems 
> to have disappeared from Blender 2.5.
> 
> Any ideas will be greatly appreciated.
> Cheers
> 
> Gilberto
> _______________________________________________
> Robotics mailing list
> Robotics at blender.org 
> http://lists.blender.org/mailman/listinfo/robo> tics
> 




More information about the Robotics mailing list