project reality header
Go Back   Project Reality Forums > PR:BF2 Mini-Mods > PR:WWII General Discussion
01 Nov 2024, 00:00:00 (PRT)
Register Developer Blogs Members List Search Quick Links
PR:WWII General Discussion General discussion of the Project Reality WWII modification.

 
 
Thread Tools Display Modes
Old 2023-06-07, 08:13   #11
Mdx00
Default Re: WW2 Binoculars

Quote:
Originally Posted by Mats391 View Post
If you are interested in making it functional, I can write a short tutorial on how to achieve that
yep, thanks
Mdx00 is offline
Old 2023-06-07, 16:03   #12
[R-DEV]Mats391
PR:BF2 Lead Developer
Supporting Member
PR Server License Administrator

Mats391's Avatar
Default Re: WW2 Binoculars

To achieve that you will need to do basic trigonometry. All calculations are done using radians.

1. Calculate the correct ObjectTemplate.zoom.zoomFactor. This value is the vertical FOV and relates to the magnification like this:
Code:
FOV=ATAN(TAN(1.1/2)/Magnification)*2
For example:
4x zoom would result in
Code:
FOV = ATAN(TAN(1.1/2)/4)*2
FOV = 0.304
2. Calculate the angles for the different ranges used in the rangefinder using
Code:
Angle=ATAN(Distance/Height)
3. Convert the angles to pixels on screen using:
Code:
Pixels = TAN(Angle) / TAN(FOV/2) * VerticalPixels/2
The vertical pixels would be the height of your resolution. The result should be rounded to closes integer.
For example:
Angle=0.1, FOV=0.304, VerticalPixels=900
Code:
Pixels=TAN(0.1) / TAN(0.304/2) * 900/2
Pixels=29.377 ~ 29
4. Last step is most annoying: Adjust texture with calculated offsets and test in game. With a texture applied to a 3d mesh, like on binoculars, the pixels in texture will not match the rendered pixels in game. I suggest to take a comparison screenshot and calculate the factor between 2d texture and rendered image in game. Sadly in the end this will require quite some trial and error.

5. Dont try to be too perfect Getting within +/-20m of actual range would already be very good. Very far ranges will matter even less. I would not even bother trying to get it to work past 1500m. At those distances the differences in pixels between two marks is usually so small that we hardly can display it anyways.

Last a tip regarding the equipment of the imperialists: Even tho they used freedom units back then, use meters in game. It makes things easier to adjust as well as easier for player to use as everything else in game is using meters.

Mineral: TIL that Wire-guided missiles actually use wire
Mats391 is offline
 


Tags
binoculars, german, reticle, usarmy, ww2

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 10:25.