[Utility] SB3Utility (GUI + Script) Releases and Support Discussion

Re: SB3Utility (GUI + Script)

@totaldecay78:
Hello here at AS! HF seems to be back to normal, although this normal is quite slow compared to old times.
In the post above is a link to the local Glossary - try the last post there for a description how to work with external materials and textures. It is not perfect yet, I found a missing part for textures which I complete next.

The example is for HS yes, but external materials and textures are also present in SBPR.



@roy12:
Uncompressed DDS is converted to ARGB32 and mipmaps are supported for this format too, not required though. But the game does not accept this format on all meshes. E.g. I replaced a DXT1 texture for a piece of clothes and the game crashed. At another place (body texture) the format the format is accepted - with and without mipmaps.
 
  • Like
Reactions: totaldecay78
Re: SB3Utility (GUI + Script)

I just tried uncompressed DDS, it's able to preview these file, but an error occurred when adding or replacing image.

Exception has been thrown by the target of an invocation.
Index was outside the bounds of the array.
 
Re: SB3Utility (GUI + Script)

Hm, I added and replaced such without error. Would you mind sharing your texture or a similar which produces this error?

Second idea, into which file are you adding/replacing the texture?

If possible attach both. Thank you!
 
Re: SB3Utility (GUI + Script)

@Enimaroah
For alpha properties textures. Are we going to see preview this way? Previous tools it has grey background and newest is now showing black background.
1.053Kappa
View attachment 12412

1.1
View attachment 12413

No issue. I thought first that dds alpha channel failing in 1.1 but when exported it looks fine.
 
Re: SB3Utility (GUI + Script)

Thanks for bringing this to my attention. It is even more strange. The better preview can be seen in the Texture editor.
TransparenceInSb3UGSwithDX11.jpg

I am currently working on TGA support and the image preview is part of it. I will try to make it look the same as in the Texture editor.
 
Re: SB3Utility (GUI + Script)

In SB3Utility 1.2.2 the color channel flipping bug still exists for Uncompressed RGB24 DDS, only Uncompressed ARGB32 DDS seem to be fixed.
Otherwise, full clothing sets converted from DXT1/DXT5 to Uncompressed ARGB32 DDS w/ MipMaps seem to be working fine with HoneySelect.

Reproduction steps:
  • Open mat_cha_03.unity3d
  • Extract cf_t_kimono_t_00_00 in DXT1 format
  • Open cf_t_kimono_t_00_00.dds with NVIDIA Texture Tools (Photoshop Plugin)
  • Colors are correct
  • Flip Image Vertically (to restore correct orientation)
  • Save as 8.8.8 RGB (24bit) with NVIDIA Texture Tools
  • Open RGB24 Uncompressed cf_t_kimono_t_00_00 with with SB3Utility 1.2.2
  • Colors are correct in Image Preview
  • Replace DXT1 with Uncompressed RGB24 cf_t_kimono_t_00_00 with SB3Utility 1.2.2
  • Colors are now incorrect in both the SB3Utility texture tab as well as in-game
  • Repeat instead saving 8.8.8.8 ARGB32 (32bit) from NVIDIA Texture Tools
  • Colors are now correct
 
Last edited:
Re: SB3Utility (GUI + Script)

Thanks for your report!

DDS files with RGB24 is functional, but it requires a bit of help in the filename. Please name them {free choosable}[size=+1]-[/size]RGB24.dds. My tests were successful with and without mipmaps.

Flipping these formats in the Texture editor causes an incorrect swap of color channels. So always flip externally.

BMP files in RGB24 format at not supported.
 
Re: SB3Utility (GUI + Script)

That wasn't working for me. I already was importing the RGB24 files my files suffixed -RGB24.dds before I reported this issue, and the colors channels were still getting swapped.

__

Hmm... I think I see the problem. I was using Assets menu -> Replace Files, which behaves as I described.

Uncompressed -RGB24 DDS color channels are swapped using that method. Image orientation is maintained on import.
Uncompressed -ARGB32 DDS color channels maintained using that method. Image orientation is maintained on import.
RGB24 BMP color channels are maintained using that method. Image orientation is maintained on import.

__

