ZenHAX

Free Game Research Forum | Official QuickBMS support | twitter @zenhax | SSL HTTPS://zenhax.com
It is currently Sun Feb 28, 2021 10:38 am

All times are UTC




Post new topic  Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Code for texconv
PostPosted: Sun Feb 14, 2021 1:12 pm 

Joined: Sun Feb 14, 2021 1:01 pm
Posts: 4
A batch code line for texconv to remove the alpha channel inside my .dds files, Luigi please. I need to remove the transparency from them. A code line that remove the transparency please, for texconv or for another... you have the skills to help me... I have spend days to read on line and try to find the solution but I failed.


Last edited by noire90 on Mon Feb 15, 2021 7:32 pm, edited 1 time in total.

Top
   
 Post subject: Re: Code for texconv
PostPosted: Sun Feb 14, 2021 6:54 pm 
User avatar

Joined: Sat Sep 15, 2018 5:22 am
Posts: 384
if you want to do some changes in a image channel, you should convert it to a raw-32bit and then start to messing with RGBA blocks (or 64bit, 16-bit? 8-bit? i hope 64-bit color dream never came true for black future!)

if you want to deal with a picture, you have to use a photo editor, paint.NET is a free one

you can convert your image with texconv.exe
Code:
"texconv.qgp" -y -ft TGA -m 1 "my_image.png" -o "output_folder"


normal transparency (full, i mean no alpha) is 0xFF (255)
and alpha colors are between 00 (full alpha) and 0xFF (full color)

use below script on 32-bit tga files to make transparency colors to full colors
Code:
get FILE_NAMER filename
string FILE_NAME = ""
string FILE_NAME + "transparency_fixer"
string FILE_NAME + \
string FILE_NAME + FILE_NAMER
get SIZER asize
xmath PIXEL_COUNT "(SIZER - 18) / 4"
log MEMORY_FILE1 0 SIZER
goto 18 MEMORY_FILE1
for i = 0 < PIXEL_COUNT
get RGB_COLOR threebyte MEMORY_FILE1
get ALPHA_CODE byte MEMORY_FILE1
if ALPHA_CODE > 0x00 & ALPHA_CODE < 0xFF
savepos CURRENT_LOCATION MEMORY_FILE1
math CURRENT_LOCATION - 1
goto CURRENT_LOCATION MEMORY_FILE1
put 0xFF byte MEMORY_FILE1
endif
next i

log FILE_NAME 0 SIZER MEMORY_FILE1


Top
   
 Post subject: Re: Code for texconv
PostPosted: Sun Feb 14, 2021 7:24 pm 

Joined: Sun Feb 14, 2021 1:01 pm
Posts: 4
Thanks for your answer but those codes don't worked in my case. I know that I can modify them with gimp one by one (adding inside them a white layer) but it's a lot of work... :( My .dds are 5GXT maybe this is the reson that those codes don't worked... I don't know.


Top
   
 Post subject: Re: Code for texconv
PostPosted: Sun Feb 14, 2021 7:32 pm 
User avatar

Joined: Sat Sep 15, 2018 5:22 am
Posts: 384
noire90 wrote:
Thanks for your answer but those codes don't worked in my case. I know that I can modify them with gimp one by one (adding inside them a white layer) but it's a lot of work... :( My .dds are 5GXT maybe this is the reson that those codes don't worked... I don't know.


my script just works on 32-bit TGA files
convert your file with this batch code (with texconv.exe)
Code:
md "output_folder"
"texconv.qgp" -y -ft TGA -m 1 "my_image.png" -o "output_folder"


Top
   
 Post subject: Re: Code for texconv
PostPosted: Sun Feb 14, 2021 7:42 pm 

Joined: Sun Feb 14, 2021 1:01 pm
Posts: 4
I need a code for dds file please because my importer recognize just the dds textures


Top
   
 Post subject: Re: Code for texconv
PostPosted: Mon Feb 15, 2021 11:33 am 
User avatar

Joined: Sat Sep 15, 2018 5:22 am
Posts: 384
noire90 wrote:
I need a code for dds file please because my importer recognize just the dds textures

convert your texture to tga and do your job and convert it to dds when you finish it

let me tell you something, if you want to edit texture files, you have to learn about color codes, texture encodings, mipmaps, block types, bit depth and many other things...


Top
   
 Post subject: Re: Code for texconv
PostPosted: Mon Feb 15, 2021 12:07 pm 

Joined: Sun Feb 14, 2021 1:01 pm
Posts: 4
Thanks again for your answer Shokoniraya, you are so kind... but this still don't work. 1)I converted my .dds to .tga with xnConvert. 2) I created a batch file with your code(md "output_folder" "texconv.qgp" -y -ft TGA -m 1 "my_image.png" -o "output_folder"). 3) I have placed texconv.exe and batch file in the .tga folder and I have double-clicked on bach file... whats happened was... texconv don't started to process and convert them just an empty output folder was created.


Top
   
 Post subject: Re: Code for texconv
PostPosted: Mon Feb 15, 2021 2:39 pm 
User avatar

Joined: Sat Sep 15, 2018 5:22 am
Posts: 384
this is a bat file code
replace texconv.qgp to texconv.exe
and replace my_image.png to your image file name (texconv can supports most of popular image formats)

Code:
md "output_folder"
"texconv.qgp" -y -ft TGA -m 1 "my_image.png" -o "output_folder"


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 8 posts ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Limited