Sign in to follow this  
Sheree

Help:GLSL texture interpolation in vertex shader

Recommended Posts

Hello everyone, I need some help to know where is my problem: Let me first show what I am doing and what I want to get. I have several textures that hold my height and its normal values(height maps), so I want to get these values to update my triangle mesh in vertex shader using VTF. In fact VTF works well but since I want to do this update as view_dependent I got a visual artifact line when values switch from one level to another. 1. Could this problem a result from the normals that come from two different levels and applied on one triangle. and if so..how can I smooth them when I operate on each vertex individually? 2. Each cell of each level results from averaging the four cells of the finer level.. So could this not smooth enough that makes that abrupt jump between two levels.! 3. If 2 is correct then one solution could be doing interpolation between these two levels: well I considered this case and I implement the interpolation but the results are not better than befor which is weird as well If you see where is the main problem I will appreciate any kind of help

Share this post


Link to post
Share on other sites
What do you mean by "switch from one level to another" ? You have the feeling that the VTF selects differents level of details (mipmaps) as your camera moves around the object ?

In general you should make sure that you lookup your texture with texture2Dlod with an explicit lod=0. This way you control which lod is used. Current implementations of texture2D should always select the lod 0 since the vertex shader can't compute the screen space partial derivatives, but just in case your graphics card tries some kind of mipmapping, you should consider using texture2Dlod instead.

Perhaps you can post the vertex shader so that we can take a look at it ?

Also, you should not try to use linear interpolation (GL_LINEAR and GL_LINEAR_MIPMAP_LINEAR for instance) because many graphics card do not support texture linear interpolation at the vertex shader, though you can perform your own bi-linear interpolation inside the shader.

The following paper describes pretty well how to implement your own interpolations (be it bi-linear or bi-linear with mipmapping) : ftp://download.nvidia.com/developer/Papers/2004/Vertex_Textures/Vertex_Textures.pdf

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this