Transparent textures

Report bugs found in the game, propose new feature requests, and discuss engine related content here.
Post Reply
User avatar
Kenon
Posts: 4
Joined: Fri Apr 05, 2019 12:32 am

Transparent textures

Post by Kenon »

Is it possible to add transparent textures on brushes to the game? If so, how? For the Hammer of thyrion port.
Sorry, I'm not good at writing in English.
Mathuz
Posts: 68
Joined: Tue Apr 02, 2019 6:40 am

Re: Transparent textures

Post by Mathuz »

I do not know about brushes but in the past I somehow managed to achieve alpha skins for models. But it had issues, like you cannot see models through the alpha skin, just geometry + I did not manage to have perfectly clean alpha.
whirledtsar
Posts: 22
Joined: Mon Apr 08, 2019 3:06 am

Re: Transparent textures

Post by whirledtsar »

It's possible to use sprites with transparency in place of models. You can use the program Fimg to convert PNG's to Quake/Hexen 2-ready .spr's. Of course this method is not as flexible & convenient as textures with transparency.
Shanjaq
Posts: 34
Joined: Wed Feb 27, 2019 11:03 am

Re: Transparent textures

Post by Shanjaq »

Can confirm that color index 0x00 appears transparent for models (even without using the translucent drawflags). BSP Brushes however do not yet support transparencies, I've opened an issue for tracking this request: https://github.com/Shanjaq/uhexen2/issues/32
Last edited by Shanjaq on Sat Apr 13, 2019 9:42 pm, edited 1 time in total.
User avatar
Kenon
Posts: 4
Joined: Fri Apr 05, 2019 12:32 am

Re: Transparent textures

Post by Kenon »

whirledtsar, I tried to make a sprite for Hexen 2, but instead of transparency, sprite is white :(. I opened a png file in fimg and saved it as a spr file.
Image

Shanjaq Thank you, I will wait in future versions of Fence Textures

Sorry, I'm not good at writing in English.
Shanjaq
Posts: 34
Joined: Wed Feb 27, 2019 11:03 am

Re: Transparent textures

Post by Shanjaq »

Hi Kenon, Sprites with transparencies should be working in the current release, I've attached a sprite ported from original Hexen and used in the Toxic Cloud spell for Peanut. I deleted the individual frame files after creating this one, but fimg should be able to extract them to show what values it needs to be transparent. Hope this helps :)
Last edited by Shanjaq on Sat Apr 13, 2019 10:41 pm, edited 1 time in total.
User avatar
Kenon
Posts: 4
Joined: Fri Apr 05, 2019 12:32 am

Re: Transparent textures

Post by Kenon »

Shanjaq, Hi, apparently I do not understand how to make a transparent Sprite. Maybe I'm doing something wrong in Gimp?
I do something like this:
1) Opening Gimp ( 2.10.8 )
2) adding png file
Image
3) in menu image> mode > indexed > use custom palette
ImageImage
4) use foreground color:
ImageImage
5) save png format (ctrl + shift + e)
Image


open fimg, add png file
Image
save as in spr file.

And when I run to test the game, there is no transparency ((((
Image

Maybe I'm doing something wrong in fimg or gimp? I would like to see a step-by-step tutorial about creating transparent *.spr.
Last edited by Kenon on Sun Apr 14, 2019 10:17 am, edited 1 time in total.
Sorry, I'm not good at writing in English.
Shanjaq
Posts: 34
Joined: Wed Feb 27, 2019 11:03 am

Re: Transparent textures

Post by Shanjaq »

Looks like the only thing missing is "Layer->Transparency->Add Alpha Channel". Once you add that and use the eraser you'll see a grey checkerboard behind the image while erasing parts. For some reason the "Color to Alpha" option is disabled while you're in Indexed mode, but if you temporarily convert to RGB you can use that feature, then convert back to Indexed and the transparent regions will still be transparent.

It looks like the image you started with had transparency, though it seemed to disappear when you got to step 4 (use foreground color). Hopefully manually adding it back in using the menu will fix things. My final, indexed image had the checkerboard background and was saved as PNG, which FIMG was able to import and created a sprite with working transparency.
Last edited by Shanjaq on Mon Apr 15, 2019 3:16 am, edited 1 time in total.
User avatar
Kenon
Posts: 4
Joined: Fri Apr 05, 2019 12:32 am

Re: Transparent textures

Post by Kenon »

Shanjaq, Thank you, now I understand how it is done!
Sorry, I'm not good at writing in English.
Post Reply