Transperacy
How can i implement transperacy in DDRaw?
For example if my character is walking in a building and a wall is blocking the view, i want the player to still be able to see the character through the wall...
Eran Kampfhttp://www.ekampf.com<br/>http://www.ekampf.com/blog/
January 30, 2000 09:23 AM
You''ll need to use alpha blending to get the most realistic effect. There is an article here on gamedev.net on how to use alpha blending. If you want to go for the quick and cheap look, just draw the person''s shadow on top of the wall without blending. This could be accomplished by putting down a black pixel for every pixel in the person bitmap.
January 30, 2000 11:38 AM
One method (for users without 3D Hardware) is to just blit a weaved pattern transparency over the wall before blitting in on the back surface.
So check if a wall is blocking your character, if so, before blitting that wall, blit a weaved or strip pattern over that wall in your wall''s transparency color and a new transparency colour to keep some of the walls data, then blit that to the screen/back buffer and you''ll see a pattern/lines of you character behind the wall.
It''s not visually appealing, but its faster than a software alpha approach. If your targeting 3D users only, then just go the alpha approach using Direct3D.
So check if a wall is blocking your character, if so, before blitting that wall, blit a weaved or strip pattern over that wall in your wall''s transparency color and a new transparency colour to keep some of the walls data, then blit that to the screen/back buffer and you''ll see a pattern/lines of you character behind the wall.
It''s not visually appealing, but its faster than a software alpha approach. If your targeting 3D users only, then just go the alpha approach using Direct3D.
quote: Original post by ekampf
How can i implement transperacy in DDRaw?
For example if my character is walking in a building and a wall is blocking the view, i want the player to still be able to see the character through the wall...
Here''s how I do it in 256 color mode... I start by using a palette that contains groups of color gradients. That is, I have 10 or 12 shades of blue (from dark to light), the same number of shades of green, yellow, red, etc. My entire palette is like that except for 16 at the beginning that I reserve for the user interface.
When I have an image (a wall, a tree, etc.) that would cover up my character, I use a special blitter to render it. A regular blitter simply copies each pixel in the image to the surface. This blitter ignores the actual color value of each pixel. If it''s a non-zero pixel then it simply decrements the value of the existing pixel that would normally be covered up by 1.
The effect is that you get a shaded silhouette instead of the actual object, with everything behind it still visible.
If the pixel is already the darkest shade allowed, then I replace it with a black pixel.
Roller Coaster Tycoon does this when you choose transparent trees and/or transparent ride supports.
It''s also a great way to do text. Render a rectangle this way (but maybe subtract 2 or 3 to make it even darker) and then draw your text on it. StarCraft uses a similar look for its menus and text panels.
//TOOM
Toom
Are you using your own blitter for all your graphics? If so are u drawing from back to front or front to back with a simple Z-Buffer?
Are you using your own blitter for all your graphics? If so are u drawing from back to front or front to back with a simple Z-Buffer?
quote: Original post by TUna
Toom
Are you using your own blitter for all your graphics? If so are u drawing from back to front or front to back with a simple Z-Buffer?
For the most part I''m using Direct Draw''s BltFast() and only using my own blitter when I need special effects like light mapping, transparency, etc. This is in an isometric engine and yes, tiles are drawn from back to front.
//TOOM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement