Jump to content
bek

Custom 2d Reticle — opticModel p3d template?

Recommended Posts

FIXED; DOWNLOAD arma 3 optic / scope / reticle / 2d / p3d / template here:

Mega: https://mega.co.nz/#!lMVgxRLD!podwp88KitRNwWjFujzb_uZSRGOOA6IPpaO37vdAvbc

Dropbox: https://dl.dropboxusercontent.com/u/15050523/Arma3-2dOpticTemplateP3D.zip

tl;dr: How do modelOptic .p3d's work?

Hi!

So for the better part of today I've been trying to work out how I can create a custom reticle in Arma3. I am unable to open default A3 p3d's in objectbuilder; so I can't see how they work. However, I assumed the modelOptic (which the scope's config points to) is a simple plane that's place infront of the game's camera.

So I created a plane, assigned my reticle .paa to it, exported that from objectbuilder, pointed my config modelOptic to that exported .p3d. This "works", however, what I cannot figure out is how this is meant to be scaled / how to get the right ratio. I made a test texture, 2048^2, with circles to show border and ratio. In-game, these circles show up quite squashed, and at an unintuitive scale. I assume after trial and error I can scale the UV's to be roughly correct, but this is really tedious and pointless if the ratio is off. How is this meant to be done? Are there legit templates I can use? I noticed some mods have "dagger" in their scope p3d's, which google leads me to believe is the modder QuickDagger who made reticle mods for a2. Did he make a template..? Surely it isn't being done by hand; you want 1 pixel in the texture to = 1 pixel in-game. I must be missing something, right? Does the 2d plane's scale matter? What is the "correct" value?

The other problem is, how in obj.builder do I set the UV border behavior? If I don't want the texture to 'repeat' or wrap around the uv border (since 2d reticle has to work at many resolutions), how do I set it to clamp? Am I even on the right track with this? No idea why something so simple has to be so obscure and poorly documented, but that's been roughly my entire experience with arma's tools so far.

I don't suppose I can simply point weaponcfg to a texture rather than a p3d? (I doubt it)

Edited by Bek
Posting solution into OP
  • Like 1

Share this post


Link to post
Share on other sites

look at the arma 2 models, they can be downloaded from BI, the reticle is a 2d plane, but with a black plane in front of it, with a cutout therefore no borders.

Achieving true scale is quite easily done in a proper UV editor. No idea if Objectbuilder has an autofunction for that however, it's a pretty basic tool...

Share this post


Link to post
Share on other sites

Huh. Why wouldn't there be a a3 template or sample for that I wonder... though, I guess if I'm still trying to apply basic logic at this point I'm setting myself up for disappointment.

Anyway, I just had a modicum of success after looking through various a1/a2 optic planes on obj.builder; the current winner is: A2SM_Data_APL\Weapons\CA\Weapons_ACR\LRTV\LRTV_optics.p3d

ALTHOUGH it seems slightly incorrect in ratio. I'm thinking I'll export this, if possible, to modo and check out its uv's, and maybe see if I can make sense of what scale the uv's should be. Actually I suppose if I'm planning on 2048^2 I'd want to set that texel density up in modo for that plane's size, but I've no idea if/how that translates to the plane's position infront of the camera...

Edited by Bek

Share this post


Link to post
Share on other sites

Alright, I got it.

TO MAKE THINGS EASIER FOR ANYONE LOOKING TO MAKE A CUSTOM 2D OPTIC / RETICLE / RETICULE / SCOPE for arma 3 (dem google keywords) I have packaged a template 2d optic, w/ p3d file that actually works (I know right?) and a simple .psd guide. So you don't have to download a2 bs, sort through said bs, find out what works, fix problems with that bs, do more bs, bs bs bs, test bs, etc.

Mega: https://mega.co.nz/#!lMVgxRLD!podwp88KitRNwWjFujzb_uZSRGOOA6IPpaO37vdAvbc

Dropbox: https://dl.dropboxusercontent.com/u/15050523/Arma3-2dOpticTemplateP3D.zip

So you want to use the above to make a reticle for A3:

Open the p3d in ObjectBuilder. Select all faces (ctrl+a). Press E to open the surface properties. Change whatever filepath is in the texture field and replace with the path to your 2d reticle .PAA. Save that p3d.

