This shows you the differences between two versions of the page.
arma:texturing:custom_texture [2009-09-16 17:15] snakeman created custom_texture initial page. |
arma:texturing:custom_texture [2015-08-22 01:44] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Custom Texture ====== | ||
- | **Custom texture** by Mateck | ||
- | |||
- | That custom texture is a very interesting thing, pretty nice and saves quite some megabytes. | ||
- | |||
- | Any details on how its done? | ||
- | |||
- | Yes it saves megabytes as we don't need to create .p3d models for every paint scheme in our addon. | ||
- | |||
- | The way to do this is very simple. | ||
- | |||
- | 1) select all faces that are using single texture\\ | ||
- | 2) create new selection | ||
- | |||
- | http://img507.imageshack.us/my.php?image=76597046um7.jpg | ||
- | |||
- | 3) in config.cpp under vehicle class put something like this | ||
- | |||
- | <code cpp> | ||
- | hiddenSelections[] = {"01_co","02_co","03_co","04_co"}; | ||
- | </code> | ||
- | |||
- | where *_co are selections used by our T-72 | ||
- | |||
- | 4) now those selections will be invisible in game, to avoid this we need to use setObjectTexture command under Init EventHandlers of our addon or later in game | ||
- | |||
- | For our T-72 we used following code | ||
- | <code cpp> | ||
- | class Extended_Init_EventHandlers | ||
- | { | ||
- | class CH_T72 { | ||
- | init = CH_Textures = [_this select 0, ""BIS""] execVM ""\ch_t72\scripts\textures.sqf"";"; | ||
- | }; | ||
- | }; | ||
- | </code> | ||
- | |||
- | and here is example code for textures.sqf | ||
- | <code cpp> | ||
- | _tex = _this select 0; | ||
- | |||
- | switch (_this select 1) do | ||
- | { | ||
- | |||
- | case "BIS" : | ||
- | { | ||
- | _tex setObjectTexture [1,"\ch_t72\data\t72_1_co.paa"]; | ||
- | _tex setObjectTexture [2,"\ch_t72\data\t72_2_co.paa"]; | ||
- | _tex setObjectTexture [3,"\ch_t72\data\t72_3_co.paa"]; | ||
- | _tex setObjectTexture [4,"\ch_t72\data\t72_4_co.paa"]; | ||
- | }; | ||
- | }; | ||
- | </code> | ||
- | |||
- | And that will be all. Fell free to use this code or change it whatever you like ;) | ||
- | |||
- | We still need to test this feature to ensure that there is no negative impact on performance and it works fine in multiplayer. | ||
- | |||
- | Need to say that this hole idea of custom textures is inspired by Dune Buggy addon by Sebastian Muller from OFP | ||
- | |||
- | **Suma** | ||
- | |||
- | That was really the original purpose, but with ArmA you can also change textures on "hiddenSelections" using "hiddenSelectionsTextures". | ||
- | |||
- | [[http://forums.bistudio.com/showpost.php?p=1188427&postcount=309|Source]] |