jedge
02-06-2006, 05:01 AM
Hi,
I'm just writing a (very) simple shader to compute geometry from a depth map (actually an elliptical depth map). The code is very simple and only require s a couple of texture lookups in the vertex shader. However, it runs extremely slow. The code for the vertex shader is below:
uniform sampler2D vs_elliptical_map;
uniform sampler2D vs_depth_map;
void main()
{
gl_Vertex = texture2D(vs_depth_map, gl_MultiTexCoord0.st)*(2.0f*texture2D(vs_elliptica l_map, gl_MultiTexCoord0.st) - vec4(1.0f));
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_Position = ftransform();
}
vs_elliptical_map stores an elliptical projection in a texture map, and vs_depth_map stores the depth of my object along each of these vectors. The code works - but as I say, it is slooow. In fact I don't think there is any significant advantage over calculating the elliptical projection in the vertex shader! If I comment out the gl_Vertex line the shader flies (as you'd expect because its just a pass through). The fragment shader just does texture mapping so I haven't included the code here. I'm running on an nVidia 6600 with the latest drivers.
I'm just writing a (very) simple shader to compute geometry from a depth map (actually an elliptical depth map). The code is very simple and only require s a couple of texture lookups in the vertex shader. However, it runs extremely slow. The code for the vertex shader is below:
uniform sampler2D vs_elliptical_map;
uniform sampler2D vs_depth_map;
void main()
{
gl_Vertex = texture2D(vs_depth_map, gl_MultiTexCoord0.st)*(2.0f*texture2D(vs_elliptica l_map, gl_MultiTexCoord0.st) - vec4(1.0f));
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_Position = ftransform();
}
vs_elliptical_map stores an elliptical projection in a texture map, and vs_depth_map stores the depth of my object along each of these vectors. The code works - but as I say, it is slooow. In fact I don't think there is any significant advantage over calculating the elliptical projection in the vertex shader! If I comment out the gl_Vertex line the shader flies (as you'd expect because its just a pass through). The fragment shader just does texture mapping so I haven't included the code here. I'm running on an nVidia 6600 with the latest drivers.