• Advertisement
Sign in to follow this  

texture still show line between vertices

This topic is 555 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello,
 

If you look at this image:

 

http://imgur.com/9exjwkL

 

why is it that I still see the lines between the vertices even tho I use a texture? Has it something to do with the fact that I am using Trianglelist instead of TriangleStrip or something like that?

 

Best Regards

Toastmastern

Share this post


Link to post
Share on other sites
Advertisement
Did some research together with some trial and error and it is where I sample my 16bpp texture and add to my height that causes this. Here is the code:
 
	vertexPosition.x = vertexPosition.x + (patch[0].sphereNormal.x * ((heightMapSample * 29429.0f) - 8200.0f));
	vertexPosition.y = vertexPosition.y + (patch[0].sphereNormal.y * ((heightMapSample * 29429.0f) - 8200.0f));
	vertexPosition.z = vertexPosition.z + (patch[0].sphereNormal.z * ((heightMapSample * 29429.0f) - 8200.0f));
It seems that when i multiply by 29429.0f(max height) and subtract by -8200.0f(lowest point) the points that sit in the same position split up causing the texture to move apart
Might have something to do with the normal vector, however that one is just the normal vector of the sphere before adding the height
that shouldn't fuck something up or could it?

More trial and error ongoing

//Toastmastern Edited by Toastmastern

Share this post


Link to post
Share on other sites

The trick might be to stop using "points that sit in the same position" and start using indexed rendering so that there is a single shared vertex instead of a bunch of vertices that happen to be in the same spot. That said, it might be hard to do that for an entire huge mesh, e.g. if you have multiple height map textures.

 

Using vertices that sit in the same spot can work, but only if you're very careful to eliminate the possibility of floating point error. e.g. If your patches have different world matrices to one another, or they sample different height-map textures, or they calculate their UVs differently, then you're going to see artifacts like this.

 

Maybe if you post the whole vertex shader and provide detail about any differences in position calculations between patches, then that'd be useful.

Share this post


Link to post
Share on other sites
If you are running the same points through the same modification you will get the same results.
This means your normals are slightly off between similar vertices. Fix this before starting to use indices. You wouldn’t be able to generate indices anyway if the vertices are slightly off anyway, and even if you did then you would just be masking the problem, not solving it.

Re-examine your method for calculating points, specifically in how to generate discrete normals for same points.


L. Spiro

Share this post


Link to post
Share on other sites

For me its perspective projection problem -> you use wrong z_near and z_far values (z fighting)

.

 

 

 

if not that then you pick wrong texture texels in shader.

Edited by WiredCat

Share this post


Link to post
Share on other sites
Thanks for all the help in this thread. The answered turned out to be linked to the normals. I do indeed have several vertices in
the same spot but their normal was different so that when I added the height they split up.

The error was that patch[0].sphereNormalx, y and z wasn't recalculated after the tessellation. I don't have the code here since I'm at work but
will post tonight.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement