Jump to content
Sign in to follow this  
blackjack-VS-

swap textures

Recommended Posts

i have a vehicle that is east side. what i want is to have a west and civilian version of the same vehicle, but with diferent textures.

i'll try to explain better... my model is 90% texturized by 2 texture files. i called them 1.pac and 2.pac. they were made for the east version.

i would like to have is:

east version using 1.pac and 2.pac

west vesion using 3.pac and 4.pac

civilian version using 5.pac and 6.pac

1-3,5 and 2-4,6 have the exact same mapping displacement, so what i wana know if there's a way to do the swap textures INSIDE cfg file.

what i dont wana have is 3 diferent pbos.... that would kill my plan!!

i know the snow bradley's and jeep's/7t trucks uses this script way. any tutorial avaiable?

Thanks for the help u can give me here. i've been away for a couple months, so i'm kind of rusty here...

Share this post


Link to post
Share on other sites

click in oxygen uner view>texture library

or with ctrl+t (i think)

load a model of which u want to change the textures

double lmb click on the texture u want to change in the library

the parts useing the textures will be slected in the modeling windows

rmb click somwhere in one of these so u can work on the selected parts and they stay selected

press shift+e to brign up teh face properties window

below u see the texture path

click on the folder icon to browse to the new texture u want to apply

click ok

save the model as a seperate p3d in ur addons folder

u also need to add the model in the config

its not possible to define the texture in the cfg afaik

hope i coudl help u ;)

Share this post


Link to post
Share on other sites

Technically it is possible, but it would be FAR easier to do as Nephilim sugests.

The way to do it via the config alone is to use hidden selections. You can define multiple faces each with a different texture m apped and hide them in your config.

The downside to this is that your model will be overly complicated, there is a fixed limit to how many 'selections' you can have (255 I think) and you'll likely need more faces that that.

It's a pain, let's hope it's something that BIS will find an easy fix for in OFP2 (or whatever its name will be).

Share this post


Link to post
Share on other sites
Quote[/b] ]1-3,5 and 2-4,6 have the exact same mapping displacement, so what i wana know if there's a way to do the swap textures INSIDE cfg file.

If you don't want to use seperate p3d files for each side you can still use the setObjectTexture function. Simply do it this way: wink_o.gif

1. Step Open the model in O2, select the whole model and go into the faces properties, now select all faces of a kind (e.g. 1.pac) the way Nephilim described and press the button "create selection" (or similiar). Now define a new selection with the name tex1. Repeat those steps with the second texture and name it tex2.

2. Step Now in the CfgModels section in the config.cpp you define those selections as the first in row (e.g. it's "tex1","tex2", "other_selections"). This is important because in the setObjectTexture function you have to use the number (e.g. tex1= 1 becase it's the first in row)

3. Step In the CfgVehicles section you add classes for all sides always useing the same model definition (e.g. model="\myaddon\model.p3d";) BUT each one gets an own eventHandler in which you state:

this setobjecttexture [0,"\myaddon\1.pac"];this setobjecttexture [1,"\myaddon\2.pac"];

In the west side's config entry you would then state:

this setobjecttexture [0,"\myaddon\3.pac"];this setobjecttexture [1,"\myaddon\4.pac"];

..and so on! There might be a couple of small mistakes here.. i'm in the university and so I didn't had the chance to check all the stuff

biggrin_o.gif

Share this post


Link to post
Share on other sites
Quote[/b] ]what i dont wana have is 3 diferent pbos.... that would kill my plan!!

All of the above can be done but depending on the complexity of the model to start with I would most likely go with 3 different p3d's West, East and Civy in the 1 PBO file.

Share this post


Link to post
Share on other sites

setobjecttexture has a disadvantage....

the modelparts u cant see are usually also calculated..

also setobjecttexture blurry textures pretty much when u apply a diffrent texture then the original..

setobjecttexture supports texturws upto 512*512 as far as ive teseted it but blurs textures

so onyl small textures (upto 64*64) will work well without any advanced scripting..

@VipHeart

why do u want to use a eventhandler whne u can do this via hiddenselections?

hiddenslections[] = {"a","b"}

this entry in one of the cfgvehcles will make the parts a and be become invisibel onteh unit ingame

if hte cfgmodels is setop properly

note that the first selction (a) of the hidden selectiosn start with an 0

so hte setobjecttexture woudl look like

this setobjecttexture [0," \myaddonfolder\texa.paa"]

and 1 for the 2nd selection (b)

this setobjecttexture [1," \myaddonfolder\texb.paa"]

cheerio

Share this post


Link to post
Share on other sites

Hmm.. What size are the 1, 2, 3, 4,5 6 textures? If they just cover a small patch, you could copy and paste the polygons these are applied to, then hide the ones apart from the ones you need to show (So for civvy vehicle, hide the east and west layers). Using the hidden selections stuff.

But, if the textures are large (covering whole half a car over large polygons, for example, and if the model isn't to big. I say copy the model for each side, then change the texture using the double click texture libary idea. Then use a config for multiple vehicles. It'll make the PBO bigger, but a lot less complicated to make smile_o.gif

In short, if the model is small, make 3 versions of it and put it in one config, if it's complicated, and the textures are on small area, use hidden selections on that area

- Ben

Share this post


Link to post
Share on other sites

thanks for the replys everyone. meanwhile i remembered that joe lemonade's dunne buggy pack02 , uses many diferent versions of the buggy with the same p3d... so i went to my unpbo files and start studying how he made it.

basicly he did almost what u guys sayed.

in the p3d he has a selection called "textur01".

then in the cfg he has this

....

hiddenSelections[] =

{

"textur01",

....

};

now in the eventhandler he has a nice script like this:

class EventHandlers

{

init="[_this select 0,_this select 1] exec ""\Buggy2\FIA1.sqs""";

};

the fia1.sqs is very simple and swaps texture i guess... here it is the sqs code.

_buggy = _this select 0

?customPanelling: goto "exit"

_buggy setObjectTexture [0, "\Buggy2\Tex\FIA01.pac"]

#exit

exit

....................

so like u said, the 0 is the 1st selection of the hidden selections.

so basicly he's using a diferent sqs for each texture...

do u think i can make this way to or what?

edit: my textures are all 512x512 and they cover almost every exterior parts... so if i cant use the diferent (complete) textures of the 3 diferent versions, i'll have to go by the simple way... i'll make 3 small faces on the both sides + front, place the side logo there and hide/unhide those faces individually for each side in the cfg.

i just wanted to swap the 2 big textures , with the objective of having 3 distinct looking versions...not only the side logos.

there's a sample pic of 01.pac that i was working last month. u can get a general idea here. i rendered all important panels with max, created a mask on psd and start spraying dirt for each 1.

wip3.jpg

Share this post


Link to post
Share on other sites
Quote[/b] ]setobjecttexture has a disadvantage....

@nephilim: As DBR_ONIX said: the solution to the blurry textures porblem is to hide small faces with the texture somewhere inside the model. This way the engine has to cache the texture during the loading process. If you don't do so the engine will only load up to the 6th mip-map (i guess).. which results in the blurry texture.

Hidden selections is not the better solution because you would have to double or trible the face count (for each texture an new part of the model..). And as we all know the engine has more problems handeling large poly sizes then texture sizes biggrin_o.gif

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  

×