🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

DirectX/SlimDX Alpha Blending

Started by
1 comment, last by RDragon1 1 week ago

Hoping someone might be able to offer some advice for an issue i am having.

I am working on abit of a project, mainly for learning, which is loading and rendering graphics from an old mmorpg i used to play a long time ago called Helbreath.

The loading and rendering of the data/graphics is fine and i have managed that without issue… until it came to the spell/effects which need to be blended. The original games source code was leaked hence how i know how to read the files and originally it used DirectDraw and i think they implemented their own blending system by reading the pixel data from the render surface and performing abit of math on it, but i might be wrong im not super familiar with C++ or DirectDraw.

The original image files are 24bit bitmaps with no alpha channel and a pure black background, this is a sample sprite sheet pulled from the games original libraries.

This is a sample of how i am getting the effects/spells to currently blend but i think they are too weak and i was wondering if there is a way to make them more vibrant and less washed out.

I am currently using these settings to perform the blending, i have spent a while messing around with mixing settings around to try and get the result i want but with no luck.

This is my first attempt at using SlimDX/DirectX so any advice would be appreciated.

For comparison here are those same effects over a black background, which is kinda the vibrancy i was hoping for.

I guess im kinda after the effect where the pure black pixels are fully transparent but the colored parts of the sprite i was hoping to like apply a weighting to say take more from the source and less from the destination making it in my mind darker/more vibrant/more saturated.

I might just be completely not understanding how this works of course!

Thanks in advance for any advice or tips!

Advertisement

I'm a little bit confused because you say the source textures have no alpha channel, but your ‘source blend’ is set to ‘source alpha’, which means it will multiply the shader's output color by the shader's output alpha… Are you outputting 1.0 as the alpha from the shader? If so, then what you have set up is ‘additive blending’, that is:

Dest = SrcColor * 1.0 + DstColor * 1.0
Dest = SrcColor + DstColor

That is mostly what I expect when you have a texture like that - that you just want to add that color on to the scene…

Do you want to try to alpha blend those sprites on instead? You don't have an alpha channel in the texture to do that properly, but you could try outputting A = max(R,G,B) from your pixel shader?

Are you trying to make it look exactly like the original game? Can you show a screenshot of a similar scene from the game?

Advertisement