View Full Version : seeing the inside of a sphere
Najdorf
2006.07.16, 11:33 PM
I'm having the following problem:
I am working on a game where there are some guys in a big sphere. (I am drawing the sphere with gluQuadric). I want to be able to see the "inside" of the sphere, even if the camera is outside. To do so, I set the "front" of the sphere to be the interior (with gluQuadricOrientation(quadric, GLU_INSIDE); ), and then culled out the back
sides
This seems to work fine on the mac, but on the pc is the camera is at a certain distance from the sphere i stop seeing inside and i just see the exterior.
Do you think my technique is right? Do you think it's an opengl issue- a driver issue? CAn you think of workarounds?
Thanks
OneSadCookie
2006.07.16, 11:38 PM
Your technique sounds OK. Did you glEnable(GL_CULL_FACE)? Did you request a depth buffer? Got a screenshot?
Najdorf
2006.07.17, 12:22 AM
Yeah I enabled cull face and glEnable(GL_DEPTH_TEST) :/
http://img529.imageshack.us/img529/7222/1qv4.png
http://img529.imageshack.us/img529/6658/2zp5.png
If camera goes just a bit further i just see the outside, while if it goes closer i can see just the interior...
TomorrowPlusX
2006.07.17, 10:22 AM
How about giving a stab at rendering the sphere yourself? Then you can be certain about windings and face-culling.
Also, if you render your sphere yourself, you can use a recursively subdivided isocahedron and have a much higher quality sphere without too many triangles. Those lat/long spheres can be ugly... if you want code to do this I'll post some.
AnotherJake
2006.07.17, 02:50 PM
Those lat/long spheres can be ugly...
Indeed, but lat/lon spheres look perfectly fine as long as there is sufficient interval used for the application. For a sky dome/sphere they should be plenty sufficient since you're only doing one and can afford the extra poly count -- say every ten degrees for interval. For smaller spheres, and where polycount is important (like needing many spheres on-screen), isocahedron is the way to go.
TomorrowPlusX
2006.07.17, 03:22 PM
Agreed -- but looking at the screenshot with the per-vertex blending -- I stand by my isocahedron recommendation!
(I use nested lat/lon spheres for my skydome...)
ThemsAllTook
2006.07.17, 04:08 PM
A third alternative which I've used with pretty nice results is a subdivided cube. Might be a bit easier to texture than an icosahedron or a lat/long sphere.
AnotherJake
2006.07.18, 12:43 AM
Agreed -- but looking at the screenshot with the per-vertex blending -- I stand by my isocahedron recommendation!
That's a good point. An isocahedron might very well help get rid of that funky blended square panel look for the vertex blending. I didn't really notice that earlier. Of course, this is just guessing at what Najdorf is trying to accomplish in the end, but I see your angle. Not that this directly addresses his major problem at the moment though...
OneSadCookie
2006.07.18, 12:49 AM
per-pixel lighting would definitely fix the ugly blended square panel look ^_^
imikedaman
2006.07.18, 01:05 AM
That's a good point. An isocahedron might very well help get rid of that funky blended square panel look for the vertex blending. I didn't really notice that earlier. Of course, this is just guessing at what Najdorf is trying to accomplish in the end, but I see your angle. Not that this directly addresses his major problem at the moment though...
Wait, since when is the problem with the vertex blending, and not with the colors and normals he's supplying at each vertex? The blending will work fine once he supplies the same normals and colors for each shared vertex.
OneSadCookie
2006.07.18, 01:19 AM
He is supplying the same color & normal for each shared vertex, but all the quads are divided into triangles along the same diagonal, and the colors are being interpolated across the triangles, not the quads.
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.