Jump to content

zeldafreak

Members
  • Posts

    5
  • Joined

  • Last visited

zeldafreak's Achievements

Squaddie

Squaddie (1/5)

0

Reputation

  1. After correcting some minor mathematical errors, I managed to get the orthographic projection to work correctly. I used your code to figure out the units to the equation (It would have taken me forever to figure out that my problems were due to the radius being in pixels). The primary issue I have now is that the edges of the globe are blue (because I'm drawing a perfect circle and drawing a not-so-perfect polygonal projection on top of it). I'm searching through your logic to see what's different that could be causing that to not work...
  2. You're right, trying to render these triangles/quads has proved to be an absolute pain. The order of the points is different for many quads and I haven't been able to figure out how to make it work with culling enabled. I'll be studying your code there to see how you've done it and I'll probably end up doing it similarly. But I guess you and I are working on the same thing. The difference is that I am reimplementing the game using .NET while you are using C++. I'll be interested in your pathfinding (geoscape, as I plan on trying A* for battlescape pathfinding) and how you're handling alien UI.
  3. Using this bit of code: float radLat = MathHelper.ToRadians((float)Latitude / 8f); float radLong = MathHelper.ToRadians((float)Longitude / 8f); float x = (float)(radius * Math.Cos(radLat) * Math.Cos(radLong)); float y = (float)(radius * Math.Cos(radLat) * Math.Sin(radLong)); float z = (float)(radius * Math.Sin(radLat)); return new Vector3(x, y, z); I was able to generate a 3D representation of the globe. The only issue is that the points do not respect clockwise or counter-clockwise orientation and so the only way to get a complete render is to turn off culling (hardly efficient). But I suspect that I can use dot-product magic to choose dynamically the order of vertices in a triangle. As far as what you said about how textures always face the user, seems like that could be handled in a shader, assuming again that faithfulness to the original was paramount; a more "simple" approach would be to just give the vertices UV coordinates that would wrap the texture around the globe. Assuming a 1:1 correlation between the texture maps and points in WORLD.DAT, wrapping each texture 45-90 times would suffice. Alternatively, you could "fake" the 3D render by simulating sending "rays" into the scene, one ray per rendered pixel, determining the point on the world that each ray struck (simpler for a sphere than one might think), and rendering the texture map by tiling it across the screen. The viewing area in the original game is 256x200 so that would be tiling the texture 8 times. I wrote a photon mapping engine for generating lightmaps several years ago and I think I could use the same techniques here. Lastly, you brought up the lighting. A true rendering engine (using Direct3D or OpenGL) should be able to handle the lighting with little help. It becomes more difficult if you're faking the render using raycasting, but still doable.
  4. Wow, thanks for taking the time to describe all that. Do you think that rendering by hand, pixel-by-pixel, is the easiest solution? I was playing around with the globe last night and it looks to me like it renders a solid blue sphere, and then renders the land geometry on top of it. Seems to me that that should be fairly straightforward to implement. Thoughts? BTW, thanks for that link on points within a polygon; I've been looking for something like that for a while. All in all, I'm interested in leveraging today's graphics technology as much as possible, even if it means sacrificing some of the faithfulness of the recreation.
  5. I'm working on a project using XNA where I'm trying to render the Geoscape Globe in three dimensions. Looking through the WORLD.DAT entry on UFOPaedia and also some other sites on Latitude/Longitude and ways to render a sphere, I've familiarized myself with a little of the necessary math, but I have a long way to go. Before I spent a ton of time, I wanted to know if anyone out there had done any similar or related work that I could steal A little about me: I've been programming for nearly ten years, from QuickBASIC to C/C++ to C# today, professionally for about five years. The development side is no problem for me, but I will have to admit that my 3D math is rusty and I'm learning/relearning as I go. As far as what I've already done, I created a 2-dimensional render, so I have somewhat of a handle on that. Where I'm having trouble is combining the information stored in WORLD.DAT (essentially texture coordinates) with a 3D sphere. I have some ideas on where to get started, but wanted to cast my line out there since, from what I've read, this seems to be a very helpful and hard-working community. Any work you've done or even just ideas based on your understanding of the problem-space would be helpful. Looking at how it's rendered in the game, I'm kinda thinking that they used some kind of ray-tracing method for rendering the globe pixel by pixel because (to my knowledge) there's no geometry stored anywhere. Anyone else have any clues? Thanks, David
×
  • Create New...