White Edges on Alpha Texture -1 reply

  • 1
  • 2

Please wait...

Guest

I didn't make it!

0 XP

 
#1 8 years ago

Hey ya' folks! Stuff still goes on here, right? Heheh!

Anywho, I'm making some trees via alpha'd .png textures, and here's what I'm getting: white edges.

beast_map_error_01.jpg

I understand that these white edges occur when the game stretches an image. It spreads out the pixels of the image, and the game replaces lost pixels with default white.

My .png files are one layer (the tree) on a transparent background. I have added a 5th channel (alpha), which has the black background and white foreground, separating the tree from the transparent background. I have tried to get rid of the white edge by covering the image with leaves, and letting only the alpha channel separate the tree from the background, but in-game the transparancy no longer works. Here's my shader:

textures/honorandvalor_env/tree_1 { q3map_nolightmap q3map_alphashadow surfaceparm alphashadow surfaceparm trans surfaceparm nonsolid cull twosided { map textures/honorandvalor_env/tree_1 alphaFunc GT0 blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA depthWrite rgbGen vertex } }

textures/honorandvalor_env/tree_1T { q3map_nolightmap q3map_alphashadow surfaceparm alphashadow surfaceparm trans surfaceparm nonsolid cull twosided { map textures/honorandvalor_env/tree_1T alphaFunc GT0 blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA depthWrite rgbGen vertex } }

My objective is to neutralize the white edges, but I'm having trouble figuring out how to do that. Any techniques, references, or tips in general? Thanks for taking a look, and any help would be much appreciated!




Didz

Ten seconds flat.

50 XP

3rd April 2009

0 Uploads

288 Posts

0 Threads

#2 8 years ago

Your "alphaFunc GT0" is what's causing the problem, that one states that any alpha level above 0 will be completely opaque and so causing the white edges. Just take that line out and it should be fine.

EDIT: Also I don't think you need the depthWrite for translucent objects cause that defeats the whole point of them being translucent, but I don't remember. Try one with it and one without it, unless another guy can confirm it on here.




Almighty_who?

Addicted to GF

50 XP

27th July 2009

0 Uploads

267 Posts

0 Threads

#3 8 years ago

not entirely true, you've got 5 channels, that's a big nono in itself. also, i can't remember if it's png or tga that does this... but you can basically paint in photoshop without any "background" layer, so when you erase things you get the checkerboard underneath (meaning it's transparrent) and save that out as a 32bit file. your channel list should look like this: RGB (combined, except it's not actually a channel, technically) R G B A <--- this is where you paint your alpha texture. another important thing is called "mipping", short for mip-mapping. if things are viewed from too far away, among other things, it tends to "mip". what might help with this is to "pad" your texture. so if leaves are green, they have a green background instead of black or white.




Didz

Ten seconds flat.

50 XP

3rd April 2009

0 Uploads

288 Posts

0 Threads

#4 8 years ago
Almighty_who?;5381388also, i can't remember if it's png or tga that does this... but you can basically paint in photoshop without any "background" layer, so when you erase things you get the checkerboard underneath (meaning it's transparrent) and save that out as a 32bit file.

Both do as they support 32-bit transparency.

TGA is recommended for 32-bit images in JKA though because it loads faster as its in bitmap form, yes yes I know it's a bigger filesize but meh, non-lossy quality and fast loading. While png has lossy quality, and JKA has to unpack the image into bitmap form first, then it can use it.




Almighty_who?

Addicted to GF

50 XP

27th July 2009

0 Uploads

267 Posts

0 Threads

#5 8 years ago

sorry i should have explained a little more clearly, one of them can have problems with alpha channels if you delete the background layer AND create an alpha channel inside photoshop. i just can't remember which =[




Guest

I didn't make it!

0 XP

 
#6 8 years ago

Wow! I'm working on a different part of the map at present (and nearly finished!), but thank you so much, all of yer', for the quick and direct replies! I'll give it a test as soon as I can, and report back with the results!




Guest

I didn't make it!

0 XP

 
#7 8 years ago

Alright, I've done the following:

- Removed the line "alphaFunc GT0" from the shader - Removed the line "depthWrite" from the shader

Result: beast_map_error_02.jpg

As you can see there's still a little bit of white there. What is less apparent in the image is that the trees are now alpha-z-fighting each other. At present I'm still using .png images however--should I convert them to .tga? I'm going to re-instate the depthWrite line just for fun and see what that does for now. Any other tips? Thanks again!

PS, sorry for earlier confusion--when I said my .png files have 5 channels, I was including "RGB" as a channel in the same way Photoshop does. More accurately speaking, my .png files have only 4 channels: Red, Green, Blue, and Alpha. Thanks though!




Almighty_who?

Addicted to GF

50 XP

27th July 2009

0 Uploads

267 Posts

0 Threads

#8 8 years ago

post your texture.




Didz

Ten seconds flat.

50 XP

3rd April 2009

0 Uploads

288 Posts

0 Threads

#9 8 years ago
Almighty_who?;5381651post your texture.

Yeah

It seems like you fade your leaves off with white in the RGB channel, but it should be the same green as the leaves use.

About z-fighting, I'm not sure how that was caused if the leaves aren't intersecting in the same plane.




The One and Only VIP Member

I R Scary Eyeball

47,311 XP

16th October 2006

6 Uploads

4,091 Posts

256 Threads

#10 8 years ago

Unless it's textured on both sides, along with cull twosided in the shader.




  • 1
  • 2