Few more hints:

Make sure texture format is one of hardware accelerated for Vertex Fetch on your gpu.
Make sure texture filtering options are supported as well.

Few months ago I tried to do the same to learn that these matters are very delicate. I used NVIdia 7800 GTX. It had texture vertex fetch support only for float luminance, float rgba formats and point filter only (sometimes it worked with bilinear but sometimes texels were black)

I finally gave up. Ended up with render to texture image and modifying vertices by CPU. Hope you will have more luck ;-)

Cheers,
Wojtek Lewandowski


----- Original Message ----- From: "Mike Weiblen" <[EMAIL PROTECTED]>
To: "osg users" <[email protected]>
Sent: Tuesday, May 01, 2007 4:11 AM
Subject: Re: [osg-users] Height map vertex shader


Hi,

Various thoughts:

What graphics card? Not all support vertex textures in hardware, and may have
different capabilities when they do.

Check the InfoLog outputs from the compile and link, they may provide hints (ATI
says when the shader forced a slow path.)

FYI texture2DLod is only necessary when using a mipmapped texture. Are you?
That could also have a performance impact.

cheers
-- mew



Zach Deedler wrote:
Hi Paul,

Yes I could've been more descriptive. "renders horribly", like 1fps. The texture I'm using is 512x256. The draw time is 1128ms. I'm up to date with
my drivers.

Zach



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Paul Speed
Sent: Sunday, April 29, 2007 21:29
To: osg users
Subject: Re: [osg-users] Height map vertex shader

Can you describe what you mean by "renders horribly"?
Perhaps that will provide a clue.

Is this just a flat shaded shape?  I noticed you aren't
giving it texture or color or anything.

-Paul

Zach Deedler 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.


--
Mike Weiblen -- Austin Texas USA -- http://mew.cx/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

-------------------------------------------------------------
This mail was scanned by BitDefender
For more informations please visit http://www.bitdefender.com


-------------------------------------------------------------




-------------------------------------------------------------
This mail was scanned by BitDefender
For more informations please visit http://www.bitdefender.com


-------------------------------------------------------------


_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to