Tank Optics Help Needed Please.
-
Gatto
- Posts: 12
- Joined: 2021-04-27 18:56
Tank Optics Help Needed Please.
So, I've been working on my own personal BF2 mod for about 4 years now. I'm presently upgrading the vanilla vehicles with new skins and huds.
I've made new huds for aircraft based on their real life counterparts, and now I'm moving onto tank optics, but I've run into a problem.
For my tank optics I want to use black on transparent as opposed to the classic green on transparent of aircraft huds, but I'm not able to achieve it.
I took a look at PR vehicle optics and see that they are, correctly, black lines/letter/numbers on transparent.
How do I achieve that effect? Do I need a particular type of alpha mask?
I'm using paint.net as my graphics editor.
Thanks in advance, Gatto.
I've made new huds for aircraft based on their real life counterparts, and now I'm moving onto tank optics, but I've run into a problem.
For my tank optics I want to use black on transparent as opposed to the classic green on transparent of aircraft huds, but I'm not able to achieve it.
I took a look at PR vehicle optics and see that they are, correctly, black lines/letter/numbers on transparent.
How do I achieve that effect? Do I need a particular type of alpha mask?
I'm using paint.net as my graphics editor.
Thanks in advance, Gatto.
- Mats391
- PR:BF2 Lead Developer
- Posts: 7643
- Joined: 2010-08-06 18:06
Re: Tank Optics Help Needed Please.
Just design your texture using the colors you want and then do not specify any hudBuilder.setNodeColor. That way it will use the colors the way you painted them.

Mineral: TIL that Wire-guided missiles actually use wire
-
Gatto
- Posts: 12
- Joined: 2021-04-27 18:56
Re: Tank Optics Help Needed Please.
Thanks for your reply.
So you're saying I should use a transparent texture with black lines/symbols on it and not designate a colour in the hud.con, right?
Well, that's actually the first thing I tried as it seemed the most obvious, and it didn't work. I just got a totally transparent optic.
The black lines weren't visible. I think black is read as transparent in overlays. At least that's the way it works with the dirty glass overlay I use on my tank huds. The darker the area of the .dds, the more transparent it is in game.
Looking at the PR2 tank optics .dds's, they are different from the usual format. But I can't replicate them at the moment.
What was the process used by the PR team to create an optic that shows as black lines/symbols on a transparent background in game, and specifically, what type of alpha layer does it need?
So you're saying I should use a transparent texture with black lines/symbols on it and not designate a colour in the hud.con, right?
Well, that's actually the first thing I tried as it seemed the most obvious, and it didn't work. I just got a totally transparent optic.
The black lines weren't visible. I think black is read as transparent in overlays. At least that's the way it works with the dirty glass overlay I use on my tank huds. The darker the area of the .dds, the more transparent it is in game.
Looking at the PR2 tank optics .dds's, they are different from the usual format. But I can't replicate them at the moment.
What was the process used by the PR team to create an optic that shows as black lines/symbols on a transparent background in game, and specifically, what type of alpha layer does it need?
- Mats391
- PR:BF2 Lead Developer
- Posts: 7643
- Joined: 2010-08-06 18:06
Re: Tank Optics Help Needed Please.
Can you post your texture and the corresponding hud.con lines?

