Jump to content
john_doe

Problems with RVMAT for glass windows

Recommended Posts

Hi guys!
 
I'm having a really hard time with RVMAT's..
I'm trying to give my glass windows a correct RVMAT like how they did in the ArmA 3 Samples (Test_House_01), but somehow things do not work in my favour..
 
So this is what i want to achieve:

  • A glass window with my own texture that is see through, has 2 textures (one for full health and one for health >0% && <50%) and breaks when health is below or eq to 0.

What i got so far:

  • My own texture for 100% health
  • See-through
  • Window break effect on health <= 0

What i still need:

  • Texture for health >0% && <50%
  • Grenades need to collide with glass and/or break them instantly

I'm using the Test_House_01 Sample from ArmA 3 Samples for a guide reference.
 
Here is my folder structure:
aWxP6Td.png
Nc63y3Q.png
 
The stages for the window texture are:

  • full health = window_dirty_glass
  • 50% health = window_broken_glass
  • 0 health = window_broken_glass (this one can probably go, because it's fine if my whole window dissappears after breaking (dont need glass pieces on the edges))

 

Here is my window_dirty_glass.rvmat (the other rvmat's are direct copies from this one)


#define _ARMA_

//Class structures_f_data : windows\window_set.rvmat{
ambient[] = {2.2,2.2,2.2,1};
diffuse[] = {1,1,1,1};
forcedDiffuse[] = {0,0,0,0};
emmisive[] = {0,0,0,1};
specular[] = {1,1,1,1};
specularPower = 800;
//renderFlags[] = {"NoZWrite"};
PixelShaderID = "Super";
VertexShaderID = "Super";
class Stage1
{
	//texture = "A3\Structures_F\Data\Windows\window_set_NOHQ.tga";
	texture = "#(argb,8,8,3)color(0.5,0.5,1,1,NOHQ)";
	uvSource = "tex";
	class uvTransform
	{
		aside[] = {1,0,0};
		up[] = {0,1,0};
		dir[] = {0,0,0};
		pos[] = {0,0,0};
	};
};
class Stage2
{
	texture = "#(argb,8,8,3)color(0.5,0.5,0.5,1,DT)";
	uvSource = "tex";
	class uvTransform
	{
		aside[] = {1,0,0};
		up[] = {0,1,0};
		dir[] = {0,0,0};
		pos[] = {0,0,0};
	};
};
class Stage3
{
	texture = "#(argb,8,8,3)color(0,0,0,0,MC)";
	uvSource = "tex";
	class uvTransform
	{
		aside[] = {1,0,0};
		up[] = {0,1,0};
		dir[] = {0,0,0};
		pos[] = {0,0,0};
	};
};
class Stage4
{
	texture = "#(argb,8,8,3)color(1,1,1,1,AS)";
	uvSource = "tex";
	class uvTransform
	{
		aside[] = {1,0,0};
		up[] = {0,1,0};
		dir[] = {0,0,0};
		pos[] = {0,0,0};
	};
};
class Stage5
{
	//texture = "A3\Structures_F\Data\Windows\window_set_SMDI.tga";
	//uvSource = "tex";
	uvSource = "none"
	// class uvTransform
	// {
		// aside[] = {1,0,0};
		// up[] = {0,1,0};
		// dir[] = {0,0,0};
		// pos[] = {0,0,0};
	// };
};
class Stage6
{
	texture = "#(ai,64,64,1)fresnel(1.4,0.3)";
	uvSource = "tex";
	class uvTransform
	{
		aside[] = {1,0,0};
		up[] = {0,1,0};
		dir[] = {0,0,0};
		pos[] = {0,0,0};
	};
};
class Stage7
{
	useWorldEnvMap = "true";
	texture = "A3\data_F\env_land_co.tga";
	uvSource = "tex";
	class uvTransform
	{
		aside[] = {1,0,0};
		up[] = {0,1,0};
		dir[] = {0,0,0};
		pos[] = {0,0,0};
	};
};
//};

And this is my config.cpp


/* This building only has one stage (undamaged) and has no doors or windows */
#include "basicdefines_A3.hpp"
#include "config_macros_glass.hpp"
#include "cfgPatches.hpp"

class CfgVehicles
{
	// Parent class declarations
	class House;
	class House_F: House
	{
		//class DestructionEffects;
	};
	class Ruins_F;

	// Class of the house in good state
	class JDOE_Test_Model: House_F
	{
		scope = 2; // 2 = public = shown in editor
		displayName = "JDOE Test Model"; // Name in editor
		model = jdoe_test\JDOE_Test_Model.p3d; // Path to model

		vehicleClass = Structures; // category in editor; "Structures" value is a class defined in CfgVehicleClasses
		mapSize = 20.27; // Scale of icon in editor
		cost = 40000; // Score penalty for destroying the house

		//selectionDamage = DamT_1; // Selection which will have textures and materials switched (according to "class Damage definitions") based on total damage of the house
		//replaceDamagedHitpoints[] = {Hitzone_1_hitpoint, Hitzone_2_hitpoint}; // Array of hitpoints (subclasses in "class Hitpoints") that can trigger switch to the damaged version when destroyed
		replaceDamaged = "JDOE_Test_Model"; // Classname of the damaged version

		// class DestructionEffects: DestructionEffects
		// {
		// 	class Ruin
		// 	{
		// 		simulation = ruin;
		// 		type = jdoe_test\JDOE_Test_Model.p3d; // Path to model of ruin used when total damage of the house reaches 1
		// 		position = "";
		// 		intensity = 1;
		// 		interval = 1;
		// 		lifeTime = 1;
		// 	};
		// };
		class HitPoints // Entities representing destructible subparts of the house
		{
			// Hitpoint of each window, defined using macros from config_macros_glass.hpp to avoid a giant wall of text due to having 14 particle effects each.
			// In practice they are defined in the same manner as the hitpoints above. These follow Glass_#_hitpoint naming trend.
			// First parameter being number id, second being a value for armor parameter and third being a value for radius parameter.
			NORMAL_GLASS_HITPOINT(1,0.01,0.175)
			NORMAL_GLASS_HITPOINT(2,0.01,0.175)
			NORMAL_GLASS_HITPOINT(3,0.01,0.175)
			NORMAL_GLASS_HITPOINT(4,0.01,0.175)
			NORMAL_GLASS_HITPOINT(5,0.01,0.175)
			NORMAL_GLASS_HITPOINT(6,0.01,0.175)
			NORMAL_GLASS_HITPOINT(7,0.01,0.175)
		};
		class Damage
		{
			// Texture pairs (below 0.5 health and 0.5+) for switching visuals (can also use generated)
			tex[] =
			{
				// Window textures
				//"A3\Structures_F\Data\Windows\window_set_CA.paa",
				//"A3\Structures_F\Data\Windows\destruct_half_window_set_CA.paa"
				"\jdoe_test\Data\window_dirty_glass_ca.paa",
				"\jdoe_test\Data\window_broken_glass_ca.paa",

				// Grey color
				"#(argb,8,8,3)color(0.501961,0.501961,0.501961,1.0,co)",
				"#(argb,8,8,3)color(0.294118,0.294118,0.294118,1.0,co)",

				// Brown color
				"#(argb,8,8,3)color(0.501961,0.25098,0,1.0,co)",
				"#(argb,8,8,3)color(0.392157,0.196078,0,1.0,co)",

				// Yellow color
				"#(argb,8,8,3)color(1,1,0.501961,1.0,co)",
				"#(argb,8,8,3)color(0.513725,0.513725,0.203922,1.0,co)",

				// Light grey color
				"#(argb,8,8,3)color(0.752941,0.752941,0.752941,1.0,co)",
				"#(argb,8,8,3)color(0.478431,0.478431,0.478431,1.0,co)",

				// Red color
				"#(argb,8,8,3)color(1,0,0,1.0,co)",
				"#(argb,8,8,3)color(0.701961,0,0,1.0,co)"
			};

			// Unlike textures, materials are not in pairs but in triplets (health: 0 - 0.49, 0.5 - 0.99, 1)
			mat[] =
			{
				 //"A3\Structures_F\Data\Windows\window_set.rvmat",
				 //"A3\Structures_F\Data\Windows\destruct_half_window_set.rvmat",
				 //"A3\Structures_F\Data\Windows\destruct_full_window_set.rvmat"
				"\jdoe_test\Data\window_dirty_glass.rvmat",
				"\jdoe_test\Data\window_broken_glass.rvmat",
				"\jdoe_test\Data\window_no_glass.rvmat"
			};
		};
		class AnimationSources
		{
			// Animation sources for windows
			class Glass_1_source
			{
				source = Hit; // "Hit" = value of this source is the health of an entity
				hitpoint = Glass_1_hitpoint; // Specifies health of what is the control value of this animation; "Glass_1_hitpoint" being the class defined in class Hitpoints
				raw = 1;
			};
			class Glass_2_source: Glass_1_source
			{
				hitpoint = Glass_2_hitpoint;
			};
			class Glass_3_source: Glass_1_source
			{
				hitpoint = Glass_3_hitpoint;
			};
			class Glass_4_source: Glass_1_source
			{
				hitpoint = Glass_4_hitpoint;
			};
			class Glass_5_source: Glass_1_source
			{
				hitpoint = Glass_5_hitpoint;
			};
			class Glass_6_source: Glass_1_source
			{
				hitpoint = Glass_6_hitpoint;
			};
			class Glass_7_source: Glass_1_source
			{
				hitpoint = Glass_7_hitpoint;
			};
		};
	};
};

The problem i'm having, with this setup, is that it cant find my rvmat files, when i spawn my building it spits out this error:


Cannot load material file \jdoe_test\data\window_dirty_glass.rvmat

same case for all the other rvmat's
 
When i try the ones they use in the Test_House_01 sample it works, but these have different textures and the health 50% texture doesnt show up..
These are the ones they use:

A3\Structures_F\Data\Windows\window_set.rvmat
A3\Structures_F\Data\Windows\destruct_half_window_set.rvmat
A3\Structures_F\Data\Windows\destruct_full_window_set.rvmat

 
 
Can anyone help me with this problem?
 
BTW, i'm a total noob when it comes to RVMAT's. I've tried some guides out there but haven't found one for buildings and glass windows..
 
 
~JohnDoe

Share this post


Link to post
Share on other sites

Hi. Try to remove leading backslash. "\jdoe_test\Data\window_broken_glass.rvmat", -> "jdoe_test\Data\window_broken_glass.rvmat"

Share this post


Link to post
Share on other sites

Okay so i did some testing..

 

I excluded the rvmat's from the binarizing so that they would get copied over directly. This didnt give me an in-game error, but gave me a specific error in my RPT about my rvmat's.

Appearently i forgot a semicolon somewhere (File: all my rvmat's, Line: 66)

 

After this i started my game and spawned my building, no errors :)

 

Now i removed the .rvmat file extension from the exclude list and binarized them..

Started my game and spawned my building, the errors are back :(

 

Now this makes me wonder, can you actually binarize rvmat's and use them? Is there a different way to reference them then

"jdoe_test\Data\window_broken_glass.rvmat"

Share this post


Link to post
Share on other sites

Add the ; to the end of line 66 then in ALL RVMATs (you said they're3 a direct copy from the one you posted, as such they'll most likely all have the error).

uvSource = "none";

Then everything should Binarize fine.

Share this post


Link to post
Share on other sites

Add the ; to the end of line 66 then in ALL RVMATs (you said they're3 a direct copy from the one you posted, as such they'll most likely all have the error).

Then everything should Binarize fine.

Yea i did that, but the errors come back once i binarize them..

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

×