Statistics | We have 1675 registered users The newest registered user is dejo123
Our users have posted a total of 30851 messages in 1411 subjects
|
Who is online? | In total there are 41 users online :: 0 Registered, 0 Hidden and 41 Guests None Most users ever online was 443 on Sun Mar 17, 2013 5:41 pm |
Latest topics | » THIS FORUM IS NOW OBSOLETE by NickTheNick Sat Sep 26, 2015 10:26 pm
» To all the people who come here looking for thrive. by NickTheNick Sat Sep 26, 2015 10:22 pm
» Build Error Code::Blocks / CMake by crovea Tue Jul 28, 2015 5:28 pm
» Hello! I can translate in japanese by tjwhale Thu Jul 02, 2015 7:23 pm
» On Leave (Offline thread) by NickTheNick Wed Jul 01, 2015 12:20 am
» Devblog #14: A Brave New Forum by NickTheNick Mon Jun 29, 2015 4:49 am
» Application for Programmer by crovea Fri Jun 26, 2015 11:14 am
» Re-Reapplication by The Creator Thu Jun 25, 2015 10:57 pm
» Application (programming) by crovea Tue Jun 23, 2015 8:00 am
» Achieving Sapience by MitochondriaBox Sun Jun 21, 2015 7:03 pm
» Microbe Stage GDD by tjwhale Sat Jun 20, 2015 3:44 pm
» Application for Programmer/ Theorist by tjwhale Wed Jun 17, 2015 9:56 am
» Application for a 3D Modeler. by Kaiju4u Wed Jun 10, 2015 11:16 am
» Presentation by Othithu Tue Jun 02, 2015 10:38 am
» Application of Sorts by crovea Sun May 31, 2015 5:06 pm
» want to contribute by Renzope Sun May 31, 2015 12:58 pm
» Music List Thread (Post New Themes Here) by Oliveriver Thu May 28, 2015 1:06 pm
» Application: English-Spanish translator by Renzope Tue May 26, 2015 1:53 pm
» Want to be promoter or project manager by TheBudderBros Sun May 24, 2015 9:00 pm
» A new round of Forum Revamps! by Oliveriver Wed May 20, 2015 11:32 am
|
|
| Planetary coordinates | |
|
+3Invader Commander Keen roadkillguy 7 posters | |
Author | Message |
---|
roadkillguy Experienced
Posts : 528 Reputation : 17 Join date : 2010-08-25 Age : 31 Location : Rhode Island
| Subject: Planetary coordinates Sat Aug 28, 2010 8:11 pm | |
| I found this pretty cool link
It uses some pretty simple equations too!
With this, we would save the altitude for points that are grid-oriented, and then map them to a sphere to make a planet! | |
| | | Commander Keen Industrial Team Lead
Posts : 1123 Reputation : 36 Join date : 2010-07-23 Location : Czech Republic (not that anyone would know where it is...)
| Subject: Re: Planetary coordinates Sun Aug 29, 2010 2:52 am | |
| This might be useful, but I'm not a maths guy, I don't understand how it works. Let's have Bashi see it. | |
| | | Invader Experienced
Posts : 528 Reputation : 11 Join date : 2010-07-10 Age : 28
| Subject: Re: Planetary coordinates Sun Aug 29, 2010 1:48 pm | |
| Pretty cool... if I wasn't a complete and total idiot in math class. | |
| | | ~sciocont Overall Team Lead
Posts : 3406 Reputation : 138 Join date : 2010-07-06
| Subject: Re: Planetary coordinates Sun Aug 29, 2010 2:55 pm | |
| Couldn't we just use regular lat/long? | |
| | | roadkillguy Experienced
Posts : 528 Reputation : 17 Join date : 2010-08-25 Age : 31 Location : Rhode Island
| Subject: Re: Planetary coordinates Sun Aug 29, 2010 3:16 pm | |
| The problem with LatLon coordinates is that when you get to the poles of the sphere, the points get much, much closer together. It would be hard to measure distances across this sphere, and would cause texturemaps and heightmaps to become ultradense and distorted.
With this method, we would define 6 boxes. One for each side of the cube. Each of the datapoints in the box would represent an altitude for it's point. We wouldn't have to worry about the poles this way.
I found out it's actually how most planet simulators do it. I'm also thinking about using ogre, rather than writing my own engine completely from scratch. | |
| | | ~sciocont Overall Team Lead
Posts : 3406 Reputation : 138 Join date : 2010-07-06
| Subject: Re: Planetary coordinates Sun Aug 29, 2010 3:22 pm | |
| - roadkillguy wrote:
- The problem with LatLon coordinates is that when you get to the poles of the sphere, the points get much, much closer together. It would be hard to measure distances across this sphere, and would cause texturemaps and heightmaps to become ultradense and distorted.
With this method, we would define 6 boxes. One for each side of the cube. Each of the datapoints in the box would represent an altitude for it's point. We wouldn't have to worry about the poles this way.
I found out it's actually how most planet simulators do it. I'm also thinking about using ogre, rather than writing my own engine completely from scratch. If it works better, I'm all for it. | |
| | | Bashinerox Programming Team lead
Posts : 238 Reputation : 8 Join date : 2010-07-07 Age : 35 Location : Australia
| Subject: Re: Planetary coordinates Tue Aug 31, 2010 11:14 am | |
| Yes, no, yes, no, yes, no, yes, no, undecided.
Pros: Much easier to map some form of "game grid" onto the sphere. You simply treat it as a cube.
Cons: Possible artifacts at "cube edges". Can you test this with various textures, and post results?
If i'm looking at it right, we need to distort the textures slightly at the inverse of the cubemapping to get the them to look right | |
| | | roadkillguy Experienced
Posts : 528 Reputation : 17 Join date : 2010-08-25 Age : 31 Location : Rhode Island
| Subject: Re: Planetary coordinates Tue Aug 31, 2010 5:11 pm | |
| What do you propose we use then? I don't think the texturemaps will have to stretch very much unless we use one for the whole planet :affraid:, and I don't like the idea of lat-lon vertices.
I haven't even made a hollow subdivided cube yet, so I can't exactly test it.:lol: EDIT: By made, I mean "Written an algorithm to do it based on a specific width" It wouldn't be too hard to do it manually, I just want to write a master-equation. Which is hard.
Also, we need some method of LOD (Level of Detail) decimation. I found something called quadtrees, but I have yet to look at any source. | |
| | | Bashinerox Programming Team lead
Posts : 238 Reputation : 8 Join date : 2010-07-07 Age : 35 Location : Australia
| Subject: Re: Planetary coordinates Tue Aug 31, 2010 8:03 pm | |
| Aha, just as in the other post i replied to, yes you use quadtrees to represent the sphere's surface. setting the texture coordinates shouldnt be too hard, if you can reverse the transforms done on the cube in order to get a sphere | |
| | | roadkillguy Experienced
Posts : 528 Reputation : 17 Join date : 2010-08-25 Age : 31 Location : Rhode Island
| Subject: Re: Planetary coordinates Tue Aug 31, 2010 10:17 pm | |
| I would actually think to create the sphere, and then modify the (altitude) of each point. Maybe that's not what you were talking about. | |
| | | Bashinerox Programming Team lead
Posts : 238 Reputation : 8 Join date : 2010-07-07 Age : 35 Location : Australia
| Subject: Re: Planetary coordinates Tue Aug 31, 2010 10:45 pm | |
| Okay.. The planet would be represented by 6 quad trees. one for each flat edge of a cube. The quad trees are wrapped around a spherical shape. A quad tree is as follows: you have a node, the root node, that can be split into four more nodes. - Code:
-
O | ---------- | | | | O O O O
each of these nodes can then be split into four more nodes, and so on. the lowest level nodes, ones without nodes underneath them, are called leafs. (note, however, that each leaf isnt necessarily sitting the same amount of nodes in.) Each leaf represents a cell. And when taking into account what i said in parenthesis above, each cell could be a different size. This is how the example video represents the data for the planet. If the leaf gets a set distance to the camera, it splits. when the camera moves away again, the leafs are discarded. Every time you split a leaf, you need to generate more detail. so each leaf then needs to have its height modified by some amount. if you use a psuedo-random function with the coordinates of the leaf on the tree, you can recreate the same planet every single time. Of course, you would eventually stop splitting the leafs as well, you need to impose a limit, to stop "infinity detail" being created and asploding the cpu | |
| | | roadkillguy Experienced
Posts : 528 Reputation : 17 Join date : 2010-08-25 Age : 31 Location : Rhode Island
| Subject: Re: Planetary coordinates Tue Aug 31, 2010 11:00 pm | |
| I understand how it works, it's just the act of creating the vertex and triangle lists that will seem a little more daunting. Not to mention the texture mapping. | |
| | | Bashinerox Programming Team lead
Posts : 238 Reputation : 8 Join date : 2010-07-07 Age : 35 Location : Australia
| Subject: Re: Planetary coordinates Tue Aug 31, 2010 11:24 pm | |
| If you walk through the tree as follows: - Code:
-
u l r d child1 child2 child3 child4
- Code:
-
walk(node, l,u,r,d) {
node->settexturecoords(l,u,r,d)
if(node->child1)walk(node-child1, l, u, r/2, d/2) if(node->child2)walk(node-child2, r/2, u, r, d/2) if(node->child3)walk(node-child3, l, d/2, r/2, d) if(node->child4)walk(node-child4, r/2, d/2, r, d) return }
(Of course i wouldnt use recursion, but it's simpler to write out than a loop.) (And i'm not sure if that is exactly, right, it looks right to me though.) l,u,r,d are the negative and positive horizontal and vertical limits of the edges of the node. the root node's limits are -1,1. Each planet would get 6 textures. texture coordintates are clamped to 0,1, so you would have to halve the number, then add 0.5 to get the texture coordinates from the cell limits. | |
| | | roadkillguy Experienced
Posts : 528 Reputation : 17 Join date : 2010-08-25 Age : 31 Location : Rhode Island
| Subject: Re: Planetary coordinates Wed Sep 01, 2010 9:05 am | |
| You must have done this before.. | |
| | | Bashinerox Programming Team lead
Posts : 238 Reputation : 8 Join date : 2010-07-07 Age : 35 Location : Australia
| Subject: Re: Planetary coordinates Thu Sep 02, 2010 1:11 am | |
| | |
| | | roadkillguy Experienced
Posts : 528 Reputation : 17 Join date : 2010-08-25 Age : 31 Location : Rhode Island
| Subject: Re: Planetary coordinates Fri Sep 03, 2010 9:57 pm | |
| There's another algorithm I've found.. It's called the ROAM algorithm. They simply subdivide where the camera is, and desubdivide where it's not. They have versions for sphere mapping as well. | |
| | | Bashinerox Programming Team lead
Posts : 238 Reputation : 8 Join date : 2010-07-07 Age : 35 Location : Australia
| Subject: Re: Planetary coordinates Fri Sep 03, 2010 10:08 pm | |
| | |
| | | roadkillguy Experienced
Posts : 528 Reputation : 17 Join date : 2010-08-25 Age : 31 Location : Rhode Island
| Subject: Re: Planetary coordinates Sat Sep 04, 2010 1:28 pm | |
| For simplicity's sake I was thinking of something like the following: Not necessarily like a quadtree, just sectioned LOD. It may prove to not work if the planet is VERY large, but for this game I was thinking spore sized planets or less. It would work by having nodes that contain two-dimensional arrays. To get the vertices, we render the initial grid, and then add more vertices depending on the detail level. It works in my head anyway EDIT: Here's some pseudo-code. - Spoiler:
Here's something I thought of: It's not quite a quadtree, but It's the same idea. We have nodes. Each node has a single 2D array. This array will contain vertex numbers for when we face the side of the cube. First, we create a two-dimensional array of vertices based on the number of nodes. (In this case 16x16) - Code:
-
0 1 2 3 4 + + + + + 5 6 7 8 9 + + + + +
+ + + + +
+ + + + +
+ + + + + We then set up the nodes. There will be 16, and they will share edges. - Code:
-
NodeList[0].vertices = [[0,1],[5,6]]; NodeList[1].vertices = [[1,2],[6,7]]; Sharing and caring Anyway, it proceeds like this untill all the nodes have their arrays updated. Then, we apply the subdivision levels. - Code:
-
1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + To update the vertices yet again, it will go something like this: - Code:
-
//PHP AND ACTIONSCRIPT HAHA. THIS WILL NOT WORK, BUT CONCEPTUALLY IT WILL -WE MAY HAVE TO USE LUA FOR THE SPLICES AND SUCH foreach(NodeList as index => i) { //SPLICE VALUES INTO THE TOP AND BOTTOM ROWS NodeList[0].vertices[0].splice(1, 0, 16); NodeList[0].vertices[1].splice(1, 0, 17); //SPLICE VALUES INTO THE MIDDLE -IN THIS CASE WE ONLY HAVE TO DO ONE ROW. NodeList[0].vertices.splice(1, 0, [18, 19, 20]); } This will be done for every node. We'll need someone to write a super-for-loop to do this well. The method by which we've updated the vertices should make facing the box very simple. We go through each node and generate faces like this: - Code:
-
+--+--+ |\ |\ | | \| \| +--+--+ |\ |\ | | \| \| +--+--+ (Node 0) It should be easy due to the two-dimensional array. Whe we face the vertices, we output them to a final array, and BAM. We have a LOD'd mesh.
Last edited by roadkillguy on Sat Sep 04, 2010 4:50 pm; edited 4 times in total | |
| | | Commander Keen Industrial Team Lead
Posts : 1123 Reputation : 36 Join date : 2010-07-23 Location : Czech Republic (not that anyone would know where it is...)
| Subject: Re: Planetary coordinates Sat Sep 04, 2010 2:56 pm | |
| Planets should be as scalabe as possible, because right now we can't just see what size will have the best gameplay/performance ratio. Limiting it to Spore size or less might lead us into problems later. | |
| | | roadkillguy Experienced
Posts : 528 Reputation : 17 Join date : 2010-08-25 Age : 31 Location : Rhode Island
| Subject: Re: Planetary coordinates Sat Sep 04, 2010 3:11 pm | |
| I'm sure it will work for what we're trying to do. | |
| | | ~sciocont Overall Team Lead
Posts : 3406 Reputation : 138 Join date : 2010-07-06
| Subject: Re: Planetary coordinates Sat Sep 04, 2010 10:16 pm | |
| - roadkillguy wrote:
- I'm sure it will work for what we're trying to do.
Again, experimentation is the best way to figure this out. | |
| | | roadkillguy Experienced
Posts : 528 Reputation : 17 Join date : 2010-08-25 Age : 31 Location : Rhode Island
| Subject: Re: Planetary coordinates Sat Sep 04, 2010 10:18 pm | |
| Yep. And I just got the ManualObject class working in OGRE. Time to write some loops. | |
| | | ~sciocont Overall Team Lead
Posts : 3406 Reputation : 138 Join date : 2010-07-06
| Subject: Re: Planetary coordinates Sat Sep 04, 2010 10:22 pm | |
| - roadkillguy wrote:
- Yep. And I just got the ManualObject class working in OGRE. Time to write some loops.
Fun. Keep up the good work. | |
| | | The Uteen Sandbox Team Lead
Posts : 1476 Reputation : 70 Join date : 2010-07-06 Age : 28 Location : England, Virgo Supercluster
| Subject: Re: Planetary coordinates Sun Sep 05, 2010 6:11 am | |
| This be used to increase detail in the center of your vision, where you are looking - things in the corner of your eye wont be detailed, you have to look round to see what it is. What do you think? | |
| | | roadkillguy Experienced
Posts : 528 Reputation : 17 Join date : 2010-08-25 Age : 31 Location : Rhode Island
| Subject: Re: Planetary coordinates Sun Sep 05, 2010 10:31 am | |
| That's what it's for. Yes. | |
| | | Sponsored content
| Subject: Re: Planetary coordinates | |
| |
| | | | Planetary coordinates | |
|
Similar topics | |
|
| Permissions in this forum: | You cannot reply to topics in this forum
| |
| |
| |