Translucency for black background tracers?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
Graaicko
Posts: 534
Joined: Tue Jun 17, 2014 11:22 pm
Graphics Processor: nVidia (Legacy GZDoom)

Translucency for black background tracers?

Post by Graaicko »

So I'm adding sprite based tracers to the weapons. Was wondering how to make sprites with black backgrounds translucent, specifically for projectiles. Recolored some tracers from Brutal doom to match real life 5.56x45 tracer ammunition. They light up red just like these.
Spoiler:
User avatar
Cherno
Posts: 1337
Joined: Tue Dec 06, 2016 11:25 am

Re: Translucency for black background tracers?

Post by Cherno »

Silly question, but why do these sprites have a black background when it's supposed to be translucent :?:
User avatar
Graaicko
Posts: 534
Joined: Tue Jun 17, 2014 11:22 pm
Graphics Processor: nVidia (Legacy GZDoom)

Re: Translucency for black background tracers?

Post by Graaicko »

Its a png file. I believe if you set some command, it makes the sprite translucent, and you don't even see the background, this is what I'm looking for.
User avatar
Cherno
Posts: 1337
Joined: Tue Dec 06, 2016 11:25 am

Re: Translucency for black background tracers?

Post by Cherno »

Use RenderStyle Add for the actor.

Code: Select all

Renderstyle ADD
Alpha 1.0//or whatever
User avatar
Enjay
 
 
Posts: 27123
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Translucency for black background tracers?

Post by Enjay »

Worth pointing out that, using this method, if you have a powerup that inverts the palette (the invulnerability power up or the enhanced night vision), all the black areas will become visible as white. So all of your projectiles will be surrounded by white rectangles. It's much better to edit the sprites to make them have proper translucency and transparency. I would still use additive rendering on them though because that looks best for effects like this.
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

Re: Translucency for black background tracers?

Post by Void Weaver »

Yep, Slade basic sprite editor can remove sprite's background colour by selected range if choosed option "Transparent Colour:", but it can remain a some black border around sprite in case if it have internal translucensy. So in that case is better solution is use Gimp\PShop to remove background\borders colour by alpha channel.

But in current case Cherno advice is quite good, I guess.
User avatar
Enjay
 
 
Posts: 27123
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Translucency for black background tracers?

Post by Enjay »

Personally, I use Paint Shop Pro's ability to create a "mask" that uses the luminance of each pixel to set its translucency. Fully black = fully translucent. It sometimes requires a bit of secondary editing because the entire thing can end up too translucent at the first pass. I just paste subsequents layer of the same masked sprite on top of each other to build up opacity until I'm satisfied with the look (quick and easy to do, usually just pressing Ctrl-L 3 or 4 times). The black background never reappears because it is fully transparent now, but the edges of the projectile sometimes end up a bit darker than perhaps I'd want. However, it's not visible most of the time and even with a palette inverting powerup active, it still looks much better than a black rectangle. Anyway, then I save and stick the graphic into my WAD/PK3 and that's it.

Obviously, I still need to set up the actor how I want in DECORATE/ZScript, but at least the background translucency is taken care of.

Here's one that worked out quite well:

Image

Image
Post Reply

Return to “Scripting”