Retexturing with setObjectTexture: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\[ *(https?\:\/\/[^\[ ]+\.bohemia\.net[^\[]+) ([^ ]+) *\]" to "{{ExternalLink|link= $1|text= $2}}")
m (Text replacement - "[[Image:" to "[[File:")
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{TOC|side}}
{{TOC|side}}
If you want to retexture an asset with the [[setObjectTexture]] command it is necessary to work with the original texture. As an example we will be using the [[Arma_3:_CfgVehicles_EMPTY|Wall Sign]] ({{ic|Land_WallSign_01_F}}). Contrary to other signs, such as the advertisment signs ({{ic|SignAd_...}}), a texture with the usual dimensions (w<sup>2</sup> * h<sup>2</sup>, eg. 256x256, 512x512, ...) will display the image wrong. This is because the texture also contains the texture for the back and sides of the board, not only the "content". With the following steps you can correctly retexture such assets.
{{Feature|informative|Textures can also be generated by the engine; see [[Procedural Textures]].}}
If you want to retexture an asset with the [[setObjectTexture]] command it is necessary to work with the original texture. As an example we will be using the [[Arma_3:_CfgVehicles_EMPTY|Wall Sign]] ({{hl|Land_WallSign_01_F}}). Contrary to other signs, such as the advertisment signs ({{hl|SignAd_...}}), a texture with the usual dimensions (2<sup>x</sup> * 2<sup>y</sup>, eg. 256x256, 512x512, ...) will display the image wrong. This is because the texture also contains the texture for the back and sides of the board, not only the "content". With the following steps you can correctly retexture such assets.


[[Image:setObjectTexture comparison.png|thumb|right|The same texture is applied to a 1x1 User Texture (bottom left) and a Land_WallSign_01_F (top with default textures, bottom right with the custom texture). The custom texture is cut off when applied to the wall sign.]]
 
 
[[File:setObjectTexture comparison.png|thumb|right|The same texture is applied to a 1x1 User Texture (bottom left) and a Land_WallSign_01_F (top with default textures, bottom right with the custom texture). The custom texture is cut off when applied to the wall sign.]]


{{Feature|warning|Be sure that you are allowed to use the original texture to retexture assets! Respect the [[Intellectual Property]] of the author!}}
{{Feature|warning|Be sure that you are allowed to use the original texture to retexture assets! Respect the [[Intellectual Property]] of the author!}}


= Prerequisites =
 
== Prerequisites ==
 
For this tutorial you will need:
For this tutorial you will need:
* [[Arma 3 Tools]]
* [[:Category:Arma 3: Official Tools|Arma 3 Tools]]
* Access to the game files. You can:
* Access to the game files. You can:
** [[Arma3P|Unpack the entire game]]
** [[Arma3P|Unpack the entire game]]
** {{ExternalLink|link= https://forums.bohemia.net/forums/topic/226269-tools-utilities-compilation-list-for-arma3/|text= Have a tool to open/unpack pbos}}
** {{Link|link= https://forums.bohemia.net/forums/topic/226269-tools-utilities-compilation-list-for-arma3/|text= Have a tool to open/unpack pbos}}


= Steps =
== Finding the original texture ==
Your safest bet to find textures is to look in the config. If you want to use [[setObjectTexture]] there has to be an attribute called {{ic|hiddenSelectionTextures}} which contains at least one entry. In case of the wall sign it looks like this:
  hiddenselectionstextures[] = {"a3\Structures_F_Orange\Signs\Special\Data\WallSign_01_F_wood_CO.paa","a3\Structures_F_Orange\Signs\Special\Data\WallSign_01_F_wood_CO.paa"};
It is also possible to find this path using [[Eden]]. You can place down an object, open its attributes (right click >> Attributes... or double click), scroll down to "Object Specific - Object: Wall Sign" and the texture paths should be listed as Texture #0 to Texture#N.


If you have the game data unpacked you simply follow that path and find the paa file. If not it will be a bit more tricky. Most of the game's data is located in the Addons folder in your game directory. But with the release of [[:Category:Arma_3:_DLCs_%26_Expansions|DLCs]] the content is way more split up. In the case of our example it is part of the Laws Of War DLC but in the game files it is called "Orange". So if we go into "Arma 3\Orange\Addons" folder you can find the structures_f_orange.pbo. If we open it we can go further down into Signs\Special\Data and find WallSign_01_F_wood_CO.paa.
== Steps ==


== Opening the paa ==
=== Finding the original texture ===
The paa file can be opened with the [[TexView 2]] program that is part of [[Arma 3 Tools]]. Opening the paa will show us the problem that we were facing initially. The texture handles the entire sign, including the back of it. What you have to do is to only modify the white part of the board.


[[Image:WallSign 01 F wood CO.png|thumb|right|The WallSign_01_F_wood_CO.paa. You can see the sides of the sign on the top and bottom right, some decorative screws, the blue back of the board and the white front.]]
Your safest bet to find textures is to look in the config. If you want to use [[setObjectTexture]] there has to be an attribute called {{hl|hiddenSelectionTextures}} which contains at least one entry. In case of the wall sign it looks like this:
<syntaxhighlight lang="cpp">
hiddenselectionstextures[] = { "a3\Structures_F_Orange\Signs\Special\Data\WallSign_01_F_wood_CO.paa", "a3\Structures_F_Orange\Signs\Special\Data\WallSign_01_F_wood_CO.paa" };
</syntaxhighlight>
It is also possible to find this path using [[:Category:Eden Editor|Eden]]. You can place down an object, open its attributes (right click >> Attributes... or double click), scroll down to "Object Specific - Object: Wall Sign" and the texture paths should be listed as Texture #0 to Texture#N.
 
If you have the game data unpacked you simply follow that path and find the paa file. If not it will be a bit more tricky. Most of the game's data is located in the Addons folder in your game directory. But with the release of [[:Category:Arma 3: DLCs %26 Expansions|DLCs]] the content is way more split up. In the case of our example it is part of the Laws Of War DLC but in the game files it is called "Orange". So if we go into {{hl|Arma 3\Orange\Addons}} directory we can find the {{hl|structures_f_orange.pbo}}. If we open it we can go further down into {{hl|Signs\Special\Data}} and find {{hl|WallSign_01_F_wood_CO.paa}}.
 
=== Opening the paa ===
 
The paa file can be opened with the [[TexView 2]] program that is part of [[:Category:Arma 3: Official Tools|Arma 3 Tools]]. Opening the paa will show us the problem that we were facing initially. The texture handles the entire sign, including the back of it. What you have to do is to only modify the white part of the board.
 
[[File:WallSign 01 F wood CO.png|thumb|right|The WallSign_01_F_wood_CO.paa. You can see the sides of the sign on the top and bottom right, some decorative screws, the blue back of the board and the white front.]]
 
=== Editing the paa ===


== Editing the paa ==
You can't directly edit paa. Instead you have to [[TexView_2_Manual#Save_as...|convert paa to png using TexView 2]] first. Then you can edit the png file and convert pack to paa with TexView 2 again.
You can't directly edit paa. Instead you have to [[TexView_2_Manual#Save_as...|convert paa to png using TexView 2]] first. Then you can edit the png file and convert pack to paa with TexView 2 again.


== Applying the texture ==
=== Applying the texture ===
 
Your paa file has to be placed in the mission folder or your mod folder. To set the texture you can use [[setObjectTexture]] or its global variant [[setObjectTextureGlobal]].
Your paa file has to be placed in the mission folder or your mod folder. To set the texture you can use [[setObjectTexture]] or its global variant [[setObjectTextureGlobal]].


[[Category:Arma:_Tutorials]]
 
[[Category:Arma: Tutorials]]

Latest revision as of 23:09, 20 November 2023

Textures can also be generated by the engine; see Procedural Textures.

If you want to retexture an asset with the setObjectTexture command it is necessary to work with the original texture. As an example we will be using the Wall Sign (Land_WallSign_01_F). Contrary to other signs, such as the advertisment signs (SignAd_...), a texture with the usual dimensions (2x * 2y, eg. 256x256, 512x512, ...) will display the image wrong. This is because the texture also contains the texture for the back and sides of the board, not only the "content". With the following steps you can correctly retexture such assets.


The same texture is applied to a 1x1 User Texture (bottom left) and a Land_WallSign_01_F (top with default textures, bottom right with the custom texture). The custom texture is cut off when applied to the wall sign.
Be sure that you are allowed to use the original texture to retexture assets! Respect the Intellectual Property of the author!


Prerequisites

For this tutorial you will need:


Steps

Finding the original texture

Your safest bet to find textures is to look in the config. If you want to use setObjectTexture there has to be an attribute called hiddenSelectionTextures which contains at least one entry. In case of the wall sign it looks like this:

hiddenselectionstextures[] = { "a3\Structures_F_Orange\Signs\Special\Data\WallSign_01_F_wood_CO.paa", "a3\Structures_F_Orange\Signs\Special\Data\WallSign_01_F_wood_CO.paa" };

It is also possible to find this path using Eden. You can place down an object, open its attributes (right click >> Attributes... or double click), scroll down to "Object Specific - Object: Wall Sign" and the texture paths should be listed as Texture #0 to Texture#N.

If you have the game data unpacked you simply follow that path and find the paa file. If not it will be a bit more tricky. Most of the game's data is located in the Addons folder in your game directory. But with the release of DLCs the content is way more split up. In the case of our example it is part of the Laws Of War DLC but in the game files it is called "Orange". So if we go into Arma 3\Orange\Addons directory we can find the structures_f_orange.pbo. If we open it we can go further down into Signs\Special\Data and find WallSign_01_F_wood_CO.paa.

Opening the paa

The paa file can be opened with the TexView 2 program that is part of Arma 3 Tools. Opening the paa will show us the problem that we were facing initially. The texture handles the entire sign, including the back of it. What you have to do is to only modify the white part of the board.

The WallSign_01_F_wood_CO.paa. You can see the sides of the sign on the top and bottom right, some decorative screws, the blue back of the board and the white front.

Editing the paa

You can't directly edit paa. Instead you have to convert paa to png using TexView 2 first. Then you can edit the png file and convert pack to paa with TexView 2 again.

Applying the texture

Your paa file has to be placed in the mission folder or your mod folder. To set the texture you can use setObjectTexture or its global variant setObjectTextureGlobal.