In your optic/weapon config, point the modelOptic property to the p3d file you've saved out. Also, my uv's are correctly flipped/oriented so you don't need to flip your scope horizontally or any nonsense like that; I noticed some mods (bp) have to do that. Which is just silly. Anyway I hope someone finds this useful; it only took me 2 days to do something that should've been done in 20 minutes max.

Share this post


Link to post
Share on other sites

I also made one that's set up to utilise the game's standard scope view texture (a3\weapons_f\acc\data\scope_view4_ca.paa):

https://www.dropbox.com/s/kw1l1053lls98mj/A3_2D_Optic.zip?dl=0

One just needs to put the .p3d in their project folder, change the path of a3_2d_optic\example_reticle.tga inside the model to their own reticle pattern, and it should mostly be done.

Having the reticle texture on a separate plane to the scope view texture allows you to scale the reticle more easily without disturbing the dimensions of other parts of your scope view. Just select the "scalable"/"reticle" selection in the model and drag while holding [Ctrl+Shift+RMB] or use the discrete "Scale Points" tool. It also allows you to make the most of the image resolution you use for the reticle texture.

Share this post


Link to post
Share on other sites

Interesting. Can anyone shed any light on how the opticZoom value works, and how it is affected by 1) the scope plane p3d's size/proportion/scale and 2) scope fov?

