Not logged in, Join Here! or Log In Below:  
News Articles Search    

 Home / 3D Theory & Graphics / Dx8 Problem when drawing transparent spheres - they have strange holes Account Manager
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.

May 21, 2005, 03:14 AM


I have some problems with my spheres. I have a universe with 30 planets and a sun. The planets and also the sun are rendered
1) itself, not transparent
2) a bit larger (scaled) transparent cloud texture
3) again a bit larger, transparent, cloud texture

The transparent spheres now have strange holes, this is too bad.
I don't know where they are coming from and how to get rid of them.
It seems they appear on the 'backside' from inside the sphere, I am not sure.

Here some screens, one with the non transparent part, two with only the transparent part(s).

I tried with and without normals, same problem, and without UV coordinates I had no texture, but also the same problem.

Any ideas?




May 21, 2005, 03:29 AM

Make sure you're not scaling the color-component.


May 21, 2005, 04:04 AM

I think I found the solution:




May 21, 2005, 09:25 AM

Hi there =)

This seems like a ZBuffer problem to me. Make sure you render your spheres from the inside to the outside. You might also try glPolygonOffest (there should be a similiar function in DX, something like zbias or so) to introduce a small increment for all your outer spheres. Finally, make sure your near to far plane ratio is not too high.

The origin of the problem is that your outer spheres recieve "noisy" z coordinates because of floating point imprecisions, and thus are partially not rendered when they should be.

- Wernaeh


May 22, 2005, 09:19 AM

Wernaeh is probably right. But if all fails, try disabling back face culling and see what happens. Or, if you're generating your spheres procedurally, try loading a sphere mesh from a file so that you know you're not doing anything wrong in your sphere generation routine. Ok, frankly, I don't really think that any of these could be the cause of the problem but hey, who knows?


May 22, 2005, 10:38 AM

enable culling
cull frontfaces

draw outermost spheres towards innermost spheres

cull backfaces

draw innermost spheres towards outermost spheres

and draw planets sorted by depth, of course, too..

that way you draw in the right order, and transparency works correctly. else, you get such, or similar results. at least, i had them once, too :D

This thread contains 6 messages.
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.