Creating a partially transparent wall effect...

Started by
5 comments, last by savage 22 years, 3 months ago
Hi All, Has anyone here played FallOut Tactics? It is basically an isometric game and I would like to reproduce the effect of when the players walks behind walls, you can still see them, though they appear a little dithered. I have thought that maybe I can work out where the player is and Blt a dithered colour keyed rectangle where the player and wall intersect to get the same effect. But I was wondering if there are any better ways of doing this as my method would give a rectangular view rather than just the player showing through. I know I am close but I just can''t seem to work it out. BTW, code examples in Object Pascal or C/C++ for DirectX or SDL would make the most sense to me . Any other ideas also welcome. Thanks, Dominique.
http://www.PascalGameDevelopment.com := go on, write a game instead;
Advertisement
Hi savage,

i use D3D and OpenGL for my 2D blitting needs soo when i need to have something transparent, i just set my renderstates to alphablendable / semi transparent and voila, instant transparent wall a la fallout tactics.

Check out this great article on Gamasutra, it will show you how to use D3D for your 2D blitting needs.
Its very simple to follow.
The benifit of using D3D instead of DirectDraw is that all your blit operations(stretch, alpha, rotations) are done in hardware.

You might need to register to view the article but Gamasutra registration is free.

http://www.gamasutra.com/features/20010629/geczy_02.htm

Hope this helps a bit,

Best regards,

Gunner
Hi Gunner,
Thanks for the quick reply, unfortunately I would like to be able to do it without resorting to D3D or OpenGL. I am aware of that 3D alphablending exists, but I wanted to learn how to do it in 2D first before letting Hardware take over my learning experience .

Thanks,


Dominique.

http://www.PascalGameDevelopment.com := go on, write a game instead;
Making semitransparent walls in software would be either using dithering (just render checkboard of source pixels, thus making it look 50% transparent) or using pixel-by-pixel alpha-blending. There are many articles here on gamedev.net - look in Articles section on how to do good alpha-blending. Note that DirectDraw won''t do it for you - you''ll have to code your own routine.
Hi LifePower,
The dithered idea is what I planned to use, but that would only give about 50% tranparency, right? I am trying to convert some C/C++ alpha blending code ( it also includes an MMX version ) I found on gamedev. So I will see if that gives me the effect I am trying to get.

Thanks again,


Dominique


Edited by - savage on January 13, 2002 1:08:48 PM
http://www.PascalGameDevelopment.com := go on, write a game instead;
savage:you can use two approaches, either simple draw every other pixel to get a checkboard like wall where white positions on the checkboard are totally transparent (so you don''t draw anything there) and black positions represent the wall pixel which you draw without any effects like alphablending. Diablo 1 uses this approach.

The other approach is alpha-blending over all pixels, most often 50% alphablending (improved speed and looks very nice)

that''s the basic stuff, hope it helps

With best regards,
Mirek Czerwiñski
http://kris.top.pl/~kherin/
With best regards, Mirek Czerwiñski
Hi All,
I have translated the DirectDraw AlphaBlending code and it works quite well with IDirectDraw7 surfaces but I am having a few problems with IDirectDraw surfaces. I now have some MMX versions which blend 4 pixels at a time but since the assembler code is Microsofts it won''t compile under Delphi . I will post the Assembler code in another thread to see if someone has experience with this.


thanks for everyone''s reply.


Dominique.

http://www.DelphiGamer.com := for all your Object Pascal game development needs;
http://www.PascalGameDevelopment.com := go on, write a game instead;

This topic is closed to new replies.

Advertisement