Understanding that seems fundamental to being able to say, figure out how many pixels in your texture = 1 mil in order to correctly (and easily) set up mil dot optics. I saved this text from some post I found somewhere (I can't find the link at the moment, it may have been in reference to a2)

It's actually pretty easy. The opticsZoom values are in radians, and refer to the horizontal field of view measured from the center of the screen.

If you have an optic with a 9 degree FOV, it should have opticsZoomMin = "9*pi/360" if you want it to fill a 4:3 screen horizontally.

That's the only important part. Relative magnification depends on whatever you define as unity. I used ~0.3 radians.

ArmA by default uses 0.25 radians for rifle optics and 0.33 radians for tank optics.

Angular magnification, of course, is just FOV at unity divided by the FOV of the optic.

If you want your optics model to actually match the FOV, you need a custom model. The BIS models aren't quite accurate enough.

Mine are a 5.12x3.84 unit rectangle, of which the middle 1.00x0.75 units are visible on a 4:3 screen.

More of the model is visible in widescreen resolutions. This is the exact size ratio used by the game--the actual size of the model doesn't matter.

Then, just define a certain number of pixels in each milliradian (if you've got a 1024x1024 texture and a 128 mil FOV, you've got 8 pixels per mil)

and make the textures to that scale.

I actually worked everything the other way around, i.e. I defined a certain texture to be 14 px/mil and worked out the opticsZoom values based on that.

That made it a lot easier to make calibrated optics.

What I'm not understanding (apart from core concept of radians) is how you'd calibrate mils correctly, as this apparently ties into the plane p3d's size and scope FOV. Can anyone clarify?

Share this post


Link to post
Share on other sites
What I'm not understanding (apart from core concept of radians) is how you'd calibrate mils correctly, as this apparently ties into the plane p3d's size and scope FOV. Can anyone clarify?

opticszoom is basically the vertical FOV - calling it "zoom" is a bit of a misnomer. Because FOV and zoom are tied together and you are working within the confines of a monitor screen, most people focus on getting the magnification right rather than the field of view through the lens (i.e. the diameter of the circular viewing aperture).

The game's default 1x FOV is something like 0.375 radians so to make a scope with 4x magnification you do opticszoom = 0.375/4 = 0.09375.

In a scope where the edges of the aperture touches the top and bottom of the screen exactly, the total FOV through the scope would therefore be 93.75 mils (1 mil = 1/1000 radians). So a distance in your reticle that was 1 mil would be equivalent to 1/93.75 of the diameter of your aperture. However, it's much harder to figure out when you don't have a texture that gauges the exact vertical FOV of the monitor, so I prefer to use ingame measurements to work out the mil-scale and do a bit of trial and error.

I use a 1m square object ingame placed exactly 1000m from my unit (e.g [Empty\Structures Virtual Reality\VR Game Block (Cube 1m)] - put it down on the map in the editor and call it "cube"), to calibrate the mil-dot spacings on the reticle.

I set the calibration object 1000m away using the debug console in the pause menu, and entering the code:

cube setpos [(getpos player select 0)+0, (getpos player select 1)-1000.5,(getpos player select 2)+1.5]

This moves the cube object's centre exactly 1000.5m due south of where the player is stood. The extra 0.5 tacked on to the 1000m distance is because it's a cube and has a 1m thickness/depth, so the front face will be 0.5m closer to the player than the centre. If you use a flat 1m plane just set it to 1000. the last +1.5 value is just to lift the cube off the ground a little to make it more parallel with your line of sight when standing or crouched. The Almyra salt-flats on the East coast of Altis, or the VR Training map is probably the best place to do this since it provides a wide, open, flat area.

If you then line up the corner of the cube with the centre of your reticle/crosshair and take a screenshot (using VanZant's SteadyShot mod to turn off weapon sway helps a lot), it'll show you the relative size of your reticle to 1 ingame mil. With the screenshot you can then measure the size of the cube on the screen to find how many pixels 1 mil ingame represents, and measure how many pixels the 1 mil spacing on your reticle represents on the screen. Calculating the ratio of these pixel measurements will indicate how much you have to scale your reticle by in order to make 1 mil on your reticle = 1 mil ingame.

Share this post


Link to post
Share on other sites

Thanks for the detailed reply.

Doing in-game iteration was my first thought as that's what I did for calibrating stadiametric rangefinders on optics, but it gets old quickly, which is why I was hoping some maths would help.

However I'm still confused by the results I'm getting. As far as I can the the modelOptic p3d has no affect, yet I'm seeing different results between optics. One q, where did that 0.375 come from? Just some arma default? I see it is the OpticsZoomMin value for the red dot on some optic configs (not default arma stuff though). Player fov doesn't affect these things.. it couldn't right?

Some examples, if I jump in the editor and screenshot that 1m cube in first person (and measure its width in ps) then compare that to RCO zoomed in, I get a difference of ~5.8x. RCO is meant to be 4x, right? Any idea what its config opticZoom value is?

There's one optic in the mod I'm looking at (breaking point) that has an opticZoom value of 0.11, which seems like a crazy high value but it only behaves like a ~4x zoom. Another optic has 0.0589, a lower value, but it zooms in more. I just don't get it, it's totally throwing me off.

Share this post


Link to post
Share on other sites
One q, where did that 0.375 come from? Just some arma default? I see it is the OpticsZoomMin value for the red dot on some optic configs (not default arma stuff though).

0.375 comes from the narrow FOV config values on BIS' 1x collimator optics and ironsights.

Generally the collimators/ironsights have narrow FOV set by opticsZoomMin = 0.375, default FOV set by opticsZoomInit = 0.75 and wide FOV set by opticsZoomMax = 1.1, but all of those are fundamentally supposed to represent 1x naked eye magnification. Wide FOV is there because your eyes can rotate and expand your FOV without turning your head (which is what you'd have to do ingame) and narrow FOV is there to maximise the image resolution on screen, to something closer to what the human eye is capable of seeing when looking at distant objects. The narrow FOV value seems to be the most sensible one of the three to use as the basis of calculating scope magnifications because then you have a magnification factor that is relative to the maximum naked eye resolution.

The game's default FOV when unsighted is also 0.75, same as the opticsZoomInit for 1x weapon sights (this is from the fovTOP value in the .Arma3profile). The amount of +/- "zoom" in first person when not looking though the optics appear to be relatively the same as those you get when zooming in/out with the collimator sights.

But I have tried to empirically measure what the 1x magnification for first person view is myself by making my own optics and adjusting the opticsZoom values until objects match the same per-pixel heigh as when not looking through the optics on the narrow FOV. I determined a value of 0.3712 to get exact pixel sizes on my scope, but 0.375 seems close enough that it would appear to be the intended 1x value.

Slight differences in the Z-axis position of the 'camera' memory points on the character model and view memory points on my optics model when attached to the weapon might account for the slight difference in apparent magnification (i.e one view may be a few cm closer to the objective than the other) and why I had to use 0.3712 instead of 0.375 to match them exactly.

Player fov doesn't affect these things.. it couldn't right?

IIRC, screwing around with the fovTop and fovLeft in your .Arma3profile can have an effect on the relative FOV (magnification) of various scopes compared to the unsighted 1x values.

Some examples, if I jump in the editor and screenshot that 1m cube in first person (and measure its width in ps) then compare that to RCO zoomed in, I get a difference of ~5.8x. RCO is meant to be 4x, right? Any idea what its config opticZoom value is?

BIS are currently tweaking some of the FOVs on their scopes in the devBranch in order to make them all consistent in terms of magnification, so it may be worth looking there to see what's changed. 3D scopes can be a bit iffy though since sometimes using the correct magnification makes the scope fill up too much or too little of the screen and look a bit weird, so you sometimes need to tweak the FOV to compensate.

But are you comparing the RCO magnification to the default FOV, or narrow FOV in first person? If it's 5.8x magnification compared to default FOV it'll be 2.9x magnification compared to narrow FOV. I've read other people measured it as 6.8x compared to default FOV before (perhaps 5.8 was a typo?) - so that would be ~3.4x compared to narrow FOV. 3.4x would be fairly consistent with a scope like the ELCAN M145

There's one optic in the mod I'm looking at (breaking point) that has an opticZoom value of 0.11, which seems like a crazy high value but it only behaves like a ~4x zoom. Another optic has 0.0589, a lower value, but it zooms in more. I just don't get it, it's totally throwing me off.

opticsZoom works the opposite of how you might expect from the size of the numbers: a smaller value gives the appearance of greater magnification. This is because the smaller value corresponds to a narrower FOV angle, but the narrower FOV is stretched to fill the same screen area - therefore single objects end up taking up more screen space than they did with a wider FOV angle (i.e they're now magnified).

That's why when calculating your magnification values you divide the 1x zoom FOV/opticsZoom by the magnification factor you want, rather than multiplying it.

Share this post


Link to post
Share on other sites

In the latest dev builds, the baseline value BI use for 1x magnification (minFov/opticZoomMin) has changed from 0.375 to 0.25 (this is the zoomed in viewed you get by holding down RMB as a soldier with weapon lowered).

Current reference BI values for vehicles/naked eye sights:

minFov / opticsZoomMin = 0.25; (==1x zoom)

initFov / opticsZoomInit = 0.75; (==0.33333333x zoom)

maxFov / opticsZoomMax = 1.25; (==0.2x zoom)

Edit: also forget about radians, they have nothing to do with Arma configs (angular FOV is NOT directly inversely proportional to zoom). Having said that I'm not sure how to correctly set up a sight texture, I'll spend a bit of time on it...

Edited by ceeeb

Share this post


Link to post
Share on other sites

I think the baseline value in Arma 2 was 0.25, so I guess we're back to the old standard.

Well, I guess it's time to reconfigure and rescale some of my scope addons... :D

Share this post


Link to post
Share on other sites

0.25 eh. I'll keep that in mind.

I made a small change to the p3d optic; I discovered the proportions were relevant so I scaled the inner square up somewhat so that the inner top/bottom borders of the scope touch the top/bottom of my 16:9 1920x1080 screen (for some of my textures anyway). Not sure if it's affected by res but whatever. The reason for this change was to get more screenspace for the inner optic.

Another thing relevant to optics: I had a friend suggest that, since the +/- functions swap out textures, I could use this on certain optics to cycle through different reticles, like so:

Rl1Yxdc.jpg

tEJkA3d.jpg

What I'm wondering though is if there's a way to do this via the Nightvision key (n) as being able to toggle "illumination" on/off would be better than switching using +/-. I mean, if the list of optics has no limit I could probably list the same two textures 20 times or so in order to have a toggle-like behavior, but that seems silly.

So would anyone have an idea of how to do so using the visionMode[] = {"Normal", "NVG"}; line? Could you create for a custom visionMode that's just a different reticle?

Edited by Bek

Share this post


Link to post
Share on other sites

So I noticed that RHS: AFRF does this with their pso, which is awesome. I had a look at their files though and they don't seem to have anything special in their config, I can only see the one obvious scope plane .p3d, yet there is an illuminated version of the reticle in the same folder as the non-illuminated one. They've got nothing extra in their visionMode[] section so I guess I was wrong about that being a way to do it. I guess they have some sort of custom script to switch out what .paa's a p3d uses in the fly, and they somehow tied this to the n key?

I also found it interesting that they didn't end their modelOptic line with .p3d, and they also have fractions for their min/max zoom like so: "0.35/4"; if that works natively I guess it's just an easier way for their developers to look and see quickly what magnification a scope is and what base number they're using for 1x. Interesting stuff.

Share this post


Link to post
Share on other sites
Having the reticle texture on a separate plane to the scope view texture allows you to scale the reticle more easily without disturbing the dimensions of other parts of your scope view. Just select the "scalable"/"reticle" selection in the model and drag while holding [Ctrl+Shift+RMB] or use the discrete "Scale Points" tool. It also allows you to make the most of the image resolution you use for the reticle texture.

So I dove back into this recently and I've realised I still have a fundamental problem: How can one scale the reticle plane so that 1 pixel on the texture = 1 pixel (texel) in game? I've been 'fine tuning' my reticle plane so that it is correct but this is an insane way to do things. So is there some correct size the plane should be inside objectbuilder for this to happen? Otherwise 1px wide lines will be blurry depending on position/scale.

Share this post


Link to post
Share on other sites

Pixel to texel ratio will depend on the user's monitor/graphics resolution settings, so it's kind of pointless trying to get it exact when it'll only display like that for you anyway.

As long as it doesn't cover more than 95% of the screen's vertical length even a 1024px*1024px reticle texture won't be stretching to fit a standard 1080 HD monitor, which AFAIK is still the most common screen resolution. It'll only look a bit naff to people with >HD or UHD screens.

A problem you do get using high-res reticle textures though is that unless you have a lot of memory, the game likes to mipmap 4k textures and sometimes the 2k ones as well in order to show other textures in the scene at better resolution - which does usually result in a blurry reticle. Ticket about BIS' blurry, mipmapped reticles here : http://feedback.arma3.com/view.php?id=23655

As such, I only ever use a reticle plane with a 2048 or greater texture when the the reticle plane covers more than 50% of the scope aperture, or use polygon geometry with a black procedural texture #(argb,8,8,3)color(0,0,0,1.0,co) to actually model the parts of the reticle that I worry about suffering due to stretching to fit screen res. 1024 is more efficient if you're not filling the screen with your reticle.

For example:

4zcrIFP.png

Ingame, playing with 1440*900 resolution (native to my monitor) they both look pretty sharp both at 6x and 12x; without texel-stretching since the screen space covered by the texture is lower than the texel resolution, and mipmapping is very rare since at 1024*1024 the textures are comparatively small in filesize and don't hog much VRAM.

Once upon a time I did make the whole reticle using 2D polygon geometry. However, I found that the reticles, particularly at low magnifications (i.e. when the reticle is small); suffered from a lot of aliasing on the mil-dots (because they're curved) and the stadia lines weren't as visible.

Edited by da12thMonkey

Share this post


Link to post
Share on other sites

Good point; I feel that's an unfortunate way to do things though. Oh well.

at 1024*1024 the textures are comparatively small in filesize and don't hog much VRAM.

Thinking about this though, it's probably (I"m not a TA and I've no way to prove one way or the other) the case that using two separate textures (1x 2048^2 for the scope border and 1x 1024^2 for the reticle) is worse for performance than simply using one 2048^2 texture that contains both, because that latter involves an extra texture call (and isn't the difference in filesize moot after .paa compression?) Though it's a fairly moot point itself since you'd be reusing that scope border over many optics, so it wouldn't really make a difference. There might be an overdraw concern with having two planes overlap as well but I'm very unsure about that; if it even exists it's still probably not much of a concern. But I thought I'd mention it anyway.

Share this post


Link to post
Share on other sites

After even more mucking around I find that your method with the reticle on a separate plane is quite handy because you can also (at least for optics with lower differences between highest and lowest magnification) scale the reticle plane up/down to calibrate the mils, though that's a bit more fiddly.

However; sometimes I get white lines around my reticle when doing this. I'm not sure why it happens (possibly due to CMAA or some AA setting). I was also hoping that I could apply an RVMAT to a reticle plane rather than JUST a texture in order to force linear texture filtering (so reticles wouldn't blur due to the texture not being 1:1 on screen), but it didn't seem to work.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×