Strange Artifacts In Heightfield
I worked out the normals for a heightfield but I'm having some odd artifacts show up. It could be the other sides of the hills, but I have back face culling enabled in OpenGL. Anything else maybe causing these artifacts to show up?
When you move around, do the artifacts move? They look like extra polygons made by an errant vertex array.
The artifacts don't move, different ones appear. It's not a vertex array problem because I'm not using vertex array
. It's just a display list. Here's the code I used to make the display list:
. It's just a display list. Here's the code I used to make the display list:Code:
list = glGenLists(1);
glNewList(list, GL_COMPILE);
{
for(int i = 0; i <= width - accuracy; i += accuracy)
{
glBegin(GL_TRIANGLE_STRIP);
for(int j = 0; j <= depth - accuracy; j += accuracy)
{
if((i + accuracy) <= (width - accuracy))
{
if(normals != NULL)
glNormal3f(normals[j * width + (i + accuracy)].x, normals[j * width + (i + accuracy)].y, normals[j * width + (i + accuracy)].z);
glVertex3f((i + accuracy) * tileSize, GetHeight(i + accuracy, j), j * tileSize);
}
if(normals != NULL)
glNormal3f(normals[j * width + i].x, normals[j * width + i].y, normals[j * width + i].z);
glVertex3f(i * tileSize, GetHeight(i, j), j * tileSize);
}
glEnd();
}
}
glEndList();
*cringes at how many more resources that takes up compared to a vertex list*
Stupid question, but you do have depth testing enabled, right? Also, how large is your depth buffer? That's also the kind of artifacts you'd get if your depth buffer is too small, but that would have to be awfully unforgiving to give artifacts with that much distinction.
Stupid question, but you do have depth testing enabled, right? Also, how large is your depth buffer? That's also the kind of artifacts you'd get if your depth buffer is too small, but that would have to be awfully unforgiving to give artifacts with that much distinction.
I know it would be better with a vertex array, but I'm just trying to get this all set up and working first. Then I'll optimize.
I'm using a 32 bit depth buffer and yes depth testing is enabled. I've kinda been stumped on this for a few days now.
I'm using a 32 bit depth buffer and yes depth testing is enabled. I've kinda been stumped on this for a few days now.
When you move up any closer, do holes start appearing, or is it always clean whenever you go up to a specific area? Can you post a build so we can test it out and view it ourselves?
It looks like you have gaps where the triangle size changes (the resolution band edges).
It doesn't really look like z-fighting to me.
Tried rendering as a mesh? Might give some insight into what you fucked up.
On a somewhat unrelated note, you can get rid of the uneven blending by running your image through a simple blur convolution filter before building a mesh from it. Looks much prettier :-p
EDIT: just for curiosity's sake, what are the near and far values you use for your clipping planes?
Tried rendering as a mesh? Might give some insight into what you fucked up.
On a somewhat unrelated note, you can get rid of the uneven blending by running your image through a simple blur convolution filter before building a mesh from it. Looks much prettier :-p
EDIT: just for curiosity's sake, what are the near and far values you use for your clipping planes?
I'm not sure what you mean by rendering as a mesh. Did you mean a vertex array or VBO? I'm looking into those next.
And the weird blending is because all the normals are surface normals. I still have to implement a normal averaging algorithm to smooth out the normals.
I believe the near and far values are .01 and 1000.0 respectively.
I did get a build up. Hopefully it works. I bundled freetype, FTGL, SDL, OpenAL, and SDL_image into the bundle. On my Mac, I have it linked to an older version of the QuickTime framework (for some weird SDL glitch) so I'm not sure if you need that as well. I didn't bundle it because it was about ten times larger with QuickTime bundled.
[DEAD LINK REMOVED]
EDIT: After seeing this post, I decided to go look at my gluPerspective() and turns out my near was .001 or .0001. I reduced it to .1 and it works just fine. Thanks
And the weird blending is because all the normals are surface normals. I still have to implement a normal averaging algorithm to smooth out the normals.
I believe the near and far values are .01 and 1000.0 respectively.
I did get a build up. Hopefully it works. I bundled freetype, FTGL, SDL, OpenAL, and SDL_image into the bundle. On my Mac, I have it linked to an older version of the QuickTime framework (for some weird SDL glitch) so I'm not sure if you need that as well. I didn't bundle it because it was about ten times larger with QuickTime bundled.
[DEAD LINK REMOVED]
EDIT: After seeing this post, I decided to go look at my gluPerspective() and turns out my near was .001 or .0001. I reduced it to .1 and it works just fine. Thanks
Those clipping plane values are likely to give you some trouble. Try making them 10.0 to 100.0 or something.
The following page has more detail (see 12.040):
http://www.opengl.org/resources/faq/tech...buffer.htm
And what I meant by rendering as as mesh is render it as a wireframe mesh, so you can see if it's deformed more easily.
EDIT: ya beat me to it :-p
The following page has more detail (see 12.040):
http://www.opengl.org/resources/faq/tech...buffer.htm
And what I meant by rendering as as mesh is render it as a wireframe mesh, so you can see if it's deformed more easily.
EDIT: ya beat me to it :-p
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| OpenGL ES 2.0, 2D Alpha Transparency Artifacts | Macmenace | 3 | 6,070 |
Mar 28, 2010 11:18 PM Last Post: AnotherJake |
|
| Multisample AA Artifacts | metacollin | 4 | 4,274 |
Aug 14, 2009 07:11 PM Last Post: metacollin |
|
| Shadow Mapping - Self-Shadowing Z-Fighting Artifacts | Bachus | 16 | 16,552 |
Feb 11, 2009 12:24 PM Last Post: arekkusu |
|
| Opaque and Translucent Objects Intersection Artifacts | Bachus | 6 | 3,582 |
Jan 11, 2003 06:55 AM Last Post: NCarter |
|