What you seem to be doing is using the Texture tab -> Replace Button?

Using that method Uncompressed -RGB24 DDS color channels are maintained. Image orientation is flipped vertically on import even without 'Flip Y' checked.
If I do the same thing on the RGB24 with 'Flip Y' checked, image orientation is maintained on import (nothing is flipped) yet color channels are swapped.

Using the that method Uncompressed -ARGB32 DDS color channels are maintained. Image orientation is flipped vertically on import even without 'Flip Y' checked.
If I do the same thing on the ARGB32 with 'Flip Y' checked, image orientation is maintained on import (nothing is flipped) and color channels are still maintained.

Using that method Uncompressed -RGB24 BMP color channels are maintained using that method. Image orientation is maintained on import.

__


In conclusion, SB3Utility is using different file handling and color conversion on import/export, depending on where in the program you perform them...

Using the Assets menu -> Replace Files
  • ARGB32 DDS. Colors channels & Vertical orientation maintained. Fully working
  • RGB24 DDS. Color channels are swapped. Vertical orientation maintained. Bugged
  • RGB24 BMP. Colors channels & Vertical orientation maintained. Fully working

Using Assets menu -> Export Files
  • ARGB32 DDS. Colors channels are swapped. Vertical orientation maintained. Bugged
  • RGB24 DDS. Color channels are swapped. Vertical orientation maintained. Bugged
  • RGB24 BMP. Color channels are maintained. Vertical orientation maintained. Output is a TGA file. Fully working

Using the Texture Tab -> Replace & Texture Tab -> Export
  • ARGB32 DDS, Colors channels maintained. Vertical orientation flipped with 'Flip Y' unchecked. Bugged
  • RGB24 DDS, Colors channels maintained. Vertical orientation flipped with 'Flip Y' unchecked. Bugged
  • DDS with 'Flip Y' checked. With both ARGB32 & RGB24 Color channels are swapped. Vertical orientation is not flipped. Double Bugged
  • RGB24 BMP, Colors channels maintained. Vertical orientation maintained with 'Flip Y' unchecked. Fully working
  • RGB24 BMP with 'Flip Y' checked. Colors channels maintained. Vertical orientation maintained even though 'Flip Y' is checked. Bugged (option ignored?)

Confused yet? I know I am...
 
Last edited:
Re: SB3Utility (GUI + Script)

Note the tooltip! FlipY is only relevant for DDS. It is ignored otherwise.

DDS textures are automatically flipped by SB3UGS in the file's menu (Export & Replace), workspace and on export of meshes. This means quality loss for DXT1 and DXT5. And this means that the orientation is correct (matches UV orientation).

You only have influence on the flipping in the Texture editor and you should avoid setting this flag because the said quality loss. But if you set this flag then orientation is correct. If you leave it unchecked then the orientation is incorrect, but with original quality.



SB3UGS_v1.2.3 comes with TGA support. TGAs can be without alpha then they will be RGB24. With alpha they are converted into ARGB32. OriginY is supported too. You can save your TGA with TopLeft or BottomLeft option, but compression is not supported.

Download:
megafileupload, sendspace
SHA256: 71011CCD7488174840FF07D056C252FF69E00A94B37A57DC215F90C370C81970

Sources:
megafileupload, sendspace
 
Last edited:
Re: SB3Utility (GUI + Script)

Note the tooltip! FlipY is only relevant for DDS. It is ignored otherwise.

DDS textures are automatically flipped by SB3UGS in the file's menu (Export & Replace), workspace and on export of meshes. This means quality loss for DXT1 and DXT5. And this means that the orientation is correct (matches UV orientation).

You only have influence on the flipping in the Texture editor and you should avoid setting this flag because the said quality loss. But if you set this flag then orientation is correct. If you leave it unchecked then the orientation is incorrect, but with original quality.

Ah, I misunderstood. I was thinking FlipY was referring to flipping the Y-axis vertical orientation of the entire image (all color channels), not flipping Y-luminance only. I don't understand the purpose of such an option for flipping Y-luminance and not Cb & Cr as well, but I guess it doesn't matter as I should just ignore the option entirely.

Is it just the case the Unity engine DDS textures are stored with upside down vertical orientation and displayed in-game flipped? So upside export is actually normal or something? Still a bit confused though, so can you clarify the following?

On Export of DDS DXT1/DXT5/Uncompressed:
  • The only proper way to maintain quality is to Export through the 'Texture Tab -> Export Button' with 'Flip Y' unchecked, which results in Y-luminance not being flipped yet the vertical orientation is output upside down? No quality loss?
  • If you export with 'Assets Menu -> Export Files', the behavior should be identical to the 'Texture Tab -> Export Button' with 'Flip Y' checked? Y-luminance flipped, vertical orientation is output right-side up? Quality loss?

On Import of DDS DXT1/DXT5/Uncompressed:
  • Import through the 'Texture Tab -> Replace Button' with 'Flip Y' unchecked assumes upside down input, which results in Y-luminance not being flipped yet the vertical orientation restored to proper orientation? No quality loss?
  • If you import with 'Assets Menu -> Replace Files', the behavior should be identical to the 'Texture Tab -> Replace Button' with 'Flip Y' checked? Y-luminance flipped, vertical orientation unchanged? Quality loss?

What I don't understand is why Uncompressed ARGB32 DDS behaves differently than Uncompressed RGB24 DDS in regards to importing:
  • With Uncompressed ARGB32 DDS using the 'Texture Tab -> Replace Button' with 'Flip Y' unchecked assumes upside down input, which results in the Y-luminance not being flipped yet the vertical orientation restored to proper orientation? No quality loss?
  • With Uncompressed ARGB32 DDS using the 'Assets Menu -> Replace Files' unlike with Uncompressed RGB24 DDS, neither the Y-luminance or the vertical orientation is changed? No quality loss?
    Why doesn't importing Uncompressed RGB24 DDS behave the same as Uncompressed ARGB32 DDS in the this case, when they do behave the same for exporting?

On Import/Export of RGB24 BMP/TGA:
  • Both 'Texture Tab -> Export Button' or 'Assets Menu -> Export Files' should always behave the same with (vertical orientation unchanged) since the texture are actually RGB and not YCbCr like DDS?

I'm trying to wrap my head around why not flipping Y-luminance and maintaining quality(?) is related to importing/exporting a DDS files with an upside down Y-axis vertical orientation at all. Is there a reason why DDS textures need to be imported and exported upside down? Couldn't you just add an option to flip the entire YCbCr image Vertical Y-axis or would even that result in quality loss for some reason?

Is there a reason to not do the following workflow when uncompressed ARGB32 output w/ mipmaps is desired:
  • Export DXT5 DDS using 'Texture Tab -> Export Button'
  • Open DXT5 DDS with NVIDIA Texture Tools with option "Load Flipped Vertically" checked.
  • Filter/Edit Texture as desired in Photoshop
  • Save as Uncompressed ARGB32 DDS with NVIDIA Texture Tools.
  • Import Uncompressed ARGB32 DDS using 'Assets Menu -> Replace Files'

It's unfortunate the same workflow cannot be used for DXT1 DDS -> Uncompressed RGB24 DDS since as mentioned above using 'Assets Menu -> Replace Files' behaves differently than importing ARGB32 for some reason.

So I guess for uncompressed RGB24 output w/ mipmaps the following workflow is needed:
  • Export DXT1 DDS using 'Texture Tab -> Export Button'
  • Open DXT1 DDS with NVIDIA Texture Tools with option "Load Flipped Vertically" checked.
  • Filter/Edit Texture as desired in Photoshop.
  • Image Rotation -> Flip Canvas Vertical in Photoshop. (since SB3Utility requires RGB24 DDS to be upside down)
  • Save as Uncompressed RGB24 DDS with NVIDIA Texture Tools.
  • Import Uncompressed RGB24 DDS using 'Texture Tab -> Replace Button'
 
Re: SB3Utility (GUI + Script)

The uncompressed supported image files are all handled in without any YCbCr knowledge. Three bytes - three channels, four bytes - four channels. Sb3UGS adapts the order of those channels/bytes, not more.

Compressed images are handled blindly. If unflipped and to maintain quality the file is blindly cut after the header and stored in the asset (DDS not PNG, PNG is converted to DDS internally). If flipped then the data is converted several times with DX and Direct3D functions and therefore looses quality.

DDS stores data with flipped orientation. A Texture2D asset stores the DXT formats in the same way. Therefore, all the flipping of Y.

I will add more answers to your questions later.

Edit:
All occasions when Sb3UGS flips DXT formats mean quality loss because of multiple conversions. Uncompressed formats can be flipped without quality loss (TGA with OriginY>0 [Bug found! Texture is not flipped when replaced], DDS).

Why doesn't importing Uncompressed RGB24 DDS behave the same as Uncompressed ARGB32 DDS in the this case, when they do behave the same for exporting?
Replacing flipped everywhere fails for RGB24. Yepp, this is buggy, but not important because you dont want to flip. Still needs to be fixed.

To your workflows:
When the Texture editor is used with unchecked FlipY, Sb3UGS exports textures in a format which can be used as import for replacing. All formats. DDS a bit inconvenient though.

When replacing a texure the format is replaced in the asset as well. All uncompressed format lead to RGB24 or ARGB32 respectively. Compressed formats lead to DXT1 or DXT5. At all places except in the Texture editor the DDS textures are flipped.

BTW, DXT1 is 32 bit, but the alpha channel is opaque.
 
Last edited:
Re: SB3Utility (GUI + Script)

Wow! I wasn't expecting you to add TGA support so soon! Well done! :)
 
Re: SB3Utility (GUI + Script)

You are welcome, Sinbad!

Your other wish for support of old titles from Illusion must wait a bit. I have two points in my queue which I rate slightly higher. But both are hopefully not as big as the external mats & textures feature.

Current queue:
  1. The case above with DDS and the neverending flipping stuff which really is confusing, for me and for others. A simplification would be great.
  2. Camera asset editor. The values of this asset must be made available. No big thing.
  3. Support for old Illusion games [as up to v1.0.54epsilon].
  4. External meshes
 
  • Like
Reactions: hellothisisuser
Re: SB3Utility (GUI + Script)

I notice a small glitch in the 1.053Kapa and compare it 1.2.2.

When porting materials that has bump maps/textures. The 1.053Kapa skips the bump textures but v1.2.2 don't. If you are releasing another update. Please be sure it does not has this glitch in future v1.2.xx thanks.

1.053Kapa
FJAJONXd.jpg

1.2.2
AUpikWIz.jpg

Back to re-do whole project again. (-_-)

Edit

Ahummm.... Help please. There is something wrong with the tool v1.2.2 I think...
View attachment 12438
Although it's look ok in the tool renderer window.

File(20Mb)
 
Last edited:
Re: SB3Utility (GUI + Script)

I changed how imported texture slots of materials are assigned to support bumpmaps, specularmaps, etc. a while ago, yes. But I think that it is better than before. So I would like to leave it as it is.

Why do you use a material with bumpmaps and want additional textures to be skipped? You could switch to a shader without bumpmaps to achieve that.
 
Re: SB3Utility (GUI + Script)

Is there a way of exporting the sprite data? Even just the coordinates on the Texture2D would do. The data can be used to script photoshop to take apart each sprite area and put it into a new layer.
 
Re: SB3Utility (GUI + Script)

Sprites contain 3D positions and indices which probably define polygons, two textures, uvTransform and other attributes. But I haven't had a look into the instances in this game. May be only part of that is used. They have a constant size of 208 bytes and most likely use the Texture2D asset SpriteAtlasTexture-asset_H-512x512-fmt12.

If a text output in the Log window would be sufficient then I could dump the positions and indices.
 
Re: SB3Utility (GUI + Script)

There is a bug with TGA export in both Sb3UGS 1.2.3 as well as Sb3UGS 1.0.54

Randomly Sb3UGS will output TGA with or without the optional TGA File footer. The files exported without the optional TGA File footer are fine. The files exported with the optional TGA File footer violates the TGA footer specification and Photoshop will refuse to open them.

Looking into it, the problem is that Sb3UGS is writing Field 31 with a NULL when it should be a "."
Code:
Field no. 	Length 	Field 	Description
28 	4 bytes 	Extension offset 	Offset in bytes from the beginning of the file
29 	4 bytes 	Developer area offset 	Offset in bytes from the beginning of the file
30 	16 bytes 	Signature 	Contains "TRUEVISION-XFILE"
31 	1 byte 		Contains "."
32 	1 byte 		Contains NULL


Incorrect Sb3UGS output for fields 30-32:
­TRUEVISION-XFILE㄀㄀
54 52 55 45 56 49 53 49 4F 4E 2D 58 46 49 4C 45 00 00


Correct output for fields 30-32:
TRUEVISION-XFILE.㄀
54 52 55 45 56 49 53 49 4F 4E 2D 58 46 49 4C 45 2E 00
 
Re: SB3Utility (GUI + Script)

This is because the footer is in the asset. Gimp produces them when exporting.

I wouldn't call this a bug of Sb3UGS. But I guess you'd like to have it filtered. Alright.
 
Re: SB3Utility (GUI + Script)

Doesn't matter either way, but if the tga footer is going to be included on export it needs to be spec complaint. If you cannot verify the footer is valid and fix it, then you may as well just strip it. Photoshop uses strict file parsing for TGA and will refuse to open the files otherwise.

I just tested Photoshop, Gimp 2.8.14 & Gimp 2.8.18, and all output Targa with a spec complaint TGA footer. So if such an issue existed with Gimp at some point, they must have long since fixed the bug. Maybe you just need to update your Gimp library if SB3Utility depends on it?
 
Last edited:
Re: SB3Utility (GUI + Script)

I know this footer for years. I currently use Gimp 2.8.16.

If you need it clean now then I would suggest to use IrfanView as intermediate solution.
 
Re: SB3Utility (GUI + Script)

In the meantime I have been just opening the TGA files with corrupt footer with IrfanView or Gimp and re-saving, which then allows me to open them in Photoshop.

This is a bug in Sb3UGS though, so hopefully it can get fixed.

If I import a TGA with a valid footer saved with Gimp or Photoshop, Sb3UGS will output a file with a TGA corrupt footer.

Gimp RGB24 TGA Export:
TRUEVISION-XFILE.㄀
54 52 55 45 56 49 53 49 4F 4E 2D 58 46 49 4C 45 2E 00

OR

Photoshop RGB24 TGA Export:
TRUEVISION-XFILE.㄀
54 52 55 45 56 49 53 49 4F 4E 2D 58 46 49 4C 45 2E 00

--->

Sb3UGS RGB24 TGA Texture Import:
TRUEVISION-XFILE.㄀
54 52 55 45 56 49 53 49 4F 4E 2D 58 46 49 4C 45 2E 00

--->

Sb3UGS RGB24 TGA Texture Export:
­TRUEVISION-XFILE㄀㄀
54 52 55 45 56 49 53 49 4F 4E 2D 58 46 49 4C 45 00 00


Maybe the problem is that Sb3UGS is failing to store the footer asset correctly on import, rather than an export issue?

One way or another, Sb3UGS is outputting TGA with the last 2 bytes NULL, when only the last 1 byte should be NULL, and not matching the footer of the imported TGA file.
 
Last edited:
Re: SB3Utility (GUI + Script)

I am convinced there is something wrong with the new tool v1.2.2. It doesn't work it DXT-5 textures using DDS converter and there is something wrong with material as well. Giving strange effect. Am I missing something about this tool?

v1.2.2
z9MxLBRt.png

1.053 Epilison
XPIImYfo.jpg

Used same file on two different tools.
 
Re: SB3Utility (GUI + Script)

Sorry ramoram. I cant reproduce that problem with DXT5, but I also dont use DDS converter. Are those textures okay in Gimp or IrfanView or any other image software? What about attaching anything for verification.



SB3UGS_v1.2.4
  • Fix for external textures of external materials wheren't exported
  • Added preferred uncompressed file format for export
    PreferredUncompressedFileFormat.jpg
  • Changed TGA export to cut anything behind regular data
  • Fix for TGA being flipped when replaced (OriginY > 0)
  • Added Camera editor
    CameraEditor.jpg

Download:
sendspace, megafileupload

Sources:
megafileupload, sendspace
 

Users who are viewing this thread