Mineral: TIL that Wire-guided missiles actually use wire
-
Gatto
- Posts: 12
- Joined: 2021-04-27 18:56
Re: Tank Optics Help Needed Please.
This is the .dds with black lines and alpha: https://drive.google.com/file/d/1WLcKrZ ... sp=sharing
... and this is white lines/transparent: https://drive.google.com/file/d/1i6kz1f ... sp=sharing
I've tried both with various configs.
Right now I'm using this for config a green hud/optic until I get the black/transparent one working:
As you can see, it's a simplified version of the actual T90 HUD drawn from reference found on the net. My mod is a mix of realism with a few arcade like elements, single player only.
I've tried without the NodeColor, and using 0 0 0 1, which shows as black in the hud editor, but comes out white in-game.
The HudGlass2 is a greyscale .dds image of dirty glass toned right down with no alpha, and worked as intended. Perhaps I should try the same with optic?
It must be something simple, but my poor old brain can't crack it right now.
I really appreciate you taking the time to help me by the way.
... and this is white lines/transparent: https://drive.google.com/file/d/1i6kz1f ... sp=sharing
I've tried both with various configs.
Right now I'm using this for config a green hud/optic until I get the black/transparent one working:
Code: Select all
hudBuilder.createSplitNode VehicleHuds T90Hud
hudBuilder.setNodeLogicShowVariable EQUAL GuiIndex 7
hudBuilder.addNodeBlendEffect 7 2
rem ------ Optic ------
hudBuilder.createPictureNode T90Hud T90Optic 250 278 300 150
hudBuilder.setPictureNodeTexture Ingame\Vehicles\Icons\Hud\Land\T90\T90_optic.dds
hudBuilder.setNodeColor 0 1 0 1
rem ------ Glass ------
hudBuilder.createPictureNode T90Hud T90scope 0 0 800 600
hudBuilder.setPictureNodeTexture Ingame\Vehicles\Icons\Hud\Land\T90\HudGlass2.dds
rem -------------------------------------- Hit Indication----------------------------------------------------
hudBuilder.createPictureNode T90Hud T90HitIndication 362 265 76 76
hudBuilder.setPictureNodeTexture Ingame/CrossHair/vsp_HitIndicator.tga
hudBuilder.setNodeColor 1 00 1
hudBuilder.setNodeAlphaVariable HitIndicatorIconAlpha
hudBuilder.setNodeShowVariable HitIndicatorIconShowI've tried without the NodeColor, and using 0 0 0 1, which shows as black in the hud editor, but comes out white in-game.
The HudGlass2 is a greyscale .dds image of dirty glass toned right down with no alpha, and worked as intended. Perhaps I should try the same with optic?
It must be something simple, but my poor old brain can't crack it right now.
I really appreciate you taking the time to help me by the way.
Last edited by Mats391 on 2021-06-30 11:08, edited 1 time in total.
- Suchar
- PR:BF2 Lead Developer
- Posts: 2208
- Joined: 2016-10-12 13:25
- Location: Poland
Re: Tank Optics Help Needed Please.
Do this
Code: Select all
hudBuilder.createSplitNode VehicleHuds T90Hud
hudBuilder.setNodeLogicShowVariable EQUAL GuiIndex 7
rem ------ Optic ------
hudBuilder.createPictureNode T90Hud T90Optic 250 278 300 150
hudBuilder.setPictureNodeTexture Ingame\Vehicles\Icons\Hud\Land\T90\T90_optic.dds
hudBuilder.setNodeColor 0 1 0 1
hudBuilder.addNodeBlendEffect 7 2
rem ------ Glass ------
hudBuilder.createPictureNode T90Hud T90scope 0 0 800 600
hudBuilder.setPictureNodeTexture Ingame\Vehicles\Icons\Hud\Land\T90\HudGlass2.dds-
Gatto
- Posts: 12
- Joined: 2021-04-27 18:56
Re: Tank Optics Help Needed Please.
Thanks for the suggestion.
Which texture should I use with that config, black/transparent, black/white, white/transparent?
Edit: Tried that config with 2 different textures, but got an opaque black hud!
Which texture should I use with that config, black/transparent, black/white, white/transparent?
Edit: Tried that config with 2 different textures, but got an opaque black hud!
Last edited by Gatto on 2021-07-01 19:33, edited 2 times in total.
- Mats391
- PR:BF2 Lead Developer
- Posts: 7643
- Joined: 2010-08-06 18:06
Re: Tank Optics Help Needed Please.
Try removing the blend effect completely

Mineral: TIL that Wire-guided missiles actually use wire
-
Gatto
- Posts: 12
- Joined: 2021-04-27 18:56
Re: Tank Optics Help Needed Please.
Okay, but I'm still not sure what my texture should look like: black lines on transparent, or white, white lines on transparent, etc.Mats391 wrote:Try removing the blend effect completely
I even tried the PR2 texture and .con parameters, and the optic didn't show up at all! I'm wondering if I should use a custom hud gui index, because at present I'm using the vanilla T90 index of 7. I don't understand how these numbers are chosen when creating a new hud, and how they affect the functionality of the hud. Any thoughts?
- Mats391
- PR:BF2 Lead Developer
- Posts: 7643
- Joined: 2010-08-06 18:06
Re: Tank Optics Help Needed Please.
Black lines on transparent, saved as dxt5 with no mipmaps.
The guiIndex depends on the WeaponHudComp of your vehicle. If your HUD is not showing at all, it might be the wrong one.
The guiIndex depends on the WeaponHudComp of your vehicle. If your HUD is not showing at all, it might be the wrong one.

Mineral: TIL that Wire-guided missiles actually use wire
-
Gatto
- Posts: 12
- Joined: 2021-04-27 18:56
Re: Tank Optics Help Needed Please.
Okay, I'll try black on transparent no alpha without the blend effect in the .con.
My hud/optic works perfectly as long as it is coloured, as in the original vanilla vehicle huds. But all attempts to get it to show as black have failed, including trying all of your suggestions.
When PR create new vehicle huds how do they go about assigning gui indexes. I've noticed for example that your T90 has indexes something like 3001, 3002, (can't remember the exact numbers), but why those numbers?
edit: This is the weapon hud comp from the T90:
ObjectTemplate.activeSafe GenericFireArm RUTNK_T90_Barrel
ObjectTemplate.modifiedByUser "armandoma"
rem ---BeginComp:WeaponHud ---
ObjectTemplate.createComponent WeaponHud
ObjectTemplate.weaponHud.hudName "120MM GUN"
ObjectTemplate.weaponHud.guiIndex 7
ObjectTemplate.weaponHud.hasFireRate 0
ObjectTemplate.weaponHud.hasRangeFinder 1
My hud/optic works perfectly as long as it is coloured, as in the original vanilla vehicle huds. But all attempts to get it to show as black have failed, including trying all of your suggestions.
When PR create new vehicle huds how do they go about assigning gui indexes. I've noticed for example that your T90 has indexes something like 3001, 3002, (can't remember the exact numbers), but why those numbers?
edit: This is the weapon hud comp from the T90:
ObjectTemplate.activeSafe GenericFireArm RUTNK_T90_Barrel
ObjectTemplate.modifiedByUser "armandoma"
rem ---BeginComp:WeaponHud ---
ObjectTemplate.createComponent WeaponHud
ObjectTemplate.weaponHud.hudName "120MM GUN"
ObjectTemplate.weaponHud.guiIndex 7
ObjectTemplate.weaponHud.hasFireRate 0
ObjectTemplate.weaponHud.hasRangeFinder 1

