Fileformat differences? (.tres .res .scn .material etc.)

Can someone explain me the advantages and disadvantages of the different file formats?

So far I’m only aware of:

.res is binary format

.tres is text format that can be easily read and edited

In addition to .res and .tres some (or all?) resources have their own fileformat:

Materials: .tres .material .res

Scenes: .tscn .scn .res

Should I use the corresponding fileformat for those and why/why not?
When saving a resource the default option is set to the text format.

1 Like

Scenes: tscn
Resources: tres
[Shader] materials: material

To some degree it doesn’t matter the extension, as i think there is some contextual text that says what it is. It’s more for us humans to discern.

E.g.

A resource file

[gd_resource ... ]
...

A scene file

[gd_scene ... ]
...

You can rename the file to another format but it doesn’t change its behavior. Scenes still act like scenes and resources act like resources.

(I couldn’t find a material example)

I see. I believe I somewhere read that .tres is better suited for version control, is that true?

Yeah, text based files are great for version control, as tools like git diff (and most code editors) can easily highlight the differences in a human understandable way.

Technically you can perform the same diff on binary files, but the highlighted differences would just look like a garbled line of characters with no meaning.

So the difference between .tscn and .snc is that .scn saves in binary and .tscn saves in readable text format. Version control is better in .tscn as it is written in readable text format.

Here is a Node3D save as a .tscn file :

[gd_scene format=3 uid="uid://mgp02mkor0at"]

  

[ext_resource type="Script" uid="uid://b74aq41vgfphe" path="res://node_3d.gd" id="1_a202f"]

  

[sub_resource type="Curve" id="Curve_a202f"]

_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.29969418, 0.06032425), 0.0, 0.0, 0, 0, Vector2(0.60144925, 0.19643795), 0.0, 0.0, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0]

point_count = 4

point_1/position = Vector2(0.29969418, 0.06032425)

point_2/position = Vector2(0.60144925, 0.19643795)

point_3/position = Vector2(1, 1)

  

[node name="Node3D" type="Node3D" unique_id=2028919695]

script = ExtResource("1_a202f")

curve = SubResource("Curve_a202f")

And now the same scene saved a .snc file :
(vs code was unable to open the file, I opened it in notepad++)

RSCC      X  ü  (µ/ý`X• æÓG?@k”ÆeR]Á©ël}HÇëN#8dÛ,?kdh²»üÛô»ïXÍ‹vZµ8.A޵’ã:Œ`@DlàcñßZ
/ 4 @ ÿå9yAÛ¬ÍroZm–MºØßñc†!>8ðÀႆŸòÊ}¸¡çü¿åŸø+pÊiÒÐÅ>’áZPf öS\¯ˆ=ZQ‘Îkq•Ù|­Ê8/WlrÆšYmCôcLkE«	N„çxˆ¨°90rÙXx a 
J¥R‘Épˆ’©}ü¥P(×v„eiÒüeÿ„@¦T`CC `Õ6ÏÇC±í“®RÛZ W#Ü_ÆÕ]K9	D‡	0¶G€LN	fB«ts£g Z8ˆL1’f¨:‘
Ì():`‚!THàÖ$Ñ"t¤HåOå¬ÔB€@ä• ä×Kñ×+t焃qá%’qXö¡ÿLéU0#š~Œª‚@‘9c`D,@µ
OìçŒ:"
¦dÔ¶V”˜aÉÍÃ&³ŒŸÂC×G‘þØÏüÉ.‚Ò6M#úÑAðöÜÜ‘Å%,ú¤A»L	×Ã¯¾ÀÅoL7hìÏŒq·iŽ
a¶4é¤}y>m;hH©]šËéE
¼ì_kú¡}j¡<RSCC

Similarly for .res and .tres, the .res is the binary format of the .tres file.

Here is the .tres file of a curve resource:

[gd_resource type="Curve" format=3 uid="uid://5kat52fc0o8f"]

  

[resource]

_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.06032425, 0.29969418), 0.0, 0.0, 0, 0, Vector2(0.19643795, 0.60144925), 0.0, 0.0, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0]

point_count = 4

point_1/position = Vector2(0.06032425, 0.29969418)

point_2/position = Vector2(0.19643795, 0.60144925)

point_3/position = Vector2(1, 1)

And the .res file for the same .tres file :
(vs code was unable to open the file, I opened it in notepad++)

RSCC      O    (µ/ý`O5 â*/€KÒ303¤}FÙ"‘ÛŸìMô¹Œ{£veïU³HiÓ¦‹·F±(ßR˜ŒEFà¸pü…aäÃBáðX@4:*eg‚ð7TŽ
÷åFR	¿d¥Yü)->IA¼nz,×µ'ý¯]é^Û	JÍXšßà¸-jPþÏ-W°:e1ß&´ØƒRœ^Tø/üÃH]ThDB~gÝ€&à§ü“& p"D¤a2Ìò1`\åöS:
àÃ3–6ggƒ%KòoÄ(¬1»Û;a±|¥ÕBaXö@0L…‡-öE¶3elh¥D9TûØ…[#OŽæ£W†;XÁRSCC

Now .material is similar to .res (it’s binary) but it is specific for materials only.
Here is a .material file :
(vs code was unable to open the file, I opened it in notepad++)

RSCC      r  O  (µ/ý`r
-" öï‡4`OÒ`.¤dP	Î_!„ì$™¤$>‘-“”w„
ûG ©‘ŽHa))¬ˆRy u x <¹9Êš¶&¥EÌZ”öM{MÒBž)bnŽ¢Vˆ–òrw®r–z²¶Òÿî\kÉð)ºîã*¿Þë]ÑÊ8U¹œ.=
û‘ó4£oº©ßÝ„»+qP¸ÐpBEŠ»p:8×õòD+_ÄÝ=¸»wgàîÜŸ}<•ÏÚWëj}á<M§ò^IƒËûÓ•µë2ÛçFa…q]Šh)¶UºÑš.Ó´³®•ƒœƒ;Ëœ¯êî\BM!„N¸qêÍSôÜÂxö×HNl‰ÞÜa)ú®’ÕÛ>§9Žé”àÂ,ã/ÝE%*/ÙH%«G=•©ëó¦Çãñx` öž0OHCÏ•ÌÖÿµ¥Ô$k%%MF¤¥J°ùŠ8üIOê‘“Ë·îÅ‚ž•ÿ«.¬@žYêß\ÿ“7miÚ.¿”YùÈ–“„£$sz2dªhK¥»sЙGSJìŒf©&Í	A…µ·]BˆA¢ƒ‰;-^¬àÐâ‹» ×Ôê@…8Ñ•!Ʀ~aàÙúi‘³ßФ®ú4&9ñž¥ß(¹–C×ò7­ÌJGVÊ2l‹P&¬üª¥´3´î*i”t:8¢ñ*Ÿ}O¿¶™ŽØ†H)›VÓ*qÒÎܦÑðì…y—“¬'=遨ѡQˆ†F’2a„hTB†w`s=F£N!†ŠF[Nj5a®²|ÔËÉ=E¦±Ì‰ö~•óëeá´?IÁ¼*Ÿëéȁ¡úÅp1˜ &ŽT6Ÿð¹%Œ€§¢¼4$"[gqû$P–ÜEU:“CûG0#¬€Ë[)u¾ÚœÀ»³rñ¨=›
 éCU‹€5¬}AîØÖèb¨•B&H‘¥Ae§×õè”ø¥t´9`[ùx#¶GƒÂaá­uÂ^i„Øu3is:åë¶phi…‘LZ^™/ìá.~ÑÊÇN0bY¢ûÏ8M0 ¦Õ6ݸÍ—9O¢`h:y–g‹ê ®ž™Œ`Ž!ö]XtX›¬Sׯ×G	yǫԘ£§E­ËKýÿeT ¬Ôà¸øŸÿžø5eñÁ*À­B篻dœ7î‡ßKjC±Ýe ÂìŠ\méÁé“´)+s‡BÝ’™2 Xü ÂE1v+rYFaüNY)p±ªJ`U¨ü¬oÏMû?•‹ÏR5íé`ñ3Íönã×
Åyr˜Dã7⠍¯é$3y
ŒÇx¡ßÓ-Í~k$
è…O çtãà×D}Î!ÝÙEžå!‰È ©Êÿ8,–„nXà90·ørs¹±Ÿ¤ÃnœxO6»x(®øâí°çôýý®ŒhÔŸKÖ¶	D¶2Ô¨z7šÄ„<nìZ‚Pþ3*©¿½ÚaaRSCC

Here is the .res file for the same material file :
(vs code was unable to open the file, I opened it in notepad++)

RSCC      v  Q  (µ/ý`v
=" Æï‡5`OÒ„0vEÈ0 @ö/BÈN’‘IJâÙ2I9qG˜¡P ðüÙсúA)®QÑDx t w žÜeM[“Ò"f-JHû¦½&é!Ï17GQ+DKy¹;«œ¥ž¬­ô¿»×Z2|Š®»Ë¸Ê¯÷:CW´6NU.§KOÃ~ä<ͨǛnêw7áîN\‡¤P±âÅÝ	¸e8×õSòD+ŸÄÝ9¸»wgàîÜÙÇSù¬}µ®ÖÎÓp*ïõ4¸¼?]Y».³}nV×¥ˆ–b[¥­é‚0M;ëZ	9HÁ5¸³ÌùªîîÀ%Ô>è„§Þ<EÁ-Œ7láé‰-Ñ›û EßU²z[ÃçtÇ1ÜC˜eü¥»¨Då%[„«G=•©ëó¦Çãñxd öž0OHCÏ•ÌÖÿµ¥Ô$k%%ÍF¤¥B°ùŠ:üIOê‘“˷ž•ÿ«,¬@žYêß\ÿ“7miÚ.¿”YùÈ–“„£$sz2dªhK¥»kЙGSJìf©&ÍI£ÂÚ¿Û®Ìø FaâŠ;.`°ðàF‹» Ú€
q¢+C†M/Ü€gë§EÎBžC“ºêÓ˜äÄ{–~£äÚ]Ëß´2+Y)˰-B™°ò«–ÒÎꫤQÒé`‰Æ«|ö=üÚfZbe"¥lZM«ÄI;sw˜j‚g/Ì»œd=éI#•¨±!Rˆ†f$)(da„pRB†w d9F“!†ˆF[Nj5a²‚|àiuÕLV¥ú³öB¼_Šü*.ŸŸçÇ«ßs5’œezO¬ê„IiÖâHe󩹦„Cð”ªË†tTB†‘ĦÝ"…äMÓÔ¡#9x#%ÃzΕpç{ íéù@()FCs"-֢ǰ_}kðê¡•sÑa¯Æ7ùº;%þR$´yÁÅ )N8ËÒ ÆXø·Ná+m9ºN'bo%§TÒŽ–v8ɤcÉoôÑä¶jy‚•fÊ5 Ÿĝôt™©ñé¬ÚØ~	'›
ëÀ&„Ç<SPaÜêq12»a†ä‡ÎÂ`Ýõ.xaÁ59©çùõ°"úÜ
,Ⱥ²$ÿKF5
IŠæ—ŠPÿ”u¿‰ÔGÛ„´€Ÿ>Ø%¸Ý”gN–¿|šï< XkWíõ˜NIãjqjB–Ø Ê
j]à£L†­ŠÜÉ:Û“ƒúU,¢˜
)~ëÀÛaEyå9©÷z„ÐŒ3iw¶GÝã<BPg…MòS‡8¤Qt=; íêØ±Š¡/q{%“5Bˆ°€_ë4D)¯YûhÎáïHE–Ž(
Â2é¨ÊclÇ*—I…¿ÀLeê*~Ü|k&¹nïÃî4ÜÅ¡ýaé€gs?'cp›“Oõ3e– 8Šäu|´É©ˆãFXë°Ìï§²õP¡u	RSCC

And here is the .tres file of it :

[gd_resource type="StandardMaterial3D" format=3 uid="uid://bkblq1omlai4l"]

[resource]
albedo_color = Color(0.41981313, 0.41981313, 0.4198131, 1)

The .res file is the daddy of all files in Godot. It’s binary and everything in Godot could be saved as .res file format. The binary file formats i.e .res, .scn and .material are better for release builds as those take less time to load. Where as text file formats like .tres and .tsnc are better for debugs and development.
Hope this clarifies the confusion.

1 Like

(post deleted by author)

1 Like

The differences are simple.

.tres and .tscn are text versions of files used when making a game. Extensions like .material and any other custom extensions (you can even make your own) are just different names for .tres files.

When you export your game, all files are exported as .scn and .res binary files.

You should always use the text versions. When you export your game, they are turned into binary files for you. Trying to use binary files while editing your game provides no benefit and has many, many drawbacks.

Having things stored as text files makes human-readable diffs possible and it makes resolving merge conflicts possible. These are things that don’t affect most people, but when they do, you’ll be glad you have the option.

The choice to use, for example, a .material vs .tres file is up to you. I recommend using .material for all material files. However, do not just rename material files from .tres to .material. That will not work and will make your file unreadable. If you want to convert a file, load it in the editor and save a new version with the new extension.

2 Likes

@Gourab wrote this:

I just looked at it myself, .material is indeed binary.

Thanks everyone for you answers! I totally forgot about this post I created 1,5 years ago. :grin:

1 Like

Good to know. That’s why you cannot rename them.

So would it be more advisable to save materials as .tres instead of .material for version control? And same for animations (.tres instead of .anim)?