seeing the inside of a sphere

Member
Posts: 749
Joined: 2003.01
Post: #1
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

©h€ck øut µy stuƒƒ åt ragdollsoft.com
New game in development Rubber Ninjas - Mac Games Downloads
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
Your technique sounds OK. Did you glEnable(GL_CULL_FACE)? Did you request a depth buffer? Got a screenshot?
Quote this message in a reply
Member
Posts: 749
Joined: 2003.01
Post: #3
Yeah I enabled cull face and glEnable(GL_DEPTH_TEST) :/

[Image: 1qv4.png]

[Image: 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...

©h€ck øut µy stuƒƒ åt ragdollsoft.com
New game in development Rubber Ninjas - Mac Games Downloads
Quote this message in a reply
Sage
Posts: 1,199
Joined: 2004.10
Post: #4
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.
Quote this message in a reply
Moderator
Posts: 3,577
Joined: 2003.06
Post: #5
TomorrowPlusX Wrote: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.
Quote this message in a reply
Sage
Posts: 1,199
Joined: 2004.10
Post: #6
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...)
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #7
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.
Quote this message in a reply
Moderator
Posts: 3,577
Joined: 2003.06
Post: #8
TomorrowPlusX Wrote: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...
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #9
per-pixel lighting would definitely fix the ugly blended square panel look ^_^
Quote this message in a reply
Member
Posts: 161
Joined: 2005.07
Post: #10
AnotherJake Wrote: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.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #11
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.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Need ray-sphere intersection code MattDiamond 23 15,148 Aug 31, 2009 02:28 PM
Last Post: Gengar003
  Lighting a sphere with OpenGL lights (normals wrong?) cecilkorik 3 8,184 Dec 27, 2007 02:40 PM
Last Post: _ibd_
  Space Box/Sphere misteranderson 1 2,460 May 12, 2006 10:48 AM
Last Post: TomorrowPlusX
  texture mapped sphere dave05 5 3,168 May 8, 2006 05:43 PM
Last Post: dave05
  Generating a sphere MacFiend 4 4,137 May 7, 2003 06:38 PM
Last Post: MacFiend