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.
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
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.