Sign in to follow this  
Lithic

Stock Art Model Problems

Recommended Posts

Lithic    345

As a hobbyist game developer I typically take the route of purchasing 3D stock art assets. However, recently with the purchase of a very large model I've a number of problems:

1) For some reason parts of the model appear to flicker when rendered in game. This is visible in the following video (look at the bottom right of the large ship model):

http://www.youtube.com/watch?v=WtTDNsI0-BI

What causes this and can it be fixed with basic model editors (blender)?

2) The ship's high poly count (747,767 tris) causes my game to slow to a crawl on lesser hardware. I think it's purely the high poly count that causes the framerate lag, since even when I disable physics on the model and use a very basic shader it's still lags. While my desktop rig can play the game just fine, my laptop chokes badly on the framerate to the point of being unplayable.

The ship is this one:

http://www.turbosquid.com/FullPreview/Index.cfm/ID/577841

The writeup seems to suggest I can reduce the level of detail by not drawing submeshes, but perhaps I could somehow get the best of both worlds with some kind of level of detail throttling based on computer capabilities (my desktop CAN handle the higher detail)?

I ran some checks on the model, it has "non-manifold" elements, that wouldn't cause the flickering issue would it?

Share this post


Link to post
Share on other sites
Lithic    345
So I figured out some strategies for reducing the level of detail and that's working to help me run it on my lesser computers...

1) Submesh Frustum Culling - I was just doing model level frustum culling, which meant the big ship was culled all or nothing. Doing it on each submesh individually helped a ton, in fact this alone made the game playable again.
2) Occlusion culling - I haven't yet implemented this one, but should help me squeeze a little more out of the hardware
3) LOD algorithms - if all else fails, the meshes in the large model are categorized by level of detail and I could stop drawing the detail submeshes at a certain distance. This would greatly reduce the poly count and really reduce hardware reqs, but since this one would cause noticable visual degradation I think I'll reserve this for the weakest GPUs

But I still am at a loss for what causes the flicker... anybody know?

Share this post


Link to post
Share on other sites
JTippetts    12970
Looks like z-fighting to me. Z-fighting happens when two polygons in the mesh are co-planar and overlapping. Float precision errors cause scanlines of the polygons to alternate in visibility, showing first one then the other as the viewpoint moves. You should be able to go in with Blender and fix the overlapping faces.

Share this post


Link to post
Share on other sites
Lithic    345
Thanks JTippets I think you called it. Wasted a few hours trying to fix this, apparently my blender skills are inadequate so I guess I'll have to find a 3D artist at some point to get it cleaned up.

Share this post


Link to post
Share on other sites
BCullis    1955
Just to add on to the topic, Z-fighting doesn't just happen if polygons are co-planar, it can also occur simply due to float imprecision if two polygons are close [i]enough[/i] and the z-scale of your view*projection matrix is too large. In those cases you see it happen far from the camera's "eye" point, as precision drops as you approach the far plane.

Share this post


Link to post
Share on other sites
Lithic    345
That actually sounds exactly like what I'm seeing: Z-fighting goes away as you get near to the ship. Too bad the fix just isn't as simple as just moving up the far plane.

Perhaps that's why Blender remove duplicate faces didn't fix it...

Edit: Maybe it *is* as simple as moving the near/far planes - changing the near plane to 10 almost eliminated the issue. Unfortunately the player ship was also getting clipped. Edited by jsuffolk

Share this post


Link to post
Share on other sites
Lithic    345
No amount of moving the near/far planes fixed it. However, there was a simple fix:

Added a line to my shaders to use a logarithmic z-buffer as described here:
http://blogs.xnainfo.com/post/Logarithmic-Depth-Buffer.aspx

Since every object uses the same z-buffer it must be applied to every shader, though.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this