Duke4.net Forums: Using addictive translucency in eduke - Duke4.net Forums

Jump to content

  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

Using addictive translucency in eduke

User is offline   Mav3r1ck 

#1

How do I add addictive translucency to sprites?
0

User is online   NightFright 

  • The Truth is in here

#2

Pretty sure you mean ADDITIVE, right? :P
1

User is offline   Hendricks266 

  • Weaponized Autism

  #3

Add this to your mod: https://hendricks266.duke4.net/stuff/duke3d_blend_package.7z

This enables the alpha field, and provides blend modes 129 (screen), 130 (multiply) and 255 (additive 100%).
6

User is offline   Mav3r1ck 

#4

View PostNightFright, on 27 November 2022 - 09:24 AM, said:

Pretty sure you mean ADDITIVE, right? :P


Yes lol, it was a typo on my part. :D

View PostHendricks266, on 27 November 2022 - 10:14 AM, said:

Add this to your mod: https://hendricks266.duke4.net/stuff/duke3d_blend_package.7z

This enables the alpha field, and provides blend modes 129 (screen), 130 (multiply) and 255 (additive 100%).


Thank you for your help, Hendricks266. :)

EDIT: How do I install it and where do I put it?

This post has been edited by Mav3r1ck: 27 November 2022 - 12:48 PM

0

User is offline   Hendricks266 

  • Weaponized Autism

  #5

Extract the archive to the root of your mod's folder. From there you can add "include blend.def" from your def file, or add its contents to yours. Then the tables should take effect if you change a sprite's .blend member in the editor, or from CON scripts.
0

User is offline   Mav3r1ck 

#6

I use a folder called "resources" for adding in custom content such as music and sounds from the psx version.

So basically, I extract the contents into my "resources" folder and add the "include resources/blend.def" into my "duke3d.def" where the executable is located, correct?

The last part confused me a bit since I'm more hands on. I do know how to edit my CON files, but I don't know which editor you're referring to change a sprite's .blend member.
0

User is offline   Mark 

#7

In Mapster 3D mode, put the cursor on the item you want to adjust. Press ' and B then enter in the number you want and hit enter. Then adust transparency and shade to what you want.
0

User is offline   Mav3r1ck 

#8

I feel kinda dumb, I didn't know he was referring to Mapster32 as the editor. This is the same as putting the cursor on the sprite and pressing "T" for the transparency in the editor, right?

I also wanted to make the game's explosions and the bullet puffs use the blend effects like how in the psx version. Can I do this to or does this explanation not cover that?
0

User is offline   Reaper_Man 

  • Once and Future King

#9

Yes, the 'B (that is literal apostrophe plus B ) command is a 3D Mode key command in Mapster that allows you to manually set the blending mode on a sprite.

However, making things spawned during gameplay (like explosions) use blend modes requires some scripting. Actually accomplishing this effect is very easy, although it immediately jumps into what I'd consider more advanced CON scripting concepts.

To do this for the explosion sprite, you could do something like this:

appendevent EVENT_SPAWN
{
	ifactor EXPLOSION2
	{
		cstator 2
		seta .blend 255
	}
}
endevent


Place this code at the bottom of game.con and it will make explosion sprites render additive.

If everything I just said is Greek to you, then I'd highly recommend reading up on CON scripting.

This post has been edited by Reaper_Man: 27 November 2022 - 06:08 PM

1

User is offline   Mav3r1ck 

#10

Sorry about the trouble for scripting this stuff in, I'm more of a visual learner. Thanks for the help. :)
0

User is offline   Danukem 

  • Duke Plus Developer

#11

Using additive blending is great for things like fires, holograms and bright energy projectiles. Essentially, anything that is transparent that should also be bright. But I am ignorant and don't know when I would use the other blend modes. Can anyone provide examples of things in game that the other blend modes would improve?
1

User is offline   Reaper_Man 

  • Once and Future King

#12

I'm not sure the base game has many instances where any of these modes would look great, as you really need art specifically designed to take advantage of them. Screen would be good for light spots or other ways of mimicking real light. In AWOL, we use multiply for things like smoke as it creates an area of darkness the same way additive creates an area of brightness. It would also work great for things like shadows the same way screen works for light spots.
2

User is offline   Mav3r1ck 

#13

For some reason, this effect doesn't work in Polymer mode. Is there any reason as to why?

This post has been edited by Mav3r1ck: 28 November 2022 - 02:56 PM

0

User is offline   Reaper_Man 

  • Once and Future King

#14

Yes - Polymer is scuffed and doesn't support blend modes (and a handful of other Polymost features).
0

User is offline   Mav3r1ck 

#15

I'm organizing my eduke32 folder and using a folder called "resources" as the mod folder with the blend tables inside it but when I attempt to use another folder called "blend" they don't work. Is there a guide that will help me organize them?
0

User is offline   VGames 

#16

I’ve got a weird sprite issue that I can’t seem to fix and it may have to do with some of this stuff. I got these 2 custom projectiles that use the texture command to force their 32 bit sprites and make them look nice in game. But the weird thing is when they’re in front of let’s say an explosion that also uses the texture command these projectiles got these black shadow outlines around them. I can’t seem to understand why they do this. Nothing else does this. All my effects sprites use the texture command to force their 32 bit palette and these 2 projectiles have this issue only. I also need to mention a lot of my effects use the seta[].alpha 128 command to make them have a blended look. I’ve had these projectiles use this too and not use this and they still have that black outline issue when in front of explosions and what not.

This post has been edited by VGames: 30 November 2022 - 02:04 PM

0

User is offline   Danukem 

  • Duke Plus Developer

#17

View PostVGames, on 30 November 2022 - 02:00 PM, said:

I’ve got a weird sprite issue that I can’t seem to fix and it may have to do with some of this stuff. I got these 2 custom projectiles that use the texture command to force their 32 bit sprites and make them look nice in game. But the weird thing is when they’re in front of let’s say an explosion that also uses the texture command these projectiles got these black shadow outlines around them. I can’t seem to understand why they do this. Nothing else does this. All my effects sprites use the texture command to force their 32 bit palette and these 2 projectiles have this issue only. I also need to mention a lot of my effects use the seta[].alpha 128 command to make them have a blended look. I’ve had these projectiles use this too and not use this and they still have that black outline issue when in front of explosions and what not.


Can you catch this happening in a screenshot?
0

User is offline   VGames 

#18

View PostDanukem, on 01 December 2022 - 12:52 AM, said:

Can you catch this happening in a screenshot?


Yes I’m sorry I was gonna post a screen shot yesterday and got too busy. I’ve been sick for 3 days so I’m catching up on stuff. When I get home I’ll post a screenshot.
0

User is offline   VGames 

#19

Attached Image: duke0001.png

Here's a pic. Notice how the purple plasma sphere further away in front of the explosions has that black ring around it? And the plasma sphere closest to you doesn't because it's not in front of the explosions? That's the issue.

Here's something odd to consider. In this following pic the red spheres in game have black rings around them like the plasma spheres do above when in front of the explosions but in this screenshot for some reason they don't at all. Could this be an issue with my GPU setup and not so much how the projectiles were scripted?

Attached Image: duke0007.png

This post has been edited by VGames: 01 December 2022 - 01:41 PM

0

User is offline   Danukem 

  • Duke Plus Developer

#20

View PostVGames, on 01 December 2022 - 01:35 PM, said:

Here's a pic. Notice how the purple plasma sphere further away in front of the explosions has that black ring around it? And the plasma sphere closest to you doesn't because it's not in front of the explosions? That's the issue.


I see. It looks like the partially transparent pixels on the plasma are being rendered as black. I'll think about what if any CON or DEF tricks might workaround that, but it sure looks like a rendering bug.
0

User is offline   VGames 

#21

View PostDanukem, on 01 December 2022 - 01:39 PM, said:

I see. It looks like the partially transparent pixels on the plasma are being rendered as black. I'll think about what if any CON or DEF tricks might workaround that, but it sure looks like a rendering bug.


Check out what I just added in the above post.
0

User is offline   Danukem 

  • Duke Plus Developer

#22

View PostVGames, on 01 December 2022 - 01:41 PM, said:

Check out what I just added in the above post.


I don't know but I maintain that it's a rendering glitch.

Also, upon looking at it more closely -- they don't really look black, it looks like the partially transparent parts aren't being rendered AT ALL, but the non-rendering goes all the way back to the map, instead of showing any sprites that should be rendered behind. If you zoom in you can see parts of the fence clearly in the "black" areas. So this theory is they only appear black because most of the map area behind them happens to be dark.

Do you use the alphacut command?
0

User is offline   Reaper_Man 

  • Once and Future King

#23

Post the relevant .def sections, and the source images files being loaded while you're at it. I almost wonder if the source image is a wrong format .png or something like that.
0

User is offline   VGames 

#24

Ok so here's the code for the texture of the plasma projectile:

texture 5359 { pal 0 { file "SOB_SPRITES/PROJECTILES/5359.png" nocompress nodownsize } }


And here's the projectile code:

defineprojectile SC_MAIN PROJ_WORKSLIKE 36878
defineprojectile SC_MAIN PROJ_XREPEAT 8
defineprojectile SC_MAIN PROJ_YREPEAT 8
defineprojectile SC_MAIN PROJ_SPAWNS SCEXPLOSION
defineprojectile SC_MAIN PROJ_BOUNCES 3
defineprojectile SC_MAIN PROJ_VEL 1000
defineprojectile SC_MAIN PROJ_VEL_MULT 2
defineprojectile SC_MAIN PROJ_EXTRA 48
defineprojectile SC_MAIN PROJ_ISOUND NB_IMPACT
defineprojectile SC_MAIN PROJ_BSOUND NB_IMPACT
defineprojectile SC_MAIN PROJ_HITRADIUS 0
defineprojectile SC_MAIN PROJ_OFFSET 150

action SC_MAINFRAMES 0 1 1 1 0
useractor notenemy SC_MAIN 0 SC_MAINFRAMES
seta[].alpha 128
enda


And this is the code in the EVENT_GAME for some size control as it exits the gun:

	case SC_MAIN
		ifpdistl 1000
			sizeat 0 0
		else
			sizeat 8 8
	break


That's all the code for the projectile.

Attached Image: 5359.png

This post has been edited by VGames: 01 December 2022 - 02:15 PM

0

#25

The pixels without 255 alpha in the projectile's png are being treated as completely opaque to other blended sprites.
You might avoid the headache just removing them

Attached thumbnail(s)

  • Attached Image: noot.png

0

User is offline   Danukem 

  • Duke Plus Developer

#26

Don't give up on transparency yet!

When Duke is involved, there is almost always a workaround. Or a reacharound -- I forget which one.
0

User is online   Phredreeke 

#27

EDuke32 doesn't support partial transparencies AFAIK. You can use alphacut in your define to set a higher threshold for when a pixel should be displayed though. https://wiki.eduke32...ki/Texture_(DEF)
0

User is offline   Danukem 

  • Duke Plus Developer

#28

View PostPhredreeke, on 02 December 2022 - 03:06 AM, said:

EDuke32 doesn't support partial transparencies AFAIK.


That is not true. Supported images with alpha channels normally do display transparency correctly if they are sprites, at least down to the alphacut limit. You can see in his screenshot that the projectile closer to the player is rendered correctly, with the transparency increasing closer to the edges. It doesn't appear to go from opaque straight to 33%, it appears to have a continuous range.

It does have a different problem, though -- it is squished. If a sprite is supposed to be circular, it's a good idea to stretch it out horizontally (either in the source image, or by giving it more x-repeat than y-repeat) to compensate for that in the renderer.

View PostPhredreeke, on 02 December 2022 - 03:06 AM, said:

You can use alphacut in your define to set a higher threshold for when a pixel should be displayed though. https://wiki.eduke32...ki/Texture_(DEF)


That's true but the results would be the same as editing the image --- either way, part of the image gets cut out. Although it wouldn't surprise me very much if changing alphacut somehow interacted with rendering code and caused the glitch to go away.
0

User is offline   Reaper_Man 

  • Once and Future King

#29

View PostVGames, on 01 December 2022 - 01:35 PM, said:

Here's a pic. Notice how the purple plasma sphere further away in front of the explosions has that black ring around it? And the plasma sphere closest to you doesn't because it's not in front of the explosions? That's the issue.

I can't reproduce this with the code and assets you uploaded. What version of EDuke are you running? Post your eduke32.log and mapster.log files. Are you sure there are no other DEF tokens for this tile?

Attached thumbnail(s)

  • Attached Image: duke0000.png

0

User is offline   VGames 

#30

View Postlllllllllllllll, on 02 December 2022 - 12:06 AM, said:

The pixels without 255 alpha in the projectile's png are being treated as completely opaque to other blended sprites.
You might avoid the headache just removing them


I have lots of other projectiles and effects that are made just like this. The shrinker spark for example is set up the exact same way and doesn’t have this issue. There’s something about these 2 projectiles that needs fixing. Plus they don’t look as nice without the blur. The main difference I can think of between the shrinker and these other 2 projectiles is they move much faster. Not sure if that could make a difference.

@reaper I’m not at my pc right now but I do have some of that code in my DEF from alien Armageddon that makes the muzzle flashes added to some of the weapons have blurred edges and blend properly. I can post the code when I get home. Maybe I’m missing something there or maybe it’s effecting these projectiles somehow even though the muzzle flashes I added that code for specifically are working just fine. And I’m using the latest version of eduke32

@dan I’ve been meaning to adjust the xrepeats for the orb like projectiles. That’s something I keep forgetting to do. Good catch.

This post has been edited by VGames: 02 December 2022 - 06:25 AM

0

Share this topic:


  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic


All copyrights and trademarks not owned by Voidpoint, LLC are the sole property of their respective owners. Play Ion Fury! ;) © Voidpoint, LLC

Enter your sign in name and password


Sign in options