Jump to content
AmericanFAC

PiP and how to script it.

Recommended Posts

So I have the basic understanding of how to make the PiP show up on screen with modules in the editor, but I cannot figure out how the vehicles are doing it.

To me it reads as if it their should be a variable that is the "Eye" for the pip camera, a variable for the direction of the camera, and then the thing it renders on.

So after debpoing the A3 files, specifically the Humvee vehicle I noticed this code that was called during the init class for the base humvee.

 		class RenderTargets {
		class Driver_display {
			renderTarget = "rendertarget0";

			class CameraView1 {
				pointPosition = "PIP0_pos";
				pointDirection = "PIP0_dir";
				renderVisionMode = 0;
				renderQuality = 2;
				fov = 0.7;
			};
		};
	};

So pip1_pos and pip1_dir are memory points in the model is is calling to. And here I have them placed

yL2Ehu.png

But my issue is the render target, I assumed it wanted me to make a selection for the screen in the 0.000 and pilot lods called rendertarget0. Didn't work. Afterwards I did some digging around in the files and found

#(argb,512,512,1)r2t(rendertarget0,1.0)

as a material for the hunter.p3d.

So I tried making a rvmat with a stage that referred to that, then applying that material to the screen selection.

I'm guessing this is more of a scripting thing, than a modelling issue, and this is what the code I ahve so far looks like

 	class acc_ipip : ItemCore {
	scope = 2;
	displayName = "Ipip";
	picture = "\A3\weapons_F\Data\UI\gear_acco_aco_CA.paa";
	model = "*****\ipip.p3d";
	descriptionShort = "ICU";
	usePip = 1;


	class ItemInfo : InventoryflashlightItem_Base_F {
		mass = 2;
		RMBhint = "Thermal Imagery";
		modelOptics = "\A3\Weapons_F\empty";
		optics = 1;


		class RenderTargets {
			class Gunner_display {
				renderTarget = "rendertarget0";

				class CameraView1 {
					pointPosition = "PIP0_pos";
					pointDirection = "PIP0_dir";
					renderVisionMode = 0;
					renderQuality = 2;
					fov = 0.7;
				};
			};

		};
	};
};

But it doesn't work, however, what it does do is draw 4-5 shadows on the ground evenly spaced from me in the shape of the attachment

0dlmjL.jpg

If anyone else has any discoveries, it'll be greatly appreciated.

Share this post


Link to post
Share on other sites

you may need to ask yourself whether weapons can use PIP?

Weapons in ArmA have a history of not being as versatile as vehicles in terms of animations and other bells and whistles, this may be a similar thing. Try making PIP work on something more basic, like a square box, to see if it's an issue with your code, or simple another 'weapons cannot do that' engine limitation.

and additionally you're adding i as a proxy item, and again, historically proxy items have had issues with transfering things such as animated parts across to the host model, so if it does work on a weapon, it may then be a proxy limitation.

Edited by Messiah

Share this post


Link to post
Share on other sites

apply this #(argb,512,512,1)r2t(rendertarget0,1.0) as texture not material. but id be real suprised if rtt worked on weapons

Share this post


Link to post
Share on other sites

anyone got PiP to really working?

I done the steps, one a vehicle..

Model.cfg = find no reference in bis vehicles, so check

.p3d = Got an area with #(argb,512,512,1)r2t(rendertarget0,1.0) as texture, No rvmat? and mempoints for the camera.

Still no function :(

EDIT.

Not sure this is the trick, but everything worked like instantly when I used a "create box" and then deleted all other sides except one.

Also had to flip the face around to make the camera right, but now its working.. so anyway, don't use insert+F6 if you have problem. Use a "create box"..

Edited by granQ
  • Like 1

Share this post


Link to post
Share on other sites

Yeah dont use f6 because then No UV and it needs it to renderthe pIp on ;)

download the TOH helicopter example

it has everything there cpp/.cfg and model showing memory point and and how macro texture refference relate (Rendertarget_x in the macro is relevant)

  • Like 1

Share this post


Link to post
Share on other sites

In principle, yes, however if you read the entire thread we'd already discussed it briefly - ArmA/OFP has a history of weapons lacking certain features that work on vehicles and units (hiddenselections, animations, proxies, lights) Some were fixed/added as the series evolved (animations A1(?), lights (OA) proxies (A3)), some remain lacking (hiddenselections), and something about PiP makes me think it just isn't going to work on a weapon.

But, looking forward to being wrong :)

Share this post


Link to post
Share on other sites
In principle, yes, however if you read the entire thread we'd already discussed it briefly

Caught on second re-read, cheers.

Share this post


Link to post
Share on other sites

i'm trying to get this to work too. can someone upload the TOH sample model please? the wiki link doesn't work for me.

Edited by Bad Benson
  • Like 1

Share this post


Link to post
Share on other sites

is there a way of calling the camera view from a vehicle to use in a pip dialog?

Share this post


Link to post
Share on other sites

Im actually creating a cornershot for a weapons pack and the PIP in the config file only works in cfgvehicles. but the way I think it will work is naming the screen "rendertarget0" and then either add an init eventhandler to the weapon... if thats even possible, or go and add it to the "man" base class with a condition of hasweapon or something. then call it through a script with:

["rendertarget0",weapon selectionposition "camera"] call BIS_fnc_PIP;

now this is just a shot in the dark. ill let you know what happens when I continue testing. but it might help

  • Like 1

Share this post


Link to post
Share on other sites

Set a hiddenselection on the texture you want to turn to PiP. Create a camera and use setObjectTexture to "#(argb,256,256,1)r2t(rendertarget0,1.0)".

Example

_cam = "camera" camCreate [getpos player select 0, getpos player select 1, (getpos player select 2) + 10];
cam_offset = [-0.18,0.08,0.05];
cam_cam camSetFov 0.6;
_cam camSetTarget player; 
_cam camCommit 2;
"rendertarget0" setPiPEffect [3, 1, 0.8, 1, 0.1, [0.3, 0.3, 0.3, -0.1], [1.0, 0.0, 1.0, 1.0], [0, 0, 0, 0]];
_cam cameraEffect ["INTERNAL", "BACK","rendertarget0"];
_obj setObjectTexture [0,"#(argb,256,256,1)r2t(rendertarget0,1.0)"];

Hope this helps.

Edited by Apocalypex
added code tags
  • Like 1

Share this post


Link to post
Share on other sites

Great post guys. I got it working, but I'm having problems aligning it with my gunners view. Any suggestions?

  • Like 1

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

×