开发者

WebGL: missing triangles when moving camera

I am rendering a complex scene in WebGL (180 mes开发者_如何学Pythonhes) corresponding to a car model (Nissan GTX)

WebGL: missing triangles when moving camera

. However when I move the camera around , it seems as if triangles were missing

WebGL: missing triangles when moving camera

,

These 'missing triangles' seem to jump randomly over the surface. Can this be a depth buffer problem or a normal calculation problem? I have no idea.

Nevertheless, if I zoom-in near the surface of the model, all triangles are there

WebGL: missing triangles when moving camera

.

Does anyone have had this problem? any tips?!


I guess, you have a wireframe mesh directly on top of (or very near) a solid mesh and this is just a depth buffer problem. It works when zooming in, because the depth buffer precision is higher in the near area of the viewing frustum.

Try adjusting the screen space depth by working with the polygon offset (or a similar fragment shader modifying gl_FragDepth) when rendering a wireframe overlay directly on top of the solid mesh. Or just move them farther away in object space.


You might be right when you suspect a depth-buffer problem - the fact that the distance to the camera affects things suggests it could be a buffer precision problem. Check out the answer to this question for a possible solution.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