[Plib-users] How should I use plib?
Brought to you by:
sjbaker
From: Troy Y. <tro...@ho...> - 2000-08-16 02:45:36
|
Sorry for the long post. I'll ask my question(s) up front. A description of what I've been up to follows. Q: What is the best way to create a scene/world using plib? It seems to me that loaders are extremely useful but what is their impact on one's ability to render a scene quickly and efficiently? Aside from loading a model, and scaling/rotating/translating it what else must be done to manage the scene/world (i.e. BSP trees, LOD, etc.)? What I'm doing... The project I'm working on (day job) is a naval simulator in which ships, aircraft, subs, weapons, rain clouds, countermeasures, and biologics (whales, birds, etc.) appear. A game engine exists that moves things around periodically. Currently the only view into the simulation is a via a 2D birds-eye representation using standard symbology. I'm interested in spicing things up with a 3D representation. Enter OpenGl... Enter plib... Using the Tux-on-a-box example as a starting point, I've managed to put something together that places models at the correct locations and even has an ocean and land... first iteration complete! Now it's time to refine/improve/tune through reiteration - and there's lots to do here. My current method of populating the scene is not at all practical (not to mention ugly) especially with regard to land and ocean. Right now, I'm using an AC3D model of a plane composed of 4 co-planar quads and scaling that to my game boundaries (2000 nautical miles on a side). I know I could get creative and draw only a large enough 'ocean' to produce a rendered scene that looks right but I've been working in'minimum intervention' mode - aside from pointing the camera, I don't have to do anything once the models are placed. (Please remember that this is my first iteration on my first OpenGl/3D program! :) One of the immediate problems with my ocean approach is that the ocean often disappears - it depends on the direction the camera is pointing and where in the scene it is placed. I'm guessing that it's getting culled because there are no vertices of the ocean inside the view frustum. Ok, so I'll have to use a different method. Eventually I'll want to add a texture and possibly even some height variations (waves). Before I talk about this further, let me tell you about land. I mentioned above that the game area is quite large - 2000 nautical miles on a side. Although all action will typically take place in a very small portion of the map, there is no way to decide up front where that might be. It is also possible to 'warp' any entity to any place on the map at any time. Since this is a naval simulation, most of the action will take place on the water but may be near a major land mass. At the moment, my land resolution is very coarse - altitude in feet at every nautical mile grid point (= 2000x2000 = 4,000,000 points). Since much of this will be water in many instances, I'm not using a 2000x2000 array to store the data. Here's the worst part (I think) of how I'm realizing this land in the scene... <cringing in anticipation of being bashed about the head>... I'm loading a single instance of a unit sized AC3D cube, scaling the height to match the height of a grid point (by adding model to ssgTransform node) and translating it to the appropriate grid location. The net result is lots of stretched cubes clustered about. I know this is not going to work (it's not scalable and it's UGLY) but I wanted to put something together with minimum effort on my part (Think 'baby steps!'). I noted that FlightGear has defined a bunch of tiles that get loaded in and I assume that something like this is the way to go here. How does one deal with being able to warp the camera anywhere on the map though? Well, thanks for your time. Any pointers/comments would be appreciated - perhaps you know of a 'getting started' tutorial? Anyway, welcome to my adventure! :) Troy. |