Project Perfect Mod Forums
:: Home :: Get Hosted :: PPM FAQ :: Forum FAQ :: Privacy Policy :: Search :: Memberlist :: Usergroups :: Register :: Profile :: Log in to check your private messages :: Log in ::


The time now is Thu Apr 18, 2024 2:11 pm
All times are UTC + 0
Texture system info from the new patch (and game in general)
Moderators: Global Moderators
Post new topic   Reply to topic Page 1 of 1 [7 Posts] Mark the topic unread ::  View previous topic :: View next topic
Author Message
jonwil
Rocket Infantry


Joined: 24 Jul 2005

PostPosted: Tue Jun 23, 2020 7:58 am    Post subject:  Texture system info from the new patch (and game in general) Reply with quote  Mark this post and the followings unread

Here is some information on how textures work in the remaster and what has changed in the remaster patch.

Ok so firstly, all texture files in the remaster are either .dds files or .tga files.
Both are standard formats so I wont go into details here.

A .tga file can have an optional .meta file. This is a JSON file containing a size  value (x and y) and a crop value (top, left, bottom, right)

Here is an example of the contents of such a file:
Code:
{"size":[256,256],"crop":[71,40,187,199]}

Basically the size value specifies what size the original tga file was and the crop value shows where within that original tga file the actual tga file goes.

Its an optimization intended to reduce the size of all the assets by removing un-necessary black borders around the 4 edges. Unsure if its somehow a benefit at runtime or not since I don't know how the GlyphX engine works.

What has changed in the patch (as part of an attempt to fix stuttering issues) is that the core game .tga files (units, structures etc) are now stored in a zip file. So in the previous version of the game you would have a folder (inside the .meg file) called data\art\textures\srgb\common\vfx\fball1 containing a bunch of .tga and .meta files and now you have a file called data\art\textures\srgb\common\vfx\fball1.zip that contains the same .tga and .meta files.

If your mod contains art for a unit, structure or effect (these are things that would go in common_vfx.xml, ra_structures.xml, ra_units.xml, ra_vfx.xml, td_structures.xml, td_units.xml or td_vfx.xml) then you probably need to use a zip for the textures in your mod going forward.

Mods that have such art will have folders like Data\Art\Textures\SRGB\Tiberian_Dawn\Units\WARRIOR or Data\Art\Textures\SRGB\Tiberian_Dawn\Units\ANT1

If you have such a folder and it already contains .meta files then all you need to do is to use a zip program to zip up the contents of the folder.
So the contents of Data\Art\Textures\SRGB\Tiberian_Dawn\Units\ANT1 would go in Data\Art\Textures\SRGB\Tiberian_Dawn\Units\ANT1.zip in your mod and the Data\Art\Textures\SRGB\Tiberian_Dawn\Units\ANT1 folder would go away.

If you have such a folder and it doesn't contain .meta files then you can also do the above and make it a zip and it will probably work. Or you can run it through the tgautil.py script released by EA/Petroglyph as part of the new patch which will generate both the .meta files and the .zip for you. Exactly how you use this script I dont know, someone who knows Python more than I do will have to explain more.

Back to top
View user's profile Send private message
Gangster
Commander


Joined: 11 Jun 2004
Location: Moscow, Russia

PostPosted: Sun Jul 05, 2020 7:05 pm    Post subject: Reply with quote  Mark this post and the followings unread

jonwil wrote:
This is a JSON file containing a size  value (x and y) and a crop value (top, left, bottom, right)

Here is an example of the contents of such a file:
Code:
{"size":[256,256],"crop":[71,40,187,199]}




I assume this part is wrong.

There is an art of MOEBIUS (which is luckly uncroped) with size of 266,208
And there is EINSTEIN which is basicly a reskin of MOEBIUS.

einstein-0000.meta
Code:
{"size":[266,208],"crop":[116,41,202,116]}


so nothing whrong about x,y. however adding "(top, left, bottom, right)" gave a weird results. so I've experimented a bit and here I think how it works:

(left, top, right, bottom)


first entry
left: crop everything below 116 on axis X

second entry
top: crop below 41on axis Y

third entry
right: crop above 202 on axis X

fourth entry
bottom: crop above 116 on axis Y


so to backward math is:

1. add to bottom =208-116
2. add to right =226-202
3. add to top 41
4. add to left 116



crop.png
 Description:
 Filesize:  26.11 KB
 Viewed:  2845 Time(s)

crop.png



_________________
Gangster is a Project Perfect Wuj (c)Aro

Last edited by Gangster on Mon Jul 06, 2020 7:56 pm; edited 1 time in total

Back to top
View user's profile Send private message
tomsons26lv
Cyborg Artillery


Joined: 30 Dec 2009
Location: Latvia

PostPosted: Mon Jul 06, 2020 1:39 pm    Post subject: Reply with quote  Mark this post and the followings unread

Ohi Nice to see you are still around.
Petro released a python script that does the cropping, generating the meta file, and zipping up and it appears to do the reverse as well.
https://github.com/electronicarts/CnC_Remastered_Collection/blob/master/SCRIPTS/tgautil.py
I'm bad at python so no clue what its doing exactly  Embarassed
Edit: got it working
The coords are top left absolute and bottom right absolute pixel locations indeed.
What a bizarre offset for this render, why just why



einstein-0000coords.png
 Description:
 Filesize:  18.46 KB
 Viewed:  2813 Time(s)

einstein-0000coords.png



einstein-0000.png
 Description:
 Filesize:  18.4 KB
 Viewed:  2814 Time(s)

einstein-0000.png



_________________
Tiberian Dawn, Red Alert, Tiberian Sun ,Red Alert 2,Renegade, Command & Conquer 3,Tiberium and Tiberium Wars and Westwood related image & video archive
https://picasaweb.google.com/113361105083292812413?noredirect=1

Skype live:tomsons26
Don't forget to state who are you otherwise i'll ignore the invite

Back to top
View user's profile Send private message Visit poster's website
Gangster
Commander


Joined: 11 Jun 2004
Location: Moscow, Russia

PostPosted: Mon Jul 06, 2020 6:48 pm    Post subject: Reply with quote  Mark this post and the followings unread

I have been trying to run this script for a two days with no luck. How you did it? HOW?!

This offset is because if Alpha. Check channels tab in PS

_________________
Gangster is a Project Perfect Wuj (c)Aro

Back to top
View user's profile Send private message
tomsons26lv
Cyborg Artillery


Joined: 30 Dec 2009
Location: Latvia

PostPosted: Mon Jul 06, 2020 8:52 pm    Post subject: Reply with quote  Mark this post and the followings unread

it has a dependency
python -m pip install Pillow
then should be able to run it via python tgautil.py

_________________
Tiberian Dawn, Red Alert, Tiberian Sun ,Red Alert 2,Renegade, Command & Conquer 3,Tiberium and Tiberium Wars and Westwood related image & video archive
https://picasaweb.google.com/113361105083292812413?noredirect=1

Skype live:tomsons26
Don't forget to state who are you otherwise i'll ignore the invite

Back to top
View user's profile Send private message Visit poster's website
Gangster
Commander


Joined: 11 Jun 2004
Location: Moscow, Russia

PostPosted: Mon Jul 06, 2020 9:27 pm    Post subject: Reply with quote  Mark this post and the followings unread

Man, I have to ask you to do a step by step tut, as I have zero experiense with py.

I tried Pyton 3.8 with inbuild pip. had bunch of syntax error, which I manage to "fix" with help of youtubers. installed Pillow. But it the end script had no effect, or maybe it was I who failed to use console right way.
Second day I tried Pyton 2.7, but it had no pip, no pilow, argparse gave error. outdated libs, manual installments everywhere.
And when I've already given up, you came and saying: "meh, got it running" Smile

please..

_________________
Gangster is a Project Perfect Wuj (c)Aro

Back to top
View user's profile Send private message
tomsons26lv
Cyborg Artillery


Joined: 30 Dec 2009
Location: Latvia

PostPosted: Mon Jul 06, 2020 10:08 pm    Post subject: Reply with quote  Mark this post and the followings unread

Uh i have no idea how to troubleshoot this. I do have 2.7 set not 3 in my system path. Just running tgautil.py it throws
Code:
    print 'Wrote ZIP archive \'{}\''.format(out_file)
                                   ^
SyntaxError: invalid syntax

but python tgautil.py works showing
Code:
usage: tgautil.py [-h] {z,u} ...
tgautil.py: error: too few arguments

z is for zip up, u is for unzip

python tgautil.py u EINSTEIN.ZIP
should just unzip the archive and uncrop the tgas

_________________
Tiberian Dawn, Red Alert, Tiberian Sun ,Red Alert 2,Renegade, Command & Conquer 3,Tiberium and Tiberium Wars and Westwood related image & video archive
https://picasaweb.google.com/113361105083292812413?noredirect=1

Skype live:tomsons26
Don't forget to state who are you otherwise i'll ignore the invite

Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [7 Posts] Mark the topic unread ::  View previous topic :: View next topic
 
Share on TwitterShare on FacebookShare on Google+Share on DiggShare on RedditShare on PInterestShare on Del.icio.usShare on Stumble Upon
Quick Reply
Username:


If you are visually impaired or cannot otherwise answer the challenges below please contact the Administrator for help.


Write only two of the following words separated by a sharp: Brotherhood, unity, peace! 

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © phpBB Group

[ Time: 0.1466s ][ Queries: 16 (0.0102s) ][ Debug on ]