Ignore alpha channel in Bitmap

Posted By: Sajeth

Ignore alpha channel in Bitmap - 03/30/11 18:18

Hello,
how can I tell the engine to ignore the alpha channel of a panel bitmap?
I'd like to have it fully solid and only use the alpha channel for collision processing.
Is this possible?
Posted By: Uhrwerk

Re: Ignore alpha channel in Bitmap - 03/30/11 18:37

You can ignore the alpha channel of a bitmap by assigning a material to it, that has its PASS_SOLID flag set. This will render the bitmap as if the alpha channel wasn't there.

However, I have no clue what you mean by "use the alpha channel for collision processing". That does not make any sense to me. Could you explain that in more detail?
Posted By: MrGuest

Re: Ignore alpha channel in Bitmap - 03/30/11 19:15

Hey Sajeth,

I created a function for testing if mouse clicked on alpha layer over 10
Code:
void billboard_click(PANEL* pnl){
	
	if(var_bullets){
		
		var alpha;
		var format = bmap_lock(pnl.bmap, 0);
		
		int x = (mouse_pos.x - pnl.pos_x) / pnl.scale_x;
		int y = (mouse_pos.y - pnl.pos_y) / pnl.scale_y;
		var pixel = pixel_for_bmap(pnl.bmap, x, y);
		COLOR col;
		
		pixel_to_vec(col, alpha, format, pixel);
		bmap_unlock(pnl.bmap);
		
		
		if(alpha > 10){
			kill_handler(pnl, pnl.scale_x, pnl.pos_y);
		}else{
		}
	}
}

hopefully it's easy enough to understand
Posted By: Sajeth

Re: Ignore alpha channel in Bitmap - 03/30/11 20:02

I was going to do exactly what MrGuest coded, but I want the panel to be solid, no matter what the alpha channel says - so the panel rendering process just ignores the alpha channel and renders the bitmap with no transparency anyways.

Well, looks like I'd just have to use a separate file for this...

Originally Posted By: Uhrwerk
You can ignore the alpha channel of a bitmap by assigning a material to it, that has its PASS_SOLID flag set. This will render the bitmap as if the alpha channel wasn't there.

However, I have no clue what you mean by "use the alpha channel for collision processing". That does not make any sense to me. Could you explain that in more detail?

Material geht leider schlecht, weilsn Panel ist - ich will den Alphakanal manuell auslesen und für die Kollisionserkennung benutzen, die Bitmap an sich soll aber dargestellt werden, als hätte sie keinen - also ohne Transparenz laugh
Posted By: Uhrwerk

Re: Ignore alpha channel in Bitmap - 03/30/11 20:14

Yeah, taking a separate file looks like the most reasonable approach for me as well, if you need the bitmap for a panel.
© 2024 lite-C Forums