Clear screen in gradient mode instead of sky-dome?

Hi

Is it possible to clear screen with color in gradient mode?

It would be fast and good solution for sky effect.
Plain color doesn’t look too realistic.

I found some articles about sky-dome generation ,but they are too complicated to implement on dynamic 3d scenes (we need to calculate position for the sky sphere in horizon and also for camera movements )

If the answer is no ,please advice me something that looks good
and are not too time/resource costing.

Thanks

Just draw a full screen quad with some color for the top vertices and another color for the bottom vertices.

Then I don’t see most of my scene…
(if not to calculate the bounds at far distance ,which I’m trying to avoid )

draw it before any other geometry and disable depth writing.

Then I probably won’t see most of my scene…
(if not to calculate the bounds at far distance ,which I’m trying to avoid )

Maybe you can use glDepthRange(1.0,1.0)

Ohhh thanks, I tried it before I posted ,but
I forgot about depth buffer and gluLookAt(…) since I switched to glOrtho(…),and I got weird result, no it works ok :o

To save fillrate, it is recommended draw sky the last - at maximum depth with depth test.

unsigned void: To save fillrate, it is recommended draw sky the last - at maximum depth with depth test.

isn’t pixel first shaded and then depth-rejected? and you have a depth test here instead of disabling it.

isn’t pixel first shaded and then depth-rejected?

fragment are first shaded if alpha test is enabled or if you write the fragment depth in a fragment shader. Otherwise it is useless to shade a fragment if we know that it is behind another one and it is discarded right after depth comprarison.

Then drawing the skybox last, you save many depth buffer writes and instead you just do depth comparisons.

Z test optimization techniques exists in many video cards, in certain cases it can kill fragments early enough to make it worth. You can not directly control it.

Anyway you probably don’t have to worry about this now.

dletozeun:
Otherwise it is useless to shade a fragment if we know that it is behind another one and it is discarded right after depth comprarison.

i remember depth sorting where geomtery is sorted according to the camera, to draw closer object first and more likely cause a depth test fail on next objects. good if geomtry is heavy on rasterization like normalmapping. makes sense. thanks.

I have just found another thread about depth test optimatizations which is what Zbuffer was talking about IMO. Look at the link in modus’s post, I think it would interest you.

http://www.opengl.org/discussion_boards/…6418#Post246418

i will give it a read. thanks alot dletozeun.