Jump to content
  • Advertisement

Archived

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

mux

Spherical Terrain Rendering

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

Anyone got any information on spherical terrain rendering? I''ve watched technobot''s threads (here) but besides that I''ve found virtually nothing on this subject.

Share this post


Link to post
Share on other sites
Advertisement
Well... if you are talking about rendering the terraing assuming that earth is spherical, you need a vertex shader and a little pitagoras maths....




radios.x = 6378.0; //Earth Radius in Km

radios.y = 40678884.0 //Earch Radius^2 in Km


float4 pos = mul(glstate.matrix.modelview[0], position);
float miniy = pow((pos.y/1000.0), 2);
pos.z = pos.z - (radios.x - sqrt(radios.y - miniy));
salida.position = mul(glstate.matrix.projection, pos);

Share this post


Link to post
Share on other sites
I agree.. use a vertex shader because well it saves effort. Instead of calculating all that nasty math all you need to do is extend that point on the sphere out along the normal to a magnitude corresponding to the height on the terrain you loaded from wherever.

Share this post


Link to post
Share on other sites
I don't understand you.... can you explain it more... perhaps a little code should help.


[edited by - motote on June 4, 2004 2:54:42 AM]

Share this post


Link to post
Share on other sites
Well I know about sphere<->plane projections etc. There are TONS of different projections each resulting in different distortions of the projected plane.

I need a projection true to the data's 'area' so I guess this would be the Lambert Azimuthal Equal Area Projection.

In the end, this is about 'planet rendering', not some stinky metroid crashing your carrier's cockpit window

Now I have no clue how I'd combine this with ie the SOAR, ROAM, or any other terrain rendering strategy

[edited by - mux on June 4, 2004 8:32:23 AM]

Share this post


Link to post
Share on other sites
To render a spherical terrain, it is not good to take a simple projection like Mercator since it can''t map the WHOLE sphere and gives strange distortions near the boundaries.

The best thing I can think of is the following: You start off with an icosahedron. That''s a "cube" with 20 triangular equilateral faces and 12 vertices. If you google for it, you''ll probably find the vertex positions and connectivity information.

From the 20 faces you build 10 groups of 2 faces that share one edge. You can map a (quadratic) texture to the faces of each group.

The groups are your "diamonds" in the sense of ROAM. In order to refine the globe, you split the common edge of each globe. The rest is exactly like in ROAM. But instead of having boundary triangles with no neighbour (like in usual terrain ROAM), all triangles have a neighbour since it''s a sphere. But data structures are actually the same.

Share this post


Link to post
Share on other sites
yeah I thought about using a platonic body. a icosahedron or a dodecahedron etc. I'll try to do it with SOAR tho (oi fear the governmental copyright) And I'll try to mix it with some projection scheme



[edited by - mux on June 4, 2004 10:33:03 AM]

Share this post


Link to post
Share on other sites
Hey, nice animation!

I think SOAR uses the same split method in principle. You can use the split dodecahedron like in the anigif and then do longest edge bisection. If you take an icosahedron, you should get slightly "more equilateral" split triangles and slightly less projection distortion, but I''m not sure.

Share this post


Link to post
Share on other sites
Here's a bunch of links that may be useful to you.

Sean O'Neil's series on planet rendering using ROAM:
1)Part One: Generating Planetary Bodies
2)Part Three: Matters of Scale

Procedural planet tutorial based on quadtrees
Procedural Planets

Various posts on gamedev
1)Technobot's 1st thread - The Basics
2)Technobot's 2nd thread - Generating the Data
3)Another thread with useful information
4)Planet Rendering - Representing a planet to scale

Some engines
1)http://drtypo.free.fr
2)Check technobot's planet threads for videos of Ysaneya's planet engine - quite incredible IMO, perhaps for some 'inspiration'?

That's all I'll give you for now Though I have many more links related to various other topics you may come up against - the generation of normals, perlin noise for procedural terrian, articles on SOAR/ROAM techniques etc.

[edited by - cheese on June 4, 2004 11:33:39 AM]

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!