Striping instead of gradient problem

Moderator
Posts: 916
Joined: 2002.10
Post: #1
From far away, I get this striping problem. When I move closer to my ferris wheel, the lineation goes away and it looks as it should. Any suggestions as to what might be the problem is and how I can fix it would be much appreciated.


[Image: ICGSS005.png]


PS. HIII *waves* I still exist Smile
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
looks like z-fighting... try pulling your far plane in, or pushing your near plane out.
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #3
Also, make sure that your depth buffer has the highest value you can choose. Be very careful with putting polygons either very close together or on top of each other, since this will happen. If they are facing different sides and you don't have cull facing enabled, you can try enabling that as well.
Quote this message in a reply
Moderator
Posts: 916
Joined: 2002.10
Post: #4
How do I increase the depth buffer's size?
And how would I dynamically set my near/far plane so I'm not clipping wanted things? or... something? Blink
Quote this message in a reply
Member
Posts: 41
Joined: 2006.01
Post: #5
Why is it so pixel-y? I suppose if you have a surface texture, it could also be a moire. So if you have a blending option, try that.
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #6
skyhawk Wrote:How do I increase the depth buffer's size?
And how would I dynamically set my near/far plane so I'm not clipping wanted things? or... something? Blink
How are you setting up your context? If it's an NSOpenGLView, you can set it from Interface Builder. You'd know how to do it if you were setting it up programatically, so I doubt you're going that rout. If you're using GLUT, look at this function. I don't know how to do it in SDL, since I've never used it. The highest value you can set the depth buffer to is 32 bits.

As for setting near and far plane, adjust your gluPerspective call.
Quote this message in a reply
Apprentice
Posts: 17
Joined: 2006.02
Post: #7
To set the size of the depth-buffer in SDL you do:
Code:
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 32);

You shouldn't need a bigger buffer for a scene like that though, the most likely problem is that you've set your zNear plane to 0.001 or something small like that. The gluPerspective man page says thus:
Quote:Depth buffer precision is affected by the values specified for zNear
and zFar. The greater the ratio of zFar to zNear is, the less effec-
tive the depth buffer will be at distinguishing between surfaces that
are near each other. If

r = zFar/zNear

roughly log2® bits of depth buffer precision are lost. Because r
approaches infinity as zNear approaches 0, zNear must never be set to
0.

Try setting your zNear to something larger, like 1.0 or 10.0.
Quote this message in a reply
Moderator
Posts: 916
Joined: 2002.10
Post: #8
I am using GLUT (by no free will of my own) I will try what you suggested when I get home and can test.

as for chris ball:
It is pixelly cause I have no anti-aliasing, am using a non-infinitely large window, and the object is constructed of small pipes (pipings are known to be very pixellated when not antialiased).

the off colored, I do not know, but hopefully increasing depth buffer will solve the problem.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  circular gradient Quartz2D pj_madrid 0 2,936 May 17, 2011 12:24 PM
Last Post: pj_madrid