Hi Zach,
I'm with Paul on the could explain what is wrong with the results, it'll
give us a better idea of what might be up.
I have done some experiments with reading textures in the vertex program -
have a look at the osgshaderterrain example, the key to success has been
getting the pixel format right on the texture, the Geforce6/7 series only
support a very limited range of pixel formats in hardware, if you don't use
these the performance really is appalling.
Robert.
On 4/29/07, Zach Deedler <[EMAIL PROTECTED]> wrote:
Hello osg-users,
I'm trying to implement dynamic terrain displacement using a shader. I am
trying to just edit a texture to cause the vertex shader to look at the
texture, and modify the vertex displacement. But, when I implemented it,
it
renders horribly. Anybody see what I did wrong in my vertex shader?
uniform sampler2D heightMapSampler;
void main()
{
vec3 vertex;
gl_TexCoord[0] = gl_MultiTexCoord0;
vec4 heightMap = texture2D( heightMapSampler, gl_MultiTexCoord0.st );
vertex.xy = gl_Vertex.xy;
//Add displacement to vertex.
vertex.z = gl_Vertex.z + heightMap.r;
gl_Position = gl_ModelViewProjectionMatrix * vec4(vertex,1.0);
}
I have a feeling I'm supposed to be using texture2DLod in the vertex
shader,
or that this just isn't a viable way to do vertex displacements.
Thanks.
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/