Original Post
🔒 Locked
Empty Sphere
Advertisement
Well, mathematically a filled sphere is given by
(x-x0)2 + (y-y0)2 + (z-z0)2 - R2 <= 0
while a hollow sphere is given by
(x-x0)2 + (y-y0)2 + (z-z0)2 - R2 == 0
But I assume that is not the answer you are expecting. The problem is, however, that I don't know _what_ you're expecting... What is the context, and how do you construct a solid sphere opposed to the hollow sphere? OpenGL, as any other rendering API, deals with surfaces only (the 2nd formula above).
A sphere is a 2-manifold, and hence rendering a sphere with an opaque material doesn't depend on its solidness. It becomes different only when you make a hole into the surface. (And, of course, its physical behaviour is different whether it is solid of hollow.)
If you want to see objects inside the sphere, you have to use transparency. From a physical point of view you need to simulate refraction, but that isn't easy. However, the refraction really depends on whether the sphere is hollow or not.
(x-x0)2 + (y-y0)2 + (z-z0)2 - R2 <= 0
while a hollow sphere is given by
(x-x0)2 + (y-y0)2 + (z-z0)2 - R2 == 0
But I assume that is not the answer you are expecting. The problem is, however, that I don't know _what_ you're expecting... What is the context, and how do you construct a solid sphere opposed to the hollow sphere? OpenGL, as any other rendering API, deals with surfaces only (the 2nd formula above).
A sphere is a 2-manifold, and hence rendering a sphere with an opaque material doesn't depend on its solidness. It becomes different only when you make a hole into the surface. (And, of course, its physical behaviour is different whether it is solid of hollow.)
If you want to see objects inside the sphere, you have to use transparency. From a physical point of view you need to simulate refraction, but that isn't easy. However, the refraction really depends on whether the sphere is hollow or not.
Maybe he means drawing a transparent sphere. Then it could be as follows:
1. draw the back faces of the sphere, i.e. inner side (if the sphere is wound CCW then changing front faces temporarily to GL_CW would do the job).
2. draw the the objects inside the sphere
3. draw the front faces of the sphere, i.e. outer side
For steps 1 and 3, blending has to be enabled.
Step 2 can be done before step 1 if the objects aren't transparent. Doing so would save some overdraw (hidden pixels of the inner side not drawn).
1. draw the back faces of the sphere, i.e. inner side (if the sphere is wound CCW then changing front faces temporarily to GL_CW would do the job).
2. draw the the objects inside the sphere
3. draw the front faces of the sphere, i.e. outer side
For steps 1 and 3, blending has to be enabled.
Step 2 can be done before step 1 if the objects aren't transparent. Doing so would save some overdraw (hidden pixels of the inner side not drawn).
Quote:
Original post by Lord_Evil
Maybe he means drawing a transparent sphere. Then it could be as follows:
1. draw the back faces of the sphere, i.e. inner side (if the sphere is wound CCW then changing front faces temporarily to GL_CW would do the job).
2. draw the the objects inside the sphere
3. draw the front faces of the sphere, i.e. outer side
For steps 1 and 3, blending has to be enabled.
Step 2 can be done before step 1 if the objects aren't transparent. Doing so would save some overdraw (hidden pixels of the inner side not drawn).
Ah, yes, "filled" in the sense of z-buffer values disallowing depth test passing ... good point.
Just for completion: Rendering transparent objects with z-buffer enabled requires the objects to be rendered in the order from back to front. In the given case the surface of the sphere has to be divided up into 2 shells, one behind and one in front of the contained objects. Lord_Evil's suggestion does that by rendering the sphere twice.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement