Vehicle Damage: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
Line 37: Line 37:




[u]Step 3[/u] - Destruct RVMATs
'''Step 3 - Destruct RVMATs'''
- Once all textures have been checked / fixed you don't need to re-enter O2
:* 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
:* For each texture with a Materials definition you need to know 2 things
      (a) the filename and location of the NOHQ file
::#the filename and location of the NOHQ file
      (b) the dimensions of the texture (eg 1024x512 or 256x256 etc)
::#the dimensions of the texture (eg 1024x512 or 256x256 etc)
- Now create a [b][i]FILENAME[/i]_destruct.rvmat[/b] for each texture using a copy of below;
:*Now create a '''''FILENAME''''' '''_destruct.rvmat''' for each texture using a copy of below
[quote]
<code>
texturefilename_destruct.rvmat
ambient[]={1.0,1.0,1.0,1.0};
ambient[]={1.0,1.0,1.0,1.0};
diffuse[]={1.0,1.0,1.0,1.0};
diffuse[]={1.0,1.0,1.0,1.0};
Line 101: Line 102:
};
};


[/quote]
</code>
- These new files will have to be in the same directory location as you other [b] .rvmat[/b] files
:* These new files will have to be in the same directory location as you other ''' .rvmat''' files
- An example; If the main texture is [b]bottom.pac[/b] and the rvmat is [b]bottom.rvmat[/b], the new file should be [b]bottom_destruct.rvmat[/b]
:* 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;
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 FIRST section needs to point to your relevant _NOHQ texture
  - The SECOND and THIRD section should (not need) point to the [u]default BIS texture of the same size as you texture[/u]
:* The SECOND and THIRD section should (not need) point to the '''''default BIS texture of the same size as you texture'''''
      0- i.e. [b]1024_512[/b] or [b]2048_1024[/b]
::* i.e. '''1024_512''' or '''2048_1024'''
      0- Most dimensions are covered by BIS from 2048x2048 through 256x256
::* Most dimensions are covered by BIS from 2048x2048 through 256x256


Once finished you should have 5 files for each texture;
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
:* 1 main, 1 Normal Map (NOHQ), 1 Spectral Map (SMDI), 1 standard Material RVMAT and 1 Destroyed RVMAT


[img]http://members.iinet.net.au/~nrspence/ArmA/DamageTut/DT_2.jpg[/img]
http://members.iinet.net.au/~nrspence/ArmA/DamageTut/DT_2.jpg


[u]Step 4[/u] - CONFIG.CPP
'''Step 4 - CONFIG.CPP'''
- Not proven but likely in each [b]CfgSkeletons[/b] you will need to inherit a BIS class, in this example "Car"
:* Not proven but likely in each '''CfgSkeletons''' you will need to inherit a BIS class, in this example "Car"


[quote]
<code>
class CfgSkeletons  
CfgSkeletons partial
{  
class CfgSkeletons
   class car;  
{
   class car;
   class MyAddonSkeleton: car
   class MyAddonSkeleton: car
   {
   {
isDiscrete=1;
isDiscrete=1;
skeletonInherit = "";  
skeletonInherit = "";  
[/quote]
</code>


- Again not proven but likely in each [b]CfgModels[/b] you will need to inherit a BIS class, in this example "Car" again
:* Again not proven but likely in each [b]CfgModels[/b] you will need to inherit a BIS class, in this example "Car" again


[quote]
<code>
CfgModels partial
class CfgModels
class CfgModels
{
{
Line 151: Line 154:
skeletonName = "MyAddonSkeleton";
skeletonName = "MyAddonSkeleton";
sectionsInherit="car";
sectionsInherit="car";
[/quote]
</code>


- Under [b]CfgVehicles[/b] you then need to make a [b]class Damage[/b] definition.
:* Under '''CfgVehicles''' you then need to make a '''class Damage''' definition.
  Below is an example
::*Below is an example


[quote]
<code>
CfgVehicles partial
class CfgVehicles
class CfgVehicles
{
{
Line 181: Line 185:
............
............
............
............
[/quote]
</code>


- The definitions are done in groups of 3 definitions;
:* The definitions are done in groups of 3 definitions;
    0- First definition is NO damage
:** First definition is NO damage
    0- Second definition is HALF damage
:** Second definition is HALF damage
    0- Third definition is FULL damage
:** Third definition is FULL damage
- In the example above there is no HALF damage definition, it simply copies the NO damage definition.
:* 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.
:* 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.
'''With above complete for ever texture, this should now mean that you will see damage on your vehicle.'''


[b][u]EXCLUSION - GLASS - PENDING being written[/u][/b]
[b][u]EXCLUSION - GLASS - PENDING being written[/u][/b]
Line 211: Line 215:
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.
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.
If you find working variations PLEASE let us all know.
[[User:Gnat|Gnat]] 17:22, 19 June 2008 (CEST)

Revision as of 17:22, 19 June 2008

Adding Damage to your Vehicle Addon - Tutorial

Draft Revision 0 - June 18, 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)


ADDING DAMAGE TEXTURES

Step 1 - 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.

http://members.iinet.net.au/~nrspence/ArmA/DamageTut/DT_1.jpg

  1. CTRL-Click on a Texture in the texture list
  2. From the menu select FACES -> FACE PROPERTIES
  3. 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
  1. the filename and location of the NOHQ file
  2. the dimensions of the texture (eg 1024x512 or 256x256 etc)
  • Now create a FILENAME _destruct.rvmat for each texture using a copy of below

texturefilename_destruct.rvmat 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="[b][color=red]SIG_general\effects\bottom_nohq.pac[/color][/b]"; 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[b][color=red]256_256[/color][/b]_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[b][color=red]256_256[/color][/b]_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
  • i.e. 1024_512 or 2048_1024
  • 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

http://members.iinet.net.au/~nrspence/ArmA/DamageTut/DT_2.jpg

Step 4 - CONFIG.CPP

  • Not proven but likely in each CfgSkeletons you will need to inherit a BIS class, in this example "Car"

CfgSkeletons partial class CfgSkeletons {

  class car;
  class MyAddonSkeleton: car
  {

isDiscrete=1; skeletonInherit = "";

  • Again not proven but likely in each [b]CfgModels[/b] you will need to inherit a BIS class, in this example "Car" again

CfgModels partial 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

CfgVehicles partial 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;
    • First definition is NO damage
    • Second definition is HALF damage
    • 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.

[b][u]EXCLUSION - GLASS - PENDING being written[/u][/b] - Glass needs extra work, I will describe one way to get "broken glass" effect


[b][u]NEXT - Animation - PENDING being written[/u][/b] - 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;

[u][b]Example Finished Product[/b][/u]

[img]http://members.iinet.net.au/~nrspence/ArmA/DamageTut/DT_6.jpg[/img]


[u]Final Note:[/u] 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. Gnat 17:22, 19 June 2008 (CEST)