Rendering error between two meshes
3 posters
Rendering error between two meshes
Hi,
I'm seeing rendering errors at the edges between two objects. I believe it only happens or at least its worse where the meshes actually intersect. In this case its a sky dome and a plane.
Also note that it is much worse on the phone (iPhone 3G). Instead of mostly just a jagged edges the layer between the plane and sky that is black is a significantly larger area.
What could cause this? Here's a screenshot from the simulator:
I'm seeing rendering errors at the edges between two objects. I believe it only happens or at least its worse where the meshes actually intersect. In this case its a sky dome and a plane.
Also note that it is much worse on the phone (iPhone 3G). Instead of mostly just a jagged edges the layer between the plane and sky that is black is a significantly larger area.
What could cause this? Here's a screenshot from the simulator:
waterbuffalo99- Posts : 36
Join date : 2009-06-03
Re: Rendering error between two meshes
1. Make sure that the zNear, zFar have acceptable values, I personally recommend something like:
zNear: 1.0
zFar: 500.0
2. Make sure that the field of view is not too narrow or too wide, I personally recommend:
FOV: 45
or
FOV: 65
3. Avoid overlapping triangles, that will cause some zFigthing...
zNear: 1.0
zFar: 500.0
2. Make sure that the field of view is not too narrow or too wide, I personally recommend:
FOV: 45
or
FOV: 65
3. Avoid overlapping triangles, that will cause some zFigthing...
zNear and zFar
Thanks. I found _SIO2camera cend and cstart were 8000 and 0.1 and changed cstart to 1.0. I was experimenting with a large plane (the diagonal is about 8000) and this is the only evidence that might be too big. Didn't recall changing cstart to 0.1 but there it was.
The problem went away in the simulator but is not completely gone on the device. I can probably live with it but I probably won't stick with such a large plane.
The problem went away in the simulator but is not completely gone on the device. I can probably live with it but I probably won't stick with such a large plane.
waterbuffalo99- Posts : 36
Join date : 2009-06-03
Re: Rendering error between two meshes
If I see it right you're having some water there and it's fighting in the Z-buffer with the terrain. Try this:
Also try different values for glPolygonOffset. See the man page.
- Code:
Render Terrain;
glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(-1.f, -2.f);
Render Water;
glDisable(GL_POLYGON_OFFSET_FILL);
Also try different values for glPolygonOffset. See the man page.
glDisable- Posts : 3
Join date : 2009-03-11
Larger zNear / cstart value of 4.0
I tried a larger value of for cstart of 4.0 and the problem is completely gone in the simulator and on the phone. Just from observing this so far it seems to be a good solution.
Given that its a 3rd person camera situation, do you see any downside of having a value of 4.0 for cstart?
-George
Given that its a 3rd person camera situation, do you see any downside of having a value of 4.0 for cstart?
-George
waterbuffalo99- Posts : 36
Join date : 2009-06-03
Re: Rendering error between two meshes
You can always increase the precision of the depth buffer by default its set to 16bits but you can change it to 24 with:
glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_DEPTH_COMPONENT16_OES, backingWidth, backingHeight);
to
glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_DEPTH_COMPONENT24_OES, backingWidth, backingHeight);
And try to don't use polygon offset... there's no need to use it for this kind of scenario...
glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_DEPTH_COMPONENT16_OES, backingWidth, backingHeight);
to
glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_DEPTH_COMPONENT24_OES, backingWidth, backingHeight);
And try to don't use polygon offset... there's no need to use it for this kind of scenario...
precision problem
I see how this is a precision problem so adjusting zNear helps but may not be good enough in some cases.
I'll try the depth buffer 24 bit solution with the original zNear of 0.1 and also with 1.0 and see what the difference is, and I'm also curious whether it will affect performance.
... thanks
I'll try the depth buffer 24 bit solution with the original zNear of 0.1 and also with 1.0 and see what the difference is, and I'm also curious whether it will affect performance.
... thanks
waterbuffalo99- Posts : 36
Join date : 2009-06-03
Similar topics
» Exporting meshes after boolean
» Exporting large meshes
» Physic object
» rendering multiple resources
» Physics out of sync with rendering rotation
» Exporting large meshes
» Physic object
» rendering multiple resources
» Physics out of sync with rendering rotation
Permissions in this forum:
You cannot reply to topics in this forum