All pastes #957881 Raw Edit

Jemand

public text v1 · immutable
#957881 ·published 2008-03-26 08:21 UTC
rendered paste body
	
	Posted: Mar. 20 2008,23:41 	
Quote (King Homer @ Mar. 11 2008,09:07)
Hi,
I'm currently working for ACE mod on several tanks, including Russian and American. We're trying to get them as realistic as possible and now I've got a small problem.

I had a look into your FCS addon for the Abrams and T72 and as the title says, I have a problem with the FOV used in the tanks.
I did a whole bunch of research, found some data here and there but now I can't go on because I don't know how the FOV and magnification in ArmA is calculated. Maybe you could explain a little bit how you got the different values and what all the comments mean in the config. Also if you use clicks, mils, degrees, rads or what else possible ;) and how you implented it.
Furthermore I'd like to know more about the elevation- and rotationspeeds for turret and guns.

I'd really appreciate it if you could help me out on this.

Kind regards
King Homer



Didn't see this until today, but if you're still interested I've got answers.

Field of view in ArmA is actually pretty simple.  All the *FOV values are in radians, and each one defines the angular distance from the center of the screen to the edge.  (So it's technically the half-field, horizontally.)  For zoom, just define some arbitrary FOV value as unity magnification.  I think I used 0.3 radians (34 degrees total FOV) for small arms and 0.33333 radians (38 degrees total FOV) for tank optics.  Double magnification means half the angular field of view, by definition.

It gets a bit more complicated when you change aspect ratio, though.  The *FOV variables are only accurate for 4:3 aspect ratios.  For 16:10 the true half-field of view is, if I'm remembering correctly, FOV * (16/10) / (4/3).  


For optics textures, everything is more complicated.  It's made even worse by the fact that the stock optics models are incorrectly scaled.  

For optics, you need to make a model that is a flat plate, 5.12x3.84 units big.  Of this, the inner 1.00x0.75 units will be visible to a player running at 4:3 aspect ratio.  The actual size doesn't matter as much as the ratios, which *must* be equal to those given here.  (Just grab the models out of my scopefix mod to see how this works.)

Then you need to decide, from the FOV you've modeled, what the scale of the optics texture needs to be.  Define it in pixels per milliradian or something similar.  I've forgotten exactly how I did the math for this, but if you've got a 1024x1024 texture, the center 1024x768 pixels are what you want to show up as the optics texture, and that 1024 pixel width is equal to twice the maxFOV value for scaling.

I actually chose the texture scale first, so it would be an integer number.  This makes the optics a lot more accurate, but it leads to a bit of goofiness in the zoom levels.  This is why unity magnification is 0.33333 radians in the first version of my mod but 10x magnification was 0.032 radians.  For 10x magnification, I think a scale of 16 pixels per milliradian was the nearest integer texture scale to a FOV value of 0.033333.  I think I forgot to change these to something more consistent when I changed the optics in the second version of my tank mod.



Version 0.2 of my tank mod doesn't do optics this way, and in fact all the gunnerOpticsModel definitions are blank textures.  If you do optics the way I described above, the optics are fixed in size and only accurate at one magnification level.  For version 0.2 I made the optics models as above, but then scaled them very small and placed them in the actual tank model at the *EXACT* distance away from the viewpoint such that they were the correct angular size on the screen.  Because of this, they are always the correct size no matter the zoom level.  I also gave them their own axis (called "headmirror" or something) and tied them to gun elevation in the cfg file.  I made a couple different textures, and added an animation that switches between them.  Then I added a script that keeps track of zoom level (by the amount of time that you've held the zoom in or zoom out keys down) and shows or hides the correct group of textures.  All the parts of the optics were modeled separately like this and animated through scripts.