Quake3World.com Forums
     Programming Discussion
        problems with shader code for alpha and geometry


Post new topicReply to topic
Login | Profile | | FAQ | Search | IRC




Print view Previous topic | Next topic 
Topic Starter Topic: problems with shader code for alpha and geometry

Warrior
Warrior
Joined: 13 May 2012
Posts: 90
PostPosted: 06-07-2012 11:59 AM           Profile Send private message  E-mail  Edit post Reply with quote


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?




Top
                 

I'm the dude!
I'm the dude!
Joined: 04 Feb 2002
Posts: 12498
PostPosted: 06-07-2012 01:45 PM           Profile Send private message  E-mail  Edit post Reply with quote




_________________
GtkRadiant | Q3Map2 | Shader Manual


Top
                 

Cool #9
Cool #9
Joined: 01 Dec 2000
Posts: 44138
PostPosted: 06-07-2012 11:06 PM           Profile   Send private message  E-mail  Edit post Reply with quote


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?




Top
                 

Warrior
Warrior
Joined: 13 May 2012
Posts: 90
PostPosted: 06-08-2012 12:31 AM           Profile Send private message  E-mail  Edit post Reply with quote


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?




Top
                 

Cool #9
Cool #9
Joined: 01 Dec 2000
Posts: 44138
PostPosted: 06-08-2012 01:46 AM           Profile   Send private message  E-mail  Edit post Reply with quote


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.




Top
                 

Warrior
Warrior
Joined: 13 May 2012
Posts: 90
PostPosted: 06-08-2012 02:19 AM           Profile Send private message  E-mail  Edit post Reply with quote


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




Top
                 

Warrior
Warrior
Joined: 13 May 2012
Posts: 90
PostPosted: 06-11-2012 11:29 AM           Profile Send private message  E-mail  Edit post Reply with quote


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:
   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?




Top
                 

Cool #9
Cool #9
Joined: 01 Dec 2000
Posts: 44138
PostPosted: 06-11-2012 10:51 PM           Profile   Send private message  E-mail  Edit post Reply with quote


In your code, use trap_R_RegisterShaderNoMip instead of trap_R_RegisterShader




Top
                 

Warrior
Warrior
Joined: 13 May 2012
Posts: 90
PostPosted: 06-13-2012 01:37 PM           Profile Send private message  E-mail  Edit post Reply with quote


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" ?




Top
                 

Cool #9
Cool #9
Joined: 01 Dec 2000
Posts: 44138
PostPosted: 06-13-2012 10:55 PM           Profile   Send private message  E-mail  Edit post Reply with quote


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.




Top
                 
Quake3World.com | Forum Index | Programming Discussion


Post new topic Reply to topic


cron
Quake3World.com
© ZeniMax. Zenimax, QUAKE III ARENA, Id Software and associated trademarks are trademarks of the ZeniMax group of companies. All rights reserved.
This is an unofficial fan website without any affiliation with or endorsement by ZeniMax.
All views and opinions expressed are those of the author.