Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Tobias

Hemisphere generation...

This topic is 6793 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, I just wondered if someone knows of an algorithm to create a hemisphere? And if anyone knows a place with some nice sky textures? Guess what I''m coding... Greets Tobias

Share this post


Link to post
Share on other sites
Advertisement
Heh same here! I''d also be interested in some Hemisphere code too....nice sky textures would''nt be a bad idea either

Share this post


Link to post
Share on other sites
Generating the coords for a hemisphere should be quite simple..

Use the XY axis to strike one arc, from 3o''clock to 12o''clock (anti-clockwise), say, every 10 degrees.. Use the resulting X as a new radius..

With this new radius, find all the points around the XZ for a full circle (again pick an angle..)

Hey presto you''ll have X,Y & Z coords for a hemisphere.

You''ll still have to work on the normals, and apply spherical texture mapping though (that I''m afraid I can''t help you with - I''m still learning too!)

If you really need to see a code example of the coord generation routines, just say so..

Cheers

Matt


Check out my project at: www.btinternet.com/~Matthew.Bennett

Share this post


Link to post
Share on other sites
Thanks 3dModelMan,

I stole this routine from Paul Bourke (I think), and
it works fine.


#define PI 3.141592654f
#define TWOPI 6.283185308f

void SphereMap( vec_t x, vec_t y, vec_t z, vec_t radius, vec_t *u, vec_t *v )
{
*v = (vec_t)acos(z/radius) / PI;
if (y >= 0.0f)
*u = (vec_t)acos(x/(radius * (vec_t)sin(PI*(*v)))) / TWOPI;
else
*u = (PI + (vec_t)acos(x/(radius * (vec_t)sin(PI*(*v))))) / (TWOPI*2.0f);
}

Greets Tobias

Edited by - Tobias on 4/10/00 1:10:40 PM

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!