#### Archived

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

# 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.

## 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 on other sites
Heh same here! I''d also be interested in some Hemisphere code too....nice sky textures would''nt be a bad idea either

##### 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 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 )
{
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

1. 1
Rutin
27
2. 2
3. 3
4. 4
5. 5

• 11
• 9
• 9
• 9
• 14
• ### Forum Statistics

• Total Topics
633313
• Total Posts
3011320
• ### Who's Online (See full list)

There are no registered users currently online

×