texture still show line between vertices

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

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 on other sites
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 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 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 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 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.

1. 1
2. 2
Rutin
23
3. 3
JoeJ
20
4. 4
5. 5

• 24
• 40
• 23
• 13
• 13
• Forum Statistics

• Total Topics
631734
• Total Posts
3001933
×

Important Information

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!