problems with shader code for alpha and geometry

Locked
3xistence
Posts: 90
Joined: Sun May 13, 2012 3:02 pm

problems with shader code for alpha and geometry

Post by 3xistence »

Hi again guys,
i have few problems with shaders so i will not ask very hard questions but as ever some suggest:
1.i need to use a shader like a background but actually it makes happear darker all other things: there's an istruction in order to put it in background?
2.for my mod (a sort of kill the captain or kill the one with most frags if you want) i need a costant icon on the head of enemy captain, i assign it etc...but the icon NEED to be ever visible also behind walls and with my code it disappear.

Any suggestions?
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: problems with shader code for alpha and geometry

Post by obsidian »

Would this work?

http://q3map2.robotrenegade.com/docs/sh ... .html#sort
[size=85][url=http://gtkradiant.com]GtkRadiant[/url] | [url=http://q3map2.robotrenegade.com]Q3Map2[/url] | [url=http://q3map2.robotrenegade.com/docs/shader_manual/]Shader Manual[/url][/size]
User avatar
Eraser
Posts: 19177
Joined: Fri Dec 01, 2000 8:00 am

Re: problems with shader code for alpha and geometry

Post by Eraser »

I don't know if it would. If the player is in a different vis area then the game won't send any data about players in those locations to the client, in which case the client doesn't even know it should draw an icon there.

I think it requires a modification of the network code so that the server transmits the origin (location) of the target player to all clients at all times so that the client knows at which origin to draw the icon.

Also, I don't know if the sort keyword allows you to draw surfaces in front of normal geometry?
3xistence
Posts: 90
Joined: Sun May 13, 2012 3:02 pm

Re: problems with shader code for alpha and geometry

Post by 3xistence »

In the shader manual there's nothing about it. Eraser center the problem: i need to draw the shader ever, also if a player is behind the wall in order to let the other players know where's and who's the leader of my (kill the leader gametype).

The other problem's more easy, today i will test a pair of things, but in short words: i make a custom hud shader, the shader stay always in foreground and don't let me see the various health bar, ammo etc...
also with alpha still makes all the numbers blacks.
There's any way to put the shader in "background" behind my hud icons and numbers?
User avatar
Eraser
Posts: 19177
Joined: Fri Dec 01, 2000 8:00 am

Re: problems with shader code for alpha and geometry

Post by Eraser »

For the HUD, change the drawing order in your code I'd say? So make sure your shader overlay is drawn first and then on top draw all the HUD elements.
3xistence
Posts: 90
Joined: Sun May 13, 2012 3:02 pm

Re: problems with shader code for alpha and geometry

Post by 3xistence »

ohhh damnit! it works, thanks again eraser!
I just, for see if it works, copied the icons draw function inside and after the shader draw and it's good!

i will need to change a little bit the code: the draw function about the shader's alone inside an "IF" and other draw functions about icons etc... are outside and before the if.

Thanks again
3xistence
Posts: 90
Joined: Sun May 13, 2012 3:02 pm

Re: problems with shaders code for alpha / geometry and picmip

Post by 3xistence »

Ok resolved the problem, just the draw code after the if sentece where there's the cg_draw of my hud and it works.

today i made a little test using my old config from quake 3 which implies the cvar r_picmip set to 6.
weird and very strange response: all my hud icons and background becomes blurry squares but i still don't understand why: i used, like in the manual, the nopicmip and also after the first attempt the nomipmap on my shaders..

same result:
here's my shader script (the last time i tried with nomipmap, before i used nopicmip):

Code: Select all

	nomipmaps
	{
		map ex/ex_armor.tga
		blendfunc blend
	}
}

Ex/Ex_health
{
	nomipmaps
	{
		map ex/ex_health.tga
		blendfunc blend
	}
}

Ex/Ex_teamStatusBar
{
	nopicmip
	{
		map gfx/2d/colorbar2.tga
		blendfunc blend
	}
}

Ex/Ex_ammoBar
{
	nomipmaps
	{
		map ex/ex_ammobar.tga
		blendfunc blend
	}
}

Ex/Ex_time
{
	nomipmaps
	{
		map ex/ex_time.tga
		blendfunc blend
	}
}
this time i really got stucked. Why he still change and smooth my icons when i set r_picmip to 6?
User avatar
Eraser
Posts: 19177
Joined: Fri Dec 01, 2000 8:00 am

Re: problems with shader code for alpha and geometry

Post by Eraser »

In your code, use trap_R_RegisterShaderNoMip instead of trap_R_RegisterShader
3xistence
Posts: 90
Joined: Sun May 13, 2012 3:02 pm

Re: problems with shader code for alpha and geometry

Post by 3xistence »

thanks again eraser. You always hit the main point!
i figured it out checking string after string cg_main file. (there's any way to "figure it out" fastly?) i mean, probably i'm doing it wrong: i'm starting from cgame(all clientside) and not from game(server side).

Another thing but it's obviously from game code: strangely, modding cgame, callvote isn't anymore callable (doesn't allow callvote in this map or similar). Something to change in server side maybe when a game isn't "pure" ?
User avatar
Eraser
Posts: 19177
Joined: Fri Dec 01, 2000 8:00 am

Re: problems with shader code for alpha and geometry

Post by Eraser »

Start a new game and see if the "g_allowVote" cvar is set to 1. It's probably set to 0, which effectively disables voting on a server.
Locked