Shader Error


(Scennative) #1

Hey,

i have a Problem with a Shader. Look here:

Here the Shader:


gfx/misc/reticlesimple
{
	nopicmip
	{
		map gfx/misc/scope.tga
		blendfunc blend
	}
}

Here the Pic:
Klick!

I hope you can help me…
I have tried with a q3ase program but with not good results.

Greetz Scenna
:stroggtapir:


(IndyJones) #2

use tinypic.com - Keine direkte Anwahl dieser Datei erlaubt!

anyway - what is ur problem? what are u trying to achieve?


(Scennative) #3

Oh sorry. Tinpic.com dont support .tga files…

Here the right File:

http://www.dateiupload.com/files/IjPpWcoAsG.tga

My problem is, the Scope pic is transparent. Thats the Problem…


(Berzerkr) #4

Not tested, but try this shader:

gfx/misc/reticlesimple
{
	nopicmip
	surfaceparm trans
	surfaceparm pointlight
	surfaceparm alphashadow
	{
		map gfx/misc/scope.tga
		rgbGen lightingDiffuse
	}
}

(twt_thunder) #5

[QUOTE=Berzerkr;214058]Not tested, but try this shader:

gfx/misc/reticlesimple
{
	nopicmip
	surfaceparm trans
	surfaceparm pointlight
	surfaceparm alphashadow
	{
		map gfx/misc/scope.tga
		rgbGen lightingDiffuse
	}
}

[/QUOTE]

correct me if i am wrong but this would do the scope transparent and as i understand he dont want it to be??


(Scennative) #6

I have testet these Shader, but then i see a black box…

But i have now fix the Problem:

gfx/misc/scope
{
nomipmaps
nopicmip
{
map gfx/misc/scope.tga
blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
}
}

Thx for helping! :slight_smile:


(Berzerkr) #7

@ thunderpwn:

For models and textures in-game the shader works, it’s near the same as used for a gasmask.
But in this case, it wasn’t working. :frowning:


(twt_thunder) #8

@berzerkr

you’re the expert here :smiley:


(B0RG) #9

I’m sorry for the interruption but… what shader needed if using 2 jpg (texture + alpha) instead of tga 32?

All my tests failed but really I have not huge knowledge about shaders.

thanks


(Nail) #10

iirc, you need to use .tga because of alpha channel


(Berzerkr) #11

You can “fake” the alpha-channel with two jpg’s.

http://berzerkr.wolfmap.de/share/fake-alpha.zip

Take a look into the pk3, especially the textures for the dynamite.
You have a normal texture in colour and another one in black/white. The b/w one has lots of black parts to make sure that there is no effect shown.

Black = no effect
White = full effect
Greyscales lower the effect

Hope this helps you.


(ischbinz) #12

normal et uses a JPG -
transparent areas have to be white then
if you use a tga - try instead of blendfunc

{
	map your texture
	alphafunc gt0
   	}

maybe this works


(B0RG) #13

Thanks to both of you.

Ok so… Berzerkr’s shader for dyna… I already know that shader type and I use it on some weapons.

The point is, due to my knowledge about shaders it very low, when I try similar shaders and combos, then the result is no transparent reticle, or full black screen, or transparent reticle but white background, or fully transparent texture (so, one transparent square)… several results except the wanted one.

Concerning to ischbinz technic, I really dont know how apply it cause if Im going to use 2 textures (lets call them reticle_eq.jpg and reticle_eq_alpha.jpg), I supose I must apply commands to both textures. So I dont know how apply the “alphafunc gt0” command.

Anyways, my current reticle is a colored TGA using this shader:

gfx/misc/reticlesimple
{
nomipmaps
nopicmip
{
map gfx/misc/reticle_eq.tga
blendFunc blend
}
}

Its an adaptation of the default shader (“blendFunc blend” instead of blendFunc filter")

And what I want is to use 2 jpg’s cause one 1024x1024 TGA texture, using so many white color on alpha layer, is about 4 MBs (uncompressed). If I apply 2 jpgs instead of one TGA, I can give more reso to my texture and also the pk3 could be even smaller than using my current 512x512 tga.


(ischbinz) #14

i mean:

fx/misc/reticlesimple
{
nomipmaps
nopicmip
{
map gfx/misc/reticle_eq.tga
alphafunc gt0
}
}


(B0RG) #15

But i dont want to use TGA


(Nail) #16

seems kinda large, 1024 x 1024


(B0RG) #17

Well, take the point we are talking about the scope’s reticle. That texture will be applied over almost the full screen. So its not 25% - 35% of the screen… as several weapons using 1024x1024 textures. It will cover 70% - 80%

Due to its just the scope, it wont be a detailed texture. But if it is small, when enlarging to cover the screen, it could look “pixelled”… or whatever its named.


(-SSF-Sage) #18

[QUOTE=ischbinz;214360]i mean:

fx/misc/reticlesimple
{
nomipmaps
nopicmip
{
map gfx/misc/reticle_eq.tga
alphafunc gt0
}
}[QUOTE=VS|TheBorg;214361]But i dont want to use TGA[/QUOTE]
[/QUOTE]
Even if you use jpg, you have to type tga in the shader. You don’t need two jpgs. With this shader it should remove everything that is 100% pure white (or was it white with GE128, I don’t remember), and nothing else.


(B0RG) #19

Whats the meaning of typing TGA in the shader if I dont use TGA texture?

Anyways, my texture.jpg has no white color. Only alpha.jpg has white/grey/black color. mmm… dunno, dunno… maybe if reticle is just white… but then Ill loose my colored reticle… well, Ill take a look tomorrow. Now its late for me.

Thanks to everybody. See you tomorrow.


(-SSF-Sage) #20

[QUOTE=VS|TheBorg;214398]Whats the meaning of typing TGA in the shader if I dont use TGA texture?

Anyways, my texture.jpg has no white color. Only alpha.jpg has white/grey/black color.[/QUOTE]

It is just something that has been done always. Well you could do it with one jpg, mark everything to be removed with white.