Page 1 of 1
Tank Optics Help Needed Please.
Posted: 2021-06-29 19:19
by Gatto
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.
Re: Tank Optics Help Needed Please.
Posted: 2021-06-29 20:35
by Mats391
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.
Re: Tank Optics Help Needed Please.
Posted: 2021-06-29 22:13
by Gatto
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?
Re: Tank Optics Help Needed Please.
Posted: 2021-06-30 06:27
by Mats391
Can you post your texture and the corresponding hud.con lines?
Re: Tank Optics Help Needed Please.
Posted: 2021-06-30 10:36
by Gatto
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:
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 HitIndicatorIconShow
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.
Re: Tank Optics Help Needed Please.
Posted: 2021-06-30 11:12
by Suchar
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
Re: Tank Optics Help Needed Please.
Posted: 2021-07-01 19:05
by Gatto
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!
Re: Tank Optics Help Needed Please.
Posted: 2021-07-02 11:05
by Mats391
Try removing the blend effect completely
Re: Tank Optics Help Needed Please.
Posted: 2021-07-02 11:27
by Gatto
Mats391 wrote:Try removing the blend effect completely
Okay, but I'm still not sure what my texture should look like: black lines on transparent, or white, white lines on transparent, etc.
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?
Re: Tank Optics Help Needed Please.
Posted: 2021-07-02 15:06
by Mats391
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.
Re: Tank Optics Help Needed Please.
Posted: 2021-07-02 16:37
by Gatto
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