Page 6 of 6

Posted: Sat Jan 29, 2011 5:20 am
by ceriux
@mexicouger - yeah, its another texture thats been altered from the original. i wish decal textures worked though, you can do some cool stuff with them some times.

@baker, if you want to set up alpha textures for hlbsp how they do it is the take the color out of the pallete which is #255 and if the texture is set to func_illusionary and a certain value which i dont remeber is off hand is set to 255 then it's transparent if you can do that. then that would be awesome.

Posted: Sat Jan 29, 2011 7:11 am
by Baker
ceriux wrote:@baker, if you want to set up alpha textures for hlbsp how they do it is the take the color out of the pallete which is #255 and if the texture is set to func_illusionary and a certain value which i dont remeber is off hand is set to 255 then it's transparent if you can do that. then that would be awesome.
You threw me off with the TGA alpha channel thing in your other thread.

This palette 255 = transparent feature may be something you get tonight, btw.

Posted: Sat Jan 29, 2011 7:44 am
by ceriux
really? wow that would be awesome =) then i wont have to bother with tga's. at least not till i get to some models.

Posted: Sat Jan 29, 2011 11:00 am
by Baker
Upload your map, I think I have this done. Except I have no test case map.

Nevertheless, I need to do some finishing touches.
ceriux wrote:really? wow that would be awesome =) then i wont have to bother with tga's. at least not till i get to some models.
Ahem. FitzQuake doesn't load external textures of q1 mdl as far I know, just bsps.

Of course, that can be changed :D

Posted: Sat Jan 29, 2011 5:09 pm
by ceriux
my map isnt setup to have hl's texture to be transparent, but i can update it to do that. just have to figure out how to find which color is the 255 color.

Posted: Sun Jan 30, 2011 6:50 am
by dreadlorde
ceriux wrote:my map isnt setup to have hl's texture to be transparent, but i can update it to do that. just have to figure out how to find which color is the 255 color.
The dark pink one. In Wally it's the last colour (lowest right).

Posted: Sun Jan 30, 2011 6:56 am
by ceriux
each pallet is different, since each textures are different. i know i can change it to the one i want i just have to figure out how to do it with out messing the picture up because of a pallet shift.

Posted: Sun Jan 30, 2011 4:34 pm
by Rikku2000
Okey i have a way to add Alpha channel:

Go to "Mod_LoadTextures" and before add:
qboolean hl_map;

then go to the line: "if (loadmodel->bspversion == HL_BSPVERSION) { ..." and add here after "byte *data;":
tx->transparent = false;
hl_map = true;


in "if ((data = WAD3_LoadTexture(mt))) {"
you add first:

if (tx->name[0] == '{')
tx->transparent = true;


change now the "GL_LoadTexture32" to:
tx->gl_texturenum = GL_LoadTexture32 (mt->name, tx->width, tx->height, (byte *)data, true, tx->transparent);

okey now we are done in here no open the "gl_rsurf.c" and
go to "R_DrawBrushModel"

before "void" add:
extern qboolean hl_map;

no go to in the void and add after "glColor3f (1,1,1);":
if (hl_map) {
glColor4f (1, 1, 1, 1);
glEnable(GL_ALPHA_TEST);
}


In "gl_model.h" find: "typedef struct texture_s"

add at end of the struct:
int transparent;

Posted: Sun Jan 30, 2011 8:10 pm
by ceriux
with that, which color would make it transparent?

Posted: Sun Jan 30, 2011 8:26 pm
by Rikku2000
The last color of the 255 palett in most hl textures is it the BLUE color

Posted: Sun Jan 30, 2011 8:42 pm
by ceriux
ahh ic, well it doesnt have to be blue, its which ever the last color is reguardless. but if this works i suppose it would save baker a lot of time.

Posted: Sun Jan 30, 2011 8:50 pm
by Rikku2000
I thing it will work a and i edit the WAD3 Convertion its from Tomaz Quake:

Code: Select all

static byte *ConvertWad3ToRGBA(miptex_t *tex) {
	byte	*in, *data, *out, *pal;
	int		d, p;

	in		= (byte *)((int) tex + tex->offsets[0]);
	data	= out = malloc(tex->width * tex->height * 4);

	if (!data)
		return NULL;

	pal				= in + (((tex->width * tex->height) * 85) >> 6);
	pal				+= 2;

	for (d = 0;d < tex->width * tex->height;d++) {
		p = *in++;
		if (tex->name[0] == '{' && p == 255)
			out[0] = out[1] = out[2] = out[3] = 0;
		else {
			p *= 3;
			out[0] = pal[p];
			out[1] = pal[p+1];
			out[2] = pal[p+2];
			out[3] = 255;
		}
		out += 4;
	}
	return data;

}
On my Engine looks like this:
Image