OFPEC Forum

Addons & Mods Depot => OFP - Addons & Mods General => Topic started by: Rubble_Maker on 20 Aug 2003, 11:40:08

Title: Texture2Material
Post by: Rubble_Maker on 20 Aug 2003, 11:40:08
Hi

I was playing with the TextureToMaterial class in OFP, but I couldn't see any effect (even if I set the specular and emissive values to some extreme it didn't change the visual appearance at all). Does this only work with weapons? I was trying it on regular vehicle textures.
Title: Re:Texture2Material
Post by: Rubble_Maker on 23 Aug 2003, 17:54:50
Ok, just so its clear what I'm talking about: This is the original texture2material conversion in BIS's config bin. Its in the materials.hpp file. Now does anybody know how to use this stuff for other textures? Into which class do I have to write the CfgTextureToMaterial class (I tried vehicle class)?


// Conversion of textures to materials is done when loading model.
// It is therefore not neccessary (and it is not possible) to define materials
// for textures that are assigned to shape runtime (like dammaged windows).
// Original materials will be used for such faces.

class CfgTextureToMaterial
{
   class CarGlass
   {
      textures[]=
      {
         "data\jeep4x4_glass.paa",
         "data\jeep_kab_sklo1.paa",
         "data\jeep_kab_sklo2.paa",

         "data\jepp4x4_glass.paa",
         "data\jepp_kab_sklo1.paa",
         "data\jepp_kab_sklo2.paa",

         "data\scud_sklo.paa",
         "data\scud_sklo2.paa",
         "data\scud_sklo3.paa",
         "data\scud_sklo4.paa",
      };
      material=#SpecularGlass;
   };
   class AirborneGlass
   {
      textures[]=
      {
         "data\jeep_kab_sklo1.paa",
         "data\uh60_kab_sklo2.paa",
         "data\uh30_cargo_pilotdoors.paa",
         "data\uh60_cargo_dvereokno.paa",
         "data\uh60_gunner_okna.paa",
         "data\ah-1_kabina_predokno.paa",
         "data\ah-1_kabina_zadokno.paa",
         "data\ah-1_kabina_topokno.paa"
      };
      material=#SpecularGlass;
   };
   class Metal
   {
      textures[]=
      {
         "data\mutt_frontg.pac",
         "data\mutt_kapotag.pac",
         "data\mutt_sklog.pac",
         "data\mutt_sideg.pac"
      };
      material=#Metal;
   };
   class AirBorneMetal
   {
      textures[]=
      {
         "data\ah-1_1_pokus.pac",
         "data\ah-1_2_pokus.pac",
         "data\ah-1_opak_pokus.pac",
         "data\ah-1_kabina_predo.paa",
         "data\ah-1_kabina_topokno.paa",
         "data\ah-1_kabina_zadokno.paa",
         "data\cobra_rotor_top.pac",
         "data\cobra_rotor_top.pac",
         "data\cobra2_kridlo_predni.pac",
         "data\cobra2_kanon_front_b.pac",
         "data\cobra2_kulas_front.paa",
         "data\cobra2_kanon_side.pac",
         "data\cobra2_vejfuk.paa",
         "data\cobra3_cumak.pac",
         "data\ah-1_bottom1.pac",
         "data\ah-1_bottom2.pac"
      };
      material=#Metal;
   };
   class RifleMetal
   {
      textures[]=
      {
         "data\m16_pmp_1s.pac",
         "data\m16_pmp_ph.pac",
         "data\m16_pmp_lod.paa",
         "data\m16_pmp_lod_gif.pac",
         "data\m4_1.pac",
         "data\m4_2.pac",
         "data\m4_miridla.pac",
         "data\xm177_1s.pac",
         "data\xm177_ph.pac",
         "data\xm177_details.pac"
      };
      material=#RifleMetal;
   };
};

class CfgMaterials
{
   // Water material is used for sea landscape parts
   class Water
   {
      ambient[] = {1,1,1,1};
      diffuse[] = {1,1,1,1};
      //diffuse[] = {0,0,0,0};
      //ambient[] = {0,0,0,0};
      //diffuse[] = {0,0,0,0};
      forcedDiffuse[] = {0,0,0,0};
      specular[] = {0.4,0.4,0.45,0};
      //specular[] = {1,1,1,0};
      specularPower = 6;
      emmisive[] = {0,0,0,0};
      //emmisive[] = {0,0.5,0.5,0};
   };
   // Terrain material is used for terrain solid ground
   class Terrain
   {
      ambient[] = {1,1,1,1};
      diffuse[] = {1,1,1,1};
      forcedDiffuse[] = {0,0,0,0};
      specular[] = {0.03,0.03,0.03,0};
      specularPower = 3;
      emmisive[] = {0,0,0,0};
      //emmisive[] = {0,0.5,0.5,0};
   };
   class SpecularGlass
   {
      ambient[] = {1,1,1,1};
      diffuse[] = {1,1,1,1};
      forcedDiffuse[] = {0,0,0,0};
      specular[] = {0.8,0.8,0.8,0};
      specularPower = 5;
      emmisive[] = {0,0,0,0};
   };
   class Metal
   {
      ambient[] = {1,1,1,1};
      diffuse[] = {1,1,1,1};
      forcedDiffuse[] = {0,0,0,0};
      specular[] = {0.2,0.2,0.2,0};
      //specular[] = {1,1,1,1};
      specularPower = 5;
      emmisive[] = {0,0,0,0};
   };
   class RifleMetal
   {
      ambient[] = {1,1,1,1};
      diffuse[] = {1,1,1,1};
      forcedDiffuse[] = {0,0,0,0};
      specular[] = {0.2,0.2,0.2,0};
      //specular[] = {1,1,1,1};
      specularPower = 5;
      emmisive[] = {0,0,0,0};
   };
};
Title: Re:Texture2Material
Post by: SelectThis on 23 Aug 2003, 18:12:34
I believe that it should be written as a seperate class (ie cfg level)

SelectThis