Jump to content
  • Advertisement
Sign in to follow this  
Jwilkins

spherical graphics engine?

This topic is 3719 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

I am just beggining programming on a graphics engine, and I was wondering... Is it possible to add a hieght map to a sphere? If so, how do you make things stick to it(like water, tress, houses...)? Also, could you program a chareter to run on it's surface? I know how to do these things on a planar height mapped surface, but not on a sphere. So is it even possible to hieghtmap a sphere, then create a world on it that had enough of a "gravitational pull" to hold everything in place, and easily navigate on its surface? -Josh

Share this post


Link to post
Share on other sites
Advertisement
The principle is the same, but instead of vertices moving along the Y axis (0, 1, 0) to go up, move them away from the centre of the sphere to go up (vertexPosition - sphereCentre).

For your physics, the idea is the same. Instead of applying force in the down axis (0, -1, 0), apply force in the axis that points to the centre (sphereCentre - objectPosition).

To stop things flying off, just don't let any of your physical objects maintain escape velocity ;)

Share this post


Link to post
Share on other sites
You might need to work in spherical coordinates (r, theta, phi). Opengl works in Cartesian coordinates (x, y, z). To learn more about spherical coordinates read this.

"Gravity" will always act radially (it will pull you from your position to the center of the planet) as biggoron says. You will also need to use the same (but opposite) vector to define the "up" direction of your camera.

Share this post


Link to post
Share on other sites
Matt thankyou I pretty much understand the logic and mathmatical theories behind it but thankyou for the link. More so asking how to transulate the math to code?

And big where in my program would i put the vertex position and object postion? Right after the declaration of the sphere, or after the adding of my height map, or would i ant to add it before adding or declaring much of any thing in the main function?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!