[aps]gnat 28 Posted June 18, 2008 <span style='font-size:11pt;line-height:100%'><span style='color:DarkRed'>Adding Damage to your addon</span></span> Draft Revision 0 - 18th June 2008 I won't pretended to be a definitive expert on this, but it seems no one else has compiled known bits all together. What I will address in this tut; - Adding damage textures over a model once fully damaged - Animating sections of the model upon damage - Basic windscreen damage What I won't address (until further knowledge); - Level 2 or intermediate damage textures - Window armour Scope - Most if not all ArmA vehicles - You can edit the P3D file (and have O2 installed) <u>DAMAGE TEXTURES Step 1</u> - Face selection - In all your Resolution and XXXX View LODs ensure the WHOLE vehicle is highlighted (ALT-A) in O2 and the whole vehicle is named "zbytek" - If at any time you add to the model, ensure you Redefine "zbytek" to be the whole model again. Step 2 - Material definitions - In every Resolution and XXXX View LOD ensure every texture you plan to make damaged has a MATERIAL definition - This also typically means each texture will also have a "_NOHQ.paa" and a "_SMDI.paa" version of the textures.    0- CTRL-Click on a Texture in the texture list    0- From the menu select FACES -> FACE PROPERTIES    0- Material definition appears in the lower right box - If the texture does not have this, you probably have no choice except to create a Material definition. Step 3 - Destruct RVMATs - Once all textures have been checked / fixed you don't need to re-enter O2 - For each texture with a Materials definition you need to know 2 things    (a) the filename and location of the NOHQ file    (b) the dimensions of the texture (eg 1024x512 or 256x256 etc) - Now create a FILENAME_destruct.rvmat for each texture using a copy of below; Quote[/b] ]ambient[]={1.0,1.0,1.0,1.0}; diffuse[]={1.0,1.0,1.0,1.0}; forcedDiffuse[]={0.0,0.0,0.0,0.0}; emmisive[]={0.0,0.0,0.0,1.0}; specular[]={1.0,1.0,1.0,0.0}; specularPower=40.0; PixelShaderID="NormalMapMacroASSpecularDIMap"; VertexShaderID="NormalMapAS"; class Stage1 { texture="<span style='color:red'>SIG_general\effects\bottom_nohq.pac</span>"; uvSource="tex"; class uvTransform { aside[]={1.0,0.0,0.0}; up[]={0.0,1.0,0.0}; dir[]={0.0,0.0,0.0}; pos[]={0.0,0.0,0.0}; }; }; class Stage2 { texture="ca\data\destruct\vehicle_destr<span style='color:red'>256_256</span>_mc.paa"; uvSource="tex"; class uvTransform { aside[]={1.0,0.0,0.0}; up[]={0.0,1.0,0.0}; dir[]={0.2,0.0,0.0}; pos[]={0.2,0.0,0.0}; }; }; class Stage3 { texture="#(argb,8,8,3)color(1,1,1,1)"; uvSource="tex"; class uvTransform { aside[]={1.0,0.0,0.0}; up[]={0.0,1.0,0.0}; dir[]={0.0,0.0,0.0}; pos[]={0.0,0.0,0.0}; }; }; class Stage4 { texture="ca\data\destruct\vehicle_destr<span style='color:red'>256_256</span>_smdi.paa"; uvSource="tex"; class uvTransform { aside[]={1.0,0.0,0.0}; up[]={0.0,1.0,0.0}; dir[]={0.0,0.0,0.0}; pos[]={0.0,0.0,0.0}; }; }; - These new files will have to be in the same directory location as you other .rvmat files - An example; If the main texture is bottom.pac and the rvmat is bottom.rvmat, the new file should be bottom_destruct.rvmat There are 3 Red Highlighted section in the above code you need to customize;  - The FIRST section needs to point to your relevant _NOHQ texture  - The SECOND and THIRD section should (not need) point to the default BIS texture of the same size as you texture    0- i.e. 1024_512 or 2048_1024    0- Most dimensions are covered by BIS from 2048x2048 through 256x256 Once finished you should have 5 files for each texture;  - 1 main, 1 Normal Map (NOHQ), 1 Spectral Map (SMDI), 1 standard Material RVMAT and 1 Destroyed RVMAT Step 4 - CONFIG.CPP - Not proven but likely in each CfgSkeletons you will need to inherit a BIS class, in this example "Car" Quote[/b] ]class CfgSkeletons {  class car;  class MyAddonSkeleton: car  { isDiscrete=1; skeletonInherit = ""; - Again not proven but likely in each CfgModels you will need to inherit a BIS class, in this example "Car" again Quote[/b] ]class CfgModels { class default{}; class Vehicle: Default { sectionsInherit=""; sections[] = {xxxx, xxxxx, xxxxxx, xxxxxx}; }; class Car: Vehicle { sectionsInherit="Vehicle"; sections[]= {xxxxxx, xxxxx, xxxxx, xxxxx, xxxxxx}; }; class MyAddonP3D: Car { skeletonName = "MyAddonSkeleton"; sectionsInherit="car"; - Under CfgVehicles you then need to make a class Damage definition.  Below is an example Quote[/b] ]class CfgVehicles { class Landrover; // extended class class MyAddon: Landrover { ............ ............ class Damage { tex[] = {}; mat[] = { "SIG_general\effects\bottom.rvmat", "SIG_general\effects\bottom.rvmat", "SIG_general\effects\bottom_destruct.rvmat", ............. ............ ............. "SIG_general\effects\LastDamageTexture.rvmat", "SIG_general\effects\LastDamageTexture.rvmat", "SIG_general\effects\LastDamageTexture_destruct.rvmat" }; }; ............ ............ - The definitions are done in groups of 3 definitions;   0- First definition is NO damage   0- Second definition is HALF damage   0- Third definition is FULL damage - In the example above there is no HALF damage definition, it simply copies the NO damage definition. - For half damage you could experiement with another "half" RVMAT file and reference it in the second line. ** - With above complete for ever texture, this should now mean that you will see damage on your vehicle. EXCLUSION - GLASS - PENDING being written - Glass needs extra work, I will describe one way to get "broken glass" effect NEXT - Animation - PENDING being written - Covers HIDING sections of the vehicle once damaged (i.e. unnessisary model detail) - Also covers animating things like LANDCONTACTs etc ..... if I didn't forget something; Example Finished Product Final Note: No doubt some of above is simply a "Parrot copy" and can in reality be changed and IT WILL STILL WORK, but without spending hours upon hours finding out what bits can be changed or altered slightly I have simple written down what works for me. If you find working variations PLEASE let us all know. Cheers Gnat  Share this post Link to post Share on other sites
raedor 8 Posted June 18, 2008 Yap, indeed. Any chance of putting it into or linking it in the biki? Share this post Link to post Share on other sites
[aps]gnat 28 Posted June 19, 2008 Any chance of putting it into or linking it in the biki? hmmmm ... well its in My first Biki page http://community.bistudio.com/wiki....utorial Share this post Link to post Share on other sites
cervantes 330 Posted June 19, 2008 thx for you very good tutorial i wait you general lee Share this post Link to post Share on other sites
namreg 0 Posted June 21, 2008 Can't be true... just when I was wondering how to get my bird burned (makes me really sad, btw) you came with your TUTORIAL THX is just not enough man.... keep it up...pleeeease Share this post Link to post Share on other sites
pathetic_berserker 4 Posted July 3, 2008 I didn't seem to need to have my damage texture defined in skeletons but I did have it in cfgmodels. Also thought I'd add this little sample. To give a glimpse at how individual parts will inherit damage textures ie. just the rotors on your chopper. BTW I had also used "trup" instead of "zbytek" (and please excuse my lazyily inconsistant layout) classHitHull  {armor=1;material=51;name="NEtrup";visual="trup";passThrough=1;} // disabled points from model class HitEngine {armor=0.3;material=51;name="motor";visual="motor";passThrough=1;} class HitAvionics {armor=0.2;material=51;name="elektronika";visual="elektronika";passThrough=0;} class HitMissiles {armor=0.5;material=51;name="munice";visual="munice";passThrough=1;} class HitVRotor { armor = 0.300000; material = 51; name = "mala vrtule"; visual = "mala vrtule"; passThrough = 1; }; class HitHRotor { armor = 0.300000; material = 51; name = "velka vrtule"; visual = "velka vrtule"; passThrough = 1; }; Share this post Link to post Share on other sites