Skip to main content
GameDev.net gamedev.net
🔒 Locked

Small Details are Flickering

Started by Endemoniada Sep 27, 2011 at 12:53 AM 7 replies 1.9k views
Original Post
Endemoniada
Endemoniada
Hi guys,

Even though I'm rendering in 3D I have an essentially 2D game, objects can only move along X and Y and rotate around Z.

I'm applying a simple per-pixel phong shader (diffuse, specular) to my objects which looks nice but is causing flickering when the objects move slowly. Anything under multisampling 8x flickers a lot, even 8x causes visual problems.

If I used normal maps for the details instead of actual geometry would it flicker less ? Would a post-processing anti-alaising technique minimize this ? What about a different, better shader ? Maybe you guys have some ideas ?

Also, is it safe to say most semi-modern vidcards are capable of multisampling 8x or better ?

I really need to fix this somehow.

Thanks.
L. Spiro
L. Spiro
What kind of texture filter are you using? Should be linear for best results.
Are you using mipmaps? You should be.


L. Spiro
I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid
Endemoniada
Endemoniada

What kind of texture filter are you using? Should be linear for best results.
Are you using mipmaps? You should be.


L. Spiro


I'm not using textures. Also, the objects are at a fixed distance, it's pretty much a 2D game.
Nanoha
Nanoha
flickering as in z fighting? What are you using for your graphics (opengl/dx/etc)? If you put them in seperate "layers" as in having them all with different z values, does the flickering stop?
Interested in Fractals? Check out my App, Fractal Scout, free on the Google Play store.
L. Spiro
L. Spiro
Why don’t you show screenshots of this flickering?


L. Spiro
I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid
Erik Rufelt
Erik Rufelt
What geometry are you using, are some triangles smaller than a pixel?
And do you have per-triangle or smooth vertex normals?
GraphicsDude
GraphicsDude
Yes, post a video and I bet we can figure it out pretty quickly.
Endemoniada
Endemoniada
Here is an image. This is a model, not a texture. I am using per-triangle normals, I don't what 'smooth vertex' normals are (maybe they will help, please tell me about them.)

When it moves slowly the highlighted edges flicker. I'm pretty sure the flickering is caused by triangles being smaller than a pixel.


0001xa.jpg


Thanks for helping.
Erik Rufelt
Erik Rufelt
That's a bit hard to fix without changing the model, as two triangles with different lighting might compete to fill a pixel, and when the model moves the "winner" can change. Especially if the model contains vertices or edges that don't line up perfectly with neighboring triangles that becomes a problem. Are you using a Z-buffer and depth-testing?
That's the first thing to try.
Smooth vertex normals are when you assign the three vertices of a triangle different normals, which will cause them to be interpolated over the triangle and cause it to be smooth-shaded (fade from one shade to another) rather than flat-shaded (same color over the entire triangle). If you have two or more triangles that share a vertex, give that vertex the same normal for all triangles. This will cause the edges to blend nicely into each other. It's particularly good for curved edges. If you want hard shading edges, such as for a 90-degree corner, then you should not use smooth shading for that edge.
Here's a comparison image from Wikipedia: http://upload.wikimedia.org/wikipedia/commons/8/84/Phong-shading-sample.jpg

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.