Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 23 Jul 2002
Offline Last Active Sep 01 2015 01:30 PM

Topics I've Started

How to determine if object is in view

15 July 2015 - 09:59 AM

We have a flight simulator application where one of the primary views comes from the EO/IR ("skyball) camera connected to the bottom of the "ownship" aircraft.  You can gimbal and zoom the camera.  The problem is since this camera can zoom (reduce FOV) quite far we see Z-fighting.  To address the Z-fighting I move the near plane out a few hundred meters and problem is fixed.  However that introduces a new problem.  Now you can't see the "ownship" because it is being clipped out by the near plane that is not very near the (air)plane, if you catch my drift! :)  So to address that we create silly masks which are nothing more then quads that positioned from the camera's view point.  We have to set their positions to cover up the aircraft mesh and then during the game loop we check if the camera's azimuth or elevation (pitch) angles are inside a mask quad, we say that the camera is "masked" by the ownship and therefore pull the near plane back to its normal position of about 0.1 meters. 


This hack works pretty good until you are in a masked condition (you can see a wing in the view for example) but you are looking far off into the distance.  You get the Z-fighting again because since we are maksed we have to pull the near plane back so we can see the wing or any other part of the aircraft.  You can define as many mask (quads) that conform to the aircraft shape as seen from this camera but you can never get it a perfect fit.


But I want to see if we can do this better, without masks.  I am using OpengGL 3.3+ and GLSL 330 and want to know if there is a better way to check if an object (the ownship 3d model) is in view, are any of its pixel fragments in the view port at any given time?  I am not a GLSL expert so that's why I am coming to the experts.



There is another approach I thought about which eliminates the need for masking altogether but it may not work so well with our shadows.  I'll just throw this one out but I want to focus on the current approach first.  This approach renders two channels where one channel defines near and far planes close to the aircraft ownship, near == 0.1m and far==500m.  The second channel defines the near as 500m and the far as 130000m (flight sim so we need a far far plane distance at a high altitutde).  So the 2nd channel draws the further scene where the 1st channel leaves off.  I tried this way and it did seem to work however our dynamic shadows have to be attached to only one channel.  This requires drawing the scene twice and our scene can get pretty heavy so its not my first choice.  That's why we went for the more hacky way first.  I may need to work with this approach more, however.


In the mean time I want to pursue improving our current solution.  Any ideas would be helpful.


Wow, its been many years since I've been on this site.  Lots of changes that look great!



particle persistence

25 February 2010 - 09:26 AM

Hi, My question revolves around how "particles" like tank tracks, shell casings and other debris remains in a scene when there could be hundreds perhaps thousands of them. Here's a case for my point. Take RoboKill game http://www.rocksolidarcade.com/games/robokill/ Stay in a room and shoot for a long time and you'll see shell casings and wall debris particles stay on the ground, even if you leave a room and come back. How is this done and still maintain performance? Do they bake the particle image into the underlying texture before leaving the room? Do they just keep the particles positions and keep rendering them even if you reenter a room? I need to experiment but it seems to me that eventually the system performance will drop too much. Or perhaps not since the games I'm thinking of are 2D and rendering particles, especially if they are part of the same texture atlas (ie. no texture switching in the frame render), is not that expensive if batch rendered. Steve

tank tracks

25 January 2010 - 12:38 PM

Anybody know how to make tank tracks that appear in the ground for a game? For example there is a tank game for Wii Play where tracks are laid where ever the tank drives. I'm not looking for code or a working solution but more for the concept of how it can be done. I can code it myself. Decals? Decal baked into the ground texture? Particles (that just spawn and stay put)? I imagine it has to be fast and easy on memory due to the fact that its not a gameplay priority to draw tracks. Just can't get my mind wrapped around how those might be done. Thanks! Steve

Spawning technique for shooter game

10 July 2009 - 09:07 AM

I'm putting together a shooter game similar to Heavy Weapon Deluxe and have been perplexed on how to spawn the enemy aircraft. I could use some help. Heavy Weapon has a wave.xml file with a level defined with a wave that has a length of time in seconds and the type and number of craft as additional parameters. I've modified this file to try and understand what is happening. To me it looks purely time based with random applied to: - height of plane, - speed - side of screen to enter If I could get some ideas on spawning craft that would be helpful. Steve

2D game ground representation

26 February 2009 - 09:23 AM

Sorry if this has been discussed before, I did my best combing this forum for an answer to this question. I need a way to represent the non-flat ground in a 2d game. Think of games like Robo Slug and Soldat (http://static.soldat.pl/screens/promo/Image4.jpg). Is it just a simple set of connected line segments? Given the players x go get the y using linear interpolation from the retrieved line segment? I've been used to platformer type of orthogonal ground tiles that I'm not sure how non-flat or uneven ground types are represented in the game world. Any thoughts? Steve