Time of flight camera simulation with z buffer
Time of flight camera simulation with z buffer
Is it possible to get the Z buffer of an image to be used as a simulation of time-of-flight camera or for simulating laser range finder or sonar? These would all be great for robotic simulations...
-
- Posts: 48
- Joined: Mon 16. May 2011, 16:29
Re: Time of flight camera simulation with z buffer
Hi ted,
I'm currently developing the new opengl-3.3-backend. With this new backend it will be rather easy to write a shader in GLSL that writes the z-buffer of every pixel.
The backend might be ready by the end of the year. If you remind me then, I'll write you a tutorial:
http://page.math.tu-berlin.de/~kutschan/
However this probably doesn't help you now...
I'm currently developing the new opengl-3.3-backend. With this new backend it will be rather easy to write a shader in GLSL that writes the z-buffer of every pixel.
The backend might be ready by the end of the year. If you remind me then, I'll write you a tutorial:
http://page.math.tu-berlin.de/~kutschan/
However this probably doesn't help you now...
Re: Time of flight camera simulation with z buffer
Thanks, that's very encouraging. You're right. I'm trying to get a paper out this week, so that will be awhile, but I have to say the support for JReality is amazingly responsive. Kudos to you all!
-
- Posts: 48
- Joined: Mon 16. May 2011, 16:29
Re: Time of flight camera simulation with z buffer
Even though the new backend isn't finished yet (no tubes for the edges, no Sphere Geometry type, some attributes not working) you could implement your depth buffer drawing like this:
This code can be found in test-backends-share/light/Test.java
It makes the vertex/fragment shaders in the specified files to be used for the object to which the Appearance a belongs.
Then in the fragment shader you need something like
And don't forget to enable the opengl3 backend as is described in the article
"Switching between Rendering-backends broken" in
Foren-Übersicht » Bugs and Feature Requests » Bugs
You have to press F3 or choose from the Viewer menu in the top menu bar of the jReality-Window to switch to opengl3.3
Code: Select all
String[] source = new String[2];
source[0] = "poly.v";
source[1] = "poly.f";
a.setAttribute("polygonShader::glsl330-source", source);
It makes the vertex/fragment shaders in the specified files to be used for the object to which the Appearance a belongs.
Then in the fragment shader you need something like
Code: Select all
out vec4 gl_FragColor;
uniform vec4 diffuseColor;
//in vec2 gl_PointCoord;
void main(void)
{
//you have to play around with getting the right shade of grey out of the fragment depth.
gl_FragColor = 0.5*gl_FragCoord.z*vec4(1, 1, 1, 1);
}
"Switching between Rendering-backends broken" in
Foren-Übersicht » Bugs and Feature Requests » Bugs
You have to press F3 or choose from the Viewer menu in the top menu bar of the jReality-Window to switch to opengl3.3