texture still show line between vertices

Started by
4 comments, last by Toastmastern 7 years, 6 months ago

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

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

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.

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

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

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.

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.

This topic is closed to new replies.

Advertisement