Sign in to follow this  

Sphere projection

This topic is 4337 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello there, I'm coding a deferred shading algorythm, for thoses of you not familliar with the subject its simply a way to lighten a scene in image space. Now my problem is not directly related to deferred shading but rater to finding the dimensions of screen aligned quad that would perfectly fit the projection of a sphere in 3D. The sphere is centered on a light position in 3D and its radius is equal to the range of the attenuation of the light. What I tried is to transform the position of the light in view space then, in the same space, create a screen aligned quad using the apropriate radius. But after projection, the quad is not large enough (this works only in ortho projection). It would be easier to understand with a picture, but I dont know how to add one here...

Share this post


Link to post
Share on other sites
The only thing I can think of off hand is that you failed to scale the radius.

As for posting an image, which would certainly help, you need a site to store the image. Usually your ISP provides some limited storage for a personal web page as part of your account. Their site should give instructions for how to set up your web page which should include how to upload files and determine the URL for the uploaded file.

You can see how any did anything in a post on this site by clicking on Edit on the post. You can't actually edit it unless it is your post, but you can see the tags they used to format their post. So as an example.

[Edited by - LilBudyWizer on January 27, 2006 11:41:22 AM]

Share this post


Link to post
Share on other sites
If the quad is centered at the sphere's origin, the difference in size is because the nearer half of the sphere gets perspectively blown up in size, while the quad (which is at the center of the sphere), gets magnified to a lesser extent. And it makes sense that your quad is sized correctly in orthographic mode, because in orthographic mode things are not blown up

Here's my brute-force solution:

Firstly, choose a plane that is perpendicular to the screen and whose origin is at the center of the sphere. The cross-section of the sphere that is formed by this plane contains the vertices that must be searched through. Find the vertex whose distance between its projected position and the sphere's projected position is the farthest. Your screen-aligned quad must be moved forward along its axis so that this vertex is in its plane.

So you don't really need to alter the quad's dimensions, you just need to move it forward enough so that its projection fits perfectly with that of the sphere.

I'm sure there's a better method out there...somewheres...but this is all I could think of.

[Edited by - riltniqaz on January 27, 2006 12:43:32 PM]

Share this post


Link to post
Share on other sites

This topic is 4337 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this