Jump to content
chronicsilence

Render to Texture PiP Aspect Ratio

Recommended Posts

I'm trying to take an in-game camera, and render it's output to the screen of a "Land_MobilePhone_smart_F". Using the code explained on the Procedural Textures page, that code looks something like this:

_screen = createVehicle ["Land_MobilePhone_smart_F", [0,0,9999], [], 0, "CAN_COLLIDE"];
_screen attachTo [player, [-0.08,1,-0], "head"];
_screen setDir 90;
_screen setObjectTexture [0, "#(argb,512,512,1)r2t(cam_r2t,1)"];

_cam = "camera" camCreate [0,0,0];
_cam cameraEffect ["Internal", "Back", "cam_r2t"];

This works, but the image that is displayed on the smart phone is horribly stretched, because the hidden texture on the smart phone is twice as high as it is wide. So I tried playing with the width and height properties in the setObjectTexture (in the format where the texture is  "#(argb,width,height,mipmaps)r2t(cam_r2t,aspect)"), by setting it to "#(argb,256,512,1)r2t(cam_r2t,1)", but that had no effect on the stretching, just the "quality" of the image in one direction or the other.

 

So I tried changing the "aspect ratio" value by setting it as "#(argb,512,512,1)r2t(cam_r2t,0.5)", no luck. So I tried the other way, ""#(argb,512,512,1)r2t(cam_r2t,2)", still no luck. And I've tried every combination I can think of with width/height/aspectRatio combinations, nothing seems to prevent the image from being extremely stretched. As far as I can tell, the "aspect ratio" value in r2t has no effect whatsoever.

 

Does anyone have any ideas how to get this camera to render properly, without have a 2:1 stretching effect?

 

Thanks!

Share this post


Link to post
Share on other sites

this is controlled, afaik, through the UV layout of the actual model. so if you have access to the model make sure to relax the UVs as much as possible so it's close to 100% proportional to the actual model face.

 

if the model is bad and you have no access to it, i'm afraid you're out of luck.

Share this post


Link to post
Share on other sites

I'm pretty good with scripting, but have yet to explore the modelling world. Could you explain what "UV"s are?

 

It's one of the items in the vanilla game, not sure if I would be able to modify it or not.

Share this post


Link to post
Share on other sites

Sorry to dig this up, but I figure readers may want to have a conclusion - and an answer to @chronicsilence's question.

If XYZ is the virtual 3-D coordinates of the geometrical shapes that comprise the model, UV's are the coordinates of the 3-D model laid out in a flat plane (sometimes called UVW's even though there's no 3rd dimension). 2-D textures and the coordinates are aligned to each other, which provides the pretty details that show color, reflection, shininess, and the illusion of touchable texture (like bumps). Think of it kind of like virtual origami. Changing the proportions of the laid out shapes affects how they stretch over the model. You need to be able to edit the UVs, in either Object Builder or a 3-D sculpting program like Max, Blender, Maya, etc, in order to change the shape proportions. Reshaping a rectangle is the most basic UV editing you could ask for; however, vanilla A3 assets cannot be edited. You probably figured it out after all this time, but it looks like you've hit an impenetrable wall.

Changing the aspect ratio setting was a great idea, but it seems to have no effect when I change it even in my models' texture settings in OB. The BIS config guides are a bit misleading, but this probably works in some other application of the engine, like ToH.

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

×