Jump to content
Sign in to follow this  
bohne

setObjectTexture respecting aspect ratio

Recommended Posts

Hello o/

 

Is there any way to use setObjectTexture respecting the textures aspect ratio, or scaling it, or another workaround to get a 1:1 texture to render correctly on a 2:1 eg. surface?

 

I am trying to iterate through every synced object and assign a texture. Now the synced objects might have surfaces in different aspect ratios. That results in my texture being stretched. I don't think having a multitude of textures for every different aspect ratio there is would be a good idea, would it?

{ 
  _x setObjectTexture [0, "gfx\foo.paa"];
} forEach (synchronizedObjects this);

I would very much appreciate your help!

Share this post


Link to post
Share on other sites

I was trying

{
  _tex = createSimpleObject ["a3\misc_f\Helpers\usertexture1m.p3d", [0,0,0]];
  _tex setObjectTexture [0, "gfx\foo.paa"];
  _tex attachTo [_x, [0,0,0]];
} forEach (synchronizedObjects this);

as a workaround. But it seems to be bad to spawn plenty objects and does not work for me (me being completely new to sqf).

Share this post


Link to post
Share on other sites

I'm not entirely sure of your question but it is possible to save textures in 2:1 ratios (i.e. 2048x1024 or 1024x512)

Share this post


Link to post
Share on other sites

MrCopyright, my texture is 1:1. Now if I render it to a sign, for example, it is being stretched because the sign "expects" a 2:1 texture.

 

Now I could save it as a 2:1 texture also, but if I want to render it to several objects all "expecting" different ratios, I obviously do not want to have a separate texture for every kind of object.

 

So I was asking if one can force setObjectTexture to render a 1:1 texture as such and not to scale it to the surface's ratio.

Share this post


Link to post
Share on other sites

MrCopyright, my texture is 1:1. Now if I render it to a sign, for example, it is being stretched because the sign "expects" a 2:1 texture.

 

Now I could save it as a 2:1 texture also, but if I want to render it to several objects all "expecting" different ratios, I obviously do not want to have a separate texture for every kind of object.

 

So I was asking if one can force setObjectTexture to render a 1:1 texture as such and not to scale it to the surface's ratio.

 

Hello,

 

This is not possible. From a modelling standpoint the UV Mapping is all different, causing different aspect ratios. Textures do not tile, they are simply projected onto the model as is.

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
Sign in to follow this  

×