.mat files - can someone explain?

Forum rules
SCS as a company do not wish to have paid mods on this forum. While we understand that not all paid mods use the Intellectual Property of other companies/people, it is very hard to moderate what is and isn't acceptable when money is involved. There are also concerns that it could look unfavorable to potential work partners going forward if SCS allow mods that may potentially use unlicensed branding.
Posting in the Mods forum (ATS and ETS2) is restricted to sharing free-to-the-public mods and providing support for mods. For more details, please check chapters [4] and [5] of Forum Rules.
User avatar
DaStig
Posts: 4456
Joined: 26 Jan 2015 17:35
Location: Stigmania
Contact:

.mat files - can someone explain?

#1 Post by DaStig » 07 Nov 2015 11:19

I've been looking for this for quite a while, and also compared many mat-files, but I can't seem to figure it out.

Can someone explain how it works?

Code: Select all

material : "eut2.dif.spec.add.env" {
	texture[0] : "/vehicle/wheel/saf_bb/axle.tobj"
	texture_name[0] : "texture_base"
	texture[1] : "/material/environment/vehicle_reflection.tobj"
	texture_name[1] : "texture_reflection"
	diffuse : { 1 , 1 , 1 }
	specular : { 1 , 1 , 1 }
	shininess : 75
	add_ambient : 0
	env_factor : { 0.07 , 0.07 , 0.07 }

}
Is there a list of those "material" definitions?
How are things linked to that .tobj-file?
What does "diffuse", "specular", "shininess", "add_ambient" and "env_factor" ?

DaStig
Member of GTM Team | ETS2 Screenshots | ATS Screenshots | Flickr | Facebook
AMD Ryzen 7 2700 | MSI B450M Mortar | GTX 1070Ti 8GB | Corsair Vengeance 16GB RAM | 3x SSD Samsung 850 Pro 250GB | Dell UtraSharp 27" U2719D

Image

SimulatorSam
Posts: 6240
Joined: 05 Mar 2014 17:52

Re: .mat files - can someone explain?

#2 Post by SimulatorSam » 07 Nov 2015 11:48

  1. There are many many different materials, but most of them can be found here.
  2. Inside a .tobj file is a path to a .dds texture, which can be opened with a hex editor.

    Image
  3. As for the over definitions they change the way the object looks ;)

User avatar
DaStig
Posts: 4456
Joined: 26 Jan 2015 17:35
Location: Stigmania
Contact:

Re: .mat files - can someone explain?

#3 Post by DaStig » 07 Nov 2015 12:08

Thanx Sam, that explains a lot ...

DaStig
Member of GTM Team | ETS2 Screenshots | ATS Screenshots | Flickr | Facebook
AMD Ryzen 7 2700 | MSI B450M Mortar | GTX 1070Ti 8GB | Corsair Vengeance 16GB RAM | 3x SSD Samsung 850 Pro 250GB | Dell UtraSharp 27" U2719D

Image

User avatar
ohaha
Posts: 17052
Joined: 07 Dec 2012 06:31
Location: Watchin' y'all
Contact:

Re: .mat files - can someone explain?

#4 Post by ohaha » 07 Nov 2015 12:20

tobj - texture object, it defines what image to use (dds) and how to use it, in game. it might also tell the game to repeat the texture in U and V direction, or whether it's a normal map etc.

mat - material, tells the game what shader (effect) to use to render the object. it contains the type of shader (eut2. ....), a list of textures (if any are needed) and a list of parameters. guess you know that, already.

each shader uses a certain set of textures and accept a certain array of parameters. if you don't specify it, I think it uses a default value; if you add too many, it ignores them.

e.g specifying env_factor in a shader which doesn't have add.env is useless.

from my understanding:

diffuse - the amount of color (in RGB) the game will use from the base texture.

e.g. for a white base texture, if you put (1, 0, 0) the game will only use the Red channel of the image.

specular - some sort of "passive" reflection on the object.
increasing it will make the object look more... glossy; decreasing it - more matte

add_ambient (always 0, afaik, at least on stuff a mod maker uses) is the amount of ambient lighting reflected off your object, used on other objects (not sure, untested)

reflection (always 0, afaik) - whether the object is reflected or not, by other objects, like glass, or mirror like surfaces (not sure, untested)

env_factor - how reflective the object is. set it to 3 and you get almost perfect mirror.

shininess - some sort of gloss, but I'm not sure exactly how it influences the visuals
Retired, but still loving it.

User avatar
DaStig
Posts: 4456
Joined: 26 Jan 2015 17:35
Location: Stigmania
Contact:

Re: .mat files - can someone explain?

#5 Post by DaStig » 07 Nov 2015 12:26

Crisp and clear Ohaha, thanx ... Now I go experimenting ...

DaStig
Member of GTM Team | ETS2 Screenshots | ATS Screenshots | Flickr | Facebook
AMD Ryzen 7 2700 | MSI B450M Mortar | GTX 1070Ti 8GB | Corsair Vengeance 16GB RAM | 3x SSD Samsung 850 Pro 250GB | Dell UtraSharp 27" U2719D

Image

User avatar
MrCapital
Posts: 7750
Joined: 17 Feb 2015 13:36
Location: The Royal Republic of Victoria
Contact:

Re: .mat files - can someone explain?

#6 Post by MrCapital » 13 Nov 2015 08:09

Great thread. This should be sticky in the top.
Image
- retired modder - do not disturb -

User avatar
EvgenKo423
Posts: 582
Joined: 04 Nov 2015 07:36
Location: Russia
Contact:

Re: .mat files - can someone explain?

#7 Post by EvgenKo423 » 18 Nov 2015 16:43

Not much info to make it sticky, IMO.

I want to add, that all possible shader (material) types can be found in an effect folder of unpacked game data. The name of a shader is its filename without the ".rfx" extension.
Also if you don't specify all the needed parameters for a specific shader, it will drop an error in a log (telling you what you've missed) and an object using such material may go bananas in a game (depending on what you've missed).
If you specify incompatible parameter, it will drop an error in a log.
Also some shaders probably may have an optional parameters.

Vitas
Posts: 154
Joined: 03 Jul 2013 18:24

Re: .mat files - can someone explain?

#8 Post by Vitas » 07 Nov 2016 22:59

Hi, i noticed that new Schwarzmuller trailers in ets 2 have reflective parts on it, so I wanted to use them on my model - for reflective tapes on the back door and on the sides of trailer. But when I use "eut2.reflective.fx" material as it is used on Schwarzmuller (or even copy the object from Schwm trailers in blender to my model), the object will not appear in game. Model itself is OK, but the object, which use reflective .mat will not appears. Theres no any error message in console too. In Blender everything works good, but not in the gane. Am I doing something wrong? Maybe SCS plugin in Blender dont know such material yet, maybe?

Thanks

User avatar
abasstreppas
Posts: 8746
Joined: 06 Feb 2013 20:32
Location: On an island outside another island, outside another island...
Contact:

Re: .mat files - can someone explain?

#9 Post by abasstreppas » 08 Nov 2016 00:02

It works with Blender2SCS, so you must have done something wrong. If you have used import/append to add the parts to your model, you also have to move it to right parent (DEFAULTPART, or whatever the main parent in your mod is called). If you've done that already you've probably forgot to apply location and rotation to the object (under the object tab) ;)
Image

User avatar
Wolfi
Beta tester
Posts: 11799
Joined: 12 Jul 2013 12:14
Location: Hospital

Re: .mat files - can someone explain?

#10 Post by Wolfi » 08 Nov 2016 05:28

EvgenKo423 wrote:Also if you don't specify all the needed parameters for a specific shader, it will drop an error in a log (telling you what you've missed) and an object using such material may go bananas in a game (depending on what you've missed).
If you specify incompatible parameter, it will drop an error in a log.
That's where SCS BT is alot better than any other modelling program. You can choose the main shader from a list and then add only the parameters available for that shader. So you can't get too many and you can't get missing ones. (as all the necessary ones for each shader are added automatically)
Also BT allows you to see any effect of your work in real time, so you can easilly check what each parameter does ;)
Fighting for life. One day at a time.

Post Reply

Return to “Help requests”

Who is online

Users browsing this forum: No registered users and 3 guests