DieHard Wolfers Forum Index DieHard Wolfers
A Wolfenstein 3d Fan Community


  Hosted by: MCS & Areyep.com - Designed by: BrotherTank

Original Yahoo Forum - Die Hard Archives

AReyeP HomepageAreyep Homepage DieHard Wolfenstein BunkerDieHard Wolfenstein Bunker Log inLog in RegisterRegister Banlist FAQFAQ Search ForumsSearch

  Username:    Password:      Remember me       

alpha pixel (slightly invisible pixls)
Page 1 of 1
DieHard Wolfers Forum Index -> Feature Fanatics View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page BottomView Next Topic
Post new topicReply to topic
Author Message
thellt
Bring 'em On
Bring 'em On


Joined: 21 Jan 2008
Last Visit: 12 May 2009

Topics: 11
Posts: 85
Location: bloodgulch
usa.gif

PostPosted: Wed Feb 06, 2008 9:02 am
   Subject: alpha pixel (slightly invisible pixls)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

i have always wondered if i could add an elite (halo character) who is almost invisible!
AlumiuN
DieHard Wolfer
DieHard Wolfer


Joined: 29 Nov 2007
Last Visit: 5:26 ago.

Topics: 38
Posts: 2497
Location: Christchurch, New Zealand
newzealand.gif

PostPosted: Wed Feb 06, 2008 12:32 pm
   Subject: Re: alpha pixel (slightly invisible pixls)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Erm... I think it's possible. I'm working on it for my HUD at the moment, but doing it for an object is an entirely different kettle of fish. And you'll need to be using Wolf4SDL, because, unless I'm mistaken, neither the original Wolf source code nor Wolf4GW had VL_GetPixel, although I'm sure it could be done with a bit more work. It just wouldn't be done with alpha, it would be done with some sort of 'masking' image saying which colours to make translucent. Smile
insurrectionman
DieHard Mutant
DieHard Mutant


Joined: 07 May 2005
Last Visit: 07 Oct 2018

Topics: 87
Posts: 759
Location: Wisconsin
usa.gif

PostPosted: Wed Feb 06, 2008 2:16 pm
   Subject: Re: alpha pixel (slightly invisible pixls)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I've come across some mixed pixels, or something when working on the parallaxing skies, and the walls and sky were translucent with each other, it was really cool, and i would like to replicate it when i get around to it.

_________________
I'm back! I missed this community!
Youtube Channel: TreeSapThief

New Site: http://www.treesapthief.com
Twitter: @treesapthief
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 8:32 ago.

Topics: 164
Posts: 8231
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Wed Feb 06, 2008 6:42 pm
   Subject: Re: alpha pixel (slightly invisible pixls)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

It'd probably involve a variation of the anti-aliasing code I mentioned before.

But to do what you're asking, my first code attempt would be having WL_DRAW look to see if a pixel from the sprite to be drawn was a color value of FEh (or 254 in layman's terms). If that condition was true, it'd find the current color where the pixel is to be drawn, then perform the Light Shading Tutorial in those pixels only. You'd have to have the Light Shading Tutorial coded in first, of course. Smile
AlumiuN
DieHard Wolfer
DieHard Wolfer


Joined: 29 Nov 2007
Last Visit: 5:26 ago.

Topics: 38
Posts: 2497
Location: Christchurch, New Zealand
newzealand.gif

PostPosted: Thu Feb 07, 2008 12:13 pm
   Subject: Re: alpha pixel (slightly invisible pixls)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I was thinking something like that, except just having an entire sprite as translucent and blending all of the colours with the ones behind them using GetColor from the light shading tutorial to find the closest colours, rather than just darkening the pixels behind it.

Semi-OT: Anti-aliasing code?
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 8:32 ago.

Topics: 164
Posts: 8231
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Thu Feb 07, 2008 6:55 pm
   Subject: Re: alpha pixel (slightly invisible pixls)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

OT -

AlumiuN wrote:
Semi-OT: Anti-aliasing code?
It's designed for Static Objects, and uses part of the routine you mentioned ... I think.

Say the color 254 is in the sprite that's to be drawn. This color appears in coordinate (X,Y) in my example.

It'll read the colors in coordinates (X-1,Y), (X,Y-1), (X+1,Y), and (X,Y+1). It then finds a color in the palette that would "in-between" the four colors it just scanned, and then draws a pixel that color where coordinate (X,Y) is supposed to be.

The "in-between" color is determined by finding the lowest and highest values of Red, Blue, and Green in the four colors it scanned. The difference between each highest and lowest value is calculated, then divided in half (or multiplying it by 0.5, if you prefer). The number you get after dividing it is then added to the lowest value, and the total is specified as the in-between color.

Each Static Object will probably have to be drawn twice in the code; once to draw it normally, then again to do the anti-aliasing using Color 254.

I imagine the algorithm is fairly slow. You'll probably have to have a well-selected set of colors for the palette if you want to make the algorithm work effectively. I doubt the Wolfenstein and Spear Of Destiny palettes would qualify as such. Sad
AlumiuN
DieHard Wolfer
DieHard Wolfer


Joined: 29 Nov 2007
Last Visit: 5:26 ago.

Topics: 38
Posts: 2497
Location: Christchurch, New Zealand
newzealand.gif

PostPosted: Fri Feb 08, 2008 5:31 pm
   Subject: Re: alpha pixel (slightly invisible pixls)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I see. You're right, that probably is quite slow. Smile In this case, it probably doesn't need to go over the sprite twice. I think I'll make it check the colour behind it using a function I had made and implemented for pulsing colours and add in a transparency calculator. On that off-topic note, do you know how to translate a vbuf position into an x and y coordinate?
BTW, thellt, once this is done, I'll (or we'll) post a complete tutorial in Code Crackers. Smile
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 8:32 ago.

Topics: 164
Posts: 8231
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Sat Feb 09, 2008 9:39 am
   Subject: Re: alpha pixel (slightly invisible pixls)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

AlumiuN wrote:
On that off-topic note, do you know how to translate a vbuf position into an x and y coordinate?
I'm not familiar with vbuf, I'm afraid. But there are other coders here who seem to have a better handle on it, thankfully. Anyway, a belated "thank you" to your interest in my routine. Smile
AlumiuN
DieHard Wolfer
DieHard Wolfer


Joined: 29 Nov 2007
Last Visit: 5:26 ago.

Topics: 38
Posts: 2497
Location: Christchurch, New Zealand
newzealand.gif

PostPosted: Sun Feb 10, 2008 12:23 am
   Subject: Re: alpha pixel (slightly invisible pixls)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Why you'd want to have anti-aliasing in 320x200 with 64x64 sprites, I'm not quite sure, but oh well. Smile
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 8:32 ago.

Topics: 164
Posts: 8231
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Sun Feb 10, 2008 6:07 pm
   Subject: Re: alpha pixel (slightly invisible pixls)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

It's for 128x128 images, actually. And if it's hard-coded for 640x480 instead, it'll be more ideal. Smile
AlumiuN
DieHard Wolfer
DieHard Wolfer


Joined: 29 Nov 2007
Last Visit: 5:26 ago.

Topics: 38
Posts: 2497
Location: Christchurch, New Zealand
newzealand.gif

PostPosted: Sun Feb 10, 2008 7:12 pm
   Subject: Re: alpha pixel (slightly invisible pixls)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Well, I think I'll be using 256x256 textures as well, so that certainly adds a little more value to it.
Ripper
Code Master - Developer
Code Master - Developer


Joined: 15 Mar 2003
Last Visit: 30 Sep 2008

Topics: 21
Posts: 527
Location: Germany
blank.gif

PostPosted: Mon Feb 25, 2008 3:32 pm
   Subject: Re: alpha pixel (slightly invisible pixls)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Back on topic: These links may be interesting for you:

_________________
Life is an awful game, but the graphics resolution rocks ;D
AlumiuN
DieHard Wolfer
DieHard Wolfer


Joined: 29 Nov 2007
Last Visit: 5:26 ago.

Topics: 38
Posts: 2497
Location: Christchurch, New Zealand
newzealand.gif

PostPosted: Tue Feb 26, 2008 12:48 am
   Subject: Re: alpha pixel (slightly invisible pixls)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

That would be nice to do. I think I can see how to do that as well.
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 02 Oct 2018

Topics: 46
Posts: 2314
Location: USA
usa.gif

PostPosted: Tue Feb 26, 2008 11:01 am
   Subject: Re: alpha pixel (slightly invisible pixls)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Monster Bash 3D has transparency. Basically what we did was use Ripper's shading tutorial and when a particular pixel is being drawn to the screen, say #254, you see what the screen already has on it and then darken it using the shade value. Ripper helped me out with it. The shading could be anything you wanted, you could make it darker, lighter, bluish, etc. Having only one pixel, though, kind of limits you. Three or so might do better....

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 8:32 ago.

Topics: 164
Posts: 8231
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Tue Feb 26, 2008 8:37 pm
   Subject: Re: alpha pixel (slightly invisible pixls)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

OT - Was Monster Bash 3D ever released?
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 02 Oct 2018

Topics: 46
Posts: 2314
Location: USA
usa.gif

PostPosted: Tue Feb 26, 2008 9:27 pm
   Subject: Re: alpha pixel (slightly invisible pixls)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

@Tricob: No, not yet, eventually I hope to after finishing what XgThug started. He has lost interest in it.

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
UnderHW
DieHard Guard
DieHard Guard


Joined: 21 Jul 2006
Last Visit: 05 Jan 2013

Topics: 20
Posts: 287

blank.gif

PostPosted: Wed Feb 27, 2008 8:03 pm
   Subject: Re: alpha pixel (slightly invisible pixls)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Oh No, another TC goes to vaporware again..... Beer

_________________
This Forum makes me bored......
thellt
Bring 'em On
Bring 'em On


Joined: 21 Jan 2008
Last Visit: 12 May 2009

Topics: 11
Posts: 85
Location: bloodgulch
usa.gif

PostPosted: Tue Mar 11, 2008 1:53 pm
   Subject: Re: alpha pixel (slightly invisible pixls)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

i kind of had the idea of having a almost invisible enemy, or a ghost (kind of like halo's active camo) (i am a halo nut too...)

_________________
}{even or }{ellt?

look for helt3d
TexZK
DieHard SS
DieHard SS


Joined: 07 Feb 2004
Last Visit: 19 Oct 2016

Topics: 19
Posts: 370
Location: Northern Italy
italy.gif

PostPosted: Wed Apr 02, 2008 9:04 am
   Subject: Re: alpha pixel (slightly invisible pixls)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Why don't we use a 24/32-bit screen buffer? Computations would become much easier and cheaper... with some hacks it could also become very very fast.

We can lock it, for example, to 8 translucency stages by shifting bits: (this is only a simple example)
::: CODE :::
...

int overlay_opacity = ...; // Between 0 (transparent) and 8 (opaque), will represent the opacity of the overlayed image (0 and 8 are useless as you can realize)
rgb_t* dst_pixel = ...; // Pointer to destination pixel (screen buffer) in a RGB structure
rgb_t* src_pixel = ...; // Pointer to source pixel (overlayed image) in a RGB structure

...

int dst_shift = overlay_opacity;
int src_shift = 8 - overlay_opacity;

...

for( ... ... ... )   // With this I mean we iterate trough all pixels in drawing region
{
    dst_pixel->r = ( dst_pixel->r >> dst_shift ) + ( src_pixel->r >> src_shift );
    dst_pixel->g = ( dst_pixel->g >> dst_shift ) + ( src_pixel->g >> src_shift );
    dst_pixel->b = ( dst_pixel->b >> dst_shift ) + ( src_pixel->b >> src_shift );
}

...


Using VL_GetPixel() will make it unneccesairly slow, so a pointer-based buffer iterating algorythm would be the best. You can also make other weird color filters by changing the operators... for example by drawing the (absolute) difference between the source and the destination pixel, or by fading trough colors (a "ramp up" for read and a "ramp down" for blue)...

Obviously a division by 256 would be the best if you desire a good accuracy in fading, but I think a shift-by-8 could be enough for fast translucency result.

I've just downloaded this amazing Wolf4SDL (extraordinary work, mates!) and I still have to see how to do such things in pratice.
AlumiuN
DieHard Wolfer
DieHard Wolfer


Joined: 29 Nov 2007
Last Visit: 5:26 ago.

Topics: 38
Posts: 2497
Location: Christchurch, New Zealand
newzealand.gif

PostPosted: Wed Apr 02, 2008 5:54 pm
   Subject: Re: alpha pixel (slightly invisible pixls)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

That's actually very helpful, considering I'm using 32-bit colour as well, which allows me to have an alpha value, and then just iterate through the entire screen using that sort of loop.
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 8:32 ago.

Topics: 164
Posts: 8231
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Wed Apr 02, 2008 7:02 pm
   Subject: Re: alpha pixel (slightly invisible pixls)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I don't need more colors myself; I just need to update my palette again so it doesn't suck. Smile
TexZK
DieHard SS
DieHard SS


Joined: 07 Feb 2004
Last Visit: 19 Oct 2016

Topics: 19
Posts: 370
Location: Northern Italy
italy.gif

PostPosted: Thu Apr 03, 2008 2:33 pm
   Subject: Re: alpha pixel (slightly invisible pixls)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Ok, but you have also to update "flash" and "blood" palettes...
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 8:32 ago.

Topics: 164
Posts: 8231
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Thu Apr 03, 2008 7:24 pm
   Subject: Re: alpha pixel (slightly invisible pixls)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

The two colors being replaced don't use either of those areas. Smile
TexZK
DieHard SS
DieHard SS


Joined: 07 Feb 2004
Last Visit: 19 Oct 2016

Topics: 19
Posts: 370
Location: Northern Italy
italy.gif

PostPosted: Wed Apr 09, 2008 10:04 am
   Subject: Re: alpha pixel (slightly invisible pixls)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

Ahhh... now I think I understand: you use those lookup tables only to draw the sprite, not to draw all the screen! I feel so stupid Very Happy
Anyway, I'd go for a 24/32-bit screen... If only I had more time to dedicate to these projects... University and a small sickness are literally killing me...
Display posts from previous:   
Post new topicReply to topic Time synchronized with the forum server time
DieHard Wolfers Forum Index -> Feature Fanatics View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page TopView Next Topic
Page 1 of 1
Jump to:  

Related topics
 Topics   Replies   Views   Last Post 
No new posts Character Selection?
Author: doom44
4 1362 Sun Aug 21, 2011 7:29 pm
Tricob View latest post
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
   You cannot delete your posts in this forum
You cannot vote in polls in this forum


Copyright ©2003-2008 DieHard Wolfers
A Modified subBunker Theme by BrotherTank
Powered by phpBB © 2001, 2005 phpBB